Add Keys for Exim Maintainers to the website
[exim-website.git] / docbook / 4.85 / 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>
16 12 Jan 2015
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.85</revnumber>
22 <date>12 Jan 2015</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2014
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of the program,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para revisionflag="changed">
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.85 of Exim.
206 Substantive changes from the 4.84 edition are marked in some
207 renditions of the document; this paragraph is so marked if the rendition is
208 capable of showing a change indicator.
209 </para>
210 <para>
211 This document is very much a reference manual; it is not a tutorial. The reader
212 is expected to have some familiarity with the SMTP mail transfer protocol and
213 with general Unix system administration. Although there are some discussions
214 and examples in places, the information is mostly organized in a way that makes
215 it easy to look up, rather than in a natural order for sequential reading.
216 Furthermore, the manual aims to cover every aspect of Exim in detail, including
217 a number of rarely-used, special-purpose features that are unlikely to be of
218 very wide interest.
219 </para>
220 <para>
221 <indexterm role="concept">
222 <primary>books about Exim</primary>
223 </indexterm>
224 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
225 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
226 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
227 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 This book also contains a chapter that gives a general introduction to SMTP and
231 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
232 with the latest release of Exim. (Note that the earlier book about Exim,
233 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
234 </para>
235 <para>
236 <indexterm role="concept">
237 <primary>Debian</primary>
238 <secondary>information sources</secondary>
239 </indexterm>
240 If you are using a Debian distribution of Exim, you will find information about
241 Debian-specific features in the file
242 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
243 The command <command>man update-exim.conf</command> is another source of Debian-specific
244 information.
245 </para>
246 <para>
247 <indexterm role="concept">
248 <primary><filename>doc/NewStuff</filename></primary>
249 </indexterm>
250 <indexterm role="concept">
251 <primary><filename>doc/ChangeLog</filename></primary>
252 </indexterm>
253 <indexterm role="concept">
254 <primary>change log</primary>
255 </indexterm>
256 As the program develops, there may be features in newer versions that have not
257 yet made it into this document, which is updated only when the most significant
258 digit of the fractional part of the version number changes. Specifications of
259 new features that are not yet in this manual are placed in the file
260 <filename>doc/NewStuff</filename> in the Exim distribution.
261 </para>
262 <para>
263 Some features may be classified as <quote>experimental</quote>. These may change
264 incompatibly while they are developing, or even be withdrawn. For this reason,
265 they are not documented in this manual. Information about experimental features
266 can be found in the file <filename>doc/experimental.txt</filename>.
267 </para>
268 <para>
269 All changes to the program (whether new features, bug fixes, or other kinds of
270 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 </para>
272 <para>
273 <indexterm role="concept">
274 <primary><filename>doc/spec.txt</filename></primary>
275 </indexterm>
276 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
277 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 directory are:
279 </para>
280 <informaltable frame="none">
281 <tgroup cols="2" colsep="0" rowsep="0">
282 <colspec colwidth="100pt" align="left"/>
283 <colspec colwidth="254pt" align="left"/>
284 <tbody>
285 <row>
286 <entry><filename>OptionLists.txt</filename></entry>
287 <entry>list of all options in alphabetical order</entry>
288 </row>
289 <row>
290 <entry><filename>dbm.discuss.txt</filename></entry>
291 <entry>discussion about DBM libraries</entry>
292 </row>
293 <row>
294 <entry><filename>exim.8</filename></entry>
295 <entry>a man page of Exim&#x2019;s command line options</entry>
296 </row>
297 <row>
298 <entry><filename>experimental.txt</filename></entry>
299 <entry>documentation of experimental features</entry>
300 </row>
301 <row>
302 <entry><filename>filter.txt</filename></entry>
303 <entry>specification of the filter language</entry>
304 </row>
305 <row>
306 <entry><filename>Exim3.upgrade</filename></entry>
307 <entry>upgrade notes from release 2 to release 3</entry>
308 </row>
309 <row>
310 <entry><filename>Exim4.upgrade</filename></entry>
311 <entry>upgrade notes from release 3 to release 4</entry>
312 </row>
313 </tbody>
314 </tgroup>
315 </informaltable>
316 <para>
317 The main specification and the specification of the filtering language are also
318 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
319 <xref linkend="SECTavail"/> below tells you how to get hold of these.
320 </para>
321 </section>
322 <section id="SECID2">
323 <title>FTP and web sites</title>
324 <para>
325 <indexterm role="concept">
326 <primary>web site</primary>
327 </indexterm>
328 <indexterm role="concept">
329 <primary>FTP site</primary>
330 </indexterm>
331 The primary site for Exim source distributions is currently the University of
332 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
333 distribution</emphasis> below. In addition, there is a web site and an FTP site at
334 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
335 <option>exim.org</option> site was previously hosted for a number of years by Energis
336 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
337 </para>
338 <para>
339 <indexterm role="concept">
340 <primary>wiki</primary>
341 </indexterm>
342 <indexterm role="concept">
343 <primary>FAQ</primary>
344 </indexterm>
345 As well as Exim distribution tar files, the Exim web site contains a number of
346 differently formatted versions of the documentation. A recent addition to the
347 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
348 which contains what used to be a separate FAQ, as well as various other
349 examples, tips, and know-how that have been contributed by Exim users.
350 </para>
351 <para>
352 <indexterm role="concept">
353 <primary>Bugzilla</primary>
354 </indexterm>
355 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
356 this to report bugs, and also to add items to the wish list. Please search
357 first to check that you are not duplicating a previous entry.
358 </para>
359 </section>
360 <section id="SECID3">
361 <title>Mailing lists</title>
362 <para>
363 <indexterm role="concept">
364 <primary>mailing lists</primary>
365 <secondary>for Exim users</secondary>
366 </indexterm>
367 The following Exim mailing lists exist:
368 </para>
369 <informaltable frame="none">
370 <tgroup cols="2" colsep="0" rowsep="0">
371 <colspec colwidth="140pt" align="left"/>
372 <colspec colwidth="254pt" align="left"/>
373 <tbody>
374 <row>
375 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
376 <entry>Moderated, low volume announcements list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-users@exim.org</emphasis></entry>
380 <entry>General discussion list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
384 <entry>Discussion of bugs, enhancements, etc.</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
388 <entry>Automated commit messages from the VCS</entry>
389 </row>
390 </tbody>
391 </tgroup>
392 </informaltable>
393 <para>
394 You can subscribe to these lists, change your existing subscriptions, and view
395 or search the archives via the mailing lists link on the Exim home page.
396 <indexterm role="concept">
397 <primary>Debian</primary>
398 <secondary>mailing list for</secondary>
399 </indexterm>
400 If you are using a Debian distribution of Exim, you may wish to subscribe to
401 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
402 via this web page:
403 </para>
404 <literallayout>
405 <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>
406 </literallayout>
407 <para>
408 Please ask Debian-specific questions on this list and not on the general Exim
409 lists.
410 </para>
411 </section>
412 <section id="SECID4">
413 <title>Exim training</title>
414 <para>
415 <indexterm role="concept">
416 <primary>training courses</primary>
417 </indexterm>
418 Training courses in Cambridge (UK) used to be run annually by the author of
419 Exim, before he retired. At the time of writing, there are no plans to run
420 further Exim courses in Cambridge. However, if that changes, relevant
421 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>.
422 </para>
423 </section>
424 <section id="SECID5">
425 <title>Bug reports</title>
426 <para>
427 <indexterm role="concept">
428 <primary>bug reports</primary>
429 </indexterm>
430 <indexterm role="concept">
431 <primary>reporting bugs</primary>
432 </indexterm>
433 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
434 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
435 whether some behaviour is a bug or not, the best thing to do is to post a
436 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
437 </para>
438 </section>
439 <section id="SECTavail">
440 <title>Where to find the Exim distribution</title>
441 <para>
442 <indexterm role="concept">
443 <primary>FTP site</primary>
444 </indexterm>
445 <indexterm role="concept">
446 <primary>distribution</primary>
447 <secondary>ftp site</secondary>
448 </indexterm>
449 The master ftp site for the Exim distribution is
450 </para>
451 <literallayout>
452 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
453 </literallayout>
454 <para>
455 This is mirrored by
456 </para>
457 <literallayout>
458 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
459 </literallayout>
460 <para>
461 The file references that follow are relative to the <filename>exim</filename> directories at
462 these sites. There are now quite a number of independent mirror sites around
463 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
464 </para>
465 <para>
466 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
467 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
468 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
469 subdirectory, the current release can always be found in files called
470 </para>
471 <literallayout>
472 <filename>exim-n.nn.tar.gz</filename>
473 <filename>exim-n.nn.tar.bz2</filename>
474 </literallayout>
475 <para>
476 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
477 files contain identical data; the only difference is the type of compression.
478 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
479 </para>
480 <para>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>signing details</secondary>
484 </indexterm>
485 <indexterm role="concept">
486 <primary>distribution</primary>
487 <secondary>public key</secondary>
488 </indexterm>
489 <indexterm role="concept">
490 <primary>public key for signed distribution</primary>
491 </indexterm>
492 The distributions will be PGP signed by an individual key of the Release
493 Coordinator.  This key will have a uid containing an email address in the
494 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
495 other Exim maintainers.  We expect that the key will be in the "strong set" of
496 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
497 PGP key, a version of which can be found in the release directory in the file
498 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
499 such as <emphasis>pool.sks-keyservers.net</emphasis>.
500 </para>
501 <para>
502 At time of last update, releases were being made by Phil Pennock and signed with
503 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
504 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
505 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
506 </para>
507 <para>
508 Releases have also been authorized to be performed by Todd Lyons who signs with
509 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
510 Pennock and Todd Lyons through a common associate.
511 </para>
512 <para>
513 The signatures for the tar bundles are in:
514 </para>
515 <literallayout>
516 <filename>exim-n.nn.tar.gz.asc</filename>
517 <filename>exim-n.nn.tar.bz2.asc</filename>
518 </literallayout>
519 <para>
520 For each released version, the log of changes is made separately available in a
521 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
522 find out what has changed without having to download the entire distribution.
523 </para>
524 <para>
525 <indexterm role="concept">
526 <primary>documentation</primary>
527 <secondary>available formats</secondary>
528 </indexterm>
529 The main distribution contains ASCII versions of this specification and other
530 documentation; other formats of the documents are available in separate files
531 inside the <filename>exim4</filename> directory of the FTP site:
532 </para>
533 <literallayout>
534 <filename>exim-html-n.nn.tar.gz</filename>
535 <filename>exim-pdf-n.nn.tar.gz</filename>
536 <filename>exim-postscript-n.nn.tar.gz</filename>
537 <filename>exim-texinfo-n.nn.tar.gz</filename>
538 </literallayout>
539 <para>
540 These tar files contain only the <filename>doc</filename> directory, not the complete
541 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
542 </para>
543 </section>
544 <section id="SECID6">
545 <title>Limitations</title>
546 <itemizedlist>
547 <listitem>
548 <para>
549 <indexterm role="concept">
550 <primary>limitations of Exim</primary>
551 </indexterm>
552 <indexterm role="concept">
553 <primary>bang paths</primary>
554 <secondary>not handled by Exim</secondary>
555 </indexterm>
556 Exim is designed for use as an Internet MTA, and therefore handles addresses in
557 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
558 simple two-component bang paths can be converted by a straightforward rewriting
559 configuration. This restriction does not prevent Exim from being interfaced to
560 UUCP as a transport mechanism, provided that domain addresses are used.
561 </para>
562 </listitem>
563 <listitem>
564 <para>
565 <indexterm role="concept">
566 <primary>domainless addresses</primary>
567 </indexterm>
568 <indexterm role="concept">
569 <primary>address</primary>
570 <secondary>without domain</secondary>
571 </indexterm>
572 Exim insists that every address it handles has a domain attached. For incoming
573 local messages, domainless addresses are automatically qualified with a
574 configured domain value. Configuration options specify from which remote
575 systems unqualified addresses are acceptable. These are then qualified on
576 arrival.
577 </para>
578 </listitem>
579 <listitem>
580 <para>
581 <indexterm role="concept">
582 <primary>transport</primary>
583 <secondary>external</secondary>
584 </indexterm>
585 <indexterm role="concept">
586 <primary>external transports</primary>
587 </indexterm>
588 The only external transport mechanisms that are currently implemented are SMTP
589 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
590 transport is available, and there are facilities for writing messages to files
591 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
592 to send messages to other transport mechanisms such as UUCP, provided they can
593 handle domain-style addresses. Batched SMTP input is also catered for.
594 </para>
595 </listitem>
596 <listitem>
597 <para>
598 Exim is not designed for storing mail for dial-in hosts. When the volumes of
599 such mail are large, it is better to get the messages <quote>delivered</quote> into files
600 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
601 other means.
602 </para>
603 </listitem>
604 <listitem>
605 <para>
606 Although Exim does have basic facilities for scanning incoming messages, these
607 are not comprehensive enough to do full virus or spam scanning. Such operations
608 are best carried out using additional specialized software packages. If you
609 compile Exim with the content-scanning extension, straightforward interfaces to
610 a number of common scanners are provided.
611 </para>
612 </listitem>
613 </itemizedlist>
614 </section>
615 <section id="SECID7">
616 <title>Run time configuration</title>
617 <para>
618 Exim&#x2019;s run time configuration is held in a single text file that is divided
619 into a number of sections. The entries in this file consist of keywords and
620 values, in the style of Smail 3 configuration files. A default configuration
621 file which is suitable for simple online installations is provided in the
622 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
623 </para>
624 </section>
625 <section id="SECID8">
626 <title>Calling interface</title>
627 <para>
628 <indexterm role="concept">
629 <primary>Sendmail compatibility</primary>
630 <secondary>command line interface</secondary>
631 </indexterm>
632 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
633 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
634 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
635 about Sendmail in order to run Exim. For actions other than sending messages,
636 Sendmail-compatible options also exist, but those that produce output (for
637 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
638 format. There are also some additional options that are compatible with Smail
639 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
640 documents all Exim&#x2019;s command line options. This information is automatically
641 made into the man page that forms part of the Exim distribution.
642 </para>
643 <para>
644 Control of messages on the queue can be done via certain privileged command
645 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
646 which displays current information in an X window, and which contains a menu
647 interface to Exim&#x2019;s command line administration options.
648 </para>
649 </section>
650 <section id="SECID9">
651 <title>Terminology</title>
652 <para>
653 <indexterm role="concept">
654 <primary>terminology definitions</primary>
655 </indexterm>
656 <indexterm role="concept">
657 <primary>body of message</primary>
658 <secondary>definition of</secondary>
659 </indexterm>
660 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
661 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
662 below) by a blank line.
663 </para>
664 <para>
665 <indexterm role="concept">
666 <primary>bounce message</primary>
667 <secondary>definition of</secondary>
668 </indexterm>
669 When a message cannot be delivered, it is normally returned to the sender in a
670 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
671 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
672 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
673 failure error report</quote>. Such messages have an empty sender address in the
674 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
675 rise to further bounce messages.
676 </para>
677 <para>
678 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
679 value which is used in the absence of any setting in the configuration. It may
680 also qualify an action which is taken unless a configuration setting specifies
681 otherwise.
682 </para>
683 <para>
684 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
685 destination cannot immediately take place for some reason (a remote host may be
686 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
687 until a later time.
688 </para>
689 <para>
690 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
691 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
692 the part of an email address following the @ sign.
693 </para>
694 <para>
695 <indexterm role="concept">
696 <primary>envelope, definition of</primary>
697 </indexterm>
698 <indexterm role="concept">
699 <primary>sender</primary>
700 <secondary>definition of</secondary>
701 </indexterm>
702 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
703 body. The envelope contains a sender address (to which bounce messages should
704 be delivered), and any number of recipient addresses. References to the
705 sender or the recipients of a message usually mean the addresses in the
706 envelope. An MTA uses these addresses for delivery, and for returning bounce
707 messages, not the addresses that appear in the header lines.
708 </para>
709 <para>
710 <indexterm role="concept">
711 <primary>message</primary>
712 <secondary>header, definition of</secondary>
713 </indexterm>
714 <indexterm role="concept">
715 <primary>header section</primary>
716 <secondary>definition of</secondary>
717 </indexterm>
718 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
719 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
720 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
721 indenting the continuations. The header is separated from the body by a blank
722 line.
723 </para>
724 <para>
725 <indexterm role="concept">
726 <primary>local part</primary>
727 <secondary>definition of</secondary>
728 </indexterm>
729 <indexterm role="concept">
730 <primary>domain</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
734 part of an email address that precedes the @ sign. The part that follows the
735 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
736 </para>
737 <para>
738 <indexterm role="concept">
739 <primary>local delivery</primary>
740 <secondary>definition of</secondary>
741 </indexterm>
742 <indexterm role="concept">
743 <primary>remote delivery, definition of</primary>
744 </indexterm>
745 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
746 delivery to a file or a pipe on the local host from delivery by SMTP over
747 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
748 host it is running on are <emphasis>remote</emphasis>.
749 </para>
750 <para>
751 <indexterm role="concept">
752 <primary>return path</primary>
753 <secondary>definition of</secondary>
754 </indexterm>
755 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
756 message&#x2019;s envelope.
757 </para>
758 <para>
759 <indexterm role="concept">
760 <primary>queue</primary>
761 <secondary>definition of</secondary>
762 </indexterm>
763 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
764 because this term is in widespread use in the context of MTAs. However, in
765 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
766 normally no ordering of waiting messages.
767 </para>
768 <para>
769 <indexterm role="concept">
770 <primary>queue runner</primary>
771 <secondary>definition of</secondary>
772 </indexterm>
773 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
774 and attempts to deliver those messages whose retry times have come. This term
775 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
776 the waiting messages are normally processed in an unpredictable order.
777 </para>
778 <para>
779 <indexterm role="concept">
780 <primary>spool directory</primary>
781 <secondary>definition of</secondary>
782 </indexterm>
783 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
784 messages on its queue &ndash; that is, those that it is in the process of
785 delivering. This should not be confused with the directory in which local
786 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
787 the Exim documentation, <quote>spool</quote> is always used in the first sense.
788 </para>
789 </section>
790 </chapter>
791
792 <chapter id="CHID2">
793 <title>Incorporated code</title>
794 <para>
795 <indexterm role="concept">
796 <primary>incorporated code</primary>
797 </indexterm>
798 <indexterm role="concept">
799 <primary>regular expressions</primary>
800 <secondary>library</secondary>
801 </indexterm>
802 <indexterm role="concept">
803 <primary>PCRE</primary>
804 </indexterm>
805 <indexterm role="concept">
806 <primary>OpenDMARC</primary>
807 </indexterm>
808 A number of pieces of external code are included in the Exim distribution.
809 </para>
810 <itemizedlist>
811 <listitem>
812 <para>
813 Regular expressions are supported in the main Exim program and in the
814 Exim monitor using the freely-distributable PCRE library, copyright
815 &copy; University of Cambridge. The source to PCRE is no longer shipped with
816 Exim, so you will need to use the version of PCRE shipped with your system,
817 or obtain and install the full version of the library from
818 <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>.
819 </para>
820 </listitem>
821 <listitem>
822 <para>
823 <indexterm role="concept">
824 <primary>cdb</primary>
825 <secondary>acknowledgment</secondary>
826 </indexterm>
827 Support for the cdb (Constant DataBase) lookup method is provided by code
828 contributed by Nigel Metheringham of (at the time he contributed it) Planet
829 Online Ltd. The implementation is completely contained within the code of Exim.
830 It does not link against an external cdb library. The code contains the
831 following statements:
832 </para>
833 <blockquote>
834 <para>
835 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
836 </para>
837 <para>
838 This program is free software; you can redistribute it and/or modify it under
839 the terms of the GNU General Public License as published by the Free Software
840 Foundation; either version 2 of the License, or (at your option) any later
841 version.
842 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
843 the spec and sample code for cdb can be obtained from
844 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
845 some code from Dan Bernstein&#x2019;s implementation (which has no license
846 restrictions applied to it).
847 </para>
848 </blockquote>
849 </listitem>
850 <listitem>
851 <para>
852 <indexterm role="concept">
853 <primary>SPA authentication</primary>
854 </indexterm>
855 <indexterm role="concept">
856 <primary>Samba project</primary>
857 </indexterm>
858 <indexterm role="concept">
859 <primary>Microsoft Secure Password Authentication</primary>
860 </indexterm>
861 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
862 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
863 Tom Kistner. This includes code taken from the Samba project, which is released
864 under the Gnu GPL.
865 </para>
866 </listitem>
867 <listitem>
868 <para>
869 <indexterm role="concept">
870 <primary>Cyrus</primary>
871 </indexterm>
872 <indexterm role="concept">
873 <primary><emphasis>pwcheck</emphasis> daemon</primary>
874 </indexterm>
875 <indexterm role="concept">
876 <primary><emphasis>pwauthd</emphasis> daemon</primary>
877 </indexterm>
878 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
879 by code taken from the Cyrus-SASL library and adapted by Alexander S.
880 Sabourenkov. The permission notice appears below, in accordance with the
881 conditions expressed therein.
882 </para>
883 <blockquote>
884 <para>
885 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
886 </para>
887 <para>
888 Redistribution and use in source and binary forms, with or without
889 modification, are permitted provided that the following conditions
890 are met:
891 </para>
892 <orderedlist numeration="arabic">
893 <listitem>
894 <para>
895 Redistributions of source code must retain the above copyright
896 notice, this list of conditions and the following disclaimer.
897 </para>
898 </listitem>
899 <listitem>
900 <para>
901 Redistributions in binary form must reproduce the above copyright
902 notice, this list of conditions and the following disclaimer in
903 the documentation and/or other materials provided with the
904 distribution.
905 </para>
906 </listitem>
907 <listitem>
908 <para>
909 The name <quote>Carnegie Mellon University</quote> must not be used to
910 endorse or promote products derived from this software without
911 prior written permission. For permission or any other legal
912 details, please contact
913 </para>
914 <literallayout>
915               Office of Technology Transfer
916               Carnegie Mellon University
917               5000 Forbes Avenue
918               Pittsburgh, PA  15213-3890
919               (412) 268-4387, fax: (412) 268-7395
920               tech-transfer@andrew.cmu.edu
921 </literallayout>
922 </listitem>
923 <listitem>
924 <para>
925 Redistributions of any form whatsoever must retain the following
926 acknowledgment:
927 </para>
928 <para>
929 <quote>This product includes software developed by Computing Services
930 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
931 </para>
932 <para>
933 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
934 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
935 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
936 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
937 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
938 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
939 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
940 </para>
941 </listitem>
942 </orderedlist>
943 </blockquote>
944 </listitem>
945 <listitem>
946 <para>
947 <indexterm role="concept">
948 <primary>Exim monitor</primary>
949 <secondary>acknowledgment</secondary>
950 </indexterm>
951 <indexterm role="concept">
952 <primary>X-windows</primary>
953 </indexterm>
954 <indexterm role="concept">
955 <primary>Athena</primary>
956 </indexterm>
957 The Exim Monitor program, which is an X-Window application, includes
958 modified versions of the Athena StripChart and TextPop widgets.
959 This code is copyright by DEC and MIT, and their permission notice appears
960 below, in accordance with the conditions expressed therein.
961 </para>
962 <blockquote>
963 <para>
964 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
965 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
966 </para>
967 <para>
968 All Rights Reserved
969 </para>
970 <para>
971 Permission to use, copy, modify, and distribute this software and its
972 documentation for any purpose and without fee is hereby granted,
973 provided that the above copyright notice appear in all copies and that
974 both that copyright notice and this permission notice appear in
975 supporting documentation, and that the names of Digital or MIT not be
976 used in advertising or publicity pertaining to distribution of the
977 software without specific, written prior permission.
978 </para>
979 <para>
980 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
981 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
982 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
983 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
984 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
985 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
986 SOFTWARE.
987 </para>
988 </blockquote>
989 </listitem>
990 <listitem>
991 <para>
992 <indexterm role="concept">
993 <primary>opendmarc</primary>
994 <secondary>acknowledgment</secondary>
995 </indexterm>
996 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
997 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
998 derived code are indicated in the respective source files. The full OpenDMARC
999 license is provided in the LICENSE.opendmarc file contained in the distributed
1000 source code.
1001 </para>
1002 </listitem>
1003 <listitem>
1004 <para>
1005 Many people have contributed code fragments, some large, some small, that were
1006 not covered by any specific licence requirements. It is assumed that the
1007 contributors are happy to see their code incorporated into Exim under the GPL.
1008 </para>
1009 </listitem>
1010 </itemizedlist>
1011 </chapter>
1012
1013 <chapter id="CHID11">
1014 <title>How Exim receives and delivers mail</title>
1015 <titleabbrev>Receiving and delivering mail</titleabbrev>
1016 <section id="SECID10">
1017 <title>Overall philosophy</title>
1018 <para>
1019 <indexterm role="concept">
1020 <primary>design philosophy</primary>
1021 </indexterm>
1022 Exim is designed to work efficiently on systems that are permanently connected
1023 to the Internet and are handling a general mix of mail. In such circumstances,
1024 most messages can be delivered immediately. Consequently, Exim does not
1025 maintain independent queues of messages for specific domains or hosts, though
1026 it does try to send several messages in a single SMTP connection after a host
1027 has been down, and it also maintains per-host retry information.
1028 </para>
1029 </section>
1030 <section id="SECID11">
1031 <title>Policy control</title>
1032 <para>
1033 <indexterm role="concept">
1034 <primary>policy control</primary>
1035 <secondary>overview</secondary>
1036 </indexterm>
1037 Policy controls are now an important feature of MTAs that are connected to the
1038 Internet. Perhaps their most important job is to stop MTAs being abused as
1039 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1040 unsolicited junk, and want to disguise its source. Exim provides flexible
1041 facilities for specifying policy controls on incoming mail:
1042 </para>
1043 <itemizedlist>
1044 <listitem>
1045 <para>
1046 <indexterm role="concept">
1047 <primary>access control lists (ACLs)</primary>
1048 <secondary>introduction</secondary>
1049 </indexterm>
1050 Exim 4 (unlike previous versions of Exim) implements policy controls on
1051 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1052 series of statements that may either grant or deny access. ACLs can be used at
1053 several places in the SMTP dialogue while receiving a message from a remote
1054 host. However, the most common places are after each RCPT command, and at the
1055 very end of the message. The sysadmin can specify conditions for accepting or
1056 rejecting individual recipients or the entire message, respectively, at these
1057 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1058 error code.
1059 </para>
1060 </listitem>
1061 <listitem>
1062 <para>
1063 An ACL is also available for locally generated, non-SMTP messages. In this
1064 case, the only available actions are to accept or deny the entire message.
1065 </para>
1066 </listitem>
1067 <listitem>
1068 <para>
1069 When Exim is compiled with the content-scanning extension, facilities are
1070 provided in the ACL mechanism for passing the message to external virus and/or
1071 spam scanning software. The result of such a scan is passed back to the ACL,
1072 which can then use it to decide what to do with the message.
1073 </para>
1074 </listitem>
1075 <listitem>
1076 <para>
1077 When a message has been received, either from a remote host or from the local
1078 host, but before the final acknowledgment has been sent, a locally supplied C
1079 function called <function>local_scan()</function> can be run to inspect the message and decide
1080 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1081 is accepted, the list of recipients can be modified by the function.
1082 </para>
1083 </listitem>
1084 <listitem>
1085 <para>
1086 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1087 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1088 Exim to be compiled with the content-scanning extension.
1089 </para>
1090 </listitem>
1091 <listitem>
1092 <para>
1093 After a message has been accepted, a further checking mechanism is available in
1094 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1095 runs at the start of every delivery process.
1096 </para>
1097 </listitem>
1098 </itemizedlist>
1099 </section>
1100 <section id="SECID12">
1101 <title>User filters</title>
1102 <para>
1103 <indexterm role="concept">
1104 <primary>filter</primary>
1105 <secondary>introduction</secondary>
1106 </indexterm>
1107 <indexterm role="concept">
1108 <primary>Sieve filter</primary>
1109 </indexterm>
1110 In a conventional Exim configuration, users are able to run private filters by
1111 setting up appropriate <filename>.forward</filename> files in their home directories. See
1112 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1113 configuration needed to support this, and the separate document entitled
1114 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1115 of filtering are available:
1116 </para>
1117 <itemizedlist>
1118 <listitem>
1119 <para>
1120 Sieve filters are written in the standard filtering language that is defined
1121 by RFC 3028.
1122 </para>
1123 </listitem>
1124 <listitem>
1125 <para>
1126 Exim filters are written in a syntax that is unique to Exim, but which is more
1127 powerful than Sieve, which it pre-dates.
1128 </para>
1129 </listitem>
1130 </itemizedlist>
1131 <para>
1132 User filters are run as part of the routing process, described below.
1133 </para>
1134 </section>
1135 <section id="SECTmessiden">
1136 <title>Message identification</title>
1137 <para>
1138 <indexterm role="concept">
1139 <primary>message ids</primary>
1140 <secondary>details of format</secondary>
1141 </indexterm>
1142 <indexterm role="concept">
1143 <primary>format</primary>
1144 <secondary>of message id</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>id of message</primary>
1148 </indexterm>
1149 <indexterm role="concept">
1150 <primary>base62</primary>
1151 </indexterm>
1152 <indexterm role="concept">
1153 <primary>base36</primary>
1154 </indexterm>
1155 <indexterm role="concept">
1156 <primary>Darwin</primary>
1157 </indexterm>
1158 <indexterm role="concept">
1159 <primary>Cygwin</primary>
1160 </indexterm>
1161 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1162 characters long. It is divided into three parts, separated by hyphens, for
1163 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1164 normally encoding numbers in base 62. However, in the Darwin operating
1165 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1166 (avoiding the use of lower case letters) is used instead, because the message
1167 id is used to construct file names, and the names of files in those systems are
1168 not always case-sensitive.
1169 </para>
1170 <para>
1171 <indexterm role="concept">
1172 <primary>pid (process id)</primary>
1173 <secondary>re-use of</secondary>
1174 </indexterm>
1175 The detail of the contents of the message id have changed as Exim has evolved.
1176 Earlier versions relied on the operating system not re-using a process id (pid)
1177 within one second. On modern operating systems, this assumption can no longer
1178 be made, so the algorithm had to be changed. To retain backward compatibility,
1179 the format of the message id was retained, which is why the following rules are
1180 somewhat eccentric:
1181 </para>
1182 <itemizedlist>
1183 <listitem>
1184 <para>
1185 The first six characters of the message id are the time at which the message
1186 started to be received, to a granularity of one second. That is, this field
1187 contains the number of seconds since the start of the epoch (the normal Unix
1188 way of representing the date and time of day).
1189 </para>
1190 </listitem>
1191 <listitem>
1192 <para>
1193 After the first hyphen, the next six characters are the id of the process that
1194 received the message.
1195 </para>
1196 </listitem>
1197 <listitem>
1198 <para>
1199 There are two different possibilities for the final two characters:
1200 </para>
1201 <orderedlist numeration="arabic">
1202 <listitem>
1203 <para>
1204 <indexterm role="option">
1205 <primary><option>localhost_number</option></primary>
1206 </indexterm>
1207 If <option>localhost_number</option> is not set, this value is the fractional part of the
1208 time of reception, normally in units of 1/2000 of a second, but for systems
1209 that must use base 36 instead of base 62 (because of case-insensitive file
1210 systems), the units are 1/1000 of a second.
1211 </para>
1212 </listitem>
1213 <listitem>
1214 <para>
1215 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1216 the fractional part of the time, which in this case is in units of 1/200
1217 (1/100) of a second.
1218 </para>
1219 </listitem>
1220 </orderedlist>
1221 </listitem>
1222 </itemizedlist>
1223 <para>
1224 After a message has been received, Exim waits for the clock to tick at the
1225 appropriate resolution before proceeding, so that if another message is
1226 received by the same process, or by another process with the same (re-used)
1227 pid, it is guaranteed that the time will be different. In most cases, the clock
1228 will already have ticked while the message was being received.
1229 </para>
1230 </section>
1231 <section id="SECID13">
1232 <title>Receiving mail</title>
1233 <para>
1234 <indexterm role="concept">
1235 <primary>receiving mail</primary>
1236 </indexterm>
1237 <indexterm role="concept">
1238 <primary>message</primary>
1239 <secondary>reception</secondary>
1240 </indexterm>
1241 The only way Exim can receive mail from another host is using SMTP over
1242 TCP/IP, in which case the sender and recipient addresses are transferred using
1243 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1244 there are several possibilities:
1245 </para>
1246 <itemizedlist>
1247 <listitem>
1248 <para>
1249 If the process runs Exim with the <option>-bm</option> option, the message is read
1250 non-interactively (usually via a pipe), with the recipients taken from the
1251 command line, or from the body of the message if <option>-t</option> is also used.
1252 </para>
1253 </listitem>
1254 <listitem>
1255 <para>
1256 If the process runs Exim with the <option>-bS</option> option, the message is also read
1257 non-interactively, but in this case the recipients are listed at the start of
1258 the message in a series of SMTP RCPT commands, terminated by a DATA
1259 command. This is so-called <quote>batch SMTP</quote> format,
1260 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1261 envelope addresses in a non-interactive submission.
1262 </para>
1263 </listitem>
1264 <listitem>
1265 <para>
1266 If the process runs Exim with the <option>-bs</option> option, the message is read
1267 interactively, using the SMTP protocol. A two-way pipe is normally used for
1268 passing data between the local process and the Exim process.
1269 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1270 example, the ACLs for SMTP commands are used for this form of submission.
1271 </para>
1272 </listitem>
1273 <listitem>
1274 <para>
1275 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1276 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1277 does not treat the loopback address specially. It treats all such connections
1278 in the same way as connections from other hosts.
1279 </para>
1280 </listitem>
1281 </itemizedlist>
1282 <para>
1283 <indexterm role="concept">
1284 <primary>message sender, constructed by Exim</primary>
1285 </indexterm>
1286 <indexterm role="concept">
1287 <primary>sender</primary>
1288 <secondary>constructed by Exim</secondary>
1289 </indexterm>
1290 In the three cases that do not involve TCP/IP, the sender address is
1291 constructed from the login name of the user that called Exim and a default
1292 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1293 option). For local or batch SMTP, a sender address that is passed using the
1294 SMTP MAIL command is ignored. However, the system administrator may allow
1295 certain users (<quote>trusted users</quote>) to specify a different sender address
1296 unconditionally, or all users to specify certain forms of different sender
1297 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1298 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1299 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1300 users to change sender addresses.
1301 </para>
1302 <para>
1303 Messages received by either of the non-interactive mechanisms are subject to
1304 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1305 (either over TCP/IP, or interacting with a local process) can be checked by a
1306 number of ACLs that operate at different times during the SMTP session. Either
1307 individual recipients, or the entire message, can be rejected if local policy
1308 requirements are not met. The <function>local_scan()</function> function (see chapter
1309 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1310 </para>
1311 <para>
1312 Exim can be configured not to start a delivery process when a message is
1313 received; this can be unconditional, or depend on the number of incoming SMTP
1314 connections or the system load. In these situations, new messages wait on the
1315 queue until a queue runner process picks them up. However, in standard
1316 configurations under normal conditions, delivery is started as soon as a
1317 message is received.
1318 </para>
1319 </section>
1320 <section id="SECID14">
1321 <title>Handling an incoming message</title>
1322 <para>
1323 <indexterm role="concept">
1324 <primary>spool directory</primary>
1325 <secondary>files that hold a message</secondary>
1326 </indexterm>
1327 <indexterm role="concept">
1328 <primary>file</primary>
1329 <secondary>how a message is held</secondary>
1330 </indexterm>
1331 When Exim accepts a message, it writes two files in its spool directory. The
1332 first contains the envelope information, the current status of the message, and
1333 the header lines, and the second contains the body of the message. The names of
1334 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1335 file containing the envelope and header, and <literal>-D</literal> for the data file.
1336 </para>
1337 <para>
1338 <indexterm role="concept">
1339 <primary>spool directory</primary>
1340 <secondary><filename>input</filename> sub-directory</secondary>
1341 </indexterm>
1342 By default all these message files are held in a single directory called
1343 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1344 not perform very well if the number of files in a directory gets large; to
1345 improve performance in such cases, the <option>split_spool_directory</option> option can be
1346 used. This causes Exim to split up the input files into 62 sub-directories
1347 whose names are single letters or digits. When this is done, the queue is
1348 processed one sub-directory at a time instead of all at once, which can improve
1349 overall performance even when there are not enough files in each directory to
1350 affect file system performance.
1351 </para>
1352 <para>
1353 The envelope information consists of the address of the message&#x2019;s sender and
1354 the addresses of the recipients. This information is entirely separate from
1355 any addresses contained in the header lines. The status of the message includes
1356 a list of recipients who have already received the message. The format of the
1357 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1358 </para>
1359 <para>
1360 <indexterm role="concept">
1361 <primary>rewriting</primary>
1362 <secondary>addresses</secondary>
1363 </indexterm>
1364 Address rewriting that is specified in the rewrite section of the configuration
1365 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1366 both in the header lines and the envelope, at the time the message is accepted.
1367 If during the course of delivery additional addresses are generated (for
1368 example, via aliasing), these new addresses are rewritten as soon as they are
1369 generated. At the time a message is actually delivered (transported) further
1370 rewriting can take place; because this is a transport option, it can be
1371 different for different forms of delivery. It is also possible to specify the
1372 addition or removal of certain header lines at the time the message is
1373 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1374 <xref linkend="CHAPtransportgeneric"/>).
1375 </para>
1376 </section>
1377 <section id="SECID15">
1378 <title>Life of a message</title>
1379 <para>
1380 <indexterm role="concept">
1381 <primary>message</primary>
1382 <secondary>life of</secondary>
1383 </indexterm>
1384 <indexterm role="concept">
1385 <primary>message</primary>
1386 <secondary>frozen</secondary>
1387 </indexterm>
1388 A message remains in the spool directory until it is completely delivered to
1389 its recipients or to an error address, or until it is deleted by an
1390 administrator or by the user who originally created it. In cases when delivery
1391 cannot proceed &ndash; for example, when a message can neither be delivered to its
1392 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1393 spool, and no more deliveries are attempted.
1394 </para>
1395 <para>
1396 <indexterm role="concept">
1397 <primary>frozen messages</primary>
1398 <secondary>thawing</secondary>
1399 </indexterm>
1400 <indexterm role="concept">
1401 <primary>message</primary>
1402 <secondary>thawing frozen</secondary>
1403 </indexterm>
1404 An administrator can <quote>thaw</quote> such messages when the problem has been
1405 corrected, and can also freeze individual messages by hand if necessary. In
1406 addition, an administrator can force a delivery error, causing a bounce message
1407 to be sent.
1408 </para>
1409 <para>
1410 <indexterm role="option">
1411 <primary><option>timeout_frozen_after</option></primary>
1412 </indexterm>
1413 <indexterm role="option">
1414 <primary><option>ignore_bounce_errors_after</option></primary>
1415 </indexterm>
1416 There are options called <option>ignore_bounce_errors_after</option> and
1417 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1418 The first applies only to frozen bounces, the second to any frozen messages.
1419 </para>
1420 <para>
1421 <indexterm role="concept">
1422 <primary>message</primary>
1423 <secondary>log file for</secondary>
1424 </indexterm>
1425 <indexterm role="concept">
1426 <primary>log</primary>
1427 <secondary>file for each message</secondary>
1428 </indexterm>
1429 While Exim is working on a message, it writes information about each delivery
1430 attempt to its main log file. This includes successful, unsuccessful, and
1431 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1432 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1433 These logs are solely for the benefit of the administrator, and are normally
1434 deleted along with the spool files when processing of a message is complete.
1435 The use of individual message logs can be disabled by setting
1436 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1437 systems.
1438 </para>
1439 <para>
1440 <indexterm role="concept">
1441 <primary>journal file</primary>
1442 </indexterm>
1443 <indexterm role="concept">
1444 <primary>file</primary>
1445 <secondary>journal</secondary>
1446 </indexterm>
1447 All the information Exim itself needs to set up a delivery is kept in the first
1448 spool file, along with the header lines. When a successful delivery occurs, the
1449 address is immediately written at the end of a journal file, whose name is the
1450 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1451 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1452 is updated to indicate which these are, and the journal file is then deleted.
1453 Updating the spool file is done by writing a new file and renaming it, to
1454 minimize the possibility of data loss.
1455 </para>
1456 <para>
1457 Should the system or the program crash after a successful delivery but before
1458 the spool file has been updated, the journal is left lying around. The next
1459 time Exim attempts to deliver the message, it reads the journal file and
1460 updates the spool file before proceeding. This minimizes the chances of double
1461 deliveries caused by crashes.
1462 </para>
1463 </section>
1464 <section id="SECTprocaddress">
1465 <title>Processing an address for delivery</title>
1466 <para>
1467 <indexterm role="concept">
1468 <primary>drivers</primary>
1469 <secondary>definition of</secondary>
1470 </indexterm>
1471 <indexterm role="concept">
1472 <primary>router</primary>
1473 <secondary>definition of</secondary>
1474 </indexterm>
1475 <indexterm role="concept">
1476 <primary>transport</primary>
1477 <secondary>definition of</secondary>
1478 </indexterm>
1479 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1480 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1481 number of them is provided in the source distribution, and compile-time options
1482 specify which ones are included in the binary. Run time options specify which
1483 ones are actually used for delivering messages.
1484 </para>
1485 <para>
1486 <indexterm role="concept">
1487 <primary>drivers</primary>
1488 <secondary>instance definition</secondary>
1489 </indexterm>
1490 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1491 of that particular driver type. Multiple instances are allowed; for example,
1492 you can set up several different <command>smtp</command> transports, each with different
1493 option values that might specify different ports or different timeouts. Each
1494 instance has its own identifying name. In what follows we will normally use the
1495 instance name when discussing one particular instance (that is, one specific
1496 configuration of the driver), and the generic driver name when discussing
1497 the driver&#x2019;s features in general.
1498 </para>
1499 <para>
1500 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1501 its delivery should happen, by assigning it to a specific transport, or
1502 converting the address into one or more new addresses (for example, via an
1503 alias file). A router may also explicitly choose to fail an address, causing it
1504 to be bounced.
1505 </para>
1506 <para>
1507 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1508 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1509 transport, the destination is a file or a pipe on the local host, whereas for a
1510 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1511 to a specific transport as a result of successful routing. If a message has
1512 several recipients, it may be passed to a number of different transports.
1513 </para>
1514 <para>
1515 <indexterm role="concept">
1516 <primary>preconditions</primary>
1517 <secondary>definition of</secondary>
1518 </indexterm>
1519 An address is processed by passing it to each configured router instance in
1520 turn, subject to certain preconditions, until a router accepts the address or
1521 specifies that it should be bounced. We will describe this process in more
1522 detail shortly. First, as a simple example, we consider how each recipient
1523 address in a message is processed in a small configuration of three routers.
1524 </para>
1525 <para>
1526 To make this a more concrete example, it is described in terms of some actual
1527 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1528 routers in many different ways, and there may be any number of routers in a
1529 configuration.
1530 </para>
1531 <para>
1532 The first router that is specified in a configuration is often one that handles
1533 addresses in domains that are not recognized specially by the local host. These
1534 are typically addresses for arbitrary domains on the Internet. A precondition
1535 is set up which looks for the special domains known to the host (for example,
1536 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1537 match. Typically, this is a router that looks up domains in the DNS in order to
1538 find the hosts to which this address routes. If it succeeds, the address is
1539 assigned to a suitable SMTP transport; if it does not succeed, the router is
1540 configured to fail the address.
1541 </para>
1542 <para>
1543 The second router is reached only when the domain is recognized as one that
1544 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1545 aliasing and forwarding. When it generates one or more new addresses from the
1546 original, each of them is routed independently from the start. Otherwise, the
1547 router may cause an address to fail, or it may simply decline to handle the
1548 address, in which case the address is passed to the next router.
1549 </para>
1550 <para>
1551 The final router in many configurations is one that checks to see if the
1552 address belongs to a local mailbox. The precondition may involve a check to
1553 see if the local part is the name of a login account, or it may look up the
1554 local part in a file or a database. If its preconditions are not met, or if
1555 the router declines, we have reached the end of the routers. When this happens,
1556 the address is bounced.
1557 </para>
1558 </section>
1559 <section id="SECID16">
1560 <title>Processing an address for verification</title>
1561 <para>
1562 <indexterm role="concept">
1563 <primary>router</primary>
1564 <secondary>for verification</secondary>
1565 </indexterm>
1566 <indexterm role="concept">
1567 <primary>verifying address</primary>
1568 <secondary>overview</secondary>
1569 </indexterm>
1570 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1571 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1572 one of the checks to be performed in an ACL for incoming messages, on both
1573 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1574 <option>-bvs</option> command line options.
1575 </para>
1576 <para>
1577 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1578 does not affect the way the routers work, but it is a state that can be
1579 detected. By this means, a router can be skipped or made to behave differently
1580 when verifying. A common example is a configuration in which the first router
1581 sends all messages to a message-scanning program, unless they have been
1582 previously scanned. Thus, the first router accepts all addresses without any
1583 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1584 would be set for such a router, causing it to be skipped in verify mode.
1585 </para>
1586 </section>
1587 <section id="SECTrunindrou">
1588 <title>Running an individual router</title>
1589 <para>
1590 <indexterm role="concept">
1591 <primary>router</primary>
1592 <secondary>running details</secondary>
1593 </indexterm>
1594 <indexterm role="concept">
1595 <primary>preconditions</primary>
1596 <secondary>checking</secondary>
1597 </indexterm>
1598 <indexterm role="concept">
1599 <primary>router</primary>
1600 <secondary>result of running</secondary>
1601 </indexterm>
1602 As explained in the example above, a number of preconditions are checked before
1603 running a router. If any are not met, the router is skipped, and the address is
1604 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1605 the router is run. What happens next depends on the outcome, which is one of
1606 the following:
1607 </para>
1608 <itemizedlist>
1609 <listitem>
1610 <para>
1611 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1612 transport, or generates one or more <quote>child</quote> addresses. Processing the
1613 original address ceases,
1614 <indexterm role="option">
1615 <primary><option>unseen</option></primary>
1616 </indexterm>
1617 unless the <option>unseen</option> option is set on the router. This option
1618 can be used to set up multiple deliveries with different routing (for example,
1619 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1620 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1621 end of routing.
1622 </para>
1623 <para>
1624 Any child addresses generated by the router are processed independently,
1625 starting with the first router by default. It is possible to change this by
1626 setting the <option>redirect_router</option> option to specify which router to start at for
1627 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1628 <option>redirect_router</option> may be anywhere in the router configuration.
1629 </para>
1630 </listitem>
1631 <listitem>
1632 <para>
1633 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1634 requests that the address be passed to another router. By default the address
1635 is passed to the next router, but this can be changed by setting the
1636 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1637 must be below the current router (to avoid loops).
1638 </para>
1639 </listitem>
1640 <listitem>
1641 <para>
1642 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1643 recognize it at all. By default, the address is passed to the next router, but
1644 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1645 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1646 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1647 </para>
1648 </listitem>
1649 <listitem>
1650 <para>
1651 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1652 the generation of a bounce message. There is no further processing of the
1653 original address unless <option>unseen</option> is set on the router.
1654 </para>
1655 </listitem>
1656 <listitem>
1657 <para>
1658 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1659 database may be offline, or a DNS lookup may have timed out.) No further
1660 processing of the address happens in this delivery attempt. It is tried again
1661 next time the message is considered for delivery.
1662 </para>
1663 </listitem>
1664 <listitem>
1665 <para>
1666 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1667 its configuration). The action is as for defer.
1668 </para>
1669 </listitem>
1670 </itemizedlist>
1671 <para>
1672 If an address reaches the end of the routers without having been accepted by
1673 any of them, it is bounced as unrouteable. The default error message in this
1674 situation is <quote>unrouteable address</quote>, but you can set your own message by
1675 making use of the <option>cannot_route_message</option> option. This can be set for any
1676 router; the value from the last router that <quote>saw</quote> the address is used.
1677 </para>
1678 <para>
1679 Sometimes while routing you want to fail a delivery when some conditions are
1680 met but others are not, instead of passing the address on for further routing.
1681 You can do this by having a second router that explicitly fails the delivery
1682 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1683 facility for this purpose.
1684 </para>
1685 </section>
1686 <section id="SECID17">
1687 <title>Duplicate addresses</title>
1688 <para>
1689 <indexterm role="concept">
1690 <primary>case of local parts</primary>
1691 </indexterm>
1692 <indexterm role="concept">
1693 <primary>address duplicate, discarding</primary>
1694 </indexterm>
1695 <indexterm role="concept">
1696 <primary>duplicate addresses</primary>
1697 </indexterm>
1698 Once routing is complete, Exim scans the addresses that are assigned to local
1699 and remote transports, and discards any duplicates that it finds. During this
1700 check, local parts are treated as case-sensitive. This happens only when
1701 actually delivering a message; when testing routers with <option>-bt</option>, all the
1702 routed addresses are shown.
1703 </para>
1704 </section>
1705 <section id="SECTrouprecon">
1706 <title>Router preconditions</title>
1707 <para>
1708 <indexterm role="concept">
1709 <primary>router</primary>
1710 <secondary>preconditions, order of processing</secondary>
1711 </indexterm>
1712 <indexterm role="concept">
1713 <primary>preconditions</primary>
1714 <secondary>order of processing</secondary>
1715 </indexterm>
1716 The preconditions that are tested for each router are listed below, in the
1717 order in which they are tested. The individual configuration options are
1718 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1719 </para>
1720 <itemizedlist>
1721 <listitem>
1722 <para>
1723 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1724 the local parts handled by the router may or must have certain prefixes and/or
1725 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1726 skipped. These conditions are tested first. When an affix is present, it is
1727 removed from the local part before further processing, including the evaluation
1728 of any other conditions.
1729 </para>
1730 </listitem>
1731 <listitem>
1732 <para>
1733 Routers can be designated for use only when not verifying an address, that is,
1734 only when routing it for delivery (or testing its delivery routing). If the
1735 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1736 address.
1737 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1738 <option>verify_recipient</option>, which independently control the use of the router for
1739 sender and recipient verification. You can set these options directly if
1740 you want a router to be used for only one type of verification.
1741 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1742 </para>
1743 </listitem>
1744 <listitem>
1745 <para>
1746 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1747 run with the <option>-bt</option> option to test an address routing. This can be helpful
1748 when the first router sends all new messages to a scanner of some sort; it
1749 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1750 having to simulate the effect of the scanner.
1751 </para>
1752 </listitem>
1753 <listitem>
1754 <para>
1755 Routers can be designated for use only when verifying an address, as
1756 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1757 Again, cutthrough delivery counts as a verification.
1758 </para>
1759 </listitem>
1760 <listitem>
1761 <para>
1762 Individual routers can be explicitly skipped when running the routers to
1763 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1764 </para>
1765 </listitem>
1766 <listitem>
1767 <para>
1768 If the <option>domains</option> option is set, the domain of the address must be in the set
1769 of domains that it defines.
1770 </para>
1771 </listitem>
1772 <listitem>
1773 <para>
1774 <indexterm role="variable">
1775 <primary><varname>$local_part_prefix</varname></primary>
1776 </indexterm>
1777 <indexterm role="variable">
1778 <primary><varname>$local_part</varname></primary>
1779 </indexterm>
1780 <indexterm role="variable">
1781 <primary><varname>$local_part_suffix</varname></primary>
1782 </indexterm>
1783 If the <option>local_parts</option> option is set, the local part of the address must be in
1784 the set of local parts that it defines. If <option>local_part_prefix</option> or
1785 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1786 part before this check. If you want to do precondition tests on local parts
1787 that include affixes, you can do so by using a <option>condition</option> option (see below)
1788 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1789 <varname>$local_part_suffix</varname> as necessary.
1790 </para>
1791 </listitem>
1792 <listitem>
1793 <para>
1794 <indexterm role="variable">
1795 <primary><varname>$local_user_uid</varname></primary>
1796 </indexterm>
1797 <indexterm role="variable">
1798 <primary><varname>$local_user_gid</varname></primary>
1799 </indexterm>
1800 <indexterm role="variable">
1801 <primary><varname>$home</varname></primary>
1802 </indexterm>
1803 If the <option>check_local_user</option> option is set, the local part must be the name of
1804 an account on the local host. If this check succeeds, the uid and gid of the
1805 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1806 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1807 remaining preconditions.
1808 </para>
1809 </listitem>
1810 <listitem>
1811 <para>
1812 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1813 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1814 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1815 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1816 could lead to confusion.
1817 </para>
1818 </listitem>
1819 <listitem>
1820 <para>
1821 If the <option>senders</option> option is set, the envelope sender address must be in the
1822 set of addresses that it defines.
1823 </para>
1824 </listitem>
1825 <listitem>
1826 <para>
1827 If the <option>require_files</option> option is set, the existence or non-existence of
1828 specified files is tested.
1829 </para>
1830 </listitem>
1831 <listitem>
1832 <para>
1833 <indexterm role="concept">
1834 <primary>customizing</primary>
1835 <secondary>precondition</secondary>
1836 </indexterm>
1837 If the <option>condition</option> option is set, it is evaluated and tested. This option
1838 uses an expanded string to allow you to set up your own custom preconditions.
1839 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1840 </para>
1841 </listitem>
1842 </itemizedlist>
1843 <para>
1844 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1845 it to check for the existence of a file in which to lookup up a domain, local
1846 part, or sender. However, as these options are all expanded, you can use the
1847 <option>exists</option> expansion condition to make such tests within each condition. The
1848 <option>require_files</option> option is intended for checking files that the router may be
1849 going to use internally, or which are needed by a specific transport (for
1850 example, <filename>.procmailrc</filename>).
1851 </para>
1852 </section>
1853 <section id="SECID18">
1854 <title>Delivery in detail</title>
1855 <para>
1856 <indexterm role="concept">
1857 <primary>delivery</primary>
1858 <secondary>in detail</secondary>
1859 </indexterm>
1860 When a message is to be delivered, the sequence of events is as follows:
1861 </para>
1862 <itemizedlist>
1863 <listitem>
1864 <para>
1865 If a system-wide filter file is specified, the message is passed to it. The
1866 filter may add recipients to the message, replace the recipients, discard the
1867 message, cause a new message to be generated, or cause the message delivery to
1868 fail. The format of the system filter file is the same as for Exim user filter
1869 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1870 filtering</emphasis>.
1871 <indexterm role="concept">
1872 <primary>Sieve filter</primary>
1873 <secondary>not available for system filter</secondary>
1874 </indexterm>
1875 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1876 </para>
1877 <para>
1878 Some additional features are available in system filters &ndash; see chapter
1879 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1880 filter only once per delivery attempt, however many recipients it has. However,
1881 if there are several delivery attempts because one or more addresses could not
1882 be immediately delivered, the system filter is run each time. The filter
1883 condition <option>first_delivery</option> can be used to detect the first run of the system
1884 filter.
1885 </para>
1886 </listitem>
1887 <listitem>
1888 <para>
1889 Each recipient address is offered to each configured router in turn, subject to
1890 its preconditions, until one is able to handle it. If no router can handle the
1891 address, that is, if they all decline, the address is failed. Because routers
1892 can be targeted at particular domains, several locally handled domains can be
1893 processed entirely independently of each other.
1894 </para>
1895 </listitem>
1896 <listitem>
1897 <para>
1898 <indexterm role="concept">
1899 <primary>routing</primary>
1900 <secondary>loops in</secondary>
1901 </indexterm>
1902 <indexterm role="concept">
1903 <primary>loop</primary>
1904 <secondary>while routing</secondary>
1905 </indexterm>
1906 A router that accepts an address may assign it to a local or a remote
1907 transport. However, the transport is not run at this time. Instead, the address
1908 is placed on a list for the particular transport, which will be run later.
1909 Alternatively, the router may generate one or more new addresses (typically
1910 from alias, forward, or filter files). New addresses are fed back into this
1911 process from the top, but in order to avoid loops, a router ignores any address
1912 which has an identically-named ancestor that was processed by itself.
1913 </para>
1914 </listitem>
1915 <listitem>
1916 <para>
1917 When all the routing has been done, addresses that have been successfully
1918 handled are passed to their assigned transports. When local transports are
1919 doing real local deliveries, they handle only one address at a time, but if a
1920 local transport is being used as a pseudo-remote transport (for example, to
1921 collect batched SMTP messages for transmission by some other means) multiple
1922 addresses can be handled. Remote transports can always handle more than one
1923 address at a time, but can be configured not to do so, or to restrict multiple
1924 addresses to the same domain.
1925 </para>
1926 </listitem>
1927 <listitem>
1928 <para>
1929 Each local delivery to a file or a pipe runs in a separate process under a
1930 non-privileged uid, and these deliveries are run one at a time. Remote
1931 deliveries also run in separate processes, normally under a uid that is private
1932 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1933 run in parallel. The maximum number of simultaneous remote deliveries for any
1934 one message is set by the <option>remote_max_parallel</option> option.
1935 The order in which deliveries are done is not defined, except that all local
1936 deliveries happen before any remote deliveries.
1937 </para>
1938 </listitem>
1939 <listitem>
1940 <para>
1941 <indexterm role="concept">
1942 <primary>queue runner</primary>
1943 </indexterm>
1944 When it encounters a local delivery during a queue run, Exim checks its retry
1945 database to see if there has been a previous temporary delivery failure for the
1946 address before running the local transport. If there was a previous failure,
1947 Exim does not attempt a new delivery until the retry time for the address is
1948 reached. However, this happens only for delivery attempts that are part of a
1949 queue run. Local deliveries are always attempted when delivery immediately
1950 follows message reception, even if retry times are set for them. This makes for
1951 better behaviour if one particular message is causing problems (for example,
1952 causing quota overflow, or provoking an error in a filter file).
1953 </para>
1954 </listitem>
1955 <listitem>
1956 <para>
1957 <indexterm role="concept">
1958 <primary>delivery</primary>
1959 <secondary>retry in remote transports</secondary>
1960 </indexterm>
1961 Remote transports do their own retry handling, since an address may be
1962 deliverable to one of a number of hosts, each of which may have a different
1963 retry time. If there have been previous temporary failures and no host has
1964 reached its retry time, no delivery is attempted, whether in a queue run or
1965 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1966 </para>
1967 </listitem>
1968 <listitem>
1969 <para>
1970 If there were any permanent errors, a bounce message is returned to an
1971 appropriate address (the sender in the common case), with details of the error
1972 for each failing address. Exim can be configured to send copies of bounce
1973 messages to other addresses.
1974 </para>
1975 </listitem>
1976 <listitem>
1977 <para>
1978 <indexterm role="concept">
1979 <primary>delivery</primary>
1980 <secondary>deferral</secondary>
1981 </indexterm>
1982 If one or more addresses suffered a temporary failure, the message is left on
1983 the queue, to be tried again later. Delivery of these addresses is said to be
1984 <emphasis>deferred</emphasis>.
1985 </para>
1986 </listitem>
1987 <listitem>
1988 <para>
1989 When all the recipient addresses have either been delivered or bounced,
1990 handling of the message is complete. The spool files and message log are
1991 deleted, though the message log can optionally be preserved if required.
1992 </para>
1993 </listitem>
1994 </itemizedlist>
1995 </section>
1996 <section id="SECID19">
1997 <title>Retry mechanism</title>
1998 <para>
1999 <indexterm role="concept">
2000 <primary>delivery</primary>
2001 <secondary>retry mechanism</secondary>
2002 </indexterm>
2003 <indexterm role="concept">
2004 <primary>retry</primary>
2005 <secondary>description of mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>queue runner</primary>
2009 </indexterm>
2010 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2011 attempt is the queue runner process. You must either run an Exim daemon that
2012 uses the <option>-q</option> option with a time interval to start queue runners at regular
2013 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2014 not arrange for queue runners to be run, messages that fail temporarily at the
2015 first attempt will remain on your queue for ever. A queue runner process works
2016 its way through the queue, one message at a time, trying each delivery that has
2017 passed its retry time.
2018 You can run several queue runners at once.
2019 </para>
2020 <para>
2021 Exim uses a set of configured rules to determine when next to retry the failing
2022 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2023 should give up trying to deliver to the address, at which point it generates a
2024 bounce message. If no retry rules are set for a particular host, address, and
2025 error combination, no retries are attempted, and temporary errors are treated
2026 as permanent.
2027 </para>
2028 </section>
2029 <section id="SECID20">
2030 <title>Temporary delivery failure</title>
2031 <para>
2032 <indexterm role="concept">
2033 <primary>delivery</primary>
2034 <secondary>temporary failure</secondary>
2035 </indexterm>
2036 There are many reasons why a message may not be immediately deliverable to a
2037 particular address. Failure to connect to a remote machine (because it, or the
2038 connection to it, is down) is one of the most common. Temporary failures may be
2039 detected during routing as well as during the transport stage of delivery.
2040 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2041 is on a file system where the user is over quota. Exim can be configured to
2042 impose its own quotas on local mailboxes; where system quotas are set they will
2043 also apply.
2044 </para>
2045 <para>
2046 If a host is unreachable for a period of time, a number of messages may be
2047 waiting for it by the time it recovers, and sending them in a single SMTP
2048 connection is clearly beneficial. Whenever a delivery to a remote host is
2049 deferred,
2050 <indexterm role="concept">
2051 <primary>hints database</primary>
2052 </indexterm>
2053 Exim makes a note in its hints database, and whenever a successful
2054 SMTP delivery has happened, it looks to see if any other messages are waiting
2055 for the same host. If any are found, they are sent over the same SMTP
2056 connection, subject to a configuration limit as to the maximum number in any
2057 one connection.
2058 </para>
2059 </section>
2060 <section id="SECID21">
2061 <title>Permanent delivery failure</title>
2062 <para>
2063 <indexterm role="concept">
2064 <primary>delivery</primary>
2065 <secondary>permanent failure</secondary>
2066 </indexterm>
2067 <indexterm role="concept">
2068 <primary>bounce message</primary>
2069 <secondary>when generated</secondary>
2070 </indexterm>
2071 When a message cannot be delivered to some or all of its intended recipients, a
2072 bounce message is generated. Temporary delivery failures turn into permanent
2073 errors when their timeout expires. All the addresses that fail in a given
2074 delivery attempt are listed in a single message. If the original message has
2075 many recipients, it is possible for some addresses to fail in one delivery
2076 attempt and others to fail subsequently, giving rise to more than one bounce
2077 message. The wording of bounce messages can be customized by the administrator.
2078 See chapter <xref linkend="CHAPemsgcust"/> for details.
2079 </para>
2080 <para>
2081 <indexterm role="concept">
2082 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2083 </indexterm>
2084 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2085 failed addresses, for the benefit of programs that try to analyse such messages
2086 automatically.
2087 </para>
2088 <para>
2089 <indexterm role="concept">
2090 <primary>bounce message</primary>
2091 <secondary>recipient of</secondary>
2092 </indexterm>
2093 A bounce message is normally sent to the sender of the original message, as
2094 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2095 address given in the MAIL command. However, when an address is expanded via a
2096 forward or alias file, an alternative address can be specified for delivery
2097 failures of the generated addresses. For a mailing list expansion (see section
2098 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2099 of the list.
2100 </para>
2101 </section>
2102 <section id="SECID22">
2103 <title>Failures to deliver bounce messages</title>
2104 <para>
2105 <indexterm role="concept">
2106 <primary>bounce message</primary>
2107 <secondary>failure to deliver</secondary>
2108 </indexterm>
2109 If a bounce message (either locally generated or received from a remote host)
2110 itself suffers a permanent delivery failure, the message is left on the queue,
2111 but it is frozen, awaiting the attention of an administrator. There are options
2112 that can be used to make Exim discard such failed messages, or to keep them
2113 for only a short time (see <option>timeout_frozen_after</option> and
2114 <option>ignore_bounce_errors_after</option>).
2115 </para>
2116 </section>
2117 </chapter>
2118
2119 <chapter id="CHID3">
2120 <title>Building and installing Exim</title>
2121 <para>
2122 <indexterm role="concept" id="IIDbuex" class="startofrange">
2123 <primary>building Exim</primary>
2124 </indexterm>
2125 </para>
2126 <section id="SECID23">
2127 <title>Unpacking</title>
2128 <para>
2129 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2130 creates a directory with the name of the current release (for example,
2131 <filename>exim-4.85</filename>) into which the following files are placed:
2132 </para>
2133 <informaltable frame="none">
2134 <tgroup cols="2" colsep="0" rowsep="0">
2135 <colspec colwidth="140pt" align="left"/>
2136 <colspec colwidth="254pt" align="left"/>
2137 <tbody>
2138 <row>
2139 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2140 <entry>contains some acknowledgments</entry>
2141 </row>
2142 <row>
2143 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2144 <entry>contains a reference to where changes are documented</entry>
2145 </row>
2146 <row>
2147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2148 <entry>the GNU General Public Licence</entry>
2149 </row>
2150 <row>
2151 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2152 <entry>top-level make file</entry>
2153 </row>
2154 <row>
2155 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2156 <entry>conditions for the use of Exim</entry>
2157 </row>
2158 <row>
2159 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2160 <entry>list of files, directories and simple build instructions</entry>
2161 </row>
2162 </tbody>
2163 </tgroup>
2164 </informaltable>
2165 <para>
2166 Other files whose names begin with <filename>README</filename> may also be present. The
2167 following subdirectories are created:
2168 </para>
2169 <informaltable frame="none">
2170 <tgroup cols="2" colsep="0" rowsep="0">
2171 <colspec colwidth="140pt" align="left"/>
2172 <colspec colwidth="254pt" align="left"/>
2173 <tbody>
2174 <row>
2175 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2176 <entry>an empty directory for local configuration files</entry>
2177 </row>
2178 <row>
2179 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2180 <entry>OS-specific files</entry>
2181 </row>
2182 <row>
2183 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2184 <entry>documentation files</entry>
2185 </row>
2186 <row>
2187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2188 <entry>source files for the Exim monitor</entry>
2189 </row>
2190 <row>
2191 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2192 <entry>scripts used in the build process</entry>
2193 </row>
2194 <row>
2195 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2196 <entry>remaining source files</entry>
2197 </row>
2198 <row>
2199 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2200 <entry>independent utilities</entry>
2201 </row>
2202 </tbody>
2203 </tgroup>
2204 </informaltable>
2205 <para>
2206 The main utility programs are contained in the <filename>src</filename> directory, and are built
2207 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2208 that may be useful to some sites.
2209 </para>
2210 </section>
2211 <section id="SECID24">
2212 <title>Multiple machine architectures and operating systems</title>
2213 <para>
2214 <indexterm role="concept">
2215 <primary>building Exim</primary>
2216 <secondary>multiple OS/architectures</secondary>
2217 </indexterm>
2218 The building process for Exim is arranged to make it easy to build binaries for
2219 a number of different architectures and operating systems from the same set of
2220 source files. Compilation does not take place in the <filename>src</filename> directory.
2221 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2222 system.
2223 <indexterm role="concept">
2224 <primary>symbolic link</primary>
2225 <secondary>to build directory</secondary>
2226 </indexterm>
2227 Symbolic links to the sources are installed in this directory, which is where
2228 the actual building takes place. In most cases, Exim can discover the machine
2229 architecture and operating system for itself, but the defaults can be
2230 overridden if necessary.
2231 </para>
2232 </section>
2233 <section id="SECTpcre">
2234 <title>PCRE library</title>
2235 <para>
2236 <indexterm role="concept">
2237 <primary>PCRE library</primary>
2238 </indexterm>
2239 Exim no longer has an embedded PCRE library as the vast majority of
2240 modern systems include PCRE as a system library, although you may need
2241 to install the PCRE or PCRE development package for your operating
2242 system. If your system has a normal PCRE installation the Exim build
2243 process will need no further configuration. If the library or the
2244 headers are in an unusual location you will need to either set the PCRE_LIBS
2245 and INCLUDE directives appropriately,
2246 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2247 If your operating system has no
2248 PCRE support then you will need to obtain and build the current PCRE
2249 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2250 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2251 </para>
2252 </section>
2253 <section id="SECTdb">
2254 <title>DBM libraries</title>
2255 <para>
2256 <indexterm role="concept">
2257 <primary>DBM libraries</primary>
2258 <secondary>discussion of</secondary>
2259 </indexterm>
2260 <indexterm role="concept">
2261 <primary>hints database</primary>
2262 <secondary>DBM files used for</secondary>
2263 </indexterm>
2264 Even if you do not use any DBM files in your configuration, Exim still needs a
2265 DBM library in order to operate, because it uses indexed files for its hints
2266 databases. Unfortunately, there are a number of DBM libraries in existence, and
2267 different operating systems often have different ones installed.
2268 </para>
2269 <para>
2270 <indexterm role="concept">
2271 <primary>Solaris</primary>
2272 <secondary>DBM library for</secondary>
2273 </indexterm>
2274 <indexterm role="concept">
2275 <primary>IRIX, DBM library for</primary>
2276 </indexterm>
2277 <indexterm role="concept">
2278 <primary>BSD, DBM library for</primary>
2279 </indexterm>
2280 <indexterm role="concept">
2281 <primary>Linux, DBM library for</primary>
2282 </indexterm>
2283 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2284 Linux distribution, the DBM configuration should happen automatically, and you
2285 may be able to ignore this section. Otherwise, you may have to learn more than
2286 you would like about DBM libraries from what follows.
2287 </para>
2288 <para>
2289 <indexterm role="concept">
2290 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2291 </indexterm>
2292 Licensed versions of Unix normally contain a library of DBM functions operating
2293 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2294 versions of Unix seem to vary in what they contain as standard. In particular,
2295 some early versions of Linux have no default DBM library, and different
2296 distributors have chosen to bundle different libraries with their packaged
2297 versions. However, the more recent releases seem to have standardized on the
2298 Berkeley DB library.
2299 </para>
2300 <para>
2301 Different DBM libraries have different conventions for naming the files they
2302 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2303 possibilities:
2304 </para>
2305 <orderedlist numeration="arabic">
2306 <listitem>
2307 <para>
2308 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2309 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2310 </para>
2311 </listitem>
2312 <listitem>
2313 <para>
2314 <indexterm role="concept">
2315 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2316 </indexterm>
2317 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2318 compatibility interface it makes two different hard links to it with names
2319 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2320 file name is used unmodified.
2321 </para>
2322 </listitem>
2323 <listitem>
2324 <para>
2325 <indexterm role="concept">
2326 <primary>Berkeley DB library</primary>
2327 </indexterm>
2328 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2329 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2330 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2331 </para>
2332 </listitem>
2333 <listitem>
2334 <para>
2335 If the Berkeley package is used in its native mode, it operates on a single
2336 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2337 the traditional <emphasis>ndbm</emphasis> interface.
2338 </para>
2339 </listitem>
2340 <listitem>
2341 <para>
2342 To complicate things further, there are several very different versions of the
2343 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2344 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2345 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2346 versions of Berkeley DB can be obtained from
2347 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2348 </para>
2349 </listitem>
2350 <listitem>
2351 <para>
2352 <indexterm role="concept">
2353 <primary><emphasis>tdb</emphasis> DBM library</primary>
2354 </indexterm>
2355 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2356 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2357 operates on a single file.
2358 </para>
2359 </listitem>
2360 </orderedlist>
2361 <para>
2362 <indexterm role="concept">
2363 <primary>USE_DB</primary>
2364 </indexterm>
2365 <indexterm role="concept">
2366 <primary>DBM libraries</primary>
2367 <secondary>configuration for building</secondary>
2368 </indexterm>
2369 Exim and its utilities can be compiled to use any of these interfaces. In order
2370 to use any version of the Berkeley DB package in native mode, you must set
2371 USE_DB in an appropriate configuration file (typically
2372 <filename>Local/Makefile</filename>). For example:
2373 </para>
2374 <literallayout class="monospaced">
2375 USE_DB=yes
2376 </literallayout>
2377 <para>
2378 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2379 error is diagnosed if you set more than one of these.
2380 </para>
2381 <para>
2382 At the lowest level, the build-time configuration sets none of these options,
2383 thereby assuming an interface of type (1). However, some operating system
2384 configuration files (for example, those for the BSD operating systems and
2385 Linux) assume type (4) by setting USE_DB as their default, and the
2386 configuration files for Cygwin set USE_GDBM. Anything you set in
2387 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2388 </para>
2389 <para>
2390 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2391 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2392 in one of these lines:
2393 </para>
2394 <literallayout class="monospaced">
2395 DBMLIB = -ldb
2396 DBMLIB = -ltdb
2397 </literallayout>
2398 <para>
2399 Settings like that will work if the DBM library is installed in the standard
2400 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2401 the default path. You may need to set INCLUDE to specify where the header
2402 file is, and to specify the path to the library more fully in DBMLIB, as in
2403 this example:
2404 </para>
2405 <literallayout class="monospaced">
2406 INCLUDE=-I/usr/local/include/db-4.1
2407 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2408 </literallayout>
2409 <para>
2410 There is further detailed discussion about the various DBM libraries in the
2411 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2412 </para>
2413 </section>
2414 <section id="SECID25">
2415 <title>Pre-building configuration</title>
2416 <para>
2417 <indexterm role="concept">
2418 <primary>building Exim</primary>
2419 <secondary>pre-building configuration</secondary>
2420 </indexterm>
2421 <indexterm role="concept">
2422 <primary>configuration for building Exim</primary>
2423 </indexterm>
2424 <indexterm role="concept">
2425 <primary><filename>Local/Makefile</filename></primary>
2426 </indexterm>
2427 <indexterm role="concept">
2428 <primary><filename>src/EDITME</filename></primary>
2429 </indexterm>
2430 Before building Exim, a local configuration file that specifies options
2431 independent of any operating system has to be created with the name
2432 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2433 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2434 therein. These descriptions are therefore not repeated here. If you are
2435 building Exim for the first time, the simplest thing to do is to copy
2436 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2437 </para>
2438 <para>
2439 There are three settings that you must supply, because Exim will not build
2440 without them. They are the location of the run time configuration file
2441 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2442 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2443 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2444 a colon-separated list of file names; Exim uses the first of them that exists.
2445 </para>
2446 <para>
2447 There are a few other parameters that can be specified either at build time or
2448 at run time, to enable the same binary to be used on a number of different
2449 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2450 directory (if not within the spool directory) are fixed, it is recommended that
2451 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2452 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2453 be logged.
2454 </para>
2455 <para>
2456 <indexterm role="concept">
2457 <primary>content scanning</primary>
2458 <secondary>specifying at build time</secondary>
2459 </indexterm>
2460 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2461 access control lists are not compiled by default. If you want to include these
2462 facilities, you need to set
2463 </para>
2464 <literallayout class="monospaced">
2465 WITH_CONTENT_SCAN=yes
2466 </literallayout>
2467 <para>
2468 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2469 chapter <xref linkend="CHAPexiscan"/>.
2470 </para>
2471 <para>
2472 <indexterm role="concept">
2473 <primary><filename>Local/eximon.conf</filename></primary>
2474 </indexterm>
2475 <indexterm role="concept">
2476 <primary><filename>exim_monitor/EDITME</filename></primary>
2477 </indexterm>
2478 If you are going to build the Exim monitor, a similar configuration process is
2479 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2480 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2481 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2482 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2483 </para>
2484 <para>
2485 This is all the configuration that is needed in straightforward cases for known
2486 operating systems. However, the building process is set up so that it is easy
2487 to override options that are set by default or by operating-system-specific
2488 configuration files, for example to change the name of the C compiler, which
2489 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2490 do this.
2491 </para>
2492 </section>
2493 <section id="SECID26">
2494 <title>Support for iconv()</title>
2495 <para>
2496 <indexterm role="concept">
2497 <primary><function>iconv()</function> support</primary>
2498 </indexterm>
2499 <indexterm role="concept">
2500 <primary>RFC 2047</primary>
2501 </indexterm>
2502 The contents of header lines in messages may be encoded according to the rules
2503 described RFC 2047. This makes it possible to transmit characters that are not
2504 in the ASCII character set, and to label them as being in a particular
2505 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2506 mechanism, it decodes them, and translates them into a specified character set
2507 (default ISO-8859-1). The translation is possible only if the operating system
2508 supports the <function>iconv()</function> function.
2509 </para>
2510 <para>
2511 However, some of the operating systems that supply <function>iconv()</function> do not support
2512 very many conversions. The GNU <option>libiconv</option> library (available from
2513 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2514 systems to remedy this deficiency, as well as on systems that do not supply
2515 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2516 </para>
2517 <literallayout class="monospaced">
2518 HAVE_ICONV=yes
2519 </literallayout>
2520 <para>
2521 to your <filename>Local/Makefile</filename> and rebuild Exim.
2522 </para>
2523 </section>
2524 <section id="SECTinctlsssl">
2525 <title>Including TLS/SSL encryption support</title>
2526 <para>
2527 <indexterm role="concept">
2528 <primary>TLS</primary>
2529 <secondary>including support for TLS</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>encryption</primary>
2533 <secondary>including support for</secondary>
2534 </indexterm>
2535 <indexterm role="concept">
2536 <primary>SUPPORT_TLS</primary>
2537 </indexterm>
2538 <indexterm role="concept">
2539 <primary>OpenSSL</primary>
2540 <secondary>building Exim with</secondary>
2541 </indexterm>
2542 <indexterm role="concept">
2543 <primary>GnuTLS</primary>
2544 <secondary>building Exim with</secondary>
2545 </indexterm>
2546 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2547 command as per RFC 2487. It can also support legacy clients that expect to
2548 start a TLS session immediately on connection to a non-standard port (see the
2549 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2550 line option).
2551 </para>
2552 <para>
2553 If you want to build Exim with TLS support, you must first install either the
2554 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2555 implementing SSL.
2556 </para>
2557 <para>
2558 If OpenSSL is installed, you should set
2559 </para>
2560 <literallayout class="monospaced">
2561 SUPPORT_TLS=yes
2562 TLS_LIBS=-lssl -lcrypto
2563 </literallayout>
2564 <para>
2565 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2566 OpenSSL library and include files. For example:
2567 </para>
2568 <literallayout class="monospaced">
2569 SUPPORT_TLS=yes
2570 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2571 TLS_INCLUDE=-I/usr/local/openssl/include/
2572 </literallayout>
2573 <para>
2574 <indexterm role="concept">
2575 <primary>pkg-config</primary>
2576 <secondary>OpenSSL</secondary>
2577 </indexterm>
2578 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2579 </para>
2580 <literallayout class="monospaced">
2581 SUPPORT_TLS=yes
2582 USE_OPENSSL_PC=openssl
2583 </literallayout>
2584 <para>
2585 <indexterm role="concept">
2586 <primary>USE_GNUTLS</primary>
2587 </indexterm>
2588 If GnuTLS is installed, you should set
2589 </para>
2590 <literallayout class="monospaced">
2591 SUPPORT_TLS=yes
2592 USE_GNUTLS=yes
2593 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2594 </literallayout>
2595 <para>
2596 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2597 library and include files. For example:
2598 </para>
2599 <literallayout class="monospaced">
2600 SUPPORT_TLS=yes
2601 USE_GNUTLS=yes
2602 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2603 TLS_INCLUDE=-I/usr/gnu/include
2604 </literallayout>
2605 <para>
2606 <indexterm role="concept">
2607 <primary>pkg-config</primary>
2608 <secondary>GnuTLS</secondary>
2609 </indexterm>
2610 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2611 </para>
2612 <literallayout class="monospaced">
2613 SUPPORT_TLS=yes
2614 USE_GNUTLS=yes
2615 USE_GNUTLS_PC=gnutls
2616 </literallayout>
2617 <para>
2618 You do not need to set TLS_INCLUDE if the relevant directory is already
2619 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2620 given in chapter <xref linkend="CHAPTLS"/>.
2621 </para>
2622 </section>
2623 <section id="SECID27">
2624 <title>Use of tcpwrappers</title>
2625 <para>
2626 <indexterm role="concept">
2627 <primary>tcpwrappers, building Exim to support</primary>
2628 </indexterm>
2629 <indexterm role="concept">
2630 <primary>USE_TCP_WRAPPERS</primary>
2631 </indexterm>
2632 <indexterm role="concept">
2633 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2634 </indexterm>
2635 <indexterm role="concept">
2636 <primary>tcp_wrappers_daemon_name</primary>
2637 </indexterm>
2638 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2639 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2640 alternative to Exim&#x2019;s own checking facilities for installations that are
2641 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2642 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2643 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2644 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2645 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2646 you might have
2647 </para>
2648 <literallayout class="monospaced">
2649 USE_TCP_WRAPPERS=yes
2650 CFLAGS=-O -I/usr/local/include
2651 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2652 </literallayout>
2653 <para>
2654 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2655 files is <quote>exim</quote>. For example, the line
2656 </para>
2657 <literallayout class="monospaced">
2658 exim : LOCAL  192.168.1.  .friendly.domain.example
2659 </literallayout>
2660 <para>
2661 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2662 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2663 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2664 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2665 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2666 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2667 further details.
2668 </para>
2669 </section>
2670 <section id="SECID28">
2671 <title>Including support for IPv6</title>
2672 <para>
2673 <indexterm role="concept">
2674 <primary>IPv6</primary>
2675 <secondary>including support for</secondary>
2676 </indexterm>
2677 Exim contains code for use on systems that have IPv6 support. Setting
2678 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2679 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2680 where the IPv6 support is not fully integrated into the normal include and
2681 library files.
2682 </para>
2683 <para>
2684 Two different types of DNS record for handling IPv6 addresses have been
2685 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2686 currently seen as the mainstream. Another record type called A6 was proposed
2687 as better than AAAA because it had more flexibility. However, it was felt to be
2688 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2689 if anyone is actually using A6 records. Exim has support for A6 records, but
2690 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2691 support has not been tested for some time.
2692 </para>
2693 </section>
2694 <section id="SECTdynamicmodules">
2695 <title>Dynamically loaded lookup module support</title>
2696 <para>
2697 <indexterm role="concept">
2698 <primary>lookup modules</primary>
2699 </indexterm>
2700 <indexterm role="concept">
2701 <primary>dynamic modules</primary>
2702 </indexterm>
2703 <indexterm role="concept">
2704 <primary>.so building</primary>
2705 </indexterm>
2706 On some platforms, Exim supports not compiling all lookup types directly into
2707 the main binary, instead putting some into external modules which can be loaded
2708 on demand.
2709 This permits packagers to build Exim with support for lookups with extensive
2710 library dependencies without requiring all users to install all of those
2711 dependencies.
2712 Most, but not all, lookup types can be built this way.
2713 </para>
2714 <para>
2715 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2716 installed; Exim will only load modules from that directory, as a security
2717 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2718 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2719 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2720 see <filename>src/EDITME</filename> for details.
2721 </para>
2722 <para>
2723 Then, for each module to be loaded dynamically, define the relevant
2724 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2725 For example, this will build in lsearch but load sqlite and mysql support
2726 on demand:
2727 </para>
2728 <literallayout class="monospaced">
2729 LOOKUP_LSEARCH=yes
2730 LOOKUP_SQLITE=2
2731 LOOKUP_MYSQL=2
2732 </literallayout>
2733 </section>
2734 <section id="SECID29">
2735 <title>The building process</title>
2736 <para>
2737 <indexterm role="concept">
2738 <primary>build directory</primary>
2739 </indexterm>
2740 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2741 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2742 operating system types, and creates a build directory if one does not exist.
2743 For example, on a Sun system running Solaris 8, the directory
2744 <filename>build-SunOS5-5.8-sparc</filename> is created.
2745 <indexterm role="concept">
2746 <primary>symbolic link</primary>
2747 <secondary>to source files</secondary>
2748 </indexterm>
2749 Symbolic links to relevant source files are installed in the build directory.
2750 </para>
2751 <para>
2752 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2753 building process fails if it is set.
2754 </para>
2755 <para>
2756 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2757 a make file inside the build directory, using the configuration files from the
2758 <filename>Local</filename> directory. The new make file is then passed to another instance of
2759 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2760 then compiling and linking the binaries for the Exim monitor (if configured), a
2761 number of utility programs, and finally Exim itself. The command <literal>make
2762 makefile</literal> can be used to force a rebuild of the make file in the build
2763 directory, should this ever be necessary.
2764 </para>
2765 <para>
2766 If you have problems building Exim, check for any comments there may be in the
2767 <filename>README</filename> file concerning your operating system, and also take a look at the
2768 FAQ, where some common problems are covered.
2769 </para>
2770 </section>
2771 <section id="SECID283">
2772 <title>Output from <quote>make</quote></title>
2773 <para>
2774 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2775 unreadable, because these lines can be very long. For this reason, the normal
2776 output is suppressed by default, and instead output similar to that which
2777 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2778 each module that is being compiled or linked. However, it is still possible to
2779 get the full output, by calling <emphasis>make</emphasis> like this:
2780 </para>
2781 <literallayout class="monospaced">
2782 FULLECHO='' make -e
2783 </literallayout>
2784 <para>
2785 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2786 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2787 given in addition to the short output.
2788 </para>
2789 </section>
2790 <section id="SECToverride">
2791 <title>Overriding build-time options for Exim</title>
2792 <para>
2793 <indexterm role="concept">
2794 <primary>build-time options, overriding</primary>
2795 </indexterm>
2796 The main make file that is created at the beginning of the building process
2797 consists of the concatenation of a number of files which set configuration
2798 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2799 more than once, the last setting overrides any previous ones. This provides a
2800 convenient way of overriding defaults. The files that are concatenated are, in
2801 order:
2802 </para>
2803 <literallayout>
2804 <filename>OS/Makefile-Default</filename>
2805 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2806 <filename>Local/Makefile</filename>
2807 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2808 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2809 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2810 <filename>OS/Makefile-Base</filename>
2811 </literallayout>
2812 <para>
2813 <indexterm role="concept">
2814 <primary><filename>Local/Makefile</filename></primary>
2815 </indexterm>
2816 <indexterm role="concept">
2817 <primary>building Exim</primary>
2818 <secondary>operating system type</secondary>
2819 </indexterm>
2820 <indexterm role="concept">
2821 <primary>building Exim</primary>
2822 <secondary>architecture type</secondary>
2823 </indexterm>
2824 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2825 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2826 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2827 and are often not needed.
2828 </para>
2829 <para>
2830 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2831 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2832 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2833 values are used, thereby providing a means of forcing particular settings.
2834 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2835 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2836 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2837 that Exim expects. You can run these scripts directly from the shell in order
2838 to find out what values are being used on your system.
2839 </para>
2840 <para>
2841 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2842 therein. Some (but not all) are mentioned below. If there is something that
2843 needs changing, review the contents of this file and the contents of the make
2844 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2845 default values are.
2846 </para>
2847 <para>
2848 <indexterm role="concept">
2849 <primary>building Exim</primary>
2850 <secondary>overriding default settings</secondary>
2851 </indexterm>
2852 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2853 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2854 need to change the original files. Instead, you should make the changes by
2855 putting the new values in an appropriate <filename>Local</filename> file. For example,
2856 <indexterm role="concept">
2857 <primary>Tru64-Unix build-time settings</primary>
2858 </indexterm>
2859 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2860 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2861 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2862 called with the option <option>-std1</option>, to make it recognize some of the features of
2863 Standard C that Exim uses. (Most other compilers recognize Standard C by
2864 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2865 containing the lines
2866 </para>
2867 <literallayout class="monospaced">
2868 CC=cc
2869 CFLAGS=-std1
2870 </literallayout>
2871 <para>
2872 If you are compiling for just one operating system, it may be easier to put
2873 these lines directly into <filename>Local/Makefile</filename>.
2874 </para>
2875 <para>
2876 Keeping all your local configuration settings separate from the distributed
2877 files makes it easy to transfer them to new versions of Exim simply by copying
2878 the contents of the <filename>Local</filename> directory.
2879 </para>
2880 <para>
2881 <indexterm role="concept">
2882 <primary>NIS lookup type</primary>
2883 <secondary>including support for</secondary>
2884 </indexterm>
2885 <indexterm role="concept">
2886 <primary>NIS+ lookup type</primary>
2887 <secondary>including support for</secondary>
2888 </indexterm>
2889 <indexterm role="concept">
2890 <primary>LDAP</primary>
2891 <secondary>including support for</secondary>
2892 </indexterm>
2893 <indexterm role="concept">
2894 <primary>lookup</primary>
2895 <secondary>inclusion in binary</secondary>
2896 </indexterm>
2897 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2898 lookup, but not all systems have these components installed, so the default is
2899 not to include the relevant code in the binary. All the different kinds of file
2900 and database lookup that Exim supports are implemented as separate code modules
2901 which are included only if the relevant compile-time options are set. In the
2902 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2903 </para>
2904 <literallayout class="monospaced">
2905 LOOKUP_LDAP=yes
2906 LOOKUP_NIS=yes
2907 LOOKUP_NISPLUS=yes
2908 </literallayout>
2909 <para>
2910 and similar settings apply to the other lookup types. They are all listed in
2911 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2912 libraries need to be installed before compiling Exim.
2913 <indexterm role="concept">
2914 <primary>cdb</primary>
2915 <secondary>including support for</secondary>
2916 </indexterm>
2917 However, there are some optional lookup types (such as cdb) for which
2918 the code is entirely contained within Exim, and no external include
2919 files or libraries are required. When a lookup type is not included in the
2920 binary, attempts to configure Exim to use it cause run time configuration
2921 errors.
2922 </para>
2923 <para>
2924 <indexterm role="concept">
2925 <primary>pkg-config</primary>
2926 <secondary>lookups</secondary>
2927 </indexterm>
2928 <indexterm role="concept">
2929 <primary>pkg-config</primary>
2930 <secondary>authenticators</secondary>
2931 </indexterm>
2932 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2933 about how to compile against a library; Exim has some initial support for
2934 being able to use pkg-config for lookups and authenticators.  For any given
2935 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2936 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2937 name of the package to be queried.  The results of querying via the
2938 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2939 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2940 syntax.  For instance:
2941 </para>
2942 <literallayout class="monospaced">
2943 LOOKUP_SQLITE=yes
2944 LOOKUP_SQLITE_PC=sqlite3
2945 AUTH_GSASL=yes
2946 AUTH_GSASL_PC=libgsasl
2947 AUTH_HEIMDAL_GSSAPI=yes
2948 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2949 </literallayout>
2950 <para>
2951 <indexterm role="concept">
2952 <primary>Perl</primary>
2953 <secondary>including support for</secondary>
2954 </indexterm>
2955 Exim can be linked with an embedded Perl interpreter, allowing Perl
2956 subroutines to be called during string expansion. To enable this facility,
2957 </para>
2958 <literallayout class="monospaced">
2959 EXIM_PERL=perl.o
2960 </literallayout>
2961 <para>
2962 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2963 chapter <xref linkend="CHAPperl"/>.
2964 </para>
2965 <para>
2966 <indexterm role="concept">
2967 <primary>X11 libraries, location of</primary>
2968 </indexterm>
2969 The location of the X11 libraries is something that varies a lot between
2970 operating systems, and there may be different versions of X11 to cope
2971 with. Exim itself makes no use of X11, but if you are compiling the Exim
2972 monitor, the X11 libraries must be available.
2973 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2974 </para>
2975 <literallayout class="monospaced">
2976 X11=/usr/X11R6
2977 XINCLUDE=-I$(X11)/include
2978 XLFLAGS=-L$(X11)/lib
2979 </literallayout>
2980 <para>
2981 These are overridden in some of the operating-system configuration files. For
2982 example, in <filename>OS/Makefile-SunOS5</filename> there is
2983 </para>
2984 <literallayout class="monospaced">
2985 X11=/usr/openwin
2986 XINCLUDE=-I$(X11)/include
2987 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2988 </literallayout>
2989 <para>
2990 If you need to override the default setting for your operating system, place a
2991 definition of all three of these variables into your
2992 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2993 </para>
2994 <para>
2995 <indexterm role="concept">
2996 <primary>EXTRALIBS</primary>
2997 </indexterm>
2998 If you need to add any extra libraries to the link steps, these can be put in a
2999 variable called EXTRALIBS, which appears in all the link commands, but by
3000 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3001 command for linking the main Exim binary, and not for any associated utilities.
3002 </para>
3003 <para>
3004 <indexterm role="concept">
3005 <primary>DBM libraries</primary>
3006 <secondary>configuration for building</secondary>
3007 </indexterm>
3008 There is also DBMLIB, which appears in the link commands for binaries that
3009 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3010 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3011 binary, and which can be used, for example, to include additional X11
3012 libraries.
3013 </para>
3014 <para>
3015 <indexterm role="concept">
3016 <primary>configuration file</primary>
3017 <secondary>editing</secondary>
3018 </indexterm>
3019 The make file copes with rebuilding Exim correctly if any of the configuration
3020 files are edited. However, if an optional configuration file is deleted, it is
3021 necessary to touch the associated non-optional file (that is,
3022 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3023 </para>
3024 </section>
3025 <section id="SECID30">
3026 <title>OS-specific header files</title>
3027 <para>
3028 <indexterm role="concept">
3029 <primary><filename>os.h</filename></primary>
3030 </indexterm>
3031 <indexterm role="concept">
3032 <primary>building Exim</primary>
3033 <secondary>OS-specific C header files</secondary>
3034 </indexterm>
3035 The <filename>OS</filename> directory contains a number of files with names of the form
3036 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3037 normally need to be changed. There is a list of macro settings that are
3038 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3039 are porting Exim to a new operating system.
3040 </para>
3041 </section>
3042 <section id="SECID31">
3043 <title>Overriding build-time options for the monitor</title>
3044 <para>
3045 <indexterm role="concept">
3046 <primary>building Eximon</primary>
3047 </indexterm>
3048 A similar process is used for overriding things when building the Exim monitor,
3049 where the files that are involved are
3050 </para>
3051 <literallayout>
3052 <filename>OS/eximon.conf-Default</filename>
3053 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3054 <filename>Local/eximon.conf</filename>
3055 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3056 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3057 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3058 </literallayout>
3059 <para>
3060 <indexterm role="concept">
3061 <primary><filename>Local/eximon.conf</filename></primary>
3062 </indexterm>
3063 As with Exim itself, the final three files need not exist, and in this case the
3064 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3065 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3066 variables of the same name, preceded by EXIMON_. For example, setting
3067 EXIMON_LOG_DEPTH in the environment overrides the value of
3068 LOG_DEPTH at run time.
3069 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3070 </para>
3071 </section>
3072 <section id="SECID32">
3073 <title>Installing Exim binaries and scripts</title>
3074 <para>
3075 <indexterm role="concept">
3076 <primary>installing Exim</primary>
3077 </indexterm>
3078 <indexterm role="concept">
3079 <primary>BIN_DIRECTORY</primary>
3080 </indexterm>
3081 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3082 arguments. The script copies binaries and utility scripts into the directory
3083 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3084 <indexterm role="concept">
3085 <primary>setuid</primary>
3086 <secondary>installing Exim with</secondary>
3087 </indexterm>
3088 The install script copies files only if they are newer than the files they are
3089 going to replace. The Exim binary is required to be owned by root and have the
3090 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3091 install</literal> as root so that it can set up the Exim binary in this way. However, in
3092 some special situations (for example, if a host is doing no local deliveries)
3093 it may be possible to run Exim without making the binary setuid root (see
3094 chapter <xref linkend="CHAPsecurity"/> for details).
3095 </para>
3096 <para>
3097 <indexterm role="concept">
3098 <primary>CONFIGURE_FILE</primary>
3099 </indexterm>
3100 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3101 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3102 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3103 by the installation script. If a run time configuration file already exists, it
3104 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3105 alternative files, no default is installed.
3106 </para>
3107 <para>
3108 <indexterm role="concept">
3109 <primary>system aliases file</primary>
3110 </indexterm>
3111 <indexterm role="concept">
3112 <primary><filename>/etc/aliases</filename></primary>
3113 </indexterm>
3114 One change is made to the default configuration file when it is installed: the
3115 default configuration contains a router that references a system aliases file.
3116 The path to this file is set to the value specified by
3117 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3118 If the system aliases file does not exist, the installation script creates it,
3119 and outputs a comment to the user.
3120 </para>
3121 <para>
3122 The created file contains no aliases, but it does contain comments about the
3123 aliases a site should normally have. Mail aliases have traditionally been
3124 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3125 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3126 Exim&#x2019;s configuration if necessary.
3127 </para>
3128 <para>
3129 The default configuration uses the local host&#x2019;s name as the only local domain,
3130 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3131 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3132 directories are supported, but no NIS or NIS+ support is configured. Domains
3133 other than the name of the local host are routed using the DNS, with delivery
3134 over SMTP.
3135 </para>
3136 <para>
3137 It is possible to install Exim for special purposes (such as building a binary
3138 distribution) in a private part of the file system. You can do this by a
3139 command such as
3140 </para>
3141 <literallayout class="monospaced">
3142 make DESTDIR=/some/directory/ install
3143 </literallayout>
3144 <para>
3145 This has the effect of pre-pending the specified directory to all the file
3146 paths, except the name of the system aliases file that appears in the default
3147 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3148 For backwards compatibility, ROOT is used if DESTDIR is not set,
3149 but this usage is deprecated.
3150 </para>
3151 <para>
3152 <indexterm role="concept">
3153 <primary>installing Exim</primary>
3154 <secondary>what is not installed</secondary>
3155 </indexterm>
3156 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3157 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3158 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3159 directory are copied, except for the info files when you have set
3160 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3161 </para>
3162 <para>
3163 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3164 to their names. The Exim binary itself, however, is handled differently. It is
3165 installed under a name that includes the version number and the compile number,
3166 for example <filename>exim-4.85-1</filename>. The script then arranges for a symbolic link
3167 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3168 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3169 from the directory (as seen by other processes).
3170 </para>
3171 <para>
3172 <indexterm role="concept">
3173 <primary>installing Exim</primary>
3174 <secondary>testing the script</secondary>
3175 </indexterm>
3176 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3177 real, you can pass the <option>-n</option> option to the installation script by this
3178 command:
3179 </para>
3180 <literallayout class="monospaced">
3181 make INSTALL_ARG=-n install
3182 </literallayout>
3183 <para>
3184 The contents of the variable INSTALL_ARG are passed to the installation
3185 script. You do not need to be root to run this test. Alternatively, you can run
3186 the installation script directly, but this must be from within the build
3187 directory. For example, from the top-level Exim directory you could use this
3188 command:
3189 </para>
3190 <literallayout class="monospaced">
3191 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3192 </literallayout>
3193 <para>
3194 <indexterm role="concept">
3195 <primary>installing Exim</primary>
3196 <secondary>install script options</secondary>
3197 </indexterm>
3198 There are two other options that can be supplied to the installation script.
3199 </para>
3200 <itemizedlist>
3201 <listitem>
3202 <para>
3203 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3204 to root, and the call to make it a setuid binary.
3205 </para>
3206 </listitem>
3207 <listitem>
3208 <para>
3209 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3210 installed binary.
3211 </para>
3212 </listitem>
3213 </itemizedlist>
3214 <para>
3215 INSTALL_ARG can be used to pass these options to the script. For example:
3216 </para>
3217 <literallayout class="monospaced">
3218 make INSTALL_ARG=-no_symlink install
3219 </literallayout>
3220 <para>
3221 The installation script can also be given arguments specifying which files are
3222 to be copied. For example, to install just the Exim binary, and nothing else,
3223 without creating the symbolic link, you could use:
3224 </para>
3225 <literallayout class="monospaced">
3226 make INSTALL_ARG='-no_symlink exim' install
3227 </literallayout>
3228 </section>
3229 <section id="SECTinsinfdoc">
3230 <title>Installing info documentation</title>
3231 <para>
3232 <indexterm role="concept">
3233 <primary>installing Exim</primary>
3234 <secondary><emphasis>info</emphasis> documentation</secondary>
3235 </indexterm>
3236 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3237 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3238 distribution. Instead it is available separately from the ftp site (see section
3239 <xref linkend="SECTavail"/>).
3240 </para>
3241 <para>
3242 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3243 source of the documentation is found in the source tree, running <literal>make
3244 install</literal> automatically builds the info files and installs them.
3245 </para>
3246 </section>
3247 <section id="SECID33">
3248 <title>Setting up the spool directory</title>
3249 <para>
3250 <indexterm role="concept">
3251 <primary>spool directory</primary>
3252 <secondary>creating</secondary>
3253 </indexterm>
3254 When it starts up, Exim tries to create its spool directory if it does not
3255 exist. The Exim uid and gid are used for the owner and group of the spool
3256 directory. Sub-directories are automatically created in the spool directory as
3257 necessary.
3258 </para>
3259 </section>
3260 <section id="SECID34">
3261 <title>Testing</title>
3262 <para>
3263 <indexterm role="concept">
3264 <primary>testing</primary>
3265 <secondary>installation</secondary>
3266 </indexterm>
3267 Having installed Exim, you can check that the run time configuration file is
3268 syntactically valid by running the following command, which assumes that the
3269 Exim binary directory is within your PATH environment variable:
3270 </para>
3271 <literallayout class="monospaced">
3272 exim -bV
3273 </literallayout>
3274 <para>
3275 If there are any errors in the configuration file, Exim outputs error messages.
3276 Otherwise it outputs the version number and build date,
3277 the DBM library that is being used, and information about which drivers and
3278 other optional code modules are included in the binary.
3279 Some simple routing tests can be done by using the address testing option. For
3280 example,
3281 </para>
3282 <literallayout>
3283 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3284 </literallayout>
3285 <para>
3286 should verify that it recognizes a local mailbox, and
3287 </para>
3288 <literallayout>
3289 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3290 </literallayout>
3291 <para>
3292 a remote one. Then try getting it to deliver mail, both locally and remotely.
3293 This can be done by passing messages directly to Exim, without going through a
3294 user agent. For example:
3295 </para>
3296 <literallayout class="monospaced">
3297 exim -v postmaster@your.domain.example
3298 From: user@your.domain.example
3299 To: postmaster@your.domain.example
3300 Subject: Testing Exim
3301
3302 This is a test message.
3303 ^D
3304 </literallayout>
3305 <para>
3306 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3307 In this case you should see copies of three log lines, one for the message&#x2019;s
3308 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3309 </para>
3310 <para>
3311 <indexterm role="concept">
3312 <primary>delivery</primary>
3313 <secondary>problems with</secondary>
3314 </indexterm>
3315 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3316 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3317 of information is running Exim with debugging turned on, by specifying the
3318 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3319 with debugging turned on by a command of the form
3320 </para>
3321 <literallayout>
3322 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3323 </literallayout>
3324 <para>
3325 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3326 produces rather a lot of output, but you can cut this down to specific areas.
3327 For example, if you use <option>-d-all+route</option> only the debugging information
3328 relevant to routing is included. (See the <option>-d</option> option in chapter
3329 <xref linkend="CHAPcommandline"/> for more details.)
3330 </para>
3331 <para>
3332 <indexterm role="concept">
3333 <primary><quote>sticky</quote> bit</primary>
3334 </indexterm>
3335 <indexterm role="concept">
3336 <primary>lock files</primary>
3337 </indexterm>
3338 One specific problem that has shown up on some sites is the inability to do
3339 local deliveries into a shared mailbox directory, because it does not have the
3340 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3341 writing to a mailbox file, and if it cannot create the lock file, the delivery
3342 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3343 directory, or by setting a specific group for local deliveries and allowing
3344 that group to create files in the directory (see the comments above the
3345 <command>local_delivery</command> transport in the default configuration file). Another
3346 approach is to configure Exim not to use lock files, but just to rely on
3347 <function>fcntl()</function> locking instead. However, you should do this only if all user
3348 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3349 see chapter <xref linkend="CHAPappendfile"/>.
3350 </para>
3351 <para>
3352 One thing that cannot be tested on a system that is already running an MTA is
3353 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3354 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3355 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3356 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3357 incoming SMTP mail.
3358 </para>
3359 <para>
3360 Testing a new version on a system that is already running Exim can most easily
3361 be done by building a binary with a different CONFIGURE_FILE setting. From
3362 within the run time configuration, all other file and directory names
3363 that Exim uses can be altered, in order to keep it entirely clear of the
3364 production version.
3365 </para>
3366 </section>
3367 <section id="SECID35">
3368 <title>Replacing another MTA with Exim</title>
3369 <para>
3370 <indexterm role="concept">
3371 <primary>replacing another MTA</primary>
3372 </indexterm>
3373 Building and installing Exim for the first time does not of itself put it in
3374 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3375 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3376 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3377 binary in order to get the user agents to pass messages to Exim. This is
3378 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3379 or <filename>/usr/lib/sendmail</filename>
3380 <indexterm role="concept">
3381 <primary>symbolic link</primary>
3382 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3383 </indexterm>
3384 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3385 privilege and executable status from the old MTA. It is then necessary to stop
3386 and restart the mailer daemon, if one is running.
3387 </para>
3388 <para>
3389 <indexterm role="concept">
3390 <primary>FreeBSD, MTA indirection</primary>
3391 </indexterm>
3392 <indexterm role="concept">
3393 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3394 </indexterm>
3395 Some operating systems have introduced alternative ways of switching MTAs. For
3396 example, if you are running FreeBSD, you need to edit the file
3397 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3398 described. A typical example of the contents of this file for running Exim is
3399 as follows:
3400 </para>
3401 <literallayout class="monospaced">
3402 sendmail            /usr/exim/bin/exim
3403 send-mail           /usr/exim/bin/exim
3404 mailq               /usr/exim/bin/exim -bp
3405 newaliases          /usr/bin/true
3406 </literallayout>
3407 <para>
3408 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3409 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3410 favourite user agent.
3411 </para>
3412 <para>
3413 You should consider what to tell your users about the change of MTA. Exim may
3414 have different capabilities to what was previously running, and there are
3415 various operational differences such as the text of messages produced by
3416 command line options and in bounce messages. If you allow your users to make
3417 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3418 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3419 </para>
3420 </section>
3421 <section id="SECID36">
3422 <title>Upgrading Exim</title>
3423 <para>
3424 <indexterm role="concept">
3425 <primary>upgrading Exim</primary>
3426 </indexterm>
3427 If you are already running Exim on your host, building and installing a new
3428 version automatically makes it available to MUAs, or any other programs that
3429 call the MTA directly. However, if you are running an Exim daemon, you do need
3430 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3431 new binary. You do not need to stop processing mail in order to install a new
3432 version of Exim. The install script does not modify an existing runtime
3433 configuration file.
3434 </para>
3435 </section>
3436 <section id="SECID37">
3437 <title>Stopping the Exim daemon on Solaris</title>
3438 <para>
3439 <indexterm role="concept">
3440 <primary>Solaris</primary>
3441 <secondary>stopping Exim on</secondary>
3442 </indexterm>
3443 The standard command for stopping the mailer daemon on Solaris is
3444 </para>
3445 <literallayout class="monospaced">
3446 /etc/init.d/sendmail stop
3447 </literallayout>
3448 <para>
3449 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3450 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3451 for the text <quote>sendmail</quote>; this is not present because the actual program name
3452 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3453 solution is to replace the line that finds the process id with something like
3454 </para>
3455 <literallayout class="monospaced">
3456 pid=`cat /var/spool/exim/exim-daemon.pid`
3457 </literallayout>
3458 <para>
3459 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3460 </para>
3461 <para>
3462 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3463 still be received from local processes, and if automatic delivery is configured
3464 (the normal case), deliveries will still occur.
3465 </para>
3466 </section>
3467 </chapter>
3468
3469 <chapter id="CHAPcommandline">
3470 <title>The Exim command line</title>
3471 <para>
3472 <indexterm role="concept" id="IIDclo1" class="startofrange">
3473 <primary>command line</primary>
3474 <secondary>options</secondary>
3475 </indexterm>
3476 <indexterm role="concept" id="IIDclo2" class="startofrange">
3477 <primary>options</primary>
3478 <secondary>command line</secondary>
3479 </indexterm>
3480 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3481 each starting with a hyphen character, followed by a number of arguments. The
3482 options are compatible with the main options of Sendmail, and there are also
3483 some additional options, some of which are compatible with Smail 3. Certain
3484 combinations of options do not make sense, and provoke an error if used.
3485 The form of the arguments depends on which options are set.
3486 </para>
3487 <section id="SECID38">
3488 <title>Setting options by program name</title>
3489 <para>
3490 <indexterm role="concept">
3491 <primary><emphasis>mailq</emphasis></primary>
3492 </indexterm>
3493 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3494 were present before any other options.
3495 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3496 standard output.
3497 This feature is for compatibility with some systems that contain a command of
3498 that name in one of the standard libraries, symbolically linked to
3499 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3500 </para>
3501 <para>
3502 <indexterm role="concept">
3503 <primary><emphasis>rsmtp</emphasis></primary>
3504 </indexterm>
3505 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3506 were present before any other options, for compatibility with Smail. The
3507 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3508 format.
3509 </para>
3510 <para>
3511 <indexterm role="concept">
3512 <primary><emphasis>rmail</emphasis></primary>
3513 </indexterm>
3514 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3515 <option>-oee</option> options were present before any other options, for compatibility with
3516 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3517 </para>
3518 <para>
3519 <indexterm role="concept">
3520 <primary><emphasis>runq</emphasis></primary>
3521 </indexterm>
3522 <indexterm role="concept">
3523 <primary>queue runner</primary>
3524 </indexterm>
3525 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3526 were present before any other options, for compatibility with Smail. The <option>-q</option>
3527 option causes a single queue runner process to be started.
3528 </para>
3529 <para>
3530 <indexterm role="concept">
3531 <primary><emphasis>newaliases</emphasis></primary>
3532 </indexterm>
3533 <indexterm role="concept">
3534 <primary>alias file</primary>
3535 <secondary>building</secondary>
3536 </indexterm>
3537 <indexterm role="concept">
3538 <primary>Sendmail compatibility</primary>
3539 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3540 </indexterm>
3541 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3542 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3543 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3544 the concept of a single alias file, but can be configured to run a given
3545 command if called with the <option>-bi</option> option.
3546 </para>
3547 </section>
3548 <section id="SECTtrustedadmin">
3549 <title>Trusted and admin users</title>
3550 <para>
3551 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3552 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3553 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3554 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3555 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3556 </para>
3557 <itemizedlist>
3558 <listitem>
3559 <para>
3560 <indexterm role="concept">
3561 <primary>trusted users</primary>
3562 <secondary>definition of</secondary>
3563 </indexterm>
3564 <indexterm role="concept">
3565 <primary>user</primary>
3566 <secondary>trusted definition of</secondary>
3567 </indexterm>
3568 The trusted users are root, the Exim user, any user listed in the
3569 <option>trusted_users</option> configuration option, and any user whose current group or any
3570 supplementary group is one of those listed in the <option>trusted_groups</option>
3571 configuration option. Note that the Exim group is not automatically trusted.
3572 </para>
3573 <para>
3574 <indexterm role="concept">
3575 <primary><quote>From</quote> line</primary>
3576 </indexterm>
3577 <indexterm role="concept">
3578 <primary>envelope sender</primary>
3579 </indexterm>
3580 Trusted users are always permitted to use the <option>-f</option> option or a leading
3581 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3582 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3583 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3584 users to set envelope senders.
3585 </para>
3586 <para>
3587 <indexterm role="concept">
3588 <primary><emphasis>From:</emphasis> header line</primary>
3589 </indexterm>
3590 <indexterm role="concept">
3591 <primary><emphasis>Sender:</emphasis> header line</primary>
3592 </indexterm>
3593 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3594 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3595 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3596 </para>
3597 <para>
3598 Trusted users may also specify a host name, host address, interface address,
3599 protocol name, ident value, and authentication data when submitting a message
3600 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3601 have the characteristics of messages received from a remote host. Untrusted
3602 users may in some circumstances use <option>-f</option>, but can never set the other values
3603 that are available to trusted users.
3604 </para>
3605 </listitem>
3606 <listitem>
3607 <para>
3608 <indexterm role="concept">
3609 <primary>user</primary>
3610 <secondary>admin definition of</secondary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>admin user</primary>
3614 <secondary>definition of</secondary>
3615 </indexterm>
3616 The admin users are root, the Exim user, and any user that is a member of the
3617 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3618 The current group does not have to be one of these groups.
3619 </para>
3620 <para>
3621 Admin users are permitted to list the queue, and to carry out certain
3622 operations on messages, for example, to force delivery failures. It is also
3623 necessary to be an admin user in order to see the full information provided by
3624 the Exim monitor, and full debugging output.
3625 </para>
3626 <para>
3627 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3628 Exim to attempt delivery of messages on its queue is restricted to admin users.
3629 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3630 option false (that is, specifying <option>no_prod_requires_admin</option>).
3631 </para>
3632 <para>
3633 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3634 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3635 false.
3636 </para>
3637 </listitem>
3638 </itemizedlist>
3639 <para>
3640 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3641 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3642 getting root. There is further discussion of this issue at the start of chapter
3643 <xref linkend="CHAPconf"/>.
3644 </para>
3645 </section>
3646 <section id="SECID39">
3647 <title>Command line options</title>
3648 <para>
3649 Exim&#x2019;s command line options are described in alphabetical order below. If none
3650 of the options that specifies a specific action (such as starting the daemon or
3651 a queue runner, or testing an address, or receiving a message in a specific
3652 format, or listing the queue) are present, and there is at least one argument
3653 on the command line, <option>-bm</option> (accept a local message on the standard input,
3654 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3655 outputs a brief message about itself and exits.
3656 </para>
3657 <!-- === Start of command line options === -->
3658 <variablelist>
3659 <varlistentry>
3660 <term><option>--</option></term>
3661 <listitem>
3662 <para>
3663 <indexterm role="option">
3664 <primary>--</primary>
3665 </indexterm>
3666 <indexterm role="concept">
3667 <primary>options</primary>
3668 <secondary>command line; terminating</secondary>
3669 </indexterm>
3670 This is a pseudo-option whose only purpose is to terminate the options and
3671 therefore to cause subsequent command line items to be treated as arguments
3672 rather than options, even if they begin with hyphens.
3673 </para>
3674 </listitem></varlistentry>
3675 <varlistentry>
3676 <term><option>--help</option></term>
3677 <listitem>
3678 <para>
3679 <indexterm role="option">
3680 <primary><option>--help</option></primary>
3681 </indexterm>
3682 This option causes Exim to output a few sentences stating what it is.
3683 The same output is generated if the Exim binary is called with no options and
3684 no arguments.
3685 </para>
3686 </listitem></varlistentry>
3687 <varlistentry>
3688 <term><option>--version</option></term>
3689 <listitem>
3690 <para>
3691 <indexterm role="option">
3692 <primary><option>--version</option></primary>
3693 </indexterm>
3694 This option is an alias for <option>-bV</option> and causes version information to be
3695 displayed.
3696 </para>
3697 </listitem></varlistentry>
3698 <varlistentry>
3699 <term><option>-Ac</option></term>
3700 <term><option>-Am</option></term>
3701 <listitem>
3702 <para>
3703 <indexterm role="option">
3704 <primary><option>-Ac</option></primary>
3705 </indexterm>
3706 <indexterm role="option">
3707 <primary><option>-Am</option></primary>
3708 </indexterm>
3709 These options are used by Sendmail for selecting configuration files and are
3710 ignored by Exim.
3711 </para>
3712 </listitem></varlistentry>
3713 <varlistentry>
3714 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3715 <listitem>
3716 <para>
3717 <indexterm role="option">
3718 <primary><option>-B</option></primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>8-bit characters</primary>
3722 </indexterm>
3723 <indexterm role="concept">
3724 <primary>Sendmail compatibility</primary>
3725 <secondary>8-bit characters</secondary>
3726 </indexterm>
3727 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3728 clean; it ignores this option.
3729 </para>
3730 </listitem></varlistentry>
3731 <varlistentry>
3732 <term><option>-bd</option></term>
3733 <listitem>
3734 <para>
3735 <indexterm role="option">
3736 <primary><option>-bd</option></primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>daemon</primary>
3740 </indexterm>
3741 <indexterm role="concept">
3742 <primary>SMTP</primary>
3743 <secondary>listener</secondary>
3744 </indexterm>
3745 <indexterm role="concept">
3746 <primary>queue runner</primary>
3747 </indexterm>
3748 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3749 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3750 that the daemon should also initiate periodic queue runs.
3751 </para>
3752 <para>
3753 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3754 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3755 disconnect from the controlling terminal. When running this way, it can be
3756 stopped by pressing ctrl-C.
3757 </para>
3758 <para>
3759 By default, Exim listens for incoming connections to the standard SMTP port on
3760 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3761 ports, on multiple ports, and only on specific interfaces. Chapter
3762 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3763 </para>
3764 <para>
3765 When a listening daemon
3766 <indexterm role="concept">
3767 <primary>daemon</primary>
3768 <secondary>process id (pid)</secondary>
3769 </indexterm>
3770 <indexterm role="concept">
3771 <primary>pid (process id)</primary>
3772 <secondary>of daemon</secondary>
3773 </indexterm>
3774 is started without the use of <option>-oX</option> (that is, without overriding the normal
3775 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3776 in Exim&#x2019;s spool directory. This location can be overridden by setting
3777 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3778 running as root.
3779 </para>
3780 <para>
3781 When <option>-oX</option> is used on the command line to start a listening daemon, the
3782 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3783 used to specify a path on the command line if a pid file is required.
3784 </para>
3785 <para>
3786 The SIGHUP signal
3787 <indexterm role="concept">
3788 <primary>SIGHUP</primary>
3789 </indexterm>
3790 <indexterm role="concept">
3791 <primary>daemon</primary>
3792 <secondary>restarting</secondary>
3793 </indexterm>
3794 can be used to cause the daemon to re-execute itself. This should be done
3795 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3796 means of the <option>.include</option> facility, is changed, and also whenever a new version
3797 of Exim is installed. It is not necessary to do this when other files that are
3798 referenced from the configuration (for example, alias files) are changed,
3799 because these are reread each time they are used.
3800 </para>
3801 </listitem></varlistentry>
3802 <varlistentry>
3803 <term><option>-bdf</option></term>
3804 <listitem>
3805 <para>
3806 <indexterm role="option">
3807 <primary><option>-bdf</option></primary>
3808 </indexterm>
3809 This option has the same effect as <option>-bd</option> except that it never disconnects
3810 from the controlling terminal, even when no debugging is specified.
3811 </para>
3812 </listitem></varlistentry>
3813 <varlistentry>
3814 <term><option>-be</option></term>
3815 <listitem>
3816 <para>
3817 <indexterm role="option">
3818 <primary><option>-be</option></primary>
3819 </indexterm>
3820 <indexterm role="concept">
3821 <primary>testing</primary>
3822 <secondary>string expansion</secondary>
3823 </indexterm>
3824 <indexterm role="concept">
3825 <primary>expansion</primary>
3826 <secondary>testing</secondary>
3827 </indexterm>
3828 Run Exim in expansion testing mode. Exim discards its root privilege, to
3829 prevent ordinary users from using this mode to read otherwise inaccessible
3830 files. If no arguments are given, Exim runs interactively, prompting for lines
3831 of data. Otherwise, it processes each argument in turn.
3832 </para>
3833 <para>
3834 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3835 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3836 used without command line arguments. If successful, it uses the <function>readline()</function>
3837 function, which provides extensive line-editing facilities, for reading the
3838 test data. A line history is supported.
3839 </para>
3840 <para>
3841 Long expansion expressions can be split over several lines by using backslash
3842 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3843 continuation lines is ignored. Each argument or data line is passed through the
3844 string expansion mechanism, and the result is output. Variable values from the
3845 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3846 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3847 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3848 </para>
3849 <para>
3850 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3851 files or databases you are using, you must exit and restart Exim before trying
3852 the same lookup again. Otherwise, because each Exim process caches the results
3853 of lookups, you will just get the same result as before.
3854 </para>
3855 </listitem></varlistentry>
3856 <varlistentry>
3857 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3858 <listitem>
3859 <para>
3860 <indexterm role="option">
3861 <primary><option>-bem</option></primary>
3862 </indexterm>
3863 <indexterm role="concept">
3864 <primary>testing</primary>
3865 <secondary>string expansion</secondary>
3866 </indexterm>
3867 <indexterm role="concept">
3868 <primary>expansion</primary>
3869 <secondary>testing</secondary>
3870 </indexterm>
3871 This option operates like <option>-be</option> except that it must be followed by the name
3872 of a file. For example:
3873 </para>
3874 <literallayout class="monospaced">
3875 exim -bem /tmp/testmessage
3876 </literallayout>
3877 <para>
3878 The file is read as a message (as if receiving a locally-submitted non-SMTP
3879 message) before any of the test expansions are done. Thus, message-specific
3880 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3881 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3882 recipients are read from the headers in the normal way, and are shown in the
3883 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3884 line, because further arguments are taken as strings to expand (just like
3885 <option>-be</option>).
3886 </para>
3887 </listitem></varlistentry>
3888 <varlistentry>
3889 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3890 <listitem>
3891 <para>
3892 <indexterm role="option">
3893 <primary><option>-bF</option></primary>
3894 </indexterm>
3895 <indexterm role="concept">
3896 <primary>system filter</primary>
3897 <secondary>testing</secondary>
3898 </indexterm>
3899 <indexterm role="concept">
3900 <primary>testing</primary>
3901 <secondary>system filter</secondary>
3902 </indexterm>
3903 This option is the same as <option>-bf</option> except that it assumes that the filter being
3904 tested is a system filter. The additional commands that are available only in
3905 system filters are recognized.
3906 </para>
3907 </listitem></varlistentry>
3908 <varlistentry>
3909 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3910 <listitem>
3911 <para>
3912 <indexterm role="option">
3913 <primary><option>-bf</option></primary>
3914 </indexterm>
3915 <indexterm role="concept">
3916 <primary>filter</primary>
3917 <secondary>testing</secondary>
3918 </indexterm>
3919 <indexterm role="concept">
3920 <primary>testing</primary>
3921 <secondary>filter file</secondary>
3922 </indexterm>
3923 <indexterm role="concept">
3924 <primary>forward file</primary>
3925 <secondary>testing</secondary>
3926 </indexterm>
3927 <indexterm role="concept">
3928 <primary>testing</primary>
3929 <secondary>forward file</secondary>
3930 </indexterm>
3931 <indexterm role="concept">
3932 <primary>Sieve filter</primary>
3933 <secondary>testing</secondary>
3934 </indexterm>
3935 This option runs Exim in user filter testing mode; the file is the filter file
3936 to be tested, and a test message must be supplied on the standard input. If
3937 there are no message-dependent tests in the filter, an empty file can be
3938 supplied.
3939 </para>
3940 <para>
3941 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3942 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3943 filter and a user filter in the same run. For example:
3944 </para>
3945 <literallayout class="monospaced">
3946 exim -bF /system/filter -bf /user/filter &lt;/test/message
3947 </literallayout>
3948 <para>
3949 This is helpful when the system filter adds header lines or sets filter
3950 variables that are used by the user filter.
3951 </para>
3952 <para>
3953 If the test filter file does not begin with one of the special lines
3954 </para>
3955 <literallayout class="monospaced">
3956 # Exim filter
3957 # Sieve filter
3958 </literallayout>
3959 <para>
3960 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3961 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3962 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3963 redirection lists.
3964 </para>
3965 <para>
3966 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3967 detected, is a list of the actions that Exim would try to take if presented
3968 with the message for real. More details of filter testing are given in the
3969 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3970 </para>
3971 <para>
3972 When testing a filter file,
3973 <indexterm role="concept">
3974 <primary><quote>From</quote> line</primary>
3975 </indexterm>
3976 <indexterm role="concept">
3977 <primary>envelope sender</primary>
3978 </indexterm>
3979 <indexterm role="option">
3980 <primary><option>-f</option></primary>
3981 <secondary>for filter testing</secondary>
3982 </indexterm>
3983 the envelope sender can be set by the <option>-f</option> option,
3984 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3985 that would normally be taken from the envelope recipient address of the message
3986 can be set by means of additional command line options (see the next four
3987 options).
3988 </para>
3989 </listitem></varlistentry>
3990 <varlistentry>
3991 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3992 <listitem>
3993 <para>
3994 <indexterm role="option">
3995 <primary><option>-bfd</option></primary>
3996 </indexterm>
3997 <indexterm role="variable">
3998 <primary><varname>$qualify_domain</varname></primary>
3999 </indexterm>
4000 This sets the domain of the recipient address when a filter file is being
4001 tested by means of the <option>-bf</option> option. The default is the value of
4002 <varname>$qualify_domain</varname>.
4003 </para>
4004 </listitem></varlistentry>
4005 <varlistentry>
4006 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4007 <listitem>
4008 <para>
4009 <indexterm role="option">
4010 <primary><option>-bfl</option></primary>
4011 </indexterm>
4012 This sets the local part of the recipient address when a filter file is being
4013 tested by means of the <option>-bf</option> option. The default is the username of the
4014 process that calls Exim. A local part should be specified with any prefix or
4015 suffix stripped, because that is how it appears to the filter when a message is
4016 actually being delivered.
4017 </para>
4018 </listitem></varlistentry>
4019 <varlistentry>
4020 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4021 <listitem>
4022 <para>
4023 <indexterm role="option">
4024 <primary><option>-bfp</option></primary>
4025 </indexterm>
4026 This sets the prefix of the local part of the recipient address when a filter
4027 file is being tested by means of the <option>-bf</option> option. The default is an empty
4028 prefix.
4029 </para>
4030 </listitem></varlistentry>
4031 <varlistentry>
4032 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4033 <listitem>
4034 <para>
4035 <indexterm role="option">
4036 <primary><option>-bfs</option></primary>
4037 </indexterm>
4038 This sets the suffix of the local part of the recipient address when a filter
4039 file is being tested by means of the <option>-bf</option> option. The default is an empty
4040 suffix.
4041 </para>
4042 </listitem></varlistentry>
4043 <varlistentry>
4044 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4045 <listitem>
4046 <para>
4047 <indexterm role="option">
4048 <primary><option>-bh</option></primary>
4049 </indexterm>
4050 <indexterm role="concept">
4051 <primary>testing</primary>
4052 <secondary>incoming SMTP</secondary>
4053 </indexterm>
4054 <indexterm role="concept">
4055 <primary>SMTP</primary>
4056 <secondary>testing incoming</secondary>
4057 </indexterm>
4058 <indexterm role="concept">
4059 <primary>testing</primary>
4060 <secondary>relay control</secondary>
4061 </indexterm>
4062 <indexterm role="concept">
4063 <primary>relaying</primary>
4064 <secondary>testing configuration</secondary>
4065 </indexterm>
4066 <indexterm role="concept">
4067 <primary>policy control</primary>
4068 <secondary>testing</secondary>
4069 </indexterm>
4070 <indexterm role="concept">
4071 <primary>debugging</primary>
4072 <secondary><option>-bh</option> option</secondary>
4073 </indexterm>
4074 This option runs a fake SMTP session as if from the given IP address, using the
4075 standard input and output. The IP address may include a port number at the end,
4076 after a full stop. For example:
4077 </para>
4078 <literallayout class="monospaced">
4079 exim -bh 10.9.8.7.1234
4080 exim -bh fe80::a00:20ff:fe86:a061.5678
4081 </literallayout>
4082 <para>
4083 When an IPv6 address is given, it is converted into canonical form. In the case
4084 of the second example above, the value of <varname>$sender_host_address</varname> after
4085 conversion to the canonical form is
4086 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4087 </para>
4088 <para>
4089 Comments as to what is going on are written to the standard error file. These
4090 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4091 This facility is provided for testing configuration options for incoming
4092 messages, to make sure they implement the required policy. For example, you can
4093 test your relay controls using <option>-bh</option>.
4094 </para>
4095 <para>
4096 <emphasis role="bold">Warning 1</emphasis>:
4097 <indexterm role="concept">
4098 <primary>RFC 1413</primary>
4099 </indexterm>
4100 You can test features of the configuration that rely on ident (RFC 1413)
4101 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4102 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4103 connection.
4104 </para>
4105 <para>
4106 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4107 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4108 occur, use <option>-bhc</option> instead.
4109 </para>
4110 <para>
4111 Messages supplied during the testing session are discarded, and nothing is
4112 written to any of the real log files. There may be pauses when DNS (and other)
4113 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4114 can be used to specify a specific IP interface and port if this is important,
4115 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4116 session were authenticated.
4117 </para>
4118 <para>
4119 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4120 output just states whether a given recipient address from a given host is
4121 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4122 </para>
4123 <para>
4124 Features such as authentication and encryption, where the client input is not
4125 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4126 specialized SMTP test program such as
4127 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4128 </para>
4129 </listitem></varlistentry>
4130 <varlistentry>
4131 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4132 <listitem>
4133 <para>
4134 <indexterm role="option">
4135 <primary><option>-bhc</option></primary>
4136 </indexterm>
4137 This option operates in the same way as <option>-bh</option>, except that address
4138 verification callouts are performed if required. This includes consulting and
4139 updating the callout cache database.
4140 </para>
4141 </listitem></varlistentry>
4142 <varlistentry>
4143 <term><option>-bi</option></term>
4144 <listitem>
4145 <para>
4146 <indexterm role="option">
4147 <primary><option>-bi</option></primary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>alias file</primary>
4151 <secondary>building</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>building alias file</primary>
4155 </indexterm>
4156 <indexterm role="concept">
4157 <primary>Sendmail compatibility</primary>
4158 <secondary><option>-bi</option> option</secondary>
4159 </indexterm>
4160 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4161 Exim does not have the concept of a single alias file, and so it cannot mimic
4162 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4163 tend to appear in various scripts such as NIS make files, so the option must be
4164 recognized.
4165 </para>
4166 <para>
4167 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4168 configuration option is run, under the uid and gid of the caller of Exim. If
4169 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4170 The command set by <option>bi_command</option> may not contain arguments. The command can
4171 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4172 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4173 <option>-bi</option> is a no-op.
4174 </para>
4175 </listitem></varlistentry>
4176 <varlistentry>
4177 <term><option>-bI:help</option></term>
4178 <listitem>
4179 <para>
4180 <indexterm role="option">
4181 <primary><option>-bI:help</option></primary>
4182 </indexterm>
4183 <indexterm role="concept">
4184 <primary>querying exim information</primary>
4185 </indexterm>
4186 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4187 information.  The output of many of these will be intended for machine
4188 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4189 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4190 options shall cause Exim to exit after producing the requested output.
4191 </para>
4192 </listitem></varlistentry>
4193 <varlistentry>
4194 <term><option>-bI:dscp</option></term>
4195 <listitem>
4196 <para>
4197 <indexterm role="option">
4198 <primary><option>-bI:dscp</option></primary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>DSCP</primary>
4202 <secondary>values</secondary>
4203 </indexterm>
4204 This option causes Exim to emit an alphabetically sorted list of all
4205 recognised DSCP names.
4206 </para>
4207 </listitem></varlistentry>
4208 <varlistentry>
4209 <term><option>-bI:sieve</option></term>
4210 <listitem>
4211 <para>
4212 <indexterm role="option">
4213 <primary><option>-bI:sieve</option></primary>
4214 </indexterm>
4215 <indexterm role="concept">
4216 <primary>Sieve filter</primary>
4217 <secondary>capabilities</secondary>
4218 </indexterm>
4219 This option causes Exim to emit an alphabetically sorted list of all supported
4220 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4221 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4222 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4223 compile-time build options, which this option will adapt to, this is the only
4224 way to guarantee a correct response.
4225 </para>
4226 </listitem></varlistentry>
4227 <varlistentry>
4228 <term><option>-bm</option></term>
4229 <listitem>
4230 <para>
4231 <indexterm role="option">
4232 <primary><option>-bm</option></primary>
4233 </indexterm>
4234 <indexterm role="concept">
4235 <primary>local message reception</primary>
4236 </indexterm>
4237 This option runs an Exim receiving process that accepts an incoming,
4238 locally-generated message on the standard input. The recipients are given as the
4239 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4240 argument can be a comma-separated list of RFC 2822 addresses. This is the
4241 default option for selecting the overall action of an Exim call; it is assumed
4242 if no other conflicting option is present.
4243 </para>
4244 <para>
4245 If any addresses in the message are unqualified (have no domain), they are
4246 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4247 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4248 suppressing this for special cases.
4249 </para>
4250 <para>
4251 Policy checks on the contents of local messages can be enforced by means of
4252 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4253 </para>
4254 <para>
4255 <indexterm role="concept">
4256 <primary>return code</primary>
4257 <secondary>for <option>-bm</option></secondary>
4258 </indexterm>
4259 The return code is zero if the message is successfully accepted. Otherwise, the
4260 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4261 </para>
4262 <para>
4263 The format
4264 <indexterm role="concept">
4265 <primary>message</primary>
4266 <secondary>format</secondary>
4267 </indexterm>
4268 <indexterm role="concept">
4269 <primary>format</primary>
4270 <secondary>message</secondary>
4271 </indexterm>
4272 <indexterm role="concept">
4273 <primary><quote>From</quote> line</primary>
4274 </indexterm>
4275 <indexterm role="concept">
4276 <primary>UUCP</primary>
4277 <secondary><quote>From</quote> line</secondary>
4278 </indexterm>
4279 <indexterm role="concept">
4280 <primary>Sendmail compatibility</primary>
4281 <secondary><quote>From</quote> line</secondary>
4282 </indexterm>
4283 of the message must be as defined in RFC 2822, except that, for
4284 compatibility with Sendmail and Smail, a line in one of the forms
4285 </para>
4286 <literallayout class="monospaced">
4287 From sender Fri Jan  5 12:55 GMT 1997
4288 From sender Fri, 5 Jan 97 12:55:01
4289 </literallayout>
4290 <para>
4291 (with the weekday optional, and possibly with additional text after the date)
4292 is permitted to appear at the start of the message. There appears to be no
4293 authoritative specification of the format of this line. Exim recognizes it by
4294 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4295 option, which can be changed if necessary.
4296 </para>
4297 <para>
4298 <indexterm role="option">
4299 <primary><option>-f</option></primary>
4300 <secondary>overriding <quote>From</quote> line</secondary>
4301 </indexterm>
4302 The specified sender is treated as if it were given as the argument to the
4303 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4304 preference to the address taken from the message. The caller of Exim must be a
4305 trusted user for the sender of a message to be set in this way.
4306 </para>
4307 </listitem></varlistentry>
4308 <varlistentry>
4309 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4310 <listitem>
4311 <para>
4312 <indexterm role="option">
4313 <primary><option>-bmalware</option></primary>
4314 </indexterm>
4315 <indexterm role="concept">
4316 <primary>testing</primary>
4317 <secondary>,</secondary>
4318 </indexterm>
4319 <indexterm role="concept">
4320 <primary>malware scan test</primary>
4321 </indexterm>
4322 This debugging option causes Exim to scan the given file,
4323 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4324 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4325 the expansion should have defaults which apply to this invocation.  ACLs are
4326 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4327 will never be populated and <option>-bmalware</option> will fail.
4328 </para>
4329 <para>
4330 Exim will have changed working directory before resolving the filename, so
4331 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4332 user when it tries to open the file, rather than as the invoking user.
4333 This option requires admin privileges.
4334 </para>
4335 <para>
4336 The <option>-bmalware</option> option will not be extended to be more generally useful,
4337 there are better tools for file-scanning.  This option exists to help
4338 administrators verify their Exim and AV scanner configuration.
4339 </para>
4340 </listitem></varlistentry>
4341 <varlistentry>
4342 <term><option>-bnq</option></term>
4343 <listitem>
4344 <para>
4345 <indexterm role="option">
4346 <primary><option>-bnq</option></primary>
4347 </indexterm>
4348 <indexterm role="concept">
4349 <primary>address qualification, suppressing</primary>
4350 </indexterm>
4351 By default, Exim automatically qualifies unqualified addresses (those
4352 without domains) that appear in messages that are submitted locally (that
4353 is, not over TCP/IP). This qualification applies both to addresses in
4354 envelopes, and addresses in header lines. Sender addresses are qualified using
4355 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4356 defaults to the value of <option>qualify_domain</option>).
4357 </para>
4358 <para>
4359 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4360 being used to re-submit messages that originally came from remote hosts after
4361 content scanning, you probably do not want to qualify unqualified addresses in
4362 header lines. (Such lines will be present only if you have not enabled a header
4363 syntax check in the appropriate ACL.)
4364 </para>
4365 <para>
4366 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4367 messages that originate on the local host. When this is used, unqualified
4368 addresses in the envelope provoke errors (causing message rejection) and
4369 unqualified addresses in header lines are left alone.
4370 </para>
4371 </listitem></varlistentry>
4372 <varlistentry>
4373 <term><option>-bP</option></term>
4374 <listitem>
4375 <para>
4376 <indexterm role="option">
4377 <primary><option>-bP</option></primary>
4378 </indexterm>
4379 <indexterm role="concept">
4380 <primary>configuration options</primary>
4381 <secondary>extracting</secondary>
4382 </indexterm>
4383 <indexterm role="concept">
4384 <primary>options</primary>
4385 <secondary>configuration &ndash; extracting</secondary>
4386 </indexterm>
4387 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4388 main configuration options to be written to the standard output. The values
4389 of one or more specific options can be requested by giving their names as
4390 arguments, for example:
4391 </para>
4392 <literallayout class="monospaced">
4393 exim -bP qualify_domain hold_domains
4394 </literallayout>
4395 <para>
4396 <indexterm role="concept">
4397 <primary>hiding configuration option values</primary>
4398 </indexterm>
4399 <indexterm role="concept">
4400 <primary>configuration options</primary>
4401 <secondary>hiding value of</secondary>
4402 </indexterm>
4403 <indexterm role="concept">
4404 <primary>options</primary>
4405 <secondary>hiding value of</secondary>
4406 </indexterm>
4407 However, any option setting that is preceded by the word <quote>hide</quote> in the
4408 configuration file is not shown in full, except to an admin user. For other
4409 users, the output is as in this example:
4410 </para>
4411 <literallayout class="monospaced">
4412 mysql_servers = &lt;value not displayable&gt;
4413 </literallayout>
4414 <para>
4415 If <option>configure_file</option> is given as an argument, the name of the run time
4416 configuration file is output.
4417 If a list of configuration files was supplied, the value that is output here
4418 is the name of the file that was actually used.
4419 </para>
4420 <para>
4421 <indexterm role="concept">
4422 <primary>options</primary>
4423 <secondary>hiding name of</secondary>
4424 </indexterm>
4425 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4426 name will not be output.
4427 </para>
4428 <para>
4429 <indexterm role="concept">
4430 <primary>daemon</primary>
4431 <secondary>process id (pid)</secondary>
4432 </indexterm>
4433 <indexterm role="concept">
4434 <primary>pid (process id)</primary>
4435 <secondary>of daemon</secondary>
4436 </indexterm>
4437 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4438 directories where log files and daemon pid files are written are output,
4439 respectively. If these values are unset, log files are written in a
4440 sub-directory of the spool directory called <option>log</option>, and the pid file is
4441 written directly into the spool directory.
4442 </para>
4443 <para>
4444 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4445 </para>
4446 <literallayout class="monospaced">
4447 exim -bP +local_domains
4448 </literallayout>
4449 <para>
4450 it searches for a matching named list of any type (domain, host, address, or
4451 local part) and outputs what it finds.
4452 </para>
4453 <para>
4454 <indexterm role="concept">
4455 <primary>options</primary>
4456 <secondary>router &ndash; extracting</secondary>
4457 </indexterm>
4458 <indexterm role="concept">
4459 <primary>options</primary>
4460 <secondary>transport &ndash; extracting</secondary>
4461 </indexterm>
4462 <indexterm role="concept">
4463 <primary>options</primary>
4464 <secondary>authenticator &ndash; extracting</secondary>
4465 </indexterm>
4466 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4467 followed by the name of an appropriate driver instance, the option settings for
4468 that driver are output. For example:
4469 </para>
4470 <literallayout class="monospaced">
4471 exim -bP transport local_delivery
4472 </literallayout>
4473 <para>
4474 The generic driver options are output first, followed by the driver&#x2019;s private
4475 options. A list of the names of drivers of a particular type can be obtained by
4476 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4477 <option>authenticator_list</option>, and a complete list of all drivers with their option
4478 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4479 <option>authenticators</option>.
4480 </para>
4481 <para>
4482 <indexterm role="concept">
4483 <primary>options</primary>
4484 <secondary>macro &ndash; extracting</secondary>
4485 </indexterm>
4486 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4487 are available, similarly to the drivers.  Because macros are sometimes used
4488 for storing passwords, this option is restricted.
4489 The output format is one item per line.
4490 </para>
4491 </listitem></varlistentry>
4492 <varlistentry>
4493 <term><option>-bp</option></term>
4494 <listitem>
4495 <para>
4496 <indexterm role="option">
4497 <primary><option>-bp</option></primary>
4498 </indexterm>
4499 <indexterm role="concept">
4500 <primary>queue</primary>
4501 <secondary>listing messages on</secondary>
4502 </indexterm>
4503 <indexterm role="concept">
4504 <primary>listing</primary>
4505 <secondary>messages on the queue</secondary>
4506 </indexterm>
4507 This option requests a listing of the contents of the mail queue on the
4508 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4509 just those messages are listed. By default, this option can be used only by an
4510 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4511 to allow any user to see the queue.
4512 </para>
4513 <para>
4514 Each message on the queue is displayed as in the following example:
4515 </para>
4516 <literallayout class="monospaced">
4517 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4518           red.king@looking-glass.fict.example
4519           &lt;other addresses&gt;
4520 </literallayout>
4521 <para>
4522 <indexterm role="concept">
4523 <primary>message</primary>
4524 <secondary>size in queue listing</secondary>
4525 </indexterm>
4526 <indexterm role="concept">
4527 <primary>size</primary>
4528 <secondary>of message</secondary>
4529 </indexterm>
4530 The first line contains the length of time the message has been on the queue
4531 (in this case 25 minutes), the size of the message (2.9K), the unique local
4532 identifier for the message, and the message sender, as contained in the
4533 envelope. For bounce messages, the sender address is empty, and appears as
4534 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4535 the default sender address, the user&#x2019;s login name is shown in parentheses
4536 before the sender address.
4537 </para>
4538 <para>
4539 <indexterm role="concept">
4540 <primary>frozen messages</primary>
4541 <secondary>in queue listing</secondary>
4542 </indexterm>
4543 If the message is frozen (attempts to deliver it are suspended) then the text
4544 <quote>*** frozen ***</quote> is displayed at the end of this line.
4545 </para>
4546 <para>
4547 The recipients of the message (taken from the envelope, not the headers) are
4548 displayed on subsequent lines. Those addresses to which the message has already
4549 been delivered are marked with the letter D. If an original address gets
4550 expanded into several addresses via an alias or forward file, the original is
4551 displayed with a D only when deliveries for all of its child addresses are
4552 complete.
4553 </para>
4554 </listitem></varlistentry>
4555 <varlistentry>
4556 <term><option>-bpa</option></term>
4557 <listitem>
4558 <para>
4559 <indexterm role="option">
4560 <primary><option>-bpa</option></primary>
4561 </indexterm>
4562 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4563 that were generated from the original top level address(es) in each message by
4564 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4565 of just <quote>D</quote>.
4566 </para>
4567 </listitem></varlistentry>
4568 <varlistentry>
4569 <term><option>-bpc</option></term>
4570 <listitem>
4571 <para>
4572 <indexterm role="option">
4573 <primary><option>-bpc</option></primary>
4574 </indexterm>
4575 <indexterm role="concept">
4576 <primary>queue</primary>
4577 <secondary>count of messages on</secondary>
4578 </indexterm>
4579 This option counts the number of messages on the queue, and writes the total
4580 to the standard output. It is restricted to admin users, unless
4581 <option>queue_list_requires_admin</option> is set false.
4582 </para>
4583 </listitem></varlistentry>
4584 <varlistentry>
4585 <term><option>-bpr</option></term>
4586 <listitem>
4587 <para>
4588 <indexterm role="option">
4589 <primary><option>-bpr</option></primary>
4590 </indexterm>
4591 This option operates like <option>-bp</option>, but the output is not sorted into
4592 chronological order of message arrival. This can speed it up when there are
4593 lots of messages on the queue, and is particularly useful if the output is
4594 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4595 </para>
4596 </listitem></varlistentry>
4597 <varlistentry>
4598 <term><option>-bpra</option></term>
4599 <listitem>
4600 <para>
4601 <indexterm role="option">
4602 <primary><option>-bpra</option></primary>
4603 </indexterm>
4604 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4605 </para>
4606 </listitem></varlistentry>
4607 <varlistentry>
4608 <term><option>-bpru</option></term>
4609 <listitem>
4610 <para>
4611 <indexterm role="option">
4612 <primary><option>-bpru</option></primary>
4613 </indexterm>
4614 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4615 </para>
4616 </listitem></varlistentry>
4617 <varlistentry>
4618 <term><option>-bpu</option></term>
4619 <listitem>
4620 <para>
4621 <indexterm role="option">
4622 <primary><option>-bpu</option></primary>
4623 </indexterm>
4624 This option operates like <option>-bp</option> but shows only undelivered top-level
4625 addresses for each message displayed. Addresses generated by aliasing or
4626 forwarding are not shown, unless the message was deferred after processing by a
4627 router with the <option>one_time</option> option set.
4628 </para>
4629 </listitem></varlistentry>
4630 <varlistentry>
4631 <term><option>-brt</option></term>
4632 <listitem>
4633 <para>
4634 <indexterm role="option">
4635 <primary><option>-brt</option></primary>
4636 </indexterm>
4637 <indexterm role="concept">
4638 <primary>testing</primary>
4639 <secondary>retry configuration</secondary>
4640 </indexterm>
4641 <indexterm role="concept">
4642 <primary>retry</primary>
4643 <secondary>configuration testing</secondary>
4644 </indexterm>
4645 This option is for testing retry rules, and it must be followed by up to three
4646 arguments. It causes Exim to look for a retry rule that matches the values
4647 and to write it to the standard output. For example:
4648 </para>
4649 <literallayout class="monospaced">
4650 exim -brt bach.comp.mus.example
4651 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4652 </literallayout>
4653 <para>
4654 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4655 argument, which is required, can be a complete address in the form
4656 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4657 contains a dot, it is interpreted as an optional second domain name; if no
4658 retry rule is found for the first argument, the second is tried. This ties in
4659 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4660 rule is found that matches the host, one that matches the mail domain is
4661 sought. Finally, an argument that is the name of a specific delivery error, as
4662 used in setting up retry rules, can be given. For example:
4663 </para>
4664 <literallayout class="monospaced">
4665 exim -brt haydn.comp.mus.example quota_3d
4666 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4667 </literallayout>
4668 </listitem></varlistentry>
4669 <varlistentry>
4670 <term><option>-brw</option></term>
4671 <listitem>
4672 <para>
4673 <indexterm role="option">
4674 <primary><option>-brw</option></primary>
4675 </indexterm>
4676 <indexterm role="concept">
4677 <primary>testing</primary>
4678 <secondary>rewriting</secondary>
4679 </indexterm>
4680 <indexterm role="concept">
4681 <primary>rewriting</primary>
4682 <secondary>testing</secondary>
4683 </indexterm>
4684 This option is for testing address rewriting rules, and it must be followed by
4685 a single argument, consisting of either a local part without a domain, or a
4686 complete address with a fully qualified domain. Exim outputs how this address
4687 would be rewritten for each possible place it might appear. See chapter
4688 <xref linkend="CHAPrewrite"/> for further details.
4689 </para>
4690 </listitem></varlistentry>
4691 <varlistentry>
4692 <term><option>-bS</option></term>
4693 <listitem>
4694 <para>
4695 <indexterm role="option">
4696 <primary><option>-bS</option></primary>
4697 </indexterm>
4698 <indexterm role="concept">
4699 <primary>SMTP</primary>
4700 <secondary>batched incoming</secondary>
4701 </indexterm>
4702 <indexterm role="concept">
4703 <primary>batched SMTP input</primary>
4704 </indexterm>
4705 This option is used for batched SMTP input, which is an alternative interface
4706 for non-interactive local message submission. A number of messages can be
4707 submitted in a single run. However, despite its name, this is not really SMTP
4708 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4709 input, but generates no responses. If the caller is trusted, or
4710 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4711 believed; otherwise the sender is always the caller of Exim.
4712 </para>
4713 <para>
4714 The message itself is read from the standard input, in SMTP format (leading
4715 dots doubled), terminated by a line containing just a single dot. An error is
4716 provoked if the terminating dot is missing. A further message may then follow.
4717 </para>
4718 <para>
4719 As for other local message submissions, the contents of incoming batch SMTP
4720 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4721 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4722 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4723 </para>
4724 <para>
4725 Some other SMTP commands are recognized in the input. HELO and EHLO act
4726 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4727 QUIT quits, ignoring the rest of the standard input.
4728 </para>
4729 <para>
4730 <indexterm role="concept">
4731 <primary>return code</primary>
4732 <secondary>for <option>-bS</option></secondary>
4733 </indexterm>
4734 If any error is encountered, reports are written to the standard output and
4735 error streams, and Exim gives up immediately. The return code is 0 if no error
4736 was detected; it is 1 if one or more messages were accepted before the error
4737 was detected; otherwise it is 2.
4738 </para>
4739 <para>
4740 More details of input using batched SMTP are given in section
4741 <xref linkend="SECTincomingbatchedSMTP"/>.
4742 </para>
4743 </listitem></varlistentry>
4744 <varlistentry>
4745 <term><option>-bs</option></term>
4746 <listitem>
4747 <para>
4748 <indexterm role="option">
4749 <primary><option>-bs</option></primary>
4750 </indexterm>
4751 <indexterm role="concept">
4752 <primary>SMTP</primary>
4753 <secondary>local input</secondary>
4754 </indexterm>
4755 <indexterm role="concept">
4756 <primary>local SMTP input</primary>
4757 </indexterm>
4758 This option causes Exim to accept one or more messages by reading SMTP commands
4759 on the standard input, and producing SMTP replies on the standard output. SMTP
4760 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4761 Some user agents use this interface as a way of passing locally-generated
4762 messages to the MTA.
4763 </para>
4764 <para>
4765 In
4766 <indexterm role="concept">
4767 <primary>sender</primary>
4768 <secondary>source of</secondary>
4769 </indexterm>
4770 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4771 set, the senders of messages are taken from the SMTP MAIL commands.
4772 Otherwise the content of these commands is ignored and the sender is set up as
4773 the calling user. Unqualified addresses are automatically qualified using
4774 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4775 <option>-bnq</option> option is used.
4776 </para>
4777 <para>
4778 <indexterm role="concept">
4779 <primary>inetd</primary>
4780 </indexterm>
4781 The
4782 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4783 using a listening daemon. Exim can distinguish the two cases by checking
4784 whether the standard input is a TCP/IP socket. When Exim is called from
4785 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4786 above concerning senders and qualification do not apply. In this situation,
4787 Exim behaves in exactly the same way as it does when receiving a message via
4788 the listening daemon.
4789 </para>
4790 </listitem></varlistentry>
4791 <varlistentry>
4792 <term><option>-bt</option></term>
4793 <listitem>
4794 <para>
4795 <indexterm role="option">
4796 <primary><option>-bt</option></primary>
4797 </indexterm>
4798 <indexterm role="concept">
4799 <primary>testing</primary>
4800 <secondary>addresses</secondary>
4801 </indexterm>
4802 <indexterm role="concept">
4803 <primary>address</primary>
4804 <secondary>testing</secondary>
4805 </indexterm>
4806 This option runs Exim in address testing mode, in which each argument is taken
4807 as a recipient address to be tested for deliverability. The results are
4808 written to the standard output. If a test fails, and the caller is not an admin
4809 user, no details of the failure are output, because these might contain
4810 sensitive information such as usernames and passwords for database lookups.
4811 </para>
4812 <para>
4813 If no arguments are given, Exim runs in an interactive manner, prompting with a
4814 right angle bracket for addresses to be tested.
4815 </para>
4816 <para>
4817 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4818 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4819 security issues.
4820 </para>
4821 <para>
4822 Each address is handled as if it were the recipient address of a message
4823 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4824 written to the standard output. However, any router that has
4825 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4826 genuine routing tests if your first router passes everything to a scanner
4827 program.
4828 </para>
4829 <para>
4830 <indexterm role="concept">
4831 <primary>return code</primary>
4832 <secondary>for <option>-bt</option></secondary>
4833 </indexterm>
4834 The return code is 2 if any address failed outright; it is 1 if no address
4835 failed outright but at least one could not be resolved for some reason. Return
4836 code 0 is given only when all addresses succeed.
4837 </para>
4838 <para>
4839 <indexterm role="concept">
4840 <primary>duplicate addresses</primary>
4841 </indexterm>
4842 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4843 addresses after routing is complete, so that only one delivery takes place.
4844 This does not happen when testing with <option>-bt</option>; the full results of routing are
4845 always shown.
4846 </para>
4847 <para>
4848 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4849 routers in the configuration makes any tests on the sender address of a
4850 message,
4851 <indexterm role="option">
4852 <primary><option>-f</option></primary>
4853 <secondary>for address testing</secondary>
4854 </indexterm>
4855 you can use the <option>-f</option> option to set an appropriate sender when running
4856 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4857 default qualifying domain. However, if you have set up (for example) routers
4858 whose behaviour depends on the contents of an incoming message, you cannot test
4859 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4860 doing such tests.
4861 </para>
4862 </listitem></varlistentry>
4863 <varlistentry>
4864 <term><option>-bV</option></term>
4865 <listitem>
4866 <para>
4867 <indexterm role="option">
4868 <primary><option>-bV</option></primary>
4869 </indexterm>
4870 <indexterm role="concept">
4871 <primary>version number of Exim</primary>
4872 </indexterm>
4873 This option causes Exim to write the current version number, compilation
4874 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4875 It also lists the DBM library that is being used, the optional modules (such as
4876 specific lookup types), the drivers that are included in the binary, and the
4877 name of the run time configuration file that is in use.
4878 </para>
4879 <para>
4880 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4881 configuration file. However, this is a static check only. It cannot check
4882 values that are to be expanded. For example, although a misspelt ACL verb is
4883 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4884 alone to discover (for example) all the typos in the configuration; some
4885 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4886 dynamic testing facilities.
4887 </para>
4888 </listitem></varlistentry>
4889 <varlistentry>
4890 <term><option>-bv</option></term>
4891 <listitem>
4892 <para>
4893 <indexterm role="option">
4894 <primary><option>-bv</option></primary>
4895 </indexterm>
4896 <indexterm role="concept">
4897 <primary>verifying address</primary>
4898 <secondary>using <option>-bv</option></secondary>
4899 </indexterm>
4900 <indexterm role="concept">
4901 <primary>address</primary>
4902 <secondary>verification</secondary>
4903 </indexterm>
4904 This option runs Exim in address verification mode, in which each argument is
4905 taken as a recipient address to be verified by the routers. (This does
4906 not involve any verification callouts). During normal operation, verification
4907 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4908 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4909 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4910 </para>
4911 <para>
4912 If verification fails, and the caller is not an admin user, no details of the
4913 failure are output, because these might contain sensitive information such as
4914 usernames and passwords for database lookups.
4915 </para>
4916 <para>
4917 If no arguments are given, Exim runs in an interactive manner, prompting with a
4918 right angle bracket for addresses to be verified.
4919 </para>
4920 <para>
4921 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4922 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4923 security issues.
4924 </para>
4925 <para>
4926 Verification differs from address testing (the <option>-bt</option> option) in that routers
4927 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4928 router that has <option>fail_verify</option> set, verification fails. The address is
4929 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4930 address, <option>-bvs</option> should be used.
4931 </para>
4932 <para>
4933 If the <option>-v</option> option is not set, the output consists of a single line for each
4934 address, stating whether it was verified or not, and giving a reason in the
4935 latter case. Without <option>-v</option>, generating more than one address by redirection
4936 causes verification to end successfully, without considering the generated
4937 addresses. However, if just one address is generated, processing continues,
4938 and the generated address must verify successfully for the overall verification
4939 to succeed.
4940 </para>
4941 <para>
4942 When <option>-v</option> is set, more details are given of how the address has been handled,
4943 and in the case of address redirection, all the generated addresses are also
4944 considered. Verification may succeed for some and fail for others.
4945 </para>
4946 <para>
4947 The
4948 <indexterm role="concept">
4949 <primary>return code</primary>
4950 <secondary>for <option>-bv</option></secondary>
4951 </indexterm>
4952 return code is 2 if any address failed outright; it is 1 if no address
4953 failed outright but at least one could not be resolved for some reason. Return
4954 code 0 is given only when all addresses succeed.
4955 </para>
4956 <para>
4957 If any of the routers in the configuration makes any tests on the sender
4958 address of a message, you should use the <option>-f</option> option to set an appropriate
4959 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4960 calling user at the default qualifying domain.
4961 </para>
4962 </listitem></varlistentry>
4963 <varlistentry>
4964 <term><option>-bvs</option></term>
4965 <listitem>
4966 <para>
4967 <indexterm role="option">
4968 <primary><option>-bvs</option></primary>
4969 </indexterm>
4970 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4971 than a recipient address. This affects any rewriting and qualification that
4972 might happen.
4973 </para>
4974 </listitem></varlistentry>
4975 <varlistentry>
4976 <term><option>-bw</option></term>
4977 <listitem>
4978 <para>
4979 <indexterm role="option">
4980 <primary><option>-bw</option></primary>
4981 </indexterm>
4982 <indexterm role="concept">
4983 <primary>daemon</primary>
4984 </indexterm>
4985 <indexterm role="concept">
4986 <primary>inetd</primary>
4987 </indexterm>
4988 <indexterm role="concept">
4989 <primary>inetd</primary>
4990 <secondary>wait mode</secondary>
4991 </indexterm>
4992 This option runs Exim as a daemon, awaiting incoming SMTP connections,
4993 similarly to the <option>-bd</option> option.  All port specifications on the command-line
4994 and in the configuration file are ignored.  Queue-running may not be specified.
4995 </para>
4996 <para>
4997 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
4998 listening for connections.  This permits the system to start up and have
4999 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5000 each port only when the first connection is received.
5001 </para>
5002 <para>
5003 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5004 which the daemon will exit, which should cause inetd to listen once more.
5005 </para>
5006 </listitem></varlistentry>
5007 <varlistentry>
5008 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5009 <listitem>
5010 <para>
5011 <indexterm role="option">
5012 <primary><option>-C</option></primary>
5013 </indexterm>
5014 <indexterm role="concept">
5015 <primary>configuration file</primary>
5016 <secondary>alternate</secondary>
5017 </indexterm>
5018 <indexterm role="concept">
5019 <primary>CONFIGURE_FILE</primary>
5020 </indexterm>
5021 <indexterm role="concept">
5022 <primary>alternate configuration file</primary>
5023 </indexterm>
5024 This option causes Exim to find the run time configuration file from the given
5025 list instead of from the list specified by the CONFIGURE_FILE
5026 compile-time setting. Usually, the list will consist of just a single file
5027 name, but it can be a colon-separated list of names. In this case, the first
5028 file that exists is used. Failure to open an existing file stops Exim from
5029 proceeding any further along the list, and an error is generated.
5030 </para>
5031 <para>
5032 When this option is used by a caller other than root, and the list is different
5033 from the compiled-in list, Exim gives up its root privilege immediately, and
5034 runs with the real and effective uid and gid set to those of the caller.
5035 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5036 file contains a list of full pathnames, one per line, for configuration files
5037 which are trusted. Root privilege is retained for any configuration file so
5038 listed, as long as the caller is the Exim user (or the user specified in the
5039 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5040 not writeable by inappropriate users or groups.
5041 </para>
5042 <para>
5043 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5044 configuration using <option>-C</option> right through message reception and delivery,
5045 even if the caller is root. The reception works, but by that time, Exim is
5046 running as the Exim user, so when it re-executes to regain privilege for the
5047 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5048 test reception and delivery using two separate commands (one to put a message
5049 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5050 </para>
5051 <para>
5052 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5053 prefix string with which any file named in a <option>-C</option> command line option
5054 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5055 However, if the value of the <option>-C</option> option is identical to the value of
5056 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5057 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5058 unset, any file name can be used with <option>-C</option>.
5059 </para>
5060 <para>
5061 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5062 to a directory to which only root has access. This prevents someone who has
5063 broken into the Exim account from running a privileged Exim with an arbitrary
5064 configuration file.
5065 </para>
5066 <para>
5067 The <option>-C</option> facility is useful for ensuring that configuration files are
5068 syntactically correct, but cannot be used for test deliveries, unless the
5069 caller is privileged, or unless it is an exotic configuration that does not
5070 require privilege. No check is made on the owner or group of the files
5071 specified by this option.
5072 </para>
5073 </listitem></varlistentry>
5074 <varlistentry>
5075 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5076 <listitem>
5077 <para>
5078 <indexterm role="option">
5079 <primary><option>-D</option></primary>
5080 </indexterm>
5081 <indexterm role="concept">
5082 <primary>macro</primary>
5083 <secondary>setting on command line</secondary>
5084 </indexterm>
5085 This option can be used to override macro definitions in the configuration file
5086 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5087 unprivileged caller, it causes Exim to give up its root privilege.
5088 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5089 completely disabled, and its use causes an immediate error exit.
5090 </para>
5091 <para>
5092 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5093 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5094 supplies macros from this list, and the values are acceptable, then Exim will
5095 not give up root privilege if the caller is root, the Exim run-time user, or
5096 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5097 to be removed in the future.  Acceptable values for the macros satisfy the
5098 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5099 </para>
5100 <para>
5101 The entire option (including equals sign if present) must all be within one
5102 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5103 string, in which case the equals sign is optional. These two commands are
5104 synonymous:
5105 </para>
5106 <literallayout class="monospaced">
5107 exim -DABC  ...
5108 exim -DABC= ...
5109 </literallayout>
5110 <para>
5111 To include spaces in a macro definition item, quotes must be used. If you use
5112 quotes, spaces are permitted around the macro name and the equals sign. For
5113 example:
5114 </para>
5115 <literallayout class="monospaced">
5116 exim '-D ABC = something' ...
5117 </literallayout>
5118 <para>
5119 <option>-D</option> may be repeated up to 10 times on a command line.
5120 </para>
5121 </listitem></varlistentry>
5122 <varlistentry>
5123 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5124 <listitem>
5125 <para>
5126 <indexterm role="option">
5127 <primary><option>-d</option></primary>
5128 </indexterm>
5129 <indexterm role="concept">
5130 <primary>debugging</primary>
5131 <secondary>list of selectors</secondary>
5132 </indexterm>
5133 <indexterm role="concept">
5134 <primary>debugging</primary>
5135 <secondary><option>-d</option> option</secondary>
5136 </indexterm>
5137 This option causes debugging information to be written to the standard
5138 error stream. It is restricted to admin users because debugging output may show
5139 database queries that contain password information. Also, the details of users&#x2019;
5140 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5141 writes an error message to the standard error stream and exits with a non-zero
5142 return code.
5143 </para>
5144 <para>
5145 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5146 standard debugging data is output. This can be reduced, or increased to include
5147 some more rarely needed information, by directly following <option>-d</option> with a string
5148 made up of names preceded by plus or minus characters. These add or remove sets
5149 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5150 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5151 no spaces are allowed in the debug setting. The available debugging categories
5152 are:
5153 </para>
5154 <literallayout>
5155 <literal>acl            </literal> ACL interpretation
5156 <literal>auth           </literal> authenticators
5157 <literal>deliver        </literal> general delivery logic
5158 <literal>dns            </literal> DNS lookups (see also resolver)
5159 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5160 <literal>exec           </literal> arguments for <function>execv()</function> calls
5161 <literal>expand         </literal> detailed debugging for string expansions
5162 <literal>filter         </literal> filter handling
5163 <literal>hints_lookup   </literal> hints data lookups
5164 <literal>host_lookup    </literal> all types of name-to-IP address handling
5165 <literal>ident          </literal> ident lookup
5166 <literal>interface      </literal> lists of local interfaces
5167 <literal>lists          </literal> matching things in lists
5168 <literal>load           </literal> system load checks
5169 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5170 <literal>lookup         </literal> general lookup code and all lookups
5171 <literal>memory         </literal> memory handling
5172 <literal>pid            </literal> add pid to debug output lines
5173 <literal>process_info   </literal> setting info for the process log
5174 <literal>queue_run      </literal> queue runs
5175 <literal>receive        </literal> general message reception logic
5176 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5177 <literal>retry          </literal> retry handling
5178 <literal>rewrite        </literal> address rewriting
5179 <literal>route          </literal> address routing
5180 <literal>timestamp      </literal> add timestamp to debug output lines
5181 <literal>tls            </literal> TLS logic
5182 <literal>transport      </literal> transports
5183 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5184 <literal>verify         </literal> address verification logic
5185 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5186 </literallayout>
5187 <para>
5188 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5189 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5190 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5191 is included, an awful lot of output that is very rarely of interest is
5192 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5193 turn everything off.
5194 </para>
5195 <para>
5196 <indexterm role="concept">
5197 <primary>resolver, debugging output</primary>
5198 </indexterm>
5199 <indexterm role="concept">
5200 <primary>DNS resolver, debugging output</primary>
5201 </indexterm>
5202 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5203 with DEBUG enabled. This is not the case in some operating systems. Also,
5204 unfortunately, debugging output from the DNS resolver is written to stdout
5205 rather than stderr.
5206 </para>
5207 <para>
5208 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5209 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5210 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5211 daemon, which then passes it on to any re-executed Exims. Exim also
5212 automatically adds the pid to debug lines when several remote deliveries are
5213 run in parallel.
5214 </para>
5215 <para>
5216 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5217 of all debug output lines. This can be useful when trying to track down delays
5218 in processing.
5219 </para>
5220 <para>
5221 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5222 any debugging is selected, or if <option>-v</option> is used.
5223 </para>
5224 </listitem></varlistentry>
5225 <varlistentry>
5226 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5227 <listitem>
5228 <para>
5229 <indexterm role="option">
5230 <primary><option>-dd</option></primary>
5231 </indexterm>
5232 This option behaves exactly like <option>-d</option> except when used on a command that
5233 starts a daemon process. In that case, debugging is turned off for the
5234 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5235 behaviour of the daemon without creating as much output as full debugging does.
5236 </para>
5237 </listitem></varlistentry>
5238 <varlistentry>
5239 <term><option>-dropcr</option></term>
5240 <listitem>
5241 <para>
5242 <indexterm role="option">
5243 <primary><option>-dropcr</option></primary>
5244 </indexterm>
5245 This is an obsolete option that is now a no-op. It used to affect the way Exim
5246 handled CR and LF characters in incoming messages. What happens now is
5247 described in section <xref linkend="SECTlineendings"/>.
5248 </para>
5249 </listitem></varlistentry>
5250 <varlistentry>
5251 <term><option>-E</option></term>
5252 <listitem>
5253 <para>
5254 <indexterm role="option">
5255 <primary><option>-E</option></primary>
5256 </indexterm>
5257 <indexterm role="concept">
5258 <primary>bounce message</primary>
5259 <secondary>generating</secondary>
5260 </indexterm>
5261 This option specifies that an incoming message is a locally-generated delivery
5262 failure report. It is used internally by Exim when handling delivery failures
5263 and is not intended for external use. Its only effect is to stop Exim
5264 generating certain messages to the postmaster, as otherwise message cascades
5265 could occur in some situations. As part of the same option, a message id may
5266 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5267 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5268 </para>
5269 </listitem></varlistentry>
5270 <varlistentry>
5271 <term><option>-e</option><emphasis>x</emphasis></term>
5272 <listitem>
5273 <para>
5274 <indexterm role="option">
5275 <primary><option>-e</option><emphasis>x</emphasis></primary>
5276 </indexterm>
5277 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5278 called by various programs without the leading <option>o</option> in the option. For
5279 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5280 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5281 </para>
5282 </listitem></varlistentry>
5283 <varlistentry>
5284 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5285 <listitem>
5286 <para>
5287 <indexterm role="option">
5288 <primary><option>-F</option></primary>
5289 </indexterm>
5290 <indexterm role="concept">
5291 <primary>sender</primary>
5292 <secondary>name</secondary>
5293 </indexterm>
5294 <indexterm role="concept">
5295 <primary>name</primary>
5296 <secondary>of sender</secondary>
5297 </indexterm>
5298 This option sets the sender&#x2019;s full name for use when a locally-generated
5299 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5300 entry from the password data is used. As users are generally permitted to alter
5301 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5302 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5303 </para>
5304 </listitem></varlistentry>
5305 <varlistentry>
5306 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5307 <listitem>
5308 <para>
5309 <indexterm role="option">
5310 <primary><option>-f</option></primary>
5311 </indexterm>
5312 <indexterm role="concept">
5313 <primary>sender</primary>
5314 <secondary>address</secondary>
5315 </indexterm>
5316 <indexterm role="concept">
5317 <primary>address</primary>
5318 <secondary>sender</secondary>
5319 </indexterm>
5320 <indexterm role="concept">
5321 <primary>trusted users</primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>envelope sender</primary>
5325 </indexterm>
5326 <indexterm role="concept">
5327 <primary>user</primary>
5328 <secondary>trusted</secondary>
5329 </indexterm>
5330 This option sets the address of the envelope sender of a locally-generated
5331 message (also known as the return path). The option can normally be used only
5332 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5333 users to use it.
5334 </para>
5335 <para>
5336 Processes running as root or the Exim user are always trusted. Other
5337 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5338 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5339 of a local message is set to the caller&#x2019;s login name at the default qualify
5340 domain.
5341 </para>
5342 <para>
5343 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5344 can be specified by any user, trusted or not, to create a message that can
5345 never provoke a bounce. An empty sender can be specified either as an empty
5346 string, or as a pair of angle brackets with nothing between them, as in these
5347 examples of shell commands:
5348 </para>
5349 <literallayout class="monospaced">
5350 exim -f '&lt;&gt;' user@domain
5351 exim -f "" user@domain
5352 </literallayout>
5353 <para>
5354 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5355 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5356 <option>-bv</option> options.
5357 </para>
5358 <para>
5359 Allowing untrusted users to change the sender address does not of itself make
5360 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5361 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5362 though this can be overridden by setting <option>no_local_from_check</option>.
5363 </para>
5364 <para>
5365 White
5366 <indexterm role="concept">
5367 <primary><quote>From</quote> line</primary>
5368 </indexterm>
5369 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5370 given as two arguments or one combined argument). The sender of a
5371 locally-generated message can also be set (when permitted) by an initial
5372 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5373 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5374 </para>
5375 </listitem></varlistentry>
5376 <varlistentry>
5377 <term><option>-G</option></term>
5378 <listitem>
5379 <para>
5380 <indexterm role="option">
5381 <primary><option>-G</option></primary>
5382 </indexterm>
5383 <indexterm role="concept">
5384 <primary>submission fixups, suppressing (command-line)</primary>
5385 </indexterm>
5386 This option is equivalent to an ACL applying:
5387 </para>
5388 <literallayout class="monospaced">
5389 control = suppress_local_fixups
5390 </literallayout>
5391 <para>
5392 for every message received.  Note that Sendmail will complain about such
5393 bad formatting, where Exim silently just does not fix it up.  This may change
5394 in future.
5395 </para>
5396 <para>
5397 As this affects audit information, the caller must be a trusted user to use
5398 this option.
5399 </para>
5400 </listitem></varlistentry>
5401 <varlistentry>
5402 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5403 <listitem>
5404 <para>
5405 <indexterm role="option">
5406 <primary><option>-h</option></primary>
5407 </indexterm>
5408 <indexterm role="concept">
5409 <primary>Sendmail compatibility</primary>
5410 <secondary><option>-h</option> option ignored</secondary>
5411 </indexterm>
5412 This option is accepted for compatibility with Sendmail, but has no effect. (In
5413 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5414 headers.)
5415 </para>
5416 </listitem></varlistentry>
5417 <varlistentry>
5418 <term><option>-i</option></term>
5419 <listitem>
5420 <para>
5421 <indexterm role="option">
5422 <primary><option>-i</option></primary>
5423 </indexterm>
5424 <indexterm role="concept">
5425 <primary>Solaris</primary>
5426 <secondary><emphasis>mail</emphasis> command</secondary>
5427 </indexterm>
5428 <indexterm role="concept">
5429 <primary>dot</primary>
5430 <secondary>in incoming non-SMTP message</secondary>
5431 </indexterm>
5432 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5433 line by itself should not terminate an incoming, non-SMTP message. I can find
5434 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5435 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5436 </para>
5437 </listitem></varlistentry>
5438 <varlistentry>
5439 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5440 <listitem>
5441 <para>
5442 <indexterm role="option">
5443 <primary><option>-L</option></primary>
5444 </indexterm>
5445 <indexterm role="concept">
5446 <primary>syslog</primary>
5447 <secondary>process name; set with flag</secondary>
5448 </indexterm>
5449 This option is equivalent to setting <option>syslog_processname</option> in the config
5450 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5451 Its use is restricted to administrators.  The configuration file has to be
5452 read and parsed, to determine access rights, before this is set and takes
5453 effect, so early configuration file errors will not honour this flag.
5454 </para>
5455 <para>
5456 The tag should not be longer than 32 characters.
5457 </para>
5458 </listitem></varlistentry>
5459 <varlistentry>
5460 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5461 <listitem>
5462 <para>
5463 <indexterm role="option">
5464 <primary><option>-M</option></primary>
5465 </indexterm>
5466 <indexterm role="concept">
5467 <primary>forcing delivery</primary>
5468 </indexterm>
5469 <indexterm role="concept">
5470 <primary>delivery</primary>
5471 <secondary>forcing attempt</secondary>
5472 </indexterm>
5473 <indexterm role="concept">
5474 <primary>frozen messages</primary>
5475 <secondary>forcing delivery</secondary>
5476 </indexterm>
5477 This option requests Exim to run a delivery attempt on each message in turn. If
5478 any of the messages are frozen, they are automatically thawed before the
5479 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5480 and <option>hold_domains</option> are ignored.
5481 </para>
5482 <para>
5483 Retry
5484 <indexterm role="concept">
5485 <primary>hints database</primary>
5486 <secondary>overriding retry hints</secondary>
5487 </indexterm>
5488 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5489 the normal retry time has not yet been reached. This option requires the caller
5490 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5491 which can be set false to relax this restriction (and also the same requirement
5492 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5493 </para>
5494 <para>
5495 The deliveries happen synchronously, that is, the original Exim process does
5496 not terminate until all the delivery attempts have finished. No output is
5497 produced unless there is a serious error. If you want to see what is happening,
5498 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5499 </para>
5500 </listitem></varlistentry>
5501 <varlistentry>
5502 <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>
5503 <listitem>
5504 <para>
5505 <indexterm role="option">
5506 <primary><option>-Mar</option></primary>
5507 </indexterm>
5508 <indexterm role="concept">
5509 <primary>message</primary>
5510 <secondary>adding recipients</secondary>
5511 </indexterm>
5512 <indexterm role="concept">
5513 <primary>recipient</primary>
5514 <secondary>adding</secondary>
5515 </indexterm>
5516 This option requests Exim to add the addresses to the list of recipients of the
5517 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5518 id, and the remaining ones must be email addresses. However, if the message is
5519 active (in the middle of a delivery attempt), it is not altered. This option
5520 can be used only by an admin user.
5521 </para>
5522 </listitem></varlistentry>
5523 <varlistentry>
5524 <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>
5525 <listitem>
5526 <para>
5527 <indexterm role="option">
5528 <primary><option>-MC</option></primary>
5529 </indexterm>
5530 <indexterm role="concept">
5531 <primary>SMTP</primary>
5532 <secondary>passed connection</secondary>
5533 </indexterm>
5534 <indexterm role="concept">
5535 <primary>SMTP</primary>
5536 <secondary>multiple deliveries</secondary>
5537 </indexterm>
5538 <indexterm role="concept">
5539 <primary>multiple SMTP deliveries</primary>
5540 </indexterm>
5541 This option is not intended for use by external callers. It is used internally
5542 by Exim to invoke another instance of itself to deliver a waiting message using
5543 an existing SMTP connection, which is passed as the standard input. Details are
5544 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5545 must be root or the Exim user in order to use it.
5546 </para>
5547 </listitem></varlistentry>
5548 <varlistentry>
5549 <term><option>-MCA</option></term>
5550 <listitem>
5551 <para>
5552 <indexterm role="option">
5553 <primary><option>-MCA</option></primary>
5554 </indexterm>
5555 This option is not intended for use by external callers. It is used internally
5556 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5557 connection to the remote host has been authenticated.
5558 </para>
5559 </listitem></varlistentry>
5560 <varlistentry>
5561 <term><option>-MCP</option></term>
5562 <listitem>
5563 <para>
5564 <indexterm role="option">
5565 <primary><option>-MCP</option></primary>
5566 </indexterm>
5567 This option is not intended for use by external callers. It is used internally
5568 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5569 which Exim is connected supports pipelining.
5570 </para>
5571 </listitem></varlistentry>
5572 <varlistentry>
5573 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5574 <listitem>
5575 <para>
5576 <indexterm role="option">
5577 <primary><option>-MCQ</option></primary>
5578 </indexterm>
5579 This option is not intended for use by external callers. It is used internally
5580 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5581 started by a queue runner. It passes on the process id of the queue runner,
5582 together with the file descriptor number of an open pipe. Closure of the pipe
5583 signals the final completion of the sequence of processes that are passing
5584 messages through the same SMTP connection.
5585 </para>
5586 </listitem></varlistentry>
5587 <varlistentry>
5588 <term><option>-MCS</option></term>
5589 <listitem>
5590 <para>
5591 <indexterm role="option">
5592 <primary><option>-MCS</option></primary>
5593 </indexterm>
5594 This option is not intended for use by external callers. It is used internally
5595 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5596 SMTP SIZE option should be used on messages delivered down the existing
5597 connection.
5598 </para>
5599 </listitem></varlistentry>
5600 <varlistentry>
5601 <term><option>-MCT</option></term>
5602 <listitem>
5603 <para>
5604 <indexterm role="option">
5605 <primary><option>-MCT</option></primary>
5606 </indexterm>
5607 This option is not intended for use by external callers. It is used internally
5608 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5609 host to which Exim is connected supports TLS encryption.
5610 </para>
5611 </listitem></varlistentry>
5612 <varlistentry>
5613 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5614 <listitem>
5615 <para>
5616 <indexterm role="option">
5617 <primary><option>-Mc</option></primary>
5618 </indexterm>
5619 <indexterm role="concept">
5620 <primary>hints database</primary>
5621 <secondary>not overridden by <option>-Mc</option></secondary>
5622 </indexterm>
5623 <indexterm role="concept">
5624 <primary>delivery</primary>
5625 <secondary>manually started &ndash; not forced</secondary>
5626 </indexterm>
5627 This option requests Exim to run a delivery attempt on each message in turn,
5628 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5629 that are found. This option is not very useful to external callers. It is
5630 provided mainly for internal use by Exim when it needs to re-invoke itself in
5631 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5632 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5633 respects retry times and other options such as <option>hold_domains</option> that are
5634 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5635 If you want to run a specific delivery as if in a queue run, you should use
5636 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5637 and other deliveries is made in one or two places.
5638 </para>
5639 </listitem></varlistentry>
5640 <varlistentry>
5641 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5642 <listitem>
5643 <para>
5644 <indexterm role="option">
5645 <primary><option>-Mes</option></primary>
5646 </indexterm>
5647 <indexterm role="concept">
5648 <primary>message</primary>
5649 <secondary>changing sender</secondary>
5650 </indexterm>
5651 <indexterm role="concept">
5652 <primary>sender</primary>
5653 <secondary>changing</secondary>
5654 </indexterm>
5655 This option requests Exim to change the sender address in the message to the
5656 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5657 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5658 be a message id, and the second one an email address. However, if the message
5659 is active (in the middle of a delivery attempt), its status is not altered.
5660 This option can be used only by an admin user.
5661 </para>
5662 </listitem></varlistentry>
5663 <varlistentry>
5664 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5665 <listitem>
5666 <para>
5667 <indexterm role="option">
5668 <primary><option>-Mf</option></primary>
5669 </indexterm>
5670 <indexterm role="concept">
5671 <primary>freezing messages</primary>
5672 </indexterm>
5673 <indexterm role="concept">
5674 <primary>message</primary>
5675 <secondary>manually freezing</secondary>
5676 </indexterm>
5677 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5678 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5679 either manually or as a result of the <option>auto_thaw</option> configuration option.
5680 However, if any of the messages are active (in the middle of a delivery
5681 attempt), their status is not altered. This option can be used only by an admin
5682 user.
5683 </para>
5684 </listitem></varlistentry>
5685 <varlistentry>
5686 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5687 <listitem>
5688 <para>
5689 <indexterm role="option">
5690 <primary><option>-Mg</option></primary>
5691 </indexterm>
5692 <indexterm role="concept">
5693 <primary>giving up on messages</primary>
5694 </indexterm>
5695 <indexterm role="concept">
5696 <primary>message</primary>
5697 <secondary>abandoning delivery attempts</secondary>
5698 </indexterm>
5699 <indexterm role="concept">
5700 <primary>delivery</primary>
5701 <secondary>abandoning further attempts</secondary>
5702 </indexterm>
5703 This option requests Exim to give up trying to deliver the listed messages,
5704 including any that are frozen. However, if any of the messages are active,
5705 their status is not altered. For non-bounce messages, a delivery error message
5706 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5707 Bounce messages are just discarded. This option can be used only by an admin
5708 user.
5709 </para>
5710 </listitem></varlistentry>
5711 <varlistentry>
5712 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5713 <listitem>
5714 <para>
5715 <indexterm role="option">
5716 <primary><option>-Mmad</option></primary>
5717 </indexterm>
5718 <indexterm role="concept">
5719 <primary>delivery</primary>
5720 <secondary>cancelling all</secondary>
5721 </indexterm>
5722 This option requests Exim to mark all the recipient addresses in the messages
5723 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5724 message is active (in the middle of a delivery attempt), its status is not
5725 altered. This option can be used only by an admin user.
5726 </para>
5727 </listitem></varlistentry>
5728 <varlistentry>
5729 <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>
5730 <listitem>
5731 <para>
5732 <indexterm role="option">
5733 <primary><option>-Mmd</option></primary>
5734 </indexterm>
5735 <indexterm role="concept">
5736 <primary>delivery</primary>
5737 <secondary>cancelling by address</secondary>
5738 </indexterm>
5739 <indexterm role="concept">
5740 <primary>recipient</primary>
5741 <secondary>removing</secondary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>removing recipients</primary>
5745 </indexterm>
5746 This option requests Exim to mark the given addresses as already delivered
5747 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5748 the remaining ones must be email addresses. These are matched to recipient
5749 addresses in the message in a case-sensitive manner. If the message is active
5750 (in the middle of a delivery attempt), its status is not altered. This option
5751 can be used only by an admin user.
5752 </para>
5753 </listitem></varlistentry>
5754 <varlistentry>
5755 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5756 <listitem>
5757 <para>
5758 <indexterm role="option">
5759 <primary><option>-Mrm</option></primary>
5760 </indexterm>
5761 <indexterm role="concept">
5762 <primary>removing messages</primary>
5763 </indexterm>
5764 <indexterm role="concept">
5765 <primary>abandoning mail</primary>
5766 </indexterm>
5767 <indexterm role="concept">
5768 <primary>message</primary>
5769 <secondary>manually discarding</secondary>
5770 </indexterm>
5771 This option requests Exim to remove the given messages from the queue. No
5772 bounce messages are sent; each message is simply forgotten. However, if any of
5773 the messages are active, their status is not altered. This option can be used
5774 only by an admin user or by the user who originally caused the message to be
5775 placed on the queue.
5776 </para>
5777 </listitem></varlistentry>
5778 <varlistentry>
5779 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5780 <listitem>
5781 <para>
5782 <indexterm role="option">
5783 <primary><option>-Mset</option></primary>
5784 </indexterm>
5785 <indexterm role="concept">
5786 <primary>testing</primary>
5787 <secondary>string expansion</secondary>
5788 </indexterm>
5789 <indexterm role="concept">
5790 <primary>expansion</primary>
5791 <secondary>testing</secondary>
5792 </indexterm>
5793 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5794 string expansions). Exim loads the given message from its spool before doing
5795 the test expansions, thus setting message-specific variables such as
5796 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5797 available. This feature is provided to make it easier to test expansions that
5798 make use of these variables. However, this option can be used only by an admin
5799 user. See also <option>-bem</option>.
5800 </para>
5801 </listitem></varlistentry>
5802 <varlistentry>
5803 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5804 <listitem>
5805 <para>
5806 <indexterm role="option">
5807 <primary><option>-Mt</option></primary>
5808 </indexterm>
5809 <indexterm role="concept">
5810 <primary>thawing messages</primary>
5811 </indexterm>
5812 <indexterm role="concept">
5813 <primary>unfreezing messages</primary>
5814 </indexterm>
5815 <indexterm role="concept">
5816 <primary>frozen messages</primary>
5817 <secondary>thawing</secondary>
5818 </indexterm>
5819 <indexterm role="concept">
5820 <primary>message</primary>
5821 <secondary>thawing frozen</secondary>
5822 </indexterm>
5823 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5824 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5825 messages are active, their status is not altered. This option can be used only
5826 by an admin user.
5827 </para>
5828 </listitem></varlistentry>
5829 <varlistentry>
5830 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5831 <listitem>
5832 <para>
5833 <indexterm role="option">
5834 <primary><option>-Mvb</option></primary>
5835 </indexterm>
5836 <indexterm role="concept">
5837 <primary>listing</primary>
5838 <secondary>message body</secondary>
5839 </indexterm>
5840 <indexterm role="concept">
5841 <primary>message</primary>
5842 <secondary>listing body of</secondary>
5843 </indexterm>
5844 This option causes the contents of the message body (-D) spool file to be
5845 written to the standard output. This option can be used only by an admin user.
5846 </para>
5847 </listitem></varlistentry>
5848 <varlistentry>
5849 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5850 <listitem>
5851 <para>
5852 <indexterm role="option">
5853 <primary><option>-Mvc</option></primary>
5854 </indexterm>
5855 <indexterm role="concept">
5856 <primary>message</primary>
5857 <secondary>listing in RFC 2822 format</secondary>
5858 </indexterm>
5859 <indexterm role="concept">
5860 <primary>listing</primary>
5861 <secondary>message in RFC 2822 format</secondary>
5862 </indexterm>
5863 This option causes a copy of the complete message (header lines plus body) to
5864 be written to the standard output in RFC 2822 format. This option can be used
5865 only by an admin user.
5866 </para>
5867 </listitem></varlistentry>
5868 <varlistentry>
5869 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5870 <listitem>
5871 <para>
5872 <indexterm role="option">
5873 <primary><option>-Mvh</option></primary>
5874 </indexterm>
5875 <indexterm role="concept">
5876 <primary>listing</primary>
5877 <secondary>message headers</secondary>
5878 </indexterm>
5879 <indexterm role="concept">
5880 <primary>header lines</primary>
5881 <secondary>listing</secondary>
5882 </indexterm>
5883 <indexterm role="concept">
5884 <primary>message</primary>
5885 <secondary>listing header lines</secondary>
5886 </indexterm>
5887 This option causes the contents of the message headers (-H) spool file to be
5888 written to the standard output. This option can be used only by an admin user.
5889 </para>
5890 </listitem></varlistentry>
5891 <varlistentry>
5892 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5893 <listitem>
5894 <para>
5895 <indexterm role="option">
5896 <primary><option>-Mvl</option></primary>
5897 </indexterm>
5898 <indexterm role="concept">
5899 <primary>listing</primary>
5900 <secondary>message log</secondary>
5901 </indexterm>
5902 <indexterm role="concept">
5903 <primary>message</primary>
5904 <secondary>listing message log</secondary>
5905 </indexterm>
5906 This option causes the contents of the message log spool file to be written to
5907 the standard output. This option can be used only by an admin user.
5908 </para>
5909 </listitem></varlistentry>
5910 <varlistentry>
5911 <term><option>-m</option></term>
5912 <listitem>
5913 <para>
5914 <indexterm role="option">
5915 <primary><option>-m</option></primary>
5916 </indexterm>
5917 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5918 treats it that way too.
5919 </para>
5920 </listitem></varlistentry>
5921 <varlistentry>
5922 <term><option>-N</option></term>
5923 <listitem>
5924 <para>
5925 <indexterm role="option">
5926 <primary><option>-N</option></primary>
5927 </indexterm>
5928 <indexterm role="concept">
5929 <primary>debugging</primary>
5930 <secondary><option>-N</option> option</secondary>
5931 </indexterm>
5932 <indexterm role="concept">
5933 <primary>debugging</primary>
5934 <secondary>suppressing delivery</secondary>
5935 </indexterm>
5936 This is a debugging option that inhibits delivery of a message at the transport
5937 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5938 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5939 had successfully done so. However, it does not make any updates to the retry
5940 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5941 than <quote>=&gt;</quote>.
5942 </para>
5943 <para>
5944 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5945 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5946 words, an ordinary user can use it only when supplying an incoming message to
5947 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5948 address may be deferred because of a configuration problem on a transport, or a
5949 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5950 the message, and applies to any subsequent delivery attempts that may happen
5951 for that message.
5952 </para>
5953 </listitem></varlistentry>
5954 <varlistentry>
5955 <term><option>-n</option></term>
5956 <listitem>
5957 <para>
5958 <indexterm role="option">
5959 <primary><option>-n</option></primary>
5960 </indexterm>
5961 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5962 For normal modes of operation, it is ignored by Exim.
5963 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5964 </para>
5965 </listitem></varlistentry>
5966 <varlistentry>
5967 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5968 <listitem>
5969 <para>
5970 <indexterm role="option">
5971 <primary><option>-O</option></primary>
5972 </indexterm>
5973 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5974 Exim.
5975 </para>
5976 </listitem></varlistentry>
5977 <varlistentry>
5978 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5979 <listitem>
5980 <para>
5981 <indexterm role="option">
5982 <primary><option>-oA</option></primary>
5983 </indexterm>
5984 <indexterm role="concept">
5985 <primary>Sendmail compatibility</primary>
5986 <secondary><option>-oA</option> option</secondary>
5987 </indexterm>
5988 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5989 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5990 description above.
5991 </para>
5992 </listitem></varlistentry>
5993 <varlistentry>
5994 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5995 <listitem>
5996 <para>
5997 <indexterm role="option">
5998 <primary><option>-oB</option></primary>
5999 </indexterm>
6000 <indexterm role="concept">
6001 <primary>SMTP</primary>
6002 <secondary>passed connection</secondary>
6003 </indexterm>
6004 <indexterm role="concept">
6005 <primary>SMTP</primary>
6006 <secondary>multiple deliveries</secondary>
6007 </indexterm>
6008 <indexterm role="concept">
6009 <primary>multiple SMTP deliveries</primary>
6010 </indexterm>
6011 This is a debugging option which limits the maximum number of messages that can
6012 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6013 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6014 </para>
6015 </listitem></varlistentry>
6016 <varlistentry>
6017 <term><option>-odb</option></term>
6018 <listitem>
6019 <para>
6020 <indexterm role="option">
6021 <primary><option>-odb</option></primary>
6022 </indexterm>
6023 <indexterm role="concept">
6024 <primary>background delivery</primary>
6025 </indexterm>
6026 <indexterm role="concept">
6027 <primary>delivery</primary>
6028 <secondary>in the background</secondary>
6029 </indexterm>
6030 This option applies to all modes in which Exim accepts incoming messages,
6031 including the listening daemon. It requests <quote>background</quote> delivery of such
6032 messages, which means that the accepting process automatically starts a
6033 delivery process for each message received, but does not wait for the delivery
6034 processes to finish.
6035 </para>
6036 <para>
6037 When all the messages have been received, the reception process exits,
6038 leaving the delivery processes to finish in their own time. The standard output
6039 and error streams are closed at the start of each delivery process.
6040 This is the default action if none of the <option>-od</option> options are present.
6041 </para>
6042 <para>
6043 If one of the queueing options in the configuration file
6044 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6045 overrides it if <option>queue_only_override</option> is set true, which is the default
6046 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6047 </para>
6048 </listitem></varlistentry>
6049 <varlistentry>
6050 <term><option>-odf</option></term>
6051 <listitem>
6052 <para>
6053 <indexterm role="option">
6054 <primary><option>-odf</option></primary>
6055 </indexterm>
6056 <indexterm role="concept">
6057 <primary>foreground delivery</primary>
6058 </indexterm>
6059 <indexterm role="concept">
6060 <primary>delivery</primary>
6061 <secondary>in the foreground</secondary>
6062 </indexterm>
6063 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6064 accepted a locally-generated message. (For the daemon it is exactly the same as
6065 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6066 and Exim waits for it to complete before proceeding.
6067 </para>
6068 <para>
6069 The original Exim reception process does not finish until the delivery
6070 process for the final message has ended. The standard error stream is left open
6071 during deliveries.
6072 </para>
6073 <para>
6074 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6075 false and one of the queueing options in the configuration file is in effect.
6076 </para>
6077 <para>
6078 If there is a temporary delivery error during foreground delivery, the
6079 message is left on the queue for later delivery, and the original reception
6080 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6081 restricted configuration that never queues messages.
6082 </para>
6083 </listitem></varlistentry>
6084 <varlistentry>
6085 <term><option>-odi</option></term>
6086 <listitem>
6087 <para>
6088 <indexterm role="option">
6089 <primary><option>-odi</option></primary>
6090 </indexterm>
6091 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6092 Sendmail.
6093 </para>
6094 </listitem></varlistentry>
6095 <varlistentry>
6096 <term><option>-odq</option></term>
6097 <listitem>
6098 <para>
6099 <indexterm role="option">
6100 <primary><option>-odq</option></primary>
6101 </indexterm>
6102 <indexterm role="concept">
6103 <primary>non-immediate delivery</primary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>delivery</primary>
6107 <secondary>suppressing immediate</secondary>
6108 </indexterm>
6109 <indexterm role="concept">
6110 <primary>queueing incoming messages</primary>
6111 </indexterm>
6112 This option applies to all modes in which Exim accepts incoming messages,
6113 including the listening daemon. It specifies that the accepting process should
6114 not automatically start a delivery process for each message received. Messages
6115 are placed on the queue, and remain there until a subsequent queue runner
6116 process encounters them. There are several configuration options (such as
6117 <option>queue_only</option>) that can be used to queue incoming messages under certain
6118 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6119 forces queueing.
6120 </para>
6121 </listitem></varlistentry>
6122 <varlistentry>
6123 <term><option>-odqs</option></term>
6124 <listitem>
6125 <para>
6126 <indexterm role="option">
6127 <primary><option>-odqs</option></primary>
6128 </indexterm>
6129 <indexterm role="concept">
6130 <primary>SMTP</primary>
6131 <secondary>delaying delivery</secondary>
6132 </indexterm>
6133 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6134 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6135 <option>queue_only_override</option> is false and one of the queueing options in the
6136 configuration file is in effect.
6137 </para>
6138 <para>
6139 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6140 message, in the background by default, but in the foreground if <option>-odi</option> is
6141 also present. The recipient addresses are routed, and local deliveries are done
6142 in the normal way. However, if any SMTP deliveries are required, they are not
6143 done at this time, so the message remains on the queue until a subsequent queue
6144 runner process encounters it. Because routing was done, Exim knows which
6145 messages are waiting for which hosts, and so a number of messages for the same
6146 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6147 configuration option has the same effect for specific domains. See also the
6148 <option>-qq</option> option.
6149 </para>
6150 </listitem></varlistentry>
6151 <varlistentry>
6152 <term><option>-oee</option></term>
6153 <listitem>
6154 <para>
6155 <indexterm role="option">
6156 <primary><option>-oee</option></primary>
6157 </indexterm>
6158 <indexterm role="concept">
6159 <primary>error</primary>
6160 <secondary>reporting</secondary>
6161 </indexterm>
6162 If an error is detected while a non-SMTP message is being received (for
6163 example, a malformed address), the error is reported to the sender in a mail
6164 message.
6165 </para>
6166 <para>
6167 <indexterm role="concept">
6168 <primary>return code</primary>
6169 <secondary>for <option>-oee</option></secondary>
6170 </indexterm>
6171 Provided
6172 this error message is successfully sent, the Exim receiving process
6173 exits with a return code of zero. If not, the return code is 2 if the problem
6174 is that the original message has no recipients, or 1 for any other error.
6175 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6176 </para>
6177 </listitem></varlistentry>
6178 <varlistentry>
6179 <term><option>-oem</option></term>
6180 <listitem>
6181 <para>
6182 <indexterm role="option">
6183 <primary><option>-oem</option></primary>
6184 </indexterm>
6185 <indexterm role="concept">
6186 <primary>error</primary>
6187 <secondary>reporting</secondary>
6188 </indexterm>
6189 <indexterm role="concept">
6190 <primary>return code</primary>
6191 <secondary>for <option>-oem</option></secondary>
6192 </indexterm>
6193 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6194 return code, whether or not the error message was successfully sent.
6195 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6196 </para>
6197 </listitem></varlistentry>
6198 <varlistentry>
6199 <term><option>-oep</option></term>
6200 <listitem>
6201 <para>
6202 <indexterm role="option">
6203 <primary><option>-oep</option></primary>
6204 </indexterm>
6205 <indexterm role="concept">
6206 <primary>error</primary>
6207 <secondary>reporting</secondary>
6208 </indexterm>
6209 If an error is detected while a non-SMTP message is being received, the
6210 error is reported by writing a message to the standard error file (stderr).
6211 <indexterm role="concept">
6212 <primary>return code</primary>
6213 <secondary>for <option>-oep</option></secondary>
6214 </indexterm>
6215 The return code is 1 for all errors.
6216 </para>
6217 </listitem></varlistentry>
6218 <varlistentry>
6219 <term><option>-oeq</option></term>
6220 <listitem>
6221 <para>
6222 <indexterm role="option">
6223 <primary><option>-oeq</option></primary>
6224 </indexterm>
6225 <indexterm role="concept">
6226 <primary>error</primary>
6227 <secondary>reporting</secondary>
6228 </indexterm>
6229 This option is supported for compatibility with Sendmail, but has the same
6230 effect as <option>-oep</option>.
6231 </para>
6232 </listitem></varlistentry>
6233 <varlistentry>
6234 <term><option>-oew</option></term>
6235 <listitem>
6236 <para>
6237 <indexterm role="option">
6238 <primary><option>-oew</option></primary>
6239 </indexterm>
6240 <indexterm role="concept">
6241 <primary>error</primary>
6242 <secondary>reporting</secondary>
6243 </indexterm>
6244 This option is supported for compatibility with Sendmail, but has the same
6245 effect as <option>-oem</option>.
6246 </para>
6247 </listitem></varlistentry>
6248 <varlistentry>
6249 <term><option>-oi</option></term>
6250 <listitem>
6251 <para>
6252 <indexterm role="option">
6253 <primary><option>-oi</option></primary>
6254 </indexterm>
6255 <indexterm role="concept">
6256 <primary>dot</primary>
6257 <secondary>in incoming non-SMTP message</secondary>
6258 </indexterm>
6259 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6260 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6261 single dot does terminate, though Exim does no special processing for other
6262 lines that start with a dot. This option is set by default if Exim is called as
6263 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6264 </para>
6265 </listitem></varlistentry>
6266 <varlistentry>
6267 <term><option>-oitrue</option></term>
6268 <listitem>
6269 <para>
6270 <indexterm role="option">
6271 <primary><option>-oitrue</option></primary>
6272 </indexterm>
6273 This option is treated as synonymous with <option>-oi</option>.
6274 </para>
6275 </listitem></varlistentry>
6276 <varlistentry>
6277 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6278 <listitem>
6279 <para>
6280 <indexterm role="option">
6281 <primary><option>-oMa</option></primary>
6282 </indexterm>
6283 <indexterm role="concept">
6284 <primary>sender</primary>
6285 <secondary>host address, specifying for local message</secondary>
6286 </indexterm>
6287 A number of options starting with <option>-oM</option> can be used to set values associated
6288 with remote hosts on locally-submitted messages (that is, messages not received
6289 over TCP/IP). These options can be used by any caller in conjunction with the
6290 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6291 other circumstances, they are ignored unless the caller is trusted.
6292 </para>
6293 <para>
6294 The <option>-oMa</option> option sets the sender host address. This may include a port
6295 number at the end, after a full stop (period). For example:
6296 </para>
6297 <literallayout class="monospaced">
6298 exim -bs -oMa 10.9.8.7.1234
6299 </literallayout>
6300 <para>
6301 An alternative syntax is to enclose the IP address in square brackets,
6302 followed by a colon and the port number:
6303 </para>
6304 <literallayout class="monospaced">
6305 exim -bs -oMa [10.9.8.7]:1234
6306 </literallayout>
6307 <para>
6308 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6309 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6310 are present on the command line, the sender host IP address is taken from
6311 whichever one is last.
6312 </para>
6313 </listitem></varlistentry>
6314 <varlistentry>
6315 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6316 <listitem>
6317 <para>
6318 <indexterm role="option">
6319 <primary><option>-oMaa</option></primary>
6320 </indexterm>
6321 <indexterm role="concept">
6322 <primary>authentication</primary>
6323 <secondary>name, specifying for local message</secondary>
6324 </indexterm>
6325 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6326 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6327 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6328 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6329 authenticated SMTP session without actually using the SMTP AUTH command.
6330 </para>
6331 </listitem></varlistentry>
6332 <varlistentry>
6333 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6334 <listitem>
6335 <para>
6336 <indexterm role="option">
6337 <primary><option>-oMai</option></primary>
6338 </indexterm>
6339 <indexterm role="concept">
6340 <primary>authentication</primary>
6341 <secondary>id, specifying for local message</secondary>
6342 </indexterm>
6343 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6344 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6345 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6346 where there is no default) for messages from local sources. See chapter
6347 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6348 </para>
6349 </listitem></varlistentry>
6350 <varlistentry>
6351 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6352 <listitem>
6353 <para>
6354 <indexterm role="option">
6355 <primary><option>-oMas</option></primary>
6356 </indexterm>
6357 <indexterm role="concept">
6358 <primary>authentication</primary>
6359 <secondary>sender, specifying for local message</secondary>
6360 </indexterm>
6361 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6362 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6363 overrides the sender address that is created from the caller&#x2019;s login id for
6364 messages from local sources, except when <option>-bh</option> is used, when there is no
6365 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6366 specified on a MAIL command overrides this value. See chapter
6367 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6368 </para>
6369 </listitem></varlistentry>
6370 <varlistentry>
6371 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6372 <listitem>
6373 <para>
6374 <indexterm role="option">
6375 <primary><option>-oMi</option></primary>
6376 </indexterm>
6377 <indexterm role="concept">
6378 <primary>interface</primary>
6379 <secondary>address, specifying for local message</secondary>
6380 </indexterm>
6381 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6382 option sets the IP interface address value. A port number may be included,
6383 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6384 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6385 </para>
6386 </listitem></varlistentry>
6387 <varlistentry>
6388 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6389 <listitem>
6390 <para>
6391 <indexterm role="option">
6392 <primary><option>-oMm</option></primary>
6393 </indexterm>
6394 <indexterm role="concept">
6395 <primary>message reference</primary>
6396 <secondary>message reference, specifying for local message</secondary>
6397 </indexterm>
6398 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6399 option sets the message reference, e.g. message-id, and is logged during
6400 delivery. This is useful when some kind of audit trail is required to tie
6401 messages together. The format of the message reference is checked and will
6402 abort if the format is invalid. The option will only be accepted if exim is
6403 running in trusted mode, not as any regular user.
6404 </para>
6405 <para>
6406 The best example of a message reference is when Exim sends a bounce message.
6407 The message reference is the message-id of the original message for which Exim
6408 is sending the bounce.
6409 </para>
6410 </listitem></varlistentry>
6411 <varlistentry>
6412 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6413 <listitem>
6414 <para>
6415 <indexterm role="option">
6416 <primary><option>-oMr</option></primary>
6417 </indexterm>
6418 <indexterm role="concept">
6419 <primary>protocol, specifying for local message</primary>
6420 </indexterm>
6421 <indexterm role="variable">
6422 <primary><varname>$received_protocol</varname></primary>
6423 </indexterm>
6424 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6425 option sets the received protocol value that is stored in
6426 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6427 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6428 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6429 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6430 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6431 be set by <option>-oMr</option>.
6432 </para>
6433 </listitem></varlistentry>
6434 <varlistentry>
6435 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6436 <listitem>
6437 <para>
6438 <indexterm role="option">
6439 <primary><option>-oMs</option></primary>
6440 </indexterm>
6441 <indexterm role="concept">
6442 <primary>sender</primary>
6443 <secondary>host name, specifying for local message</secondary>
6444 </indexterm>
6445 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6446 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6447 present, Exim does not attempt to look up a host name from an IP address; it
6448 uses the name it is given.
6449 </para>
6450 </listitem></varlistentry>
6451 <varlistentry>
6452 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6453 <listitem>
6454 <para>
6455 <indexterm role="option">
6456 <primary><option>-oMt</option></primary>
6457 </indexterm>
6458 <indexterm role="concept">
6459 <primary>sender</primary>
6460 <secondary>ident string, specifying for local message</secondary>
6461 </indexterm>
6462 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6463 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6464 local callers is the login id of the calling process, except when <option>-bh</option> is
6465 used, when there is no default.
6466 </para>
6467 </listitem></varlistentry>
6468 <varlistentry>
6469 <term><option>-om</option></term>
6470 <listitem>
6471 <para>
6472 <indexterm role="option">
6473 <primary><option>-om</option></primary>
6474 </indexterm>
6475 <indexterm role="concept">
6476 <primary>Sendmail compatibility</primary>
6477 <secondary><option>-om</option> option ignored</secondary>
6478 </indexterm>
6479 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6480 message should receive a copy of the message if the sender appears in an alias
6481 expansion. Exim always does this, so the option does nothing.
6482 </para>
6483 </listitem></varlistentry>
6484 <varlistentry>
6485 <term><option>-oo</option></term>
6486 <listitem>
6487 <para>
6488 <indexterm role="option">
6489 <primary><option>-oo</option></primary>
6490 </indexterm>
6491 <indexterm role="concept">
6492 <primary>Sendmail compatibility</primary>
6493 <secondary><option>-oo</option> option ignored</secondary>
6494 </indexterm>
6495 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6496 whatever that means.
6497 </para>
6498 </listitem></varlistentry>
6499 <varlistentry>
6500 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6501 <listitem>
6502 <para>
6503 <indexterm role="option">
6504 <primary><option>-oP</option></primary>
6505 </indexterm>
6506 <indexterm role="concept">
6507 <primary>pid (process id)</primary>
6508 <secondary>of daemon</secondary>
6509 </indexterm>
6510 <indexterm role="concept">
6511 <primary>daemon</primary>
6512 <secondary>process id (pid)</secondary>
6513 </indexterm>
6514 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6515 value. The option specifies the file to which the process id of the daemon is
6516 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6517 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6518 because in those cases, the normal pid file is not used.
6519 </para>
6520 </listitem></varlistentry>
6521 <varlistentry>
6522 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6523 <listitem>
6524 <para>
6525 <indexterm role="option">
6526 <primary><option>-or</option></primary>
6527 </indexterm>
6528 <indexterm role="concept">
6529 <primary>timeout</primary>
6530 <secondary>for non-SMTP input</secondary>
6531 </indexterm>
6532 This option sets a timeout value for incoming non-SMTP messages. If it is not
6533 set, Exim will wait forever for the standard input. The value can also be set
6534 by the <option>receive_timeout</option> option. The format used for specifying times is
6535 described in section <xref linkend="SECTtimeformat"/>.
6536 </para>
6537 </listitem></varlistentry>
6538 <varlistentry>
6539 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6540 <listitem>
6541 <para>
6542 <indexterm role="option">
6543 <primary><option>-os</option></primary>
6544 </indexterm>
6545 <indexterm role="concept">
6546 <primary>timeout</primary>
6547 <secondary>for SMTP input</secondary>
6548 </indexterm>
6549 <indexterm role="concept">
6550 <primary>SMTP</primary>
6551 <secondary>input timeout</secondary>
6552 </indexterm>
6553 This option sets a timeout value for incoming SMTP messages. The timeout
6554 applies to each SMTP command and block of data. The value can also be set by
6555 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6556 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6557 </para>
6558 </listitem></varlistentry>
6559 <varlistentry>
6560 <term><option>-ov</option></term>
6561 <listitem>
6562 <para>
6563 <indexterm role="option">
6564 <primary><option>-ov</option></primary>
6565 </indexterm>
6566 This option has exactly the same effect as <option>-v</option>.
6567 </para>
6568 </listitem></varlistentry>
6569 <varlistentry>
6570 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6571 <listitem>
6572 <para>
6573 <indexterm role="option">
6574 <primary><option>-oX</option></primary>
6575 </indexterm>
6576 <indexterm role="concept">
6577 <primary>TCP/IP</primary>
6578 <secondary>setting listening ports</secondary>
6579 </indexterm>
6580 <indexterm role="concept">
6581 <primary>TCP/IP</primary>
6582 <secondary>setting listening interfaces</secondary>
6583 </indexterm>
6584 <indexterm role="concept">
6585 <primary>port</primary>
6586 <secondary>receiving TCP/IP</secondary>
6587 </indexterm>
6588 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6589 is also given. It controls which ports and interfaces the daemon uses. Details
6590 of the syntax, and how it interacts with configuration file options, are given
6591 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6592 file is written unless <option>-oP</option> is also present to specify a pid file name.
6593 </para>
6594 </listitem></varlistentry>
6595 <varlistentry>
6596 <term><option>-pd</option></term>
6597 <listitem>
6598 <para>
6599 <indexterm role="option">
6600 <primary><option>-pd</option></primary>
6601 </indexterm>
6602 <indexterm role="concept">
6603 <primary>Perl</primary>
6604 <secondary>starting the interpreter</secondary>
6605 </indexterm>
6606 This option applies when an embedded Perl interpreter is linked with Exim (see
6607 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6608 option, forcing the starting of the interpreter to be delayed until it is
6609 needed.
6610 </para>
6611 </listitem></varlistentry>
6612 <varlistentry>
6613 <term><option>-ps</option></term>
6614 <listitem>
6615 <para>
6616 <indexterm role="option">
6617 <primary><option>-ps</option></primary>
6618 </indexterm>
6619 <indexterm role="concept">
6620 <primary>Perl</primary>
6621 <secondary>starting the interpreter</secondary>
6622 </indexterm>
6623 This option applies when an embedded Perl interpreter is linked with Exim (see
6624 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6625 option, forcing the starting of the interpreter to occur as soon as Exim is
6626 started.
6627 </para>
6628 </listitem></varlistentry>
6629 <varlistentry>
6630 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6631 <listitem>
6632 <para>
6633 <indexterm role="option">
6634 <primary><option>-p</option></primary>
6635 </indexterm>
6636 For compatibility with Sendmail, this option is equivalent to
6637 </para>
6638 <literallayout>
6639 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6640 </literallayout>
6641 <para>
6642 It sets the incoming protocol and host name (for trusted callers). The
6643 host name and its colon can be omitted when only the protocol is to be set.
6644 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6645 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6646 or <literal>s</literal> using this option (but that does not seem a real limitation).
6647 </para>
6648 </listitem></varlistentry>
6649 <varlistentry>
6650 <term><option>-q</option></term>
6651 <listitem>
6652 <para>
6653 <indexterm role="option">
6654 <primary><option>-q</option></primary>
6655 </indexterm>
6656 <indexterm role="concept">
6657 <primary>queue runner</primary>
6658 <secondary>starting manually</secondary>
6659 </indexterm>
6660 This option is normally restricted to admin users. However, there is a
6661 configuration option called <option>prod_requires_admin</option> which can be set false to
6662 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6663 and <option>-S</option> options).
6664 </para>
6665 <para>
6666 <indexterm role="concept">
6667 <primary>queue runner</primary>
6668 <secondary>description of operation</secondary>
6669 </indexterm>
6670 The <option>-q</option> option starts one queue runner process. This scans the queue of
6671 waiting messages, and runs a delivery process for each one in turn. It waits
6672 for each delivery process to finish before starting the next one. A delivery
6673 process may not actually do any deliveries if the retry times for the addresses
6674 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6675 </para>
6676 <para>
6677 If
6678 <indexterm role="concept">
6679 <primary>SMTP</primary>
6680 <secondary>passed connection</secondary>
6681 </indexterm>
6682 <indexterm role="concept">
6683 <primary>SMTP</primary>
6684 <secondary>multiple deliveries</secondary>
6685 </indexterm>
6686 <indexterm role="concept">
6687 <primary>multiple SMTP deliveries</primary>
6688 </indexterm>
6689 the delivery process spawns other processes to deliver other messages down
6690 passed SMTP connections, the queue runner waits for these to finish before
6691 proceeding.
6692 </para>
6693 <para>
6694 When all the queued messages have been considered, the original queue runner
6695 process terminates. In other words, a single pass is made over the waiting
6696 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6697 this to be repeated periodically.
6698 </para>
6699 <para>
6700 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6701 random, but it is likely to be different each time, which is all that matters.
6702 If one particular message screws up a remote MTA, other messages to the same
6703 MTA have a chance of getting through if they get tried first.
6704 </para>
6705 <para>
6706 It is possible to cause the messages to be processed in lexical message id
6707 order, which is essentially the order in which they arrived, by setting the
6708 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6709 </para>
6710 </listitem></varlistentry>
6711 <varlistentry>
6712 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6713 <listitem>
6714 <para>
6715 The <option>-q</option> option may be followed by one or more flag letters that change its
6716 behaviour. They are all optional, but if more than one is present, they must
6717 appear in the correct order. Each flag is described in a separate item below.
6718 </para>
6719 </listitem></varlistentry>
6720 <varlistentry>
6721 <term><option>-qq...</option></term>
6722 <listitem>
6723 <para>
6724 <indexterm role="option">
6725 <primary><option>-qq</option></primary>
6726 </indexterm>
6727 <indexterm role="concept">
6728 <primary>queue</primary>
6729 <secondary>double scanning</secondary>
6730 </indexterm>
6731 <indexterm role="concept">
6732 <primary>queue</primary>
6733 <secondary>routing</secondary>
6734 </indexterm>
6735 <indexterm role="concept">
6736 <primary>routing</primary>
6737 <secondary>whole queue before delivery</secondary>
6738 </indexterm>
6739 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6740 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6741 every domain. Addresses are routed, local deliveries happen, but no remote
6742 transports are run.
6743 </para>
6744 <para>
6745 <indexterm role="concept">
6746 <primary>hints database</primary>
6747 <secondary>remembering routing</secondary>
6748 </indexterm>
6749 The hints database that remembers which messages are waiting for specific hosts
6750 is updated, as if delivery to those hosts had been deferred. After this is
6751 complete, a second, normal queue scan happens, with routing and delivery taking
6752 place as normal. Messages that are routed to the same host should mostly be
6753 delivered down a single SMTP
6754 <indexterm role="concept">
6755 <primary>SMTP</primary>
6756 <secondary>passed connection</secondary>
6757 </indexterm>
6758 <indexterm role="concept">
6759 <primary>SMTP</primary>
6760 <secondary>multiple deliveries</secondary>
6761 </indexterm>
6762 <indexterm role="concept">
6763 <primary>multiple SMTP deliveries</primary>
6764 </indexterm>
6765 connection because of the hints that were set up during the first queue scan.
6766 This option may be useful for hosts that are connected to the Internet
6767 intermittently.
6768 </para>
6769 </listitem></varlistentry>
6770 <varlistentry>
6771 <term><option>-q[q]i...</option></term>
6772 <listitem>
6773 <para>
6774 <indexterm role="option">
6775 <primary><option>-qi</option></primary>
6776 </indexterm>
6777 <indexterm role="concept">
6778 <primary>queue</primary>
6779 <secondary>initial delivery</secondary>
6780 </indexterm>
6781 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6782 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6783 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6784 <option>-odq</option> and want a queue runner just to process the new messages.
6785 </para>
6786 </listitem></varlistentry>
6787 <varlistentry>
6788 <term><option>-q[q][i]f...</option></term>
6789 <listitem>
6790 <para>
6791 <indexterm role="option">
6792 <primary><option>-qf</option></primary>
6793 </indexterm>
6794 <indexterm role="concept">
6795 <primary>queue</primary>
6796 <secondary>forcing delivery</secondary>
6797 </indexterm>
6798 <indexterm role="concept">
6799 <primary>delivery</primary>
6800 <secondary>forcing in queue run</secondary>
6801 </indexterm>
6802 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6803 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6804 their retry times are tried.
6805 </para>
6806 </listitem></varlistentry>
6807 <varlistentry>
6808 <term><option>-q[q][i]ff...</option></term>
6809 <listitem>
6810 <para>
6811 <indexterm role="option">
6812 <primary><option>-qff</option></primary>
6813 </indexterm>
6814 <indexterm role="concept">
6815 <primary>frozen messages</primary>
6816 <secondary>forcing delivery</secondary>
6817 </indexterm>
6818 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6819 frozen or not.
6820 </para>
6821 </listitem></varlistentry>
6822 <varlistentry>
6823 <term><option>-q[q][i][f[f]]l</option></term>
6824 <listitem>
6825 <para>
6826 <indexterm role="option">
6827 <primary><option>-ql</option></primary>
6828 </indexterm>
6829 <indexterm role="concept">
6830 <primary>queue</primary>
6831 <secondary>local deliveries only</secondary>
6832 </indexterm>
6833 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6834 be done. If a message requires any remote deliveries, it remains on the queue
6835 for later delivery.
6836 </para>
6837 </listitem></varlistentry>
6838 <varlistentry>
6839 <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>
6840 <listitem>
6841 <para>
6842 <indexterm role="concept">
6843 <primary>queue</primary>
6844 <secondary>delivering specific messages</secondary>
6845 </indexterm>
6846 When scanning the queue, Exim can be made to skip over messages whose ids are
6847 lexically less than a given value by following the <option>-q</option> option with a
6848 starting message id. For example:
6849 </para>
6850 <literallayout class="monospaced">
6851 exim -q 0t5C6f-0000c8-00
6852 </literallayout>
6853 <para>
6854 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6855 second message id is given, messages whose ids are lexically greater than it
6856 are also skipped. If the same id is given twice, for example,
6857 </para>
6858 <literallayout class="monospaced">
6859 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6860 </literallayout>
6861 <para>
6862 just one delivery process is started, for that message. This differs from
6863 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6864 that it counts as a delivery from a queue run. Note that the selection
6865 mechanism does not affect the order in which the messages are scanned. There
6866 are also other ways of selecting specific sets of messages for delivery in a
6867 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6868 </para>
6869 </listitem></varlistentry>
6870 <varlistentry>
6871 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6872 <listitem>
6873 <para>
6874 <indexterm role="concept">
6875 <primary>queue runner</primary>
6876 <secondary>starting periodically</secondary>
6877 </indexterm>
6878 <indexterm role="concept">
6879 <primary>periodic queue running</primary>
6880 </indexterm>
6881 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6882 starting a queue runner process at intervals specified by the given time value
6883 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6884 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6885 single daemon process handles both functions. A common way of starting up a
6886 combined daemon at system boot time is to use a command such as
6887 </para>
6888 <literallayout class="monospaced">
6889 /usr/exim/bin/exim -bd -q30m
6890 </literallayout>
6891 <para>
6892 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6893 process every 30 minutes.
6894 </para>
6895 <para>
6896 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6897 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6898 </para>
6899 </listitem></varlistentry>
6900 <varlistentry>
6901 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6902 <listitem>
6903 <para>
6904 <indexterm role="option">
6905 <primary><option>-qR</option></primary>
6906 </indexterm>
6907 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6908 compatibility.
6909 </para>
6910 </listitem></varlistentry>
6911 <varlistentry>
6912 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6913 <listitem>
6914 <para>
6915 <indexterm role="option">
6916 <primary><option>-qS</option></primary>
6917 </indexterm>
6918 This option is synonymous with <option>-S</option>.
6919 </para>
6920 </listitem></varlistentry>
6921 <varlistentry>
6922 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6923 <listitem>
6924 <para>
6925 <indexterm role="option">
6926 <primary><option>-R</option></primary>
6927 </indexterm>
6928 <indexterm role="concept">
6929 <primary>queue runner</primary>
6930 <secondary>for specific recipients</secondary>
6931 </indexterm>
6932 <indexterm role="concept">
6933 <primary>delivery</primary>
6934 <secondary>to given domain</secondary>
6935 </indexterm>
6936 <indexterm role="concept">
6937 <primary>domain</primary>
6938 <secondary>delivery to</secondary>
6939 </indexterm>
6940 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6941 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6942 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6943 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6944 </para>
6945 <para>
6946 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6947 perform a single queue run, except that, when scanning the messages on the
6948 queue, Exim processes only those that have at least one undelivered recipient
6949 address containing the given string, which is checked in a case-independent
6950 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6951 regular expression; otherwise it is a literal string.
6952 </para>
6953 <para>
6954 If you want to do periodic queue runs for messages with specific recipients,
6955 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6956 </para>
6957 <literallayout class="monospaced">
6958 exim -q25m -R @special.domain.example
6959 </literallayout>
6960 <para>
6961 This example does a queue run for messages with recipients in the given domain
6962 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6963 applied to each queue run.
6964 </para>
6965 <para>
6966 Once a message is selected for delivery by this mechanism, all its addresses
6967 are processed. For the first selected message, Exim overrides any retry
6968 information and forces a delivery attempt for each undelivered address. This
6969 means that if delivery of any address in the first message is successful, any
6970 existing retry information is deleted, and so delivery attempts for that
6971 address in subsequently selected messages (which are processed without forcing)
6972 will run. However, if delivery of any address does not succeed, the retry
6973 information is updated, and in subsequently selected messages, the failing
6974 address will be skipped.
6975 </para>
6976 <para>
6977 <indexterm role="concept">
6978 <primary>frozen messages</primary>
6979 <secondary>forcing delivery</secondary>
6980 </indexterm>
6981 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6982 all selected messages, not just the first; frozen messages are included when
6983 <emphasis>ff</emphasis> is present.
6984 </para>
6985 <para>
6986 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6987 to a given domain after a host has been down for some time. When the SMTP
6988 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6989 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6990 an arbitrary command instead.
6991 </para>
6992 </listitem></varlistentry>
6993 <varlistentry>
6994 <term><option>-r</option></term>
6995 <listitem>
6996 <para>
6997 <indexterm role="option">
6998 <primary><option>-r</option></primary>
6999 </indexterm>
7000 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7001 </para>
7002 </listitem></varlistentry>
7003 <varlistentry>
7004 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7005 <listitem>
7006 <para>
7007 <indexterm role="option">
7008 <primary><option>-S</option></primary>
7009 </indexterm>
7010 <indexterm role="concept">
7011 <primary>delivery</primary>
7012 <secondary>from given sender</secondary>
7013 </indexterm>
7014 <indexterm role="concept">
7015 <primary>queue runner</primary>
7016 <secondary>for specific senders</secondary>
7017 </indexterm>
7018 This option acts like <option>-R</option> except that it checks the string against each
7019 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7020 conditions must be met for a message to be selected. If either of the options
7021 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7022 </para>
7023 </listitem></varlistentry>
7024 <varlistentry>
7025 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7026 <listitem>
7027 <para>
7028 <indexterm role="option">
7029 <primary><option>-Tqt</option></primary>
7030 </indexterm>
7031 This is an option that is exclusively for use by the Exim testing suite. It is not
7032 recognized when Exim is run normally. It allows for the setting up of explicit
7033 <quote>queue times</quote> so that various warning/retry features can be tested.
7034 </para>
7035 </listitem></varlistentry>
7036 <varlistentry>
7037 <term><option>-t</option></term>
7038 <listitem>
7039 <para>
7040 <indexterm role="option">
7041 <primary><option>-t</option></primary>
7042 </indexterm>
7043 <indexterm role="concept">
7044 <primary>recipient</primary>
7045 <secondary>extracting from header lines</secondary>
7046 </indexterm>
7047 <indexterm role="concept">
7048 <primary><emphasis>Bcc:</emphasis> header line</primary>
7049 </indexterm>
7050 <indexterm role="concept">
7051 <primary><emphasis>Cc:</emphasis> header line</primary>
7052 </indexterm>
7053 <indexterm role="concept">
7054 <primary><emphasis>To:</emphasis> header line</primary>
7055 </indexterm>
7056 When Exim is receiving a locally-generated, non-SMTP message on its standard
7057 input, the <option>-t</option> option causes the recipients of the message to be obtained
7058 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7059 from the command arguments. The addresses are extracted before any rewriting
7060 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7061 </para>
7062 <para>
7063 <indexterm role="concept">
7064 <primary>Sendmail compatibility</primary>
7065 <secondary><option>-t</option> option</secondary>
7066 </indexterm>
7067 If the command has any arguments, they specify addresses to which the message
7068 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7069 the recipients list obtained from the headers. This is compatible with Smail 3
7070 and in accordance with the documented behaviour of several versions of
7071 Sendmail, as described in man pages on a number of operating systems (e.g.
7072 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7073 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7074 Sendmail book documents it that way. Exim can be made to add argument addresses
7075 instead of subtracting them by setting the option
7076 <option>extract_addresses_remove_arguments</option> false.
7077 </para>
7078 <para>
7079 <indexterm role="concept">
7080 <primary><option>Resent-</option> header lines</primary>
7081 <secondary>with <option>-t</option></secondary>
7082 </indexterm>
7083 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7084 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7085 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7086 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7087 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7088 </para>
7089 <para>
7090 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7091 message is resent several times). The RFC also specifies that they should be
7092 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7093 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7094 nor indeed exactly what constitutes a <quote>set</quote>.
7095 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7096 are often added at the end of the header, and if a message is resent more than
7097 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7098 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7099 </para>
7100 </listitem></varlistentry>
7101 <varlistentry>
7102 <term><option>-ti</option></term>
7103 <listitem>
7104 <para>
7105 <indexterm role="option">
7106 <primary><option>-ti</option></primary>
7107 </indexterm>
7108 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7109 compatibility with Sendmail.
7110 </para>
7111 </listitem></varlistentry>
7112 <varlistentry>
7113 <term><option>-tls-on-connect</option></term>
7114 <listitem>
7115 <para>
7116 <indexterm role="option">
7117 <primary><option>-tls-on-connect</option></primary>
7118 </indexterm>
7119 <indexterm role="concept">
7120 <primary>TLS</primary>
7121 <secondary>use without STARTTLS</secondary>
7122 </indexterm>
7123 <indexterm role="concept">
7124 <primary>TLS</primary>
7125 <secondary>automatic start</secondary>
7126 </indexterm>
7127 This option is available when Exim is compiled with TLS support. It forces all
7128 incoming SMTP connections to behave as if the incoming port is listed in the
7129 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7130 <xref linkend="CHAPTLS"/> for further details.
7131 </para>
7132 </listitem></varlistentry>
7133 <varlistentry>
7134 <term><option>-U</option></term>
7135 <listitem>
7136 <para>
7137 <indexterm role="option">
7138 <primary><option>-U</option></primary>
7139 </indexterm>
7140 <indexterm role="concept">
7141 <primary>Sendmail compatibility</primary>
7142 <secondary><option>-U</option> option ignored</secondary>
7143 </indexterm>
7144 Sendmail uses this option for <quote>initial message submission</quote>, and its
7145 documentation states that in future releases, it may complain about
7146 syntactically invalid messages rather than fixing them when this flag is not
7147 set. Exim ignores this option.
7148 </para>
7149 </listitem></varlistentry>
7150 <varlistentry>
7151 <term><option>-v</option></term>
7152 <listitem>
7153 <para>
7154 <indexterm role="option">
7155 <primary><option>-v</option></primary>
7156 </indexterm>
7157 This option causes Exim to write information to the standard error stream,
7158 describing what it is doing. In particular, it shows the log lines for
7159 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7160 dialogue is shown. Some of the log lines shown may not actually be written to
7161 the log if the setting of <option>log_selector</option> discards them. Any relevant
7162 selectors are shown with each log line. If none are shown, the logging is
7163 unconditional.
7164 </para>
7165 </listitem></varlistentry>
7166 <varlistentry>
7167 <term><option>-x</option></term>
7168 <listitem>
7169 <para>
7170 <indexterm role="option">
7171 <primary><option>-x</option></primary>
7172 </indexterm>
7173 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7174 National Language Support extended characters in the body of the mail item</quote>).
7175 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7176 this option.
7177 </para>
7178 </listitem></varlistentry>
7179 <varlistentry>
7180 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7181 <listitem>
7182 <para>
7183 <indexterm role="option">
7184 <primary><option>-X</option></primary>
7185 </indexterm>
7186 This option is interpreted by Sendmail to cause debug information to be sent
7187 to the named file.  It is ignored by Exim.
7188 </para>
7189 </listitem></varlistentry>
7190 </variablelist>
7191 <para>
7192 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7193 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7194 </para>
7195 <!-- === End of command line options === -->
7196 </section>
7197 </chapter>
7198
7199 <chapter id="CHAPconf">
7200 <title>The Exim run time configuration file</title>
7201 <titleabbrev>The runtime configuration file</titleabbrev>
7202 <para>
7203 <indexterm role="concept">
7204 <primary>run time configuration</primary>
7205 </indexterm>
7206 <indexterm role="concept">
7207 <primary>configuration file</primary>
7208 <secondary>general description</secondary>
7209 </indexterm>
7210 <indexterm role="concept">
7211 <primary>CONFIGURE_FILE</primary>
7212 </indexterm>
7213 <indexterm role="concept">
7214 <primary>configuration file</primary>
7215 <secondary>errors in</secondary>
7216 </indexterm>
7217 <indexterm role="concept">
7218 <primary>error</primary>
7219 <secondary>in configuration file</secondary>
7220 </indexterm>
7221 <indexterm role="concept">
7222 <primary>return code</primary>
7223 <secondary>for bad configuration</secondary>
7224 </indexterm>
7225 Exim uses a single run time configuration file that is read whenever an Exim
7226 binary is executed. Note that in normal operation, this happens frequently,
7227 because Exim is designed to operate in a distributed manner, without central
7228 control.
7229 </para>
7230 <para>
7231 If a syntax error is detected while reading the configuration file, Exim
7232 writes a message on the standard error, and exits with a non-zero return code.
7233 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7234 errors can be detected at this time. The values of any expanded options are
7235 not checked until the expansion happens, even when the expansion does not
7236 actually alter the string.
7237 </para>
7238 <para>
7239 The name of the configuration file is compiled into the binary for security
7240 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7241 most configurations, this specifies a single file. However, it is permitted to
7242 give a colon-separated list of file names, in which case Exim uses the first
7243 existing file in the list.
7244 </para>
7245 <para>
7246 <indexterm role="concept">
7247 <primary>EXIM_USER</primary>
7248 </indexterm>
7249 <indexterm role="concept">
7250 <primary>EXIM_GROUP</primary>
7251 </indexterm>
7252 <indexterm role="concept">
7253 <primary>CONFIGURE_OWNER</primary>
7254 </indexterm>
7255 <indexterm role="concept">
7256 <primary>CONFIGURE_GROUP</primary>
7257 </indexterm>
7258 <indexterm role="concept">
7259 <primary>configuration file</primary>
7260 <secondary>ownership</secondary>
7261 </indexterm>
7262 <indexterm role="concept">
7263 <primary>ownership</primary>
7264 <secondary>configuration file</secondary>
7265 </indexterm>
7266 The run time configuration file must be owned by root or by the user that is
7267 specified at compile time by the CONFIGURE_OWNER option (if set). The
7268 configuration file must not be world-writeable, or group-writeable unless its
7269 group is the root group or the one specified at compile time by the
7270 CONFIGURE_GROUP option.
7271 </para>
7272 <para>
7273 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7274 to root, anybody who is able to edit the run time configuration file has an
7275 easy way to run commands as root. If you specify a user or group in the
7276 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7277 who are members of that group will trivially be able to obtain root privileges.
7278 </para>
7279 <para>
7280 Up to Exim version 4.72, the run time configuration file was also permitted to
7281 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7282 since it offered a simple privilege escalation for any attacker who managed to
7283 compromise the Exim user account.
7284 </para>
7285 <para>
7286 A default configuration file, which will work correctly in simple situations,
7287 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7288 defines just one file name, the installation process copies the default
7289 configuration to a new file of that name if it did not previously exist. If
7290 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7291 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7292 configuration.
7293 </para>
7294 <section id="SECID40">
7295 <title>Using a different configuration file</title>
7296 <para>
7297 <indexterm role="concept">
7298 <primary>configuration file</primary>
7299 <secondary>alternate</secondary>
7300 </indexterm>
7301 A one-off alternate configuration can be specified by the <option>-C</option> command line
7302 option, which may specify a single file or a list of files. However, when
7303 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7304 unless the argument for <option>-C</option> is identical to the built-in value from
7305 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7306 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7307 is useful mainly for checking the syntax of configuration files before
7308 installing them. No owner or group checks are done on a configuration file
7309 specified by <option>-C</option>, if root privilege has been dropped.
7310 </para>
7311 <para>
7312 Even the Exim user is not trusted to specify an arbitrary configuration file
7313 with the <option>-C</option> option to be used with root privileges, unless that file is
7314 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7315 testing a configuration using <option>-C</option> right through message reception and
7316 delivery, even if the caller is root. The reception works, but by that time,
7317 Exim is running as the Exim user, so when it re-execs to regain privilege for
7318 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7319 can test reception and delivery using two separate commands (one to put a
7320 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7321 <option>-M</option>).
7322 </para>
7323 <para>
7324 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7325 prefix string with which any file named in a <option>-C</option> command line option must
7326 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7327 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7328 name can be used with <option>-C</option>.
7329 </para>
7330 <para>
7331 One-off changes to a configuration can be specified by the <option>-D</option> command line
7332 option, which defines and overrides values for macros used inside the
7333 configuration file. However, like <option>-C</option>, the use of this option by a
7334 non-privileged user causes Exim to discard its root privilege.
7335 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7336 completely disabled, and its use causes an immediate error exit.
7337 </para>
7338 <para>
7339 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7340 to declare certain macro names trusted, such that root privilege will not
7341 necessarily be discarded.
7342 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7343 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7344 values are acceptable, then Exim will not give up root privilege if the caller
7345 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7346 transition mechanism and is expected to be removed in the future.  Acceptable
7347 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7348 </para>
7349 <para>
7350 Some sites may wish to use the same Exim binary on different machines that
7351 share a file system, but to use different configuration files on each machine.
7352 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7353 looks for a file whose name is the configuration file name followed by a dot
7354 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7355 file does not exist, the standard name is tried. This processing occurs for
7356 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7357 </para>
7358 <para>
7359 In some esoteric situations different versions of Exim may be run under
7360 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7361 help with this. See the comments in <filename>src/EDITME</filename> for details.
7362 </para>
7363 </section>
7364 <section id="SECTconffilfor">
7365 <title>Configuration file format</title>
7366 <para>
7367 <indexterm role="concept">
7368 <primary>configuration file</primary>
7369 <secondary>format of</secondary>
7370 </indexterm>
7371 <indexterm role="concept">
7372 <primary>format</primary>
7373 <secondary>configuration file</secondary>
7374 </indexterm>
7375 Exim&#x2019;s configuration file is divided into a number of different parts. General
7376 option settings must always appear at the start of the file. The other parts
7377 are all optional, and may appear in any order. Each part other than the first
7378 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7379 optional parts are:
7380 </para>
7381 <itemizedlist>
7382 <listitem>
7383 <para>
7384 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7385 <xref linkend="CHAPACL"/>).
7386 </para>
7387 </listitem>
7388 <listitem>
7389 <para>
7390 <indexterm role="concept">
7391 <primary>AUTH</primary>
7392 <secondary>configuration</secondary>
7393 </indexterm>
7394 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7395 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7396 </para>
7397 </listitem>
7398 <listitem>
7399 <para>
7400 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7401 addresses and determine how the message is to be delivered (see chapters
7402 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7403 </para>
7404 </listitem>
7405 <listitem>
7406 <para>
7407 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7408 define mechanisms for copying messages to destinations (see chapters
7409 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7410 </para>
7411 </listitem>
7412 <listitem>
7413 <para>
7414 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7415 If there is no retry section, or if it is empty (that is, no retry rules are
7416 defined), Exim will not retry deliveries. In this situation, temporary errors
7417 are treated the same as permanent errors. Retry rules are discussed in chapter
7418 <xref linkend="CHAPretry"/>.
7419 </para>
7420 </listitem>
7421 <listitem>
7422 <para>
7423 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7424 when new addresses are generated during delivery. Rewriting is discussed in
7425 chapter <xref linkend="CHAPrewrite"/>.
7426 </para>
7427 </listitem>
7428 <listitem>
7429 <para>
7430 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7431 want to use this feature, you must set
7432 </para>
7433 <literallayout class="monospaced">
7434 LOCAL_SCAN_HAS_OPTIONS=yes
7435 </literallayout>
7436 <para>
7437 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7438 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7439 </para>
7440 </listitem>
7441 </itemizedlist>
7442 <para>
7443 <indexterm role="concept">
7444 <primary>configuration file</primary>
7445 <secondary>leading white space in</secondary>
7446 </indexterm>
7447 <indexterm role="concept">
7448 <primary>configuration file</primary>
7449 <secondary>trailing white space in</secondary>
7450 </indexterm>
7451 <indexterm role="concept">
7452 <primary>white space</primary>
7453 <secondary>in configuration file</secondary>
7454 </indexterm>
7455 Leading and trailing white space in configuration lines is always ignored.
7456 </para>
7457 <para>
7458 Blank lines in the file, and lines starting with a # character (ignoring
7459 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7460 # character other than at the beginning of a line is not treated specially,
7461 and does not introduce a comment.
7462 </para>
7463 <para>
7464 Any non-comment line can be continued by ending it with a backslash. Note that
7465 the general rule for white space means that trailing white space after the
7466 backslash and leading white space at the start of continuation
7467 lines is ignored. Comment lines beginning with # (but not empty lines) may
7468 appear in the middle of a sequence of continuation lines.
7469 </para>
7470 <para>
7471 A convenient way to create a configuration file is to start from the
7472 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7473 change settings as required.
7474 </para>
7475 <para>
7476 The ACLs, retry rules, and rewriting rules have their own syntax which is
7477 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7478 respectively. The other parts of the configuration file have some syntactic
7479 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7480 onwards. Before that, the inclusion, macro, and conditional facilities are
7481 described.
7482 </para>
7483 </section>
7484 <section id="SECID41">
7485 <title>File inclusions in the configuration file</title>
7486 <para>
7487 <indexterm role="concept">
7488 <primary>inclusions in configuration file</primary>
7489 </indexterm>
7490 <indexterm role="concept">
7491 <primary>configuration file</primary>
7492 <secondary>including other files</secondary>
7493 </indexterm>
7494 <indexterm role="concept">
7495 <primary><literal>.include</literal> in configuration file</primary>
7496 </indexterm>
7497 <indexterm role="concept">
7498 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7499 </indexterm>
7500 You can include other files inside Exim&#x2019;s run time configuration file by
7501 using this syntax:
7502 </para>
7503 <literallayout>
7504 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7505 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7506 </literallayout>
7507 <para>
7508 on a line by itself. Double quotes round the file name are optional. If you use
7509 the first form, a configuration error occurs if the file does not exist; the
7510 second form does nothing for non-existent files. In all cases, an absolute file
7511 name is required.
7512 </para>
7513 <para>
7514 Includes may be nested to any depth, but remember that Exim reads its
7515 configuration file often, so it is a good idea to keep them to a minimum.
7516 If you change the contents of an included file, you must HUP the daemon,
7517 because an included file is read only when the configuration itself is read.
7518 </para>
7519 <para>
7520 The processing of inclusions happens early, at a physical line level, so, like
7521 comment lines, an inclusion can be used in the middle of an option setting,
7522 for example:
7523 </para>
7524 <literallayout class="monospaced">
7525 hosts_lookup = a.b.c \
7526                .include /some/file
7527 </literallayout>
7528 <para>
7529 Include processing happens after macro processing (see below). Its effect is to
7530 process the lines of the included file as if they occurred inline where the
7531 inclusion appears.
7532 </para>
7533 </section>
7534 <section id="SECTmacrodefs">
7535 <title>Macros in the configuration file</title>
7536 <para>
7537 <indexterm role="concept">
7538 <primary>macro</primary>
7539 <secondary>description of</secondary>
7540 </indexterm>
7541 <indexterm role="concept">
7542 <primary>configuration file</primary>
7543 <secondary>macros</secondary>
7544 </indexterm>
7545 If a line in the main part of the configuration (that is, before the first
7546 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7547 definition, and must be of the form
7548 </para>
7549 <literallayout>
7550 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7551 </literallayout>
7552 <para>
7553 The name must consist of letters, digits, and underscores, and need not all be
7554 in upper case, though that is recommended. The rest of the line, including any
7555 continuations, is the replacement text, and has leading and trailing white
7556 space removed. Quotes are not removed. The replacement text can never end with
7557 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7558 </para>
7559 <para>
7560 Macros may also be defined between router, transport, authenticator, or ACL
7561 definitions. They may not, however, be defined within an individual driver or
7562 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7563 </para>
7564 </section>
7565 <section id="SECID42">
7566 <title>Macro substitution</title>
7567 <para>
7568 Once a macro is defined, all subsequent lines in the file (and any included
7569 files) are scanned for the macro name; if there are several macros, the line is
7570 scanned for each in turn, in the order in which the macros are defined. The
7571 replacement text is not re-scanned for the current macro, though it is scanned
7572 for subsequently defined macros. For this reason, a macro name may not contain
7573 the name of a previously defined macro as a substring. You could, for example,
7574 define
7575 </para>
7576 <literallayout>
7577 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7578 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7579 </literallayout>
7580 <para>
7581 but putting the definitions in the opposite order would provoke a configuration
7582 error. Macro expansion is applied to individual physical lines from the file,
7583 before checking for line continuation or file inclusion (see above). If a line
7584 consists solely of a macro name, and the expansion of the macro is empty, the
7585 line is ignored. A macro at the start of a line may turn the line into a
7586 comment line or a <literal>.include</literal> line.
7587 </para>
7588 </section>
7589 <section id="SECID43">
7590 <title>Redefining macros</title>
7591 <para>
7592 Once defined, the value of a macro can be redefined later in the configuration
7593 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7594 <emphasis>=</emphasis>. For example:
7595 </para>
7596 <literallayout class="monospaced">
7597 MAC =  initial value
7598 ...
7599 MAC == updated value
7600 </literallayout>
7601 <para>
7602 Redefinition does not alter the order in which the macros are applied to the
7603 subsequent lines of the configuration file. It is still the same order in which
7604 the macros were originally defined. All that changes is the macro&#x2019;s value.
7605 Redefinition makes it possible to accumulate values. For example:
7606 </para>
7607 <literallayout class="monospaced">
7608 MAC =  initial value
7609 ...
7610 MAC == MAC and something added
7611 </literallayout>
7612 <para>
7613 This can be helpful in situations where the configuration file is built
7614 from a number of other files.
7615 </para>
7616 </section>
7617 <section id="SECID44">
7618 <title>Overriding macro values</title>
7619 <para>
7620 The values set for macros in the configuration file can be overridden by the
7621 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7622 used, unless called by root or the Exim user. A definition on the command line
7623 using the <option>-D</option> option causes all definitions and redefinitions within the
7624 file to be ignored.
7625 </para>
7626 </section>
7627 <section id="SECID45">
7628 <title>Example of macro usage</title>
7629 <para>
7630 As an example of macro usage, consider a configuration where aliases are looked
7631 up in a MySQL database. It helps to keep the file less cluttered if long
7632 strings such as SQL statements are defined separately as macros, for example:
7633 </para>
7634 <literallayout class="monospaced">
7635 ALIAS_QUERY = select mailbox from user where \
7636               login='${quote_mysql:$local_part}';
7637 </literallayout>
7638 <para>
7639 This can then be used in a <command>redirect</command> router setting like this:
7640 </para>
7641 <literallayout class="monospaced">
7642 data = ${lookup mysql{ALIAS_QUERY}}
7643 </literallayout>
7644 <para>
7645 In earlier versions of Exim macros were sometimes used for domain, host, or
7646 address lists. In Exim 4 these are handled better by named lists &ndash; see
7647 section <xref linkend="SECTnamedlists"/>.
7648 </para>
7649 </section>
7650 <section id="SECID46">
7651 <title>Conditional skips in the configuration file</title>
7652 <para>
7653 <indexterm role="concept">
7654 <primary>configuration file</primary>
7655 <secondary>conditional skips</secondary>
7656 </indexterm>
7657 <indexterm role="concept">
7658 <primary><literal>.ifdef</literal></primary>
7659 </indexterm>
7660 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7661 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7662 portions of the configuration file. The processing happens whenever the file is
7663 read (that is, when an Exim binary starts to run).
7664 </para>
7665 <para>
7666 The implementation is very simple. Instances of the first four directives must
7667 be followed by text that includes the names of one or macros. The condition
7668 that is tested is whether or not any macro substitution has taken place in the
7669 line. Thus:
7670 </para>
7671 <literallayout class="monospaced">
7672 .ifdef AAA
7673 message_size_limit = 50M
7674 .else
7675 message_size_limit = 100M
7676 .endif
7677 </literallayout>
7678 <para>
7679 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7680 otherwise. If there is more than one macro named on the line, the condition
7681 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7682 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7683 </para>
7684 <para>
7685 Although you can use a macro expansion to generate one of these directives,
7686 it is not very useful, because the condition <quote>there was a macro substitution
7687 in this line</quote> will always be true.
7688 </para>
7689 <para>
7690 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7691 to clarify complicated nestings.
7692 </para>
7693 </section>
7694 <section id="SECTcos">
7695 <title>Common option syntax</title>
7696 <para>
7697 <indexterm role="concept">
7698 <primary>common option syntax</primary>
7699 </indexterm>
7700 <indexterm role="concept">
7701 <primary>syntax of common options</primary>
7702 </indexterm>
7703 <indexterm role="concept">
7704 <primary>configuration file</primary>
7705 <secondary>common option syntax</secondary>
7706 </indexterm>
7707 For the main set of options, driver options, and <function>local_scan()</function> options,
7708 each setting is on a line by itself, and starts with a name consisting of
7709 lower-case letters and underscores. Many options require a data value, and in
7710 these cases the name must be followed by an equals sign (with optional white
7711 space) and then the value. For example:
7712 </para>
7713 <literallayout class="monospaced">
7714 qualify_domain = mydomain.example.com
7715 </literallayout>
7716 <para>
7717 <indexterm role="concept">
7718 <primary>hiding configuration option values</primary>
7719 </indexterm>
7720 <indexterm role="concept">
7721 <primary>configuration options</primary>
7722 <secondary>hiding value of</secondary>
7723 </indexterm>
7724 <indexterm role="concept">
7725 <primary>options</primary>
7726 <secondary>hiding value of</secondary>
7727 </indexterm>
7728 Some option settings may contain sensitive data, for example, passwords for
7729 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7730 line option to read these values, you can precede the option settings with the
7731 word <quote>hide</quote>. For example:
7732 </para>
7733 <literallayout class="monospaced">
7734 hide mysql_servers = localhost/users/admin/secret-password
7735 </literallayout>
7736 <para>
7737 For non-admin users, such options are displayed like this:
7738 </para>
7739 <literallayout class="monospaced">
7740 mysql_servers = &lt;value not displayable&gt;
7741 </literallayout>
7742 <para>
7743 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7744 all instances of the same driver.
7745 </para>
7746 <para>
7747 The following sections describe the syntax used for the different data types
7748 that are found in option settings.
7749 </para>
7750 </section>
7751 <section id="SECID47">
7752 <title>Boolean options</title>
7753 <para>
7754 <indexterm role="concept">
7755 <primary>format</primary>
7756 <secondary>boolean</secondary>
7757 </indexterm>
7758 <indexterm role="concept">
7759 <primary>boolean configuration values</primary>
7760 </indexterm>
7761 <indexterm role="option">
7762 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7763 </indexterm>
7764 <indexterm role="option">
7765 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7766 </indexterm>
7767 Options whose type is given as boolean are on/off switches. There are two
7768 different ways of specifying such options: with and without a data value. If
7769 the option name is specified on its own without data, the switch is turned on;
7770 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7771 boolean options may be followed by an equals sign and one of the words
7772 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7773 the following two settings have exactly the same effect:
7774 </para>
7775 <literallayout class="monospaced">
7776 queue_only
7777 queue_only = true
7778 </literallayout>
7779 <para>
7780 The following two lines also have the same (opposite) effect:
7781 </para>
7782 <literallayout class="monospaced">
7783 no_queue_only
7784 queue_only = false
7785 </literallayout>
7786 <para>
7787 You can use whichever syntax you prefer.
7788 </para>
7789 </section>
7790 <section id="SECID48">
7791 <title>Integer values</title>
7792 <para>
7793 <indexterm role="concept">
7794 <primary>integer configuration values</primary>
7795 </indexterm>
7796 <indexterm role="concept">
7797 <primary>format</primary>
7798 <secondary>integer</secondary>
7799 </indexterm>
7800 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7801 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7802 number is assumed. Otherwise, it is treated as an octal number unless it starts
7803 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7804 hexadecimal number.
7805 </para>
7806 <para>
7807 If an integer value is followed by the letter K, it is multiplied by 1024; if
7808 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7809 of integer option settings are output, values which are an exact multiple of
7810 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7811 and M. The printing style is independent of the actual input format that was
7812 used.
7813 </para>
7814 </section>
7815 <section id="SECID49">
7816 <title>Octal integer values</title>
7817 <para>
7818 <indexterm role="concept">
7819 <primary>integer format</primary>
7820 </indexterm>
7821 <indexterm role="concept">
7822 <primary>format</primary>
7823 <secondary>octal integer</secondary>
7824 </indexterm>
7825 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7826 interpreted as an octal number, whether or not it starts with the digit zero.
7827 Such options are always output in octal.
7828 </para>
7829 </section>
7830 <section id="SECID50">
7831 <title>Fixed point numbers</title>
7832 <para>
7833 <indexterm role="concept">
7834 <primary>fixed point configuration values</primary>
7835 </indexterm>
7836 <indexterm role="concept">
7837 <primary>format</primary>
7838 <secondary>fixed point</secondary>
7839 </indexterm>
7840 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7841 integer, optionally followed by a decimal point and up to three further digits.
7842 </para>
7843 </section>
7844 <section id="SECTtimeformat">
7845 <title>Time intervals</title>
7846 <para>
7847 <indexterm role="concept">
7848 <primary>time interval</primary>
7849 <secondary>specifying in configuration</secondary>
7850 </indexterm>
7851 <indexterm role="concept">
7852 <primary>format</primary>
7853 <secondary>time interval</secondary>
7854 </indexterm>
7855 A time interval is specified as a sequence of numbers, each followed by one of
7856 the following letters, with no intervening white space:
7857 </para>
7858 <informaltable frame="none">
7859 <tgroup cols="2" colsep="0" rowsep="0">
7860 <colspec colwidth="30pt" align="left"/>
7861 <colspec colwidth="254pt" align="left"/>
7862 <tbody>
7863 <row>
7864 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7865 <entry>seconds</entry>
7866 </row>
7867 <row>
7868 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7869 <entry>minutes</entry>
7870 </row>
7871 <row>
7872 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7873 <entry>hours</entry>
7874 </row>
7875 <row>
7876 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7877 <entry>days</entry>
7878 </row>
7879 <row>
7880 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7881 <entry>weeks</entry>
7882 </row>
7883 </tbody>
7884 </tgroup>
7885 </informaltable>
7886 <para>
7887 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7888 intervals are output in the same format. Exim does not restrict the values; it
7889 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7890 </para>
7891 </section>
7892 <section id="SECTstrings">
7893 <title>String values</title>
7894 <para>
7895 <indexterm role="concept">
7896 <primary>string</primary>
7897 <secondary>format of configuration values</secondary>
7898 </indexterm>
7899 <indexterm role="concept">
7900 <primary>format</primary>
7901 <secondary>string</secondary>
7902 </indexterm>
7903 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7904 or without double-quotes. If it does not start with a double-quote, the value
7905 consists of the remainder of the line plus any continuation lines, starting at
7906 the first character after any leading white space, with trailing white space
7907 removed, and with no interpretation of the characters in the string. Because
7908 Exim removes comment lines (those beginning with #) at an early stage, they can
7909 appear in the middle of a multi-line string. The following two settings are
7910 therefore equivalent:
7911 </para>
7912 <literallayout class="monospaced">
7913 trusted_users = uucp:mail
7914 trusted_users = uucp:\
7915                 # This comment line is ignored
7916                 mail
7917 </literallayout>
7918 <para>
7919 <indexterm role="concept">
7920 <primary>string</primary>
7921 <secondary>quoted</secondary>
7922 </indexterm>
7923 <indexterm role="concept">
7924 <primary>escape characters in quoted strings</primary>
7925 </indexterm>
7926 If a string does start with a double-quote, it must end with a closing
7927 double-quote, and any backslash characters other than those used for line
7928 continuation are interpreted as escape characters, as follows:
7929 </para>
7930 <informaltable frame="none">
7931 <tgroup cols="2" colsep="0" rowsep="0">
7932 <colspec colwidth="100pt" align="left"/>
7933 <colspec colwidth="254pt" align="left"/>
7934 <tbody>
7935 <row>
7936 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7937 <entry>single backslash</entry>
7938 </row>
7939 <row>
7940 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7941 <entry>newline</entry>
7942 </row>
7943 <row>
7944 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7945 <entry>carriage return</entry>
7946 </row>
7947 <row>
7948 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7949 <entry>tab</entry>
7950 </row>
7951 <row>
7952 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7953 <entry>up to 3 octal digits specify one character</entry>
7954 </row>
7955 <row>
7956 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7957 <entry>up to 2 hexadecimal digits specify one character</entry>
7958 </row>
7959 </tbody>
7960 </tgroup>
7961 </informaltable>
7962 <para>
7963 If a backslash is followed by some other character, including a double-quote
7964 character, that character replaces the pair.
7965 </para>
7966 <para>
7967 Quoting is necessary only if you want to make use of the backslash escapes to
7968 insert special characters, or if you need to specify a value with leading or
7969 trailing spaces. These cases are rare, so quoting is almost never needed in
7970 current versions of Exim. In versions of Exim before 3.14, quoting was required
7971 in order to continue lines, so you may come across older configuration files
7972 and examples that apparently quote unnecessarily.
7973 </para>
7974 </section>
7975 <section id="SECID51">
7976 <title>Expanded strings</title>
7977 <para>
7978 <indexterm role="concept">
7979 <primary>expansion</primary>
7980 <secondary>definition of</secondary>
7981 </indexterm>
7982 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7983 by which means various parts of the string may be changed according to the
7984 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7985 is as just described; in particular, the handling of backslashes in quoted
7986 strings is done as part of the input process, before expansion takes place.
7987 However, backslash is also an escape character for the expander, so any
7988 backslashes that are required for that reason must be doubled if they are
7989 within a quoted configuration string.
7990 </para>
7991 </section>
7992 <section id="SECID52">
7993 <title>User and group names</title>
7994 <para>
7995 <indexterm role="concept">
7996 <primary>user name</primary>
7997 <secondary>format of</secondary>
7998 </indexterm>
7999 <indexterm role="concept">
8000 <primary>format</primary>
8001 <secondary>user name</secondary>
8002 </indexterm>
8003 <indexterm role="concept">
8004 <primary>groups</primary>
8005 <secondary>name format</secondary>
8006 </indexterm>
8007 <indexterm role="concept">
8008 <primary>format</primary>
8009 <secondary>group name</secondary>
8010 </indexterm>
8011 User and group names are specified as strings, using the syntax described
8012 above, but the strings are interpreted specially. A user or group name must
8013 either consist entirely of digits, or be a name that can be looked up using the
8014 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8015 </para>
8016 </section>
8017 <section id="SECTlistconstruct">
8018 <title>List construction</title>
8019 <para>
8020 <indexterm role="concept">
8021 <primary>list</primary>
8022 <secondary>syntax of in configuration</secondary>
8023 </indexterm>
8024 <indexterm role="concept">
8025 <primary>format</primary>
8026 <secondary>list item in configuration</secondary>
8027 </indexterm>
8028 <indexterm role="concept">
8029 <primary>string</primary>
8030 <secondary>list, definition of</secondary>
8031 </indexterm>
8032 The data for some configuration options is a list of items, with colon as the
8033 default separator. Many of these options are shown with type <quote>string list</quote> in
8034 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8035 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8036 are all the same; however, those other than <quote>string list</quote> are subject to
8037 particular kinds of interpretation, as described in chapter
8038 <xref linkend="CHAPdomhosaddlists"/>.
8039 </para>
8040 <para>
8041 In all these cases, the entire list is treated as a single string as far as the
8042 input syntax is concerned. The <option>trusted_users</option> setting in section
8043 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8044 in a list, it must be entered as two colons. Leading and trailing white space
8045 on each item in a list is ignored. This makes it possible to include items that
8046 start with a colon, and in particular, certain forms of IPv6 address. For
8047 example, the list
8048 </para>
8049 <literallayout class="monospaced">
8050 local_interfaces = 127.0.0.1 : ::::1
8051 </literallayout>
8052 <para>
8053 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8054 </para>
8055 <para>
8056 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8057 list items, it is not ignored when parsing the list. The space after the first
8058 colon in the example above is necessary. If it were not there, the list would
8059 be interpreted as the two items 127.0.0.1:: and 1.
8060 </para>
8061 </section>
8062 <section id="SECID53">
8063 <title>Changing list separators</title>
8064 <para>
8065 <indexterm role="concept">
8066 <primary>list separator</primary>
8067 <secondary>changing</secondary>
8068 </indexterm>
8069 <indexterm role="concept">
8070 <primary>IPv6</primary>
8071 <secondary>addresses in lists</secondary>
8072 </indexterm>
8073 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8074 introduced to allow the separator character to be changed. If a list begins
8075 with a left angle bracket, followed by any punctuation character, that
8076 character is used instead of colon as the list separator. For example, the list
8077 above can be rewritten to use a semicolon separator like this:
8078 </para>
8079 <literallayout class="monospaced">
8080 local_interfaces = &lt;; 127.0.0.1 ; ::1
8081 </literallayout>
8082 <para>
8083 This facility applies to all lists, with the exception of the list in
8084 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8085 confined to circumstances where they really are needed.
8086 </para>
8087 <para>
8088 <indexterm role="concept">
8089 <primary>list separator</primary>
8090 <secondary>newline as</secondary>
8091 </indexterm>
8092 <indexterm role="concept">
8093 <primary>newline</primary>
8094 <secondary>as list separator</secondary>
8095 </indexterm>
8096 It is also possible to use newline and other control characters (those with
8097 code values less than 32, plus DEL) as separators in lists. Such separators
8098 must be provided literally at the time the list is processed. For options that
8099 are string-expanded, you can write the separator using a normal escape
8100 sequence. This will be processed by the expander before the string is
8101 interpreted as a list. For example, if a newline-separated list of domains is
8102 generated by a lookup, you can process it directly by a line such as this:
8103 </para>
8104 <literallayout class="monospaced">
8105 domains = &lt;\n ${lookup mysql{.....}}
8106 </literallayout>
8107 <para>
8108 This avoids having to change the list separator in such data. You are unlikely
8109 to want to use a control character as a separator in an option that is not
8110 expanded, because the value is literal text. However, it can be done by giving
8111 the value in quotes. For example:
8112 </para>
8113 <literallayout class="monospaced">
8114 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8115 </literallayout>
8116 <para>
8117 Unlike printing character separators, which can be included in list items by
8118 doubling, it is not possible to include a control character as data when it is
8119 set as the separator. Two such characters in succession are interpreted as
8120 enclosing an empty list item.
8121 </para>
8122 </section>
8123 <section id="SECTempitelis">
8124 <title>Empty items in lists</title>
8125 <para>
8126 <indexterm role="concept">
8127 <primary>list</primary>
8128 <secondary>empty item in</secondary>
8129 </indexterm>
8130 An empty item at the end of a list is always ignored. In other words, trailing
8131 separator characters are ignored. Thus, the list in
8132 </para>
8133 <literallayout class="monospaced">
8134 senders = user@domain :
8135 </literallayout>
8136 <para>
8137 contains only a single item. If you want to include an empty string as one item
8138 in a list, it must not be the last item. For example, this list contains three
8139 items, the second of which is empty:
8140 </para>
8141 <literallayout class="monospaced">
8142 senders = user1@domain : : user2@domain
8143 </literallayout>
8144 <para>
8145 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8146 are interpreted as representing a single colon data character (and the list
8147 would then contain just one item). If you want to specify a list that contains
8148 just one, empty item, you can do it as in this example:
8149 </para>
8150 <literallayout class="monospaced">
8151 senders = :
8152 </literallayout>
8153 <para>
8154 In this case, the first item is empty, and the second is discarded because it
8155 is at the end of the list.
8156 </para>
8157 </section>
8158 <section id="SECTfordricon">
8159 <title>Format of driver configurations</title>
8160 <para>
8161 <indexterm role="concept">
8162 <primary>drivers</primary>
8163 <secondary>configuration format</secondary>
8164 </indexterm>
8165 There are separate parts in the configuration for defining routers, transports,
8166 and authenticators. In each part, you are defining a number of driver
8167 instances, each with its own set of options. Each driver instance is defined by
8168 a sequence of lines like this:
8169 </para>
8170 <literallayout>
8171 &lt;<emphasis>instance name</emphasis>&gt;:
8172   &lt;<emphasis>option</emphasis>&gt;
8173   ...
8174   &lt;<emphasis>option</emphasis>&gt;
8175 </literallayout>
8176 <para>
8177 In the following example, the instance name is <command>localuser</command>, and it is
8178 followed by three options settings:
8179 </para>
8180 <literallayout class="monospaced">
8181 localuser:
8182   driver = accept
8183   check_local_user
8184   transport = local_delivery
8185 </literallayout>
8186 <para>
8187 For each driver instance, you specify which Exim code module it uses &ndash; by the
8188 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8189 settings. For example, in the case of transports, if you want a transport to
8190 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8191 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8192 described in detail in its own separate chapter later in this manual.
8193 </para>
8194 <para>
8195 You can have several routers, transports, or authenticators that are based on
8196 the same underlying driver (each must have a different instance name).
8197 </para>
8198 <para>
8199 The order in which routers are defined is important, because addresses are
8200 passed to individual routers one by one, in order. The order in which
8201 transports are defined does not matter at all. The order in which
8202 authenticators are defined is used only when Exim, as a client, is searching
8203 them to find one that matches an authentication mechanism offered by the
8204 server.
8205 </para>
8206 <para>
8207 <indexterm role="concept">
8208 <primary>generic options</primary>
8209 </indexterm>
8210 <indexterm role="concept">
8211 <primary>options</primary>
8212 <secondary>generic &ndash; definition of</secondary>
8213 </indexterm>
8214 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8215 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8216 same type (that is, all routers, all transports or all authenticators). The
8217 <option>driver</option> option is a generic option that must appear in every definition.
8218 <indexterm role="concept">
8219 <primary>private options</primary>
8220 </indexterm>
8221 The private options are special for each driver, and none need appear, because
8222 they all have default values.
8223 </para>
8224 <para>
8225 The options may appear in any order, except that the <option>driver</option> option must
8226 precede any private options, since these depend on the particular driver. For
8227 this reason, it is recommended that <option>driver</option> always be the first option.
8228 </para>
8229 <para>
8230 Driver instance names, which are used for reference in log entries and
8231 elsewhere, can be any sequence of letters, digits, and underscores (starting
8232 with a letter) and must be unique among drivers of the same type. A router and
8233 a transport (for example) can each have the same name, but no two router
8234 instances can have the same name. The name of a driver instance should not be
8235 confused with the name of the underlying driver module. For example, the
8236 configuration lines:
8237 </para>
8238 <literallayout class="monospaced">
8239 remote_smtp:
8240   driver = smtp
8241 </literallayout>
8242 <para>
8243 create an instance of the <command>smtp</command> transport driver whose name is
8244 <command>remote_smtp</command>. The same driver code can be used more than once, with
8245 different instance names and different option settings each time. A second
8246 instance of the <command>smtp</command> transport, with different options, might be defined
8247 thus:
8248 </para>
8249 <literallayout class="monospaced">
8250 special_smtp:
8251   driver = smtp
8252   port = 1234
8253   command_timeout = 10s
8254 </literallayout>
8255 <para>
8256 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8257 these transport instances from routers, and these names would appear in log
8258 lines.
8259 </para>
8260 <para>
8261 Comment lines may be present in the middle of driver specifications. The full
8262 list of option settings for any particular driver instance, including all the
8263 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8264 option.
8265 </para>
8266 </section>
8267 </chapter>
8268
8269 <chapter id="CHAPdefconfil">
8270 <title>The default configuration file</title>
8271 <para>
8272 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8273 <primary>configuration file</primary>
8274 <secondary>default <quote>walk through</quote></secondary>
8275 </indexterm>
8276 <indexterm role="concept">
8277 <primary>default</primary>
8278 <secondary>configuration file <quote>walk through</quote></secondary>
8279 </indexterm>
8280 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8281 is sufficient for a host with simple mail requirements. As an introduction to
8282 the way Exim is configured, this chapter <quote>walks through</quote> the default
8283 configuration, giving brief explanations of the settings. Detailed descriptions
8284 of the options are given in subsequent chapters. The default configuration file
8285 itself contains extensive comments about ways you might want to modify the
8286 initial settings. However, note that there are many options that are not
8287 mentioned at all in the default configuration.
8288 </para>
8289 <section id="SECTdefconfmain">
8290 <title>Main configuration settings</title>
8291 <para>
8292 The main (global) configuration option settings must always come first in the
8293 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8294 the line
8295 </para>
8296 <literallayout class="monospaced">
8297 # primary_hostname =
8298 </literallayout>
8299 <para>
8300 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8301 to know the official, fully qualified name of your host, and this is where you
8302 can specify it. However, in most cases you do not need to set this option. When
8303 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8304 </para>
8305 <para>
8306 The first three non-comment configuration lines are as follows:
8307 </para>
8308 <literallayout class="monospaced">
8309 domainlist local_domains    = @
8310 domainlist relay_to_domains =
8311 hostlist   relay_from_hosts = 127.0.0.1
8312 </literallayout>
8313 <para>
8314 These are not, in fact, option settings. They are definitions of two named
8315 domain lists and one named host list. Exim allows you to give names to lists of
8316 domains, hosts, and email addresses, in order to make it easier to manage the
8317 configuration file (see section <xref linkend="SECTnamedlists"/>).
8318 </para>
8319 <para>
8320 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8321 later in the configuration to identify domains that are to be delivered
8322 on the local host.
8323 </para>
8324 <para>
8325 <indexterm role="concept">
8326 <primary>@ in a domain list</primary>
8327 </indexterm>
8328 There is just one item in this list, the string <quote>@</quote>. This is a special form
8329 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8330 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8331 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8332 the same configuration file can be used on different hosts.
8333 </para>
8334 <para>
8335 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8336 list itself is empty. Later in the configuration we will come to the part that
8337 controls mail relaying through the local host; it allows relaying to any
8338 domains in this list. By default, therefore, no relaying on the basis of a mail
8339 domain is permitted.
8340 </para>
8341 <para>
8342 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8343 used later in the configuration to permit relaying from any host or IP address
8344 that matches the list. The default contains just the IP address of the IPv4
8345 loopback interface, which means that processes on the local host are able to
8346 submit mail for relaying by sending it over TCP/IP to that interface. No other
8347 hosts are permitted to submit messages for relaying.
8348 </para>
8349 <para>
8350 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8351 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8352 and hosts that will be used in the controls that are specified later.
8353 </para>
8354 <para>
8355 The next two configuration lines are genuine option settings:
8356 </para>
8357 <literallayout class="monospaced">
8358 acl_smtp_rcpt = acl_check_rcpt
8359 acl_smtp_data = acl_check_data
8360 </literallayout>
8361 <para>
8362 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8363 during an incoming SMTP session for every recipient of a message (every RCPT
8364 command), and after the contents of the message have been received,
8365 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8366 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8367 section of the configuration. The RCPT ACL controls which recipients are
8368 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8369 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8370 contents of a message to be checked.
8371 </para>
8372 <para>
8373 Two commented-out option settings are next:
8374 </para>
8375 <literallayout class="monospaced">
8376 # av_scanner = clamd:/tmp/clamd
8377 # spamd_address = 127.0.0.1 783
8378 </literallayout>
8379 <para>
8380 These are example settings that can be used when Exim is compiled with the
8381 content-scanning extension. The first specifies the interface to the virus
8382 scanner, and the second specifies the interface to SpamAssassin. Further
8383 details are given in chapter <xref linkend="CHAPexiscan"/>.
8384 </para>
8385 <para>
8386 Three more commented-out option settings follow:
8387 </para>
8388 <literallayout class="monospaced">
8389 # tls_advertise_hosts = *
8390 # tls_certificate = /etc/ssl/exim.crt
8391 # tls_privatekey = /etc/ssl/exim.pem
8392 </literallayout>
8393 <para>
8394 These are example settings that can be used when Exim is compiled with
8395 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8396 first one specifies the list of clients that are allowed to use TLS when
8397 connecting to this server; in this case the wildcard means all clients. The
8398 other options specify where Exim should find its TLS certificate and private
8399 key, which together prove the server&#x2019;s identity to any clients that connect.
8400 More details are given in chapter <xref linkend="CHAPTLS"/>.
8401 </para>
8402 <para>
8403 Another two commented-out option settings follow:
8404 </para>
8405 <literallayout class="monospaced">
8406 # daemon_smtp_ports = 25 : 465 : 587
8407 # tls_on_connect_ports = 465
8408 </literallayout>
8409 <para>
8410 <indexterm role="concept">
8411 <primary>port</primary>
8412 <secondary>465 and 587</secondary>
8413 </indexterm>
8414 <indexterm role="concept">
8415 <primary>port</primary>
8416 <secondary>for message submission</secondary>
8417 </indexterm>
8418 <indexterm role="concept">
8419 <primary>message</primary>
8420 <secondary>submission, ports for</secondary>
8421 </indexterm>
8422 <indexterm role="concept">
8423 <primary>ssmtp protocol</primary>
8424 </indexterm>
8425 <indexterm role="concept">
8426 <primary>smtps protocol</primary>
8427 </indexterm>
8428 <indexterm role="concept">
8429 <primary>SMTP</primary>
8430 <secondary>ssmtp protocol</secondary>
8431 </indexterm>
8432 <indexterm role="concept">
8433 <primary>SMTP</primary>
8434 <secondary>smtps protocol</secondary>
8435 </indexterm>
8436 These options provide better support for roaming users who wish to use this
8437 server for message submission. They are not much use unless you have turned on
8438 TLS (as described in the previous paragraph) and authentication (about which
8439 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8440 on end-user networks, so RFC 4409 specifies that message submission should use
8441 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8442 configured to use port 587 correctly, so these settings also enable the
8443 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8444 <xref linkend="SECTsupobssmt"/>).
8445 </para>
8446 <para>
8447 Two more commented-out options settings follow:
8448 </para>
8449 <literallayout class="monospaced">
8450 # qualify_domain =
8451 # qualify_recipient =
8452 </literallayout>
8453 <para>
8454 The first of these specifies a domain that Exim uses when it constructs a
8455 complete email address from a local login name. This is often needed when Exim
8456 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8457 the value of <option>primary_hostname</option> is used. If you set both of these options,
8458 you can have different qualification domains for sender and recipient
8459 addresses. If you set only the first one, its value is used in both cases.
8460 </para>
8461 <para>
8462 <indexterm role="concept">
8463 <primary>domain literal</primary>
8464 <secondary>recognizing format</secondary>
8465 </indexterm>
8466 The following line must be uncommented if you want Exim to recognize
8467 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8468 (an IP address within square brackets) instead of a named domain.
8469 </para>
8470 <literallayout class="monospaced">
8471 # allow_domain_literals
8472 </literallayout>
8473 <para>
8474 The RFCs still require this form, but many people think that in the modern
8475 Internet it makes little sense to permit mail to be sent to specific hosts by
8476 quoting their IP addresses. This ancient format has been used by people who
8477 try to abuse hosts by using them for unwanted relaying. However, some
8478 people believe there are circumstances (for example, messages addressed to
8479 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8480 </para>
8481 <para>
8482 The next configuration line is a kind of trigger guard:
8483 </para>
8484 <literallayout class="monospaced">
8485 never_users = root
8486 </literallayout>
8487 <para>
8488 It specifies that no delivery must ever be run as the root user. The normal
8489 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8490 setting is a guard against slips in the configuration.
8491 The list of users specified by <option>never_users</option> is not, however, the complete
8492 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8493 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8494 contents of <option>never_users</option> are added to this list. By default
8495 FIXED_NEVER_USERS also specifies root.
8496 </para>
8497 <para>
8498 When a remote host connects to Exim in order to send mail, the only information
8499 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8500 line,
8501 </para>
8502 <literallayout class="monospaced">
8503 host_lookup = *
8504 </literallayout>
8505 <para>
8506 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8507 in order to get a host name. This improves the quality of the logging
8508 information, but if you feel it is too expensive, you can remove it entirely,
8509 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8510 Note that it is not always possible to find a host name from an IP address,
8511 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8512 unreachable.
8513 </para>
8514 <para>
8515 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8516 1413 (hence their names):
8517 </para>
8518 <literallayout class="monospaced">
8519 rfc1413_hosts = *
8520 rfc1413_query_timeout = 0s
8521 </literallayout>
8522 <para>
8523 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8524 Few hosts offer RFC1413 service these days; calls have to be
8525 terminated by a timeout and this needlessly delays the startup
8526 of an incoming SMTP connection.
8527 If you have hosts for which you trust RFC1413 and need this
8528 information, you can change this.
8529 </para>
8530 <para>
8531 This line enables an efficiency SMTP option.  It is negotiated by clients
8532 and not expected to cause problems but can be disabled if needed.
8533 </para>
8534 <literallayout class="monospaced">
8535 prdr_enable = true
8536 </literallayout>
8537 <para>
8538 When Exim receives messages over SMTP connections, it expects all addresses to
8539 be fully qualified with a domain, as required by the SMTP definition. However,
8540 if you are running a server to which simple clients submit messages, you may
8541 find that they send unqualified addresses. The two commented-out options:
8542 </para>
8543 <literallayout class="monospaced">
8544 # sender_unqualified_hosts =
8545 # recipient_unqualified_hosts =
8546 </literallayout>
8547 <para>
8548 show how you can specify hosts that are permitted to send unqualified sender
8549 and recipient addresses, respectively.
8550 </para>
8551 <para>
8552 The <option>percent_hack_domains</option> option is also commented out:
8553 </para>
8554 <literallayout class="monospaced">
8555 # percent_hack_domains =
8556 </literallayout>
8557 <para>
8558 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8559 This is an almost obsolete form of explicit email routing. If you do not know
8560 anything about it, you can safely ignore this topic.
8561 </para>
8562 <para>
8563 The last two settings in the main part of the default configuration are
8564 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8565 message is frozen, Exim no longer continues to try to deliver it. Freezing
8566 occurs when a bounce message encounters a permanent failure because the sender
8567 address of the original message that caused the bounce is invalid, so the
8568 bounce cannot be delivered. This is probably the most common case, but there
8569 are also other conditions that cause freezing, and frozen messages are not
8570 always bounce messages.
8571 </para>
8572 <literallayout class="monospaced">
8573 ignore_bounce_errors_after = 2d
8574 timeout_frozen_after = 7d
8575 </literallayout>
8576 <para>
8577 The first of these options specifies that failing bounce messages are to be
8578 discarded after 2 days on the queue. The second specifies that any frozen
8579 message (whether a bounce message or not) is to be timed out (and discarded)
8580 after a week. In this configuration, the first setting ensures that no failing
8581 bounce message ever lasts a week.
8582 </para>
8583 </section>
8584 <section id="SECID54">
8585 <title>ACL configuration</title>
8586 <para>
8587 <indexterm role="concept">
8588 <primary>default</primary>
8589 <secondary>ACLs</secondary>
8590 </indexterm>
8591 <indexterm role="concept">
8592 <primary>access control lists (ACLs)</primary>
8593 <secondary>default configuration</secondary>
8594 </indexterm>
8595 In the default configuration, the ACL section follows the main configuration.
8596 It starts with the line
8597 </para>
8598 <literallayout class="monospaced">
8599 begin acl
8600 </literallayout>
8601 <para>
8602 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8603 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8604 and <option>acl_smtp_data</option> above.
8605 </para>
8606 <para>
8607 <indexterm role="concept">
8608 <primary>RCPT</primary>
8609 <secondary>ACL for</secondary>
8610 </indexterm>
8611 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8612 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8613 are considered in order, until the recipient address is either accepted or
8614 rejected. The RCPT command is then accepted or rejected, according to the
8615 result of the ACL processing.
8616 </para>
8617 <literallayout class="monospaced">
8618 acl_check_rcpt:
8619 </literallayout>
8620 <para>
8621 This line, consisting of a name terminated by a colon, marks the start of the
8622 ACL, and names it.
8623 </para>
8624 <literallayout class="monospaced">
8625 accept  hosts = :
8626 </literallayout>
8627 <para>
8628 This ACL statement accepts the recipient if the sending host matches the list.
8629 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8630 names or IP addresses. The presence of the colon puts an empty item in the
8631 list; Exim matches this only if the incoming message did not come from a remote
8632 host, because in that case, the remote hostname is empty. The colon is
8633 important. Without it, the list itself is empty, and can never match anything.
8634 </para>
8635 <para>
8636 What this statement is doing is to accept unconditionally all recipients in
8637 messages that are submitted by SMTP from local processes using the standard
8638 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8639 manner.
8640 </para>
8641 <literallayout class="monospaced">
8642 deny    message       = Restricted characters in address
8643         domains       = +local_domains
8644         local_parts   = ^[.] : ^.*[@%!/|]
8645
8646 deny    message       = Restricted characters in address
8647         domains       = !+local_domains
8648         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8649 </literallayout>
8650 <para>
8651 These statements are concerned with local parts that contain any of the
8652 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8653 Although these characters are entirely legal in local parts (in the case of
8654 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8655 in Internet mail addresses.
8656 </para>
8657 <para>
8658 The first three have in the past been associated with explicitly routed
8659 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8660 option). Addresses containing these characters are regularly tried by spammers
8661 in an attempt to bypass relaying restrictions, and also by open relay testing
8662 programs. Unless you really need them it is safest to reject these characters
8663 at this early stage. This configuration is heavy-handed in rejecting these
8664 characters for all messages it accepts from remote hosts. This is a deliberate
8665 policy of being as safe as possible.
8666 </para>
8667 <para>
8668 The first rule above is stricter, and is applied to messages that are addressed
8669 to one of the local domains handled by this host. This is implemented by the
8670 first condition, which restricts it to domains that are listed in the
8671 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8672 reference to a named list. In this configuration, there is just one domain in
8673 <emphasis>local_domains</emphasis>, but in general there may be many.
8674 </para>
8675 <para>
8676 The second condition on the first statement uses two regular expressions to
8677 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8678 or <quote>|</quote>. If you have local accounts that include these characters, you will
8679 have to modify this rule.
8680 </para>
8681 <para>
8682 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8683 allows them because they have been encountered in practice. (Consider the
8684 common convention of local parts constructed as
8685 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8686 the author of Exim, who has no second initial.) However, a local part starting
8687 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8688 file name (for example, for a mailing list). This is also true for local parts
8689 that contain slashes. A pipe symbol can also be troublesome if the local part
8690 is incorporated unthinkingly into a shell command line.
8691 </para>
8692 <para>
8693 The second rule above applies to all other domains, and is less strict. This
8694 allows your own users to send outgoing messages to sites that use slashes
8695 and vertical bars in their local parts. It blocks local parts that begin
8696 with a dot, slash, or vertical bar, but allows these characters within the
8697 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8698 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8699 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8700 </para>
8701 <literallayout class="monospaced">
8702 accept  local_parts   = postmaster
8703         domains       = +local_domains
8704 </literallayout>
8705 <para>
8706 This statement, which has two conditions, accepts an incoming address if the
8707 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8708 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8709 reference to a named list. In this configuration, there is just one domain in
8710 <emphasis>local_domains</emphasis>, but in general there may be many.
8711 </para>
8712 <para>
8713 The presence of this statement means that mail to postmaster is never blocked
8714 by any of the subsequent tests. This can be helpful while sorting out problems
8715 in cases where the subsequent tests are incorrectly denying access.
8716 </para>
8717 <literallayout class="monospaced">
8718 require verify        = sender
8719 </literallayout>
8720 <para>
8721 This statement requires the sender address to be verified before any subsequent
8722 ACL statement can be used. If verification fails, the incoming recipient
8723 address is refused. Verification consists of trying to route the address, to
8724 see if a bounce message could be delivered to it. In the case of remote
8725 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8726 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8727 discusses the details of address verification.
8728 </para>
8729 <literallayout class="monospaced">
8730 accept  hosts         = +relay_from_hosts
8731         control       = submission
8732 </literallayout>
8733 <para>
8734 This statement accepts the address if the message is coming from one of the
8735 hosts that are defined as being allowed to relay through this host. Recipient
8736 verification is omitted here, because in many cases the clients are dumb MUAs
8737 that do not cope well with SMTP error responses. For the same reason, the
8738 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8739 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8740 messages that are deficient in some way, for example, because they lack a
8741 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8742 probably add recipient verification here, and disable submission mode.
8743 </para>
8744 <literallayout class="monospaced">
8745 accept  authenticated = *
8746         control       = submission
8747 </literallayout>
8748 <para>
8749 This statement accepts the address if the client host has authenticated itself.
8750 Submission mode is again specified, on the grounds that such messages are most
8751 likely to come from MUAs. The default configuration does not define any
8752 authenticators, though it does include some nearly complete commented-out
8753 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8754 fact authenticate until you complete the authenticator definitions.
8755 </para>
8756 <literallayout class="monospaced">
8757 require message = relay not permitted
8758         domains = +local_domains : +relay_to_domains
8759 </literallayout>
8760 <para>
8761 This statement rejects the address if its domain is neither a local domain nor
8762 one of the domains for which this host is a relay.
8763 </para>
8764 <literallayout class="monospaced">
8765 require verify = recipient
8766 </literallayout>
8767 <para>
8768 This statement requires the recipient address to be verified; if verification
8769 fails, the address is rejected.
8770 </para>
8771 <literallayout class="monospaced">
8772 # deny    message     = rejected because $sender_host_address \
8773 #                       is in a black list at $dnslist_domain\n\
8774 #                       $dnslist_text
8775 #         dnslists    = black.list.example
8776 #
8777 # warn    dnslists    = black.list.example
8778 #         add_header  = X-Warning: $sender_host_address is in \
8779 #                       a black list at $dnslist_domain
8780 #         log_message = found in $dnslist_domain
8781 </literallayout>
8782 <para>
8783 These commented-out lines are examples of how you could configure Exim to check
8784 sending hosts against a DNS black list. The first statement rejects messages
8785 from blacklisted hosts, whereas the second just inserts a warning header
8786 line.
8787 </para>
8788 <literallayout class="monospaced">
8789 # require verify = csa
8790 </literallayout>
8791 <para>
8792 This commented-out line is an example of how you could turn on client SMTP
8793 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8794 records.
8795 </para>
8796 <literallayout class="monospaced">
8797 accept
8798 </literallayout>
8799 <para>
8800 The final statement in the first ACL unconditionally accepts any recipient
8801 address that has successfully passed all the previous tests.
8802 </para>
8803 <literallayout class="monospaced">
8804 acl_check_data:
8805 </literallayout>
8806 <para>
8807 This line marks the start of the second ACL, and names it. Most of the contents
8808 of this ACL are commented out:
8809 </para>
8810 <literallayout class="monospaced">
8811 # deny    malware   = *
8812 #         message   = This message contains a virus \
8813 #                     ($malware_name).
8814 </literallayout>
8815 <para>
8816 These lines are examples of how to arrange for messages to be scanned for
8817 viruses when Exim has been compiled with the content-scanning extension, and a
8818 suitable virus scanner is installed. If the message is found to contain a
8819 virus, it is rejected with the given custom error message.
8820 </para>
8821 <literallayout class="monospaced">
8822 # warn    spam      = nobody
8823 #         message   = X-Spam_score: $spam_score\n\
8824 #                     X-Spam_score_int: $spam_score_int\n\
8825 #                     X-Spam_bar: $spam_bar\n\
8826 #                     X-Spam_report: $spam_report
8827 </literallayout>
8828 <para>
8829 These lines are an example of how to arrange for messages to be scanned by
8830 SpamAssassin when Exim has been compiled with the content-scanning extension,
8831 and SpamAssassin has been installed. The SpamAssassin check is run with
8832 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8833 series of extra header line. In this case, the message is not rejected,
8834 whatever the spam score.
8835 </para>
8836 <literallayout class="monospaced">
8837 accept
8838 </literallayout>
8839 <para>
8840 This final line in the DATA ACL accepts the message unconditionally.
8841 </para>
8842 </section>
8843 <section id="SECID55">
8844 <title>Router configuration</title>
8845 <para>
8846 <indexterm role="concept">
8847 <primary>default</primary>
8848 <secondary>routers</secondary>
8849 </indexterm>
8850 <indexterm role="concept">
8851 <primary>routers</primary>
8852 <secondary>default</secondary>
8853 </indexterm>
8854 The router configuration comes next in the default configuration, introduced
8855 by the line
8856 </para>
8857 <literallayout class="monospaced">
8858 begin routers
8859 </literallayout>
8860 <para>
8861 Routers are the modules in Exim that make decisions about where to send
8862 messages. An address is passed to each router in turn, until it is either
8863 accepted, or failed. This means that the order in which you define the routers
8864 matters. Each router is fully described in its own chapter later in this
8865 manual. Here we give only brief overviews.
8866 </para>
8867 <literallayout class="monospaced">
8868 # domain_literal:
8869 #   driver = ipliteral
8870 #   domains = !+local_domains
8871 #   transport = remote_smtp
8872 </literallayout>
8873 <para>
8874 <indexterm role="concept">
8875 <primary>domain literal</primary>
8876 <secondary>default router</secondary>
8877 </indexterm>
8878 This router is commented out because the majority of sites do not want to
8879 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8880 you uncomment this router, you also need to uncomment the setting of
8881 <option>allow_domain_literals</option> in the main part of the configuration.
8882 </para>
8883 <literallayout class="monospaced">
8884 dnslookup:
8885   driver = dnslookup
8886   domains = ! +local_domains
8887   transport = remote_smtp
8888   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8889   no_more
8890 </literallayout>
8891 <para>
8892 The first uncommented router handles addresses that do not involve any local
8893 domains. This is specified by the line
8894 </para>
8895 <literallayout class="monospaced">
8896 domains = ! +local_domains
8897 </literallayout>
8898 <para>
8899 The <option>domains</option> option lists the domains to which this router applies, but the
8900 exclamation mark is a negation sign, so the router is used only for domains
8901 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8902 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8903 indicates that it is referring to a named list. Addresses in other domains are
8904 passed on to the following routers.
8905 </para>
8906 <para>
8907 The name of the router driver is <command>dnslookup</command>,
8908 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8909 the name of this router instance is the same as the name of the driver. The
8910 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8911 one of the driver modules that is in the Exim binary.
8912 </para>
8913 <para>
8914 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8915 DNS in order to obtain a list of hosts to which the address is routed. If the
8916 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8917 specified by the <option>transport</option> option. If the router does not find the domain
8918 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8919 the address fails and is bounced.
8920 </para>
8921 <para>
8922 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8923 be entirely ignored. This option is present because a number of cases have been
8924 encountered where MX records in the DNS point to host names
8925 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8926 Completely ignoring these IP addresses causes Exim to fail to route the
8927 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8928 continue to try to deliver the message periodically until the address timed
8929 out.
8930 </para>
8931 <literallayout class="monospaced">
8932 system_aliases:
8933   driver = redirect
8934   allow_fail
8935   allow_defer
8936   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8937 # user = exim
8938   file_transport = address_file
8939   pipe_transport = address_pipe
8940 </literallayout>
8941 <para>
8942 Control reaches this and subsequent routers only for addresses in the local
8943 domains. This router checks to see whether the local part is defined as an
8944 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8945 data that it looks up from that file. If no data is found for the local part,
8946 the value of the <option>data</option> option is empty, causing the address to be passed to
8947 the next router.
8948 </para>
8949 <para>
8950 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8951 often used. That is why it is referenced by from the default configuration
8952 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8953 <filename>Local/Makefile</filename> before building Exim.
8954 </para>
8955 <literallayout class="monospaced">
8956 userforward:
8957   driver = redirect
8958   check_local_user
8959 # local_part_suffix = +* : -*
8960 # local_part_suffix_optional
8961   file = $home/.forward
8962 # allow_filter
8963   no_verify
8964   no_expn
8965   check_ancestor
8966   file_transport = address_file
8967   pipe_transport = address_pipe
8968   reply_transport = address_reply
8969 </literallayout>
8970 <para>
8971 This is the most complicated router in the default configuration. It is another
8972 redirection router, but this time it is looking for forwarding data set up by
8973 individual users. The <option>check_local_user</option> setting specifies a check that the
8974 local part of the address is the login name of a local user. If it is not, the
8975 router is skipped. The two commented options that follow <option>check_local_user</option>,
8976 namely:
8977 </para>
8978 <literallayout class="monospaced">
8979 # local_part_suffix = +* : -*
8980 # local_part_suffix_optional
8981 </literallayout>
8982 <para>
8983 <indexterm role="variable">
8984 <primary><varname>$local_part_suffix</varname></primary>
8985 </indexterm>
8986 show how you can specify the recognition of local part suffixes. If the first
8987 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8988 by any sequence of characters, is removed from the local part and placed in the
8989 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8990 presence of a suffix in the local part is optional. When a suffix is present,
8991 the check for a local login uses the local part with the suffix removed.
8992 </para>
8993 <para>
8994 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8995 home directory is consulted. If it does not exist, or is empty, the router
8996 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8997 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8998 </para>
8999 <para>
9000 <indexterm role="concept">
9001 <primary>Sieve filter</primary>
9002 <secondary>enabling in default router</secondary>
9003 </indexterm>
9004 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9005 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9006 is commented out by default), the contents of the file are interpreted as a set
9007 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9008 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9009 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9010 </para>
9011 <para>
9012 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9013 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9014 There are two reasons for doing this:
9015 </para>
9016 <orderedlist numeration="arabic">
9017 <listitem>
9018 <para>
9019 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9020 checking an address for validity; it makes sense not to waste resources doing
9021 unnecessary work.
9022 </para>
9023 </listitem>
9024 <listitem>
9025 <para>
9026 More importantly, when Exim is verifying addresses or handling an EXPN
9027 command during an SMTP session, it is running as the Exim user, not as root.
9028 The group is the Exim group, and no additional groups are set up.
9029 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9030 this time.
9031 </para>
9032 </listitem>
9033 </orderedlist>
9034 <para>
9035 The setting of <option>check_ancestor</option> prevents the router from generating a new
9036 address that is the same as any previous address that was redirected. (This
9037 works round a problem concerning a bad interaction between aliasing and
9038 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9039 </para>
9040 <para>
9041 The final three option settings specify the transports that are to be used when
9042 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9043 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9044 </para>
9045 <literallayout class="monospaced">
9046 a.nother@elsewhere.example, /home/spqr/archive
9047 </literallayout>
9048 <para>
9049 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9050 transport.
9051 </para>
9052 <literallayout class="monospaced">
9053 localuser:
9054   driver = accept
9055   check_local_user
9056 # local_part_suffix = +* : -*
9057 # local_part_suffix_optional
9058   transport = local_delivery
9059 </literallayout>
9060 <para>
9061 The final router sets up delivery into local mailboxes, provided that the local
9062 part is the name of a local login, by accepting the address and assigning it to
9063 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9064 routers, so the address is bounced. The commented suffix settings fulfil the
9065 same purpose as they do for the <command>userforward</command> router.
9066 </para>
9067 </section>
9068 <section id="SECID56">
9069 <title>Transport configuration</title>
9070 <para>
9071 <indexterm role="concept">
9072 <primary>default</primary>
9073 <secondary>transports</secondary>
9074 </indexterm>
9075 <indexterm role="concept">
9076 <primary>transports</primary>
9077 <secondary>default</secondary>
9078 </indexterm>
9079 Transports define mechanisms for actually delivering messages. They operate
9080 only when referenced from routers, so the order in which they are defined does
9081 not matter. The transports section of the configuration starts with
9082 </para>
9083 <literallayout class="monospaced">
9084 begin transports
9085 </literallayout>
9086 <para>
9087 One remote transport and four local transports are defined.
9088 </para>
9089 <literallayout class="monospaced">
9090 remote_smtp:
9091   driver = smtp
9092   hosts_try_prdr = *
9093 </literallayout>
9094 <para>
9095 This transport is used for delivering messages over SMTP connections.
9096 The list of remote hosts comes from the router.
9097 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9098 It is negotiated between client and server
9099 and not expected to cause problems but can be disabled if needed.
9100 All other options are defaulted.
9101 </para>
9102 <literallayout class="monospaced">
9103 local_delivery:
9104   driver = appendfile
9105   file = /var/mail/$local_part
9106   delivery_date_add
9107   envelope_to_add
9108   return_path_add
9109 # group = mail
9110 # mode = 0660
9111 </literallayout>
9112 <para>
9113 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9114 traditional BSD mailbox format. By default it runs under the uid and gid of the
9115 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9116 directory. Some systems use the alternative approach of running mail deliveries
9117 under a particular group instead of using the sticky bit. The commented options
9118 show how this can be done.
9119 </para>
9120 <para>
9121 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9122 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9123 similarly-named options above.
9124 </para>
9125 <literallayout class="monospaced">
9126 address_pipe:
9127   driver = pipe
9128   return_output
9129 </literallayout>
9130 <para>
9131 This transport is used for handling deliveries to pipes that are generated by
9132 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9133 option specifies that any output generated by the pipe is to be returned to the
9134 sender.
9135 </para>
9136 <literallayout class="monospaced">
9137 address_file:
9138   driver = appendfile
9139   delivery_date_add
9140   envelope_to_add
9141   return_path_add
9142 </literallayout>
9143 <para>
9144 This transport is used for handling deliveries to files that are generated by
9145 redirection. The name of the file is not specified in this instance of
9146 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9147 </para>
9148 <literallayout class="monospaced">
9149 address_reply:
9150   driver = autoreply
9151 </literallayout>
9152 <para>
9153 This transport is used for handling automatic replies generated by users&#x2019;
9154 filter files.
9155 </para>
9156 </section>
9157 <section id="SECID57">
9158 <title>Default retry rule</title>
9159 <para>
9160 <indexterm role="concept">
9161 <primary>retry</primary>
9162 <secondary>default rule</secondary>
9163 </indexterm>
9164 <indexterm role="concept">
9165 <primary>default</primary>
9166 <secondary>retry rule</secondary>
9167 </indexterm>
9168 The retry section of the configuration file contains rules which affect the way
9169 Exim retries deliveries that cannot be completed at the first attempt. It is
9170 introduced by the line
9171 </para>
9172 <literallayout class="monospaced">
9173 begin retry
9174 </literallayout>
9175 <para>
9176 In the default configuration, there is just one rule, which applies to all
9177 errors:
9178 </para>
9179 <literallayout class="monospaced">
9180 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9181 </literallayout>
9182 <para>
9183 This causes any temporarily failing address to be retried every 15 minutes for
9184 2 hours, then at intervals starting at one hour and increasing by a factor of
9185 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9186 is not delivered after 4 days of temporary failure, it is bounced.
9187 </para>
9188 <para>
9189 If the retry section is removed from the configuration, or is empty (that is,
9190 if no retry rules are defined), Exim will not retry deliveries. This turns
9191 temporary errors into permanent errors.
9192 </para>
9193 </section>
9194 <section id="SECID58">
9195 <title>Rewriting configuration</title>
9196 <para>
9197 The rewriting section of the configuration, introduced by
9198 </para>
9199 <literallayout class="monospaced">
9200 begin rewrite
9201 </literallayout>
9202 <para>
9203 contains rules for rewriting addresses in messages as they arrive. There are no
9204 rewriting rules in the default configuration file.
9205 </para>
9206 </section>
9207 <section id="SECTdefconfauth">
9208 <title>Authenticators configuration</title>
9209 <para>
9210 <indexterm role="concept">
9211 <primary>AUTH</primary>
9212 <secondary>configuration</secondary>
9213 </indexterm>
9214 The authenticators section of the configuration, introduced by
9215 </para>
9216 <literallayout class="monospaced">
9217 begin authenticators
9218 </literallayout>
9219 <para>
9220 defines mechanisms for the use of the SMTP AUTH command. The default
9221 configuration file contains two commented-out example authenticators
9222 which support plaintext username/password authentication using the
9223 standard PLAIN mechanism and the traditional but non-standard LOGIN
9224 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9225 to support most MUA software.
9226 </para>
9227 <para>
9228 The example PLAIN authenticator looks like this:
9229 </para>
9230 <literallayout class="monospaced">
9231 #PLAIN:
9232 #  driver                  = plaintext
9233 #  server_set_id           = $auth2
9234 #  server_prompts          = :
9235 #  server_condition        = Authentication is not yet configured
9236 #  server_advertise_condition = ${if def:tls_in_cipher }
9237 </literallayout>
9238 <para>
9239 And the example LOGIN authenticator looks like this:
9240 </para>
9241 <literallayout class="monospaced">
9242 #LOGIN:
9243 #  driver                  = plaintext
9244 #  server_set_id           = $auth1
9245 #  server_prompts          = &lt;| Username: | Password:
9246 #  server_condition        = Authentication is not yet configured
9247 #  server_advertise_condition = ${if def:tls_in_cipher }
9248 </literallayout>
9249 <para>
9250 The <option>server_set_id</option> option makes Exim remember the authenticated username
9251 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9252 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9253 that it implements the details of the specific authentication mechanism,
9254 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9255 when Exim offers authentication to clients; in the examples, this is only
9256 when TLS or SSL has been started, so to enable the authenticators you also
9257 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9258 </para>
9259 <para>
9260 The <option>server_condition</option> setting defines how to verify that the username and
9261 password are correct. In the examples it just produces an error message.
9262 To make the authenticators work, you can use a string expansion
9263 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9264 </para>
9265 <para>
9266 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9267 usercode and password are in different positions.
9268 Chapter <xref linkend="CHAPplaintext"/> covers both.
9269 </para>
9270 <para>
9271 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9272 </para>
9273 </section>
9274 </chapter>
9275
9276 <chapter id="CHAPregexp">
9277 <title>Regular expressions</title>
9278 <para>
9279 <indexterm role="concept">
9280 <primary>regular expressions</primary>
9281 <secondary>library</secondary>
9282 </indexterm>
9283 <indexterm role="concept">
9284 <primary>PCRE</primary>
9285 </indexterm>
9286 Exim supports the use of regular expressions in many of its options. It
9287 uses the PCRE regular expression library; this provides regular expression
9288 matching that is compatible with Perl 5. The syntax and semantics of
9289 regular expressions is discussed in many Perl reference books, and also in
9290 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9291 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9292 </para>
9293 <para>
9294 The documentation for the syntax and semantics of the regular expressions that
9295 are supported by PCRE is included in the PCRE distribution, and no further
9296 description is included here. The PCRE functions are called from Exim using
9297 the default option settings (that is, with no PCRE options set), except that
9298 the PCRE_CASELESS option is set when the matching is required to be
9299 case-insensitive.
9300 </para>
9301 <para>
9302 In most cases, when a regular expression is required in an Exim configuration,
9303 it has to start with a circumflex, in order to distinguish it from plain text
9304 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9305 second item in the colon-separated list is a regular expression.
9306 </para>
9307 <literallayout class="monospaced">
9308 domains = a.b.c : ^\\d{3} : *.y.z : ...
9309 </literallayout>
9310 <para>
9311 The doubling of the backslash is required because of string expansion that
9312 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9313 of this issue, and a way of avoiding the need for doubling backslashes. The
9314 regular expression that is eventually used in this example contains just one
9315 backslash. The circumflex is included in the regular expression, and has the
9316 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9317 matched.
9318 </para>
9319 <para>
9320 There are, however, two cases where a circumflex is not required for the
9321 recognition of a regular expression: these are the <option>match</option> condition in a
9322 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9323 these cases, the relevant string is always treated as a regular expression; if
9324 it does not start with a circumflex, the expression is not anchored, and can
9325 match anywhere in the subject string.
9326 </para>
9327 <para>
9328 In all cases, if you want a regular expression to match at the end of a string,
9329 you must code the $ metacharacter to indicate this. For example:
9330 </para>
9331 <literallayout class="monospaced">
9332 domains = ^\\d{3}\\.example
9333 </literallayout>
9334 <para>
9335 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9336 You need to use:
9337 </para>
9338 <literallayout class="monospaced">
9339 domains = ^\\d{3}\\.example\$
9340 </literallayout>
9341 <para>
9342 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9343 $ is needed because string expansion also interprets dollar characters.
9344 </para>
9345 </chapter>
9346
9347 <chapter id="CHAPfdlookup">
9348 <title>File and database lookups</title>
9349 <para>
9350 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9351 <primary>file</primary>
9352 <secondary>lookups</secondary>
9353 </indexterm>
9354 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9355 <primary>database</primary>
9356 <secondary>lookups</secondary>
9357 </indexterm>
9358 <indexterm role="concept">
9359 <primary>lookup</primary>
9360 <secondary>description of</secondary>
9361 </indexterm>
9362 Exim can be configured to look up data in files or databases as it processes
9363 messages. Two different kinds of syntax are used:
9364 </para>
9365 <orderedlist numeration="arabic">
9366 <listitem>
9367 <para>
9368 A string that is to be expanded may contain explicit lookup requests. These
9369 cause parts of the string to be replaced by data that is obtained from the
9370 lookup. Lookups of this type are conditional expansion items. Different results
9371 can be defined for the cases of lookup success and failure. See chapter
9372 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9373 </para>
9374 </listitem>
9375 <listitem>
9376 <para>
9377 Lists of domains, hosts, and email addresses can contain lookup requests as a
9378 way of avoiding excessively long linear lists. In this case, the data that is
9379 returned by the lookup is often (but not always) discarded; whether the lookup
9380 succeeds or fails is what really counts. These kinds of list are described in
9381 chapter <xref linkend="CHAPdomhosaddlists"/>.
9382 </para>
9383 </listitem>
9384 </orderedlist>
9385 <para>
9386 String expansions, lists, and lookups interact with each other in such a way
9387 that there is no order in which to describe any one of them that does not
9388 involve references to the others. Each of these three chapters makes more sense
9389 if you have read the other two first. If you are reading this for the first
9390 time, be aware that some of it will make a lot more sense after you have read
9391 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9392 </para>
9393 <section id="SECID60">
9394 <title>Examples of different lookup syntax</title>
9395 <para>
9396 It is easy to confuse the two different kinds of lookup, especially as the
9397 lists that may contain the second kind are always expanded before being
9398 processed as lists. Therefore, they may also contain lookups of the first kind.
9399 Be careful to distinguish between the following two examples:
9400 </para>
9401 <literallayout class="monospaced">
9402 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9403 domains = lsearch;/some/file
9404 </literallayout>
9405 <para>
9406 The first uses a string expansion, the result of which must be a domain list.
9407 No strings have been specified for a successful or a failing lookup; the
9408 defaults in this case are the looked-up data and an empty string, respectively.
9409 The expansion takes place before the string is processed as a list, and the
9410 file that is searched could contain lines like this:
9411 </para>
9412 <literallayout class="monospaced">
9413 192.168.3.4: domain1:domain2:...
9414 192.168.1.9: domain3:domain4:...
9415 </literallayout>
9416 <para>
9417 When the lookup succeeds, the result of the expansion is a list of domains (and
9418 possibly other types of item that are allowed in domain lists).
9419 </para>
9420 <para>
9421 In the second example, the lookup is a single item in a domain list. It causes
9422 Exim to use a lookup to see if the domain that is being processed can be found
9423 in the file. The file could contains lines like this:
9424 </para>
9425 <literallayout class="monospaced">
9426 domain1:
9427 domain2:
9428 </literallayout>
9429 <para>
9430 Any data that follows the keys is not relevant when checking that the domain
9431 matches the list item.
9432 </para>
9433 <para>
9434 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9435 Consider a file containing lines like this:
9436 </para>
9437 <literallayout class="monospaced">
9438 192.168.5.6: lsearch;/another/file
9439 </literallayout>
9440 <para>
9441 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9442 first <option>domains</option> setting above generates the second setting, which therefore
9443 causes a second lookup to occur.
9444 </para>
9445 <para>
9446 The rest of this chapter describes the different lookup types that are
9447 available. Any of them can be used in any part of the configuration where a
9448 lookup is permitted.
9449 </para>
9450 </section>
9451 <section id="SECID61">
9452 <title>Lookup types</title>
9453 <para>
9454 <indexterm role="concept">
9455 <primary>lookup</primary>
9456 <secondary>types of</secondary>
9457 </indexterm>
9458 <indexterm role="concept">
9459 <primary>single-key lookup</primary>
9460 <secondary>definition of</secondary>
9461 </indexterm>
9462 Two different types of data lookup are implemented:
9463 </para>
9464 <itemizedlist>
9465 <listitem>
9466 <para>
9467 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9468 and a single key to search for. The key must be a non-empty string for the
9469 lookup to succeed. The lookup type determines how the file is searched.
9470 </para>
9471 </listitem>
9472 <listitem>
9473 <para>
9474 <indexterm role="concept">
9475 <primary>query-style lookup</primary>
9476 <secondary>definition of</secondary>
9477 </indexterm>
9478 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9479 key value is assumed by Exim for query-style lookups. You can use whichever
9480 Exim variables you need to construct the database query.
9481 </para>
9482 </listitem>
9483 </itemizedlist>
9484 <para>
9485 The code for each lookup type is in a separate source file that is included in
9486 the binary of Exim only if the corresponding compile-time option is set. The
9487 default settings in <filename>src/EDITME</filename> are:
9488 </para>
9489 <literallayout class="monospaced">
9490 LOOKUP_DBM=yes
9491 LOOKUP_LSEARCH=yes
9492 </literallayout>
9493 <para>
9494 which means that only linear searching and DBM lookups are included by default.
9495 For some types of lookup (e.g. SQL databases), you need to install appropriate
9496 libraries and header files before building Exim.
9497 </para>
9498 </section>
9499 <section id="SECTsinglekeylookups">
9500 <title>Single-key lookup types</title>
9501 <para>
9502 <indexterm role="concept">
9503 <primary>lookup</primary>
9504 <secondary>single-key types</secondary>
9505 </indexterm>
9506 <indexterm role="concept">
9507 <primary>single-key lookup</primary>
9508 <secondary>list of types</secondary>
9509 </indexterm>
9510 The following single-key lookup types are implemented:
9511 </para>
9512 <itemizedlist>
9513 <listitem>
9514 <para>
9515 <indexterm role="concept">
9516 <primary>cdb</primary>
9517 <secondary>description of</secondary>
9518 </indexterm>
9519 <indexterm role="concept">
9520 <primary>lookup</primary>
9521 <secondary>cdb</secondary>
9522 </indexterm>
9523 <indexterm role="concept">
9524 <primary>binary zero</primary>
9525 <secondary>in lookup key</secondary>
9526 </indexterm>
9527 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9528 string without a terminating binary zero. The cdb format is designed for
9529 indexed files that are read frequently and never updated, except by total
9530 re-creation. As such, it is particularly suitable for large files containing
9531 aliases or other indexed data referenced by an MTA. Information about cdb can
9532 be found in several places:
9533 </para>
9534 <literallayout>
9535 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9536 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9537 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9538 </literallayout>
9539 <para>
9540 A cdb distribution is not needed in order to build Exim with cdb support,
9541 because the code for reading cdb files is included directly in Exim itself.
9542 However, no means of building or testing cdb files is provided with Exim, so
9543 you need to obtain a cdb distribution in order to do this.
9544 </para>
9545 </listitem>
9546 <listitem>
9547 <para>
9548 <indexterm role="concept">
9549 <primary>DBM</primary>
9550 <secondary>lookup type</secondary>
9551 </indexterm>
9552 <indexterm role="concept">
9553 <primary>lookup</primary>
9554 <secondary>dbm</secondary>
9555 </indexterm>
9556 <indexterm role="concept">
9557 <primary>binary zero</primary>
9558 <secondary>in lookup key</secondary>
9559 </indexterm>
9560 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9561 DBM file by looking up the record with the given key. A terminating binary
9562 zero is included in the key that is passed to the DBM library. See section
9563 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9564 </para>
9565 <para>
9566 <indexterm role="concept">
9567 <primary>Berkeley DB library</primary>
9568 <secondary>file format</secondary>
9569 </indexterm>
9570 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9571 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9572 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9573 the DB_UNKNOWN option. This enables it to handle any of the types of database
9574 that the library supports, and can be useful for accessing DBM files created by
9575 other applications. (For earlier DB versions, DB_HASH is always used.)
9576 </para>
9577 </listitem>
9578 <listitem>
9579 <para>
9580 <indexterm role="concept">
9581 <primary>lookup</primary>
9582 <secondary>dbmjz</secondary>
9583 </indexterm>
9584 <indexterm role="concept">
9585 <primary>lookup</primary>
9586 <secondary>dbm &ndash; embedded NULs</secondary>
9587 </indexterm>
9588 <indexterm role="concept">
9589 <primary>sasldb2</primary>
9590 </indexterm>
9591 <indexterm role="concept">
9592 <primary>dbmjz lookup type</primary>
9593 </indexterm>
9594 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9595 interpreted as an Exim list; the elements of the list are joined together with
9596 ASCII NUL characters to form the lookup key.  An example usage would be to
9597 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9598 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9599 <command>cram_md5</command> authenticator.
9600 </para>
9601 </listitem>
9602 <listitem>
9603 <para>
9604 <indexterm role="concept">
9605 <primary>lookup</primary>
9606 <secondary>dbmnz</secondary>
9607 </indexterm>
9608 <indexterm role="concept">
9609 <primary>lookup</primary>
9610 <secondary>dbm &ndash; terminating zero</secondary>
9611 </indexterm>
9612 <indexterm role="concept">
9613 <primary>binary zero</primary>
9614 <secondary>in lookup key</secondary>
9615 </indexterm>
9616 <indexterm role="concept">
9617 <primary>Courier</primary>
9618 </indexterm>
9619 <indexterm role="concept">
9620 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9621 </indexterm>
9622 <indexterm role="concept">
9623 <primary>dbmnz lookup type</primary>
9624 </indexterm>
9625 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9626 is not included in the key that is passed to the DBM library. You may need this
9627 if you want to look up data in files that are created by or shared with some
9628 other application that does not use terminating zeros. For example, you need to
9629 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9630 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9631 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9632 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9633 </para>
9634 </listitem>
9635 <listitem>
9636 <para>
9637 <indexterm role="concept">
9638 <primary>lookup</primary>
9639 <secondary>dsearch</secondary>
9640 </indexterm>
9641 <indexterm role="concept">
9642 <primary>dsearch lookup type</primary>
9643 </indexterm>
9644 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9645 whose name is the key by calling the <function>lstat()</function> function. The key may not
9646 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9647 the lookup is the name of the entry, which may be a file, directory,
9648 symbolic link, or any other kind of directory entry. An example of how this
9649 lookup can be used to support virtual domains is given in section
9650 <xref linkend="SECTvirtualdomains"/>.
9651 </para>
9652 </listitem>
9653 <listitem>
9654 <para>
9655 <indexterm role="concept">
9656 <primary>lookup</primary>
9657 <secondary>iplsearch</secondary>
9658 </indexterm>
9659 <indexterm role="concept">
9660 <primary>iplsearch lookup type</primary>
9661 </indexterm>
9662 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9663 terminated by a colon or white space or the end of the line. The keys in the
9664 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9665 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9666 being interpreted as a key terminator. For example:
9667 </para>
9668 <literallayout class="monospaced">
9669 1.2.3.4:           data for 1.2.3.4
9670 192.168.0.0/16:    data for 192.168.0.0/16
9671 "abcd::cdab":      data for abcd::cdab
9672 "abcd:abcd::/32"   data for abcd:abcd::/32
9673 </literallayout>
9674 <para>
9675 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9676 file is searched linearly, using the CIDR masks where present, until a matching
9677 key is found. The first key that matches is used; there is no attempt to find a
9678 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9679 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9680 </para>
9681 <para>
9682 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9683 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9684 lookup types support only literal keys.
9685 </para>
9686 <para>
9687 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9688 the implicit key is the host&#x2019;s IP address rather than its name (see section
9689 <xref linkend="SECThoslispatsikey"/>).
9690 </para>
9691 </listitem>
9692 <listitem>
9693 <para>
9694 <indexterm role="concept">
9695 <primary>linear search</primary>
9696 </indexterm>
9697 <indexterm role="concept">
9698 <primary>lookup</primary>
9699 <secondary>lsearch</secondary>
9700 </indexterm>
9701 <indexterm role="concept">
9702 <primary>lsearch lookup type</primary>
9703 </indexterm>
9704 <indexterm role="concept">
9705 <primary>case sensitivity</primary>
9706 <secondary>in lsearch lookup</secondary>
9707 </indexterm>
9708 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9709 line beginning with the search key, terminated by a colon or white space or the
9710 end of the line. The search is case-insensitive; that is, upper and lower case
9711 letters are treated as the same. The first occurrence of the key that is found
9712 in the file is used.
9713 </para>
9714 <para>
9715 White space between the key and the colon is permitted. The remainder of the
9716 line, with leading and trailing white space removed, is the data. This can be
9717 continued onto subsequent lines by starting them with any amount of white
9718 space, but only a single space character is included in the data at such a
9719 junction. If the data begins with a colon, the key must be terminated by a
9720 colon, for example:
9721 </para>
9722 <literallayout class="monospaced">
9723 baduser:  :fail:
9724 </literallayout>
9725 <para>
9726 Empty lines and lines beginning with # are ignored, even if they occur in the
9727 middle of an item. This is the traditional textual format of alias files. Note
9728 that the keys in an <command>lsearch</command> file are literal strings. There is no
9729 wildcarding of any kind.
9730 </para>
9731 <para>
9732 <indexterm role="concept">
9733 <primary>lookup</primary>
9734 <secondary>lsearch &ndash; colons in keys</secondary>
9735 </indexterm>
9736 <indexterm role="concept">
9737 <primary>white space</primary>
9738 <secondary>in lsearch key</secondary>
9739 </indexterm>
9740 In most <command>lsearch</command> files, keys are not required to contain colons or #
9741 characters, or white space. However, if you need this feature, it is available.
9742 If a key begins with a doublequote character, it is terminated only by a
9743 matching quote (or end of line), and the normal escaping rules apply to its
9744 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9745 quoted keys (exactly as for unquoted keys). There is no special handling of
9746 quotes for the data part of an <command>lsearch</command> line.
9747 </para>
9748 </listitem>
9749 <listitem>
9750 <para>
9751 <indexterm role="concept">
9752 <primary>NIS lookup type</primary>
9753 </indexterm>
9754 <indexterm role="concept">
9755 <primary>lookup</primary>
9756 <secondary>NIS</secondary>
9757 </indexterm>
9758 <indexterm role="concept">
9759 <primary>binary zero</primary>
9760 <secondary>in lookup key</secondary>
9761 </indexterm>
9762 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9763 the given key, without a terminating binary zero. There is a variant called
9764 <command>nis0</command> which does include the terminating binary zero in the key. This is
9765 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9766 aliases; the full map names must be used.
9767 </para>
9768 </listitem>
9769 <listitem>
9770 <para>
9771 <indexterm role="concept">
9772 <primary>wildlsearch lookup type</primary>
9773 </indexterm>
9774 <indexterm role="concept">
9775 <primary>lookup</primary>
9776 <secondary>wildlsearch</secondary>
9777 </indexterm>
9778 <indexterm role="concept">
9779 <primary>nwildlsearch lookup type</primary>
9780 </indexterm>
9781 <indexterm role="concept">
9782 <primary>lookup</primary>
9783 <secondary>nwildlsearch</secondary>
9784 </indexterm>
9785 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9786 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9787 the file may be wildcarded. The difference between these two lookup types is
9788 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9789 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9790 </para>
9791 <para>
9792 <indexterm role="concept">
9793 <primary>case sensitivity</primary>
9794 <secondary>in (n)wildlsearch lookup</secondary>
9795 </indexterm>
9796 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9797 file that are regular expressions can be made case-sensitive by the use of
9798 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9799 </para>
9800 <orderedlist numeration="arabic">
9801 <listitem>
9802 <para>
9803 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9804 </para>
9805 <literallayout class="monospaced">
9806     *.a.b.c       data for anything.a.b.c
9807     *fish         data for anythingfish
9808 </literallayout>
9809 </listitem>
9810 <listitem>
9811 <para>
9812 The string may begin with a circumflex to indicate a regular expression. For
9813 example, for <command>wildlsearch</command>:
9814 </para>
9815 <literallayout class="monospaced">
9816     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9817 </literallayout>
9818 <para>
9819 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9820 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9821 string-expanded, the equivalent entry is:
9822 </para>
9823 <literallayout class="monospaced">
9824     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9825 </literallayout>
9826 <para>
9827 The case-insensitive flag is set at the start of compiling the regular
9828 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9829 For example, to make the entire pattern case-sensitive:
9830 </para>
9831 <literallayout class="monospaced">
9832     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9833 </literallayout>
9834 <para>
9835 If the regular expression contains white space or colon characters, you must
9836 either quote it (see <command>lsearch</command> above), or represent these characters in other
9837 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9838 colon. This may be easier than quoting, because if you quote, you have to
9839 escape all the backslashes inside the quotes.
9840 </para>
9841 <para>
9842 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9843 match for later use, because the results of all lookups are cached. If a lookup
9844 is repeated, the result is taken from the cache, and no actual pattern matching
9845 takes place. The values of all the numeric variables are unset after a
9846 <command>(n)wildlsearch</command> match.
9847 </para>
9848 </listitem>
9849 <listitem>
9850 <para>
9851 Although I cannot see it being of much use, the general matching function that
9852 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9853 lookup name terminated by a semicolon, and followed by lookup data. For
9854 example:
9855 </para>
9856 <literallayout class="monospaced">
9857     cdb;/some/file  data for keys that match the file
9858 </literallayout>
9859 <para>
9860 The data that is obtained from the nested lookup is discarded.
9861 </para>
9862 </listitem>
9863 </orderedlist>
9864 <para>
9865 Keys that do not match any of these patterns are interpreted literally. The
9866 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9867 be followed by optional colons.
9868 </para>
9869 <para>
9870 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9871 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9872 lookup types support only literal keys.
9873 </para>
9874 </listitem>
9875 </itemizedlist>
9876 </section>
9877 <section id="SECID62">
9878 <title>Query-style lookup types</title>
9879 <para>
9880 <indexterm role="concept">
9881 <primary>lookup</primary>
9882 <secondary>query-style types</secondary>
9883 </indexterm>
9884 <indexterm role="concept">
9885 <primary>query-style lookup</primary>
9886 <secondary>list of types</secondary>
9887 </indexterm>
9888 The supported query-style lookup types are listed below. Further details about
9889 many of them are given in later sections.
9890 </para>
9891 <itemizedlist>
9892 <listitem>
9893 <para>
9894 <indexterm role="concept">
9895 <primary>DNS</primary>
9896 <secondary>as a lookup type</secondary>
9897 </indexterm>
9898 <indexterm role="concept">
9899 <primary>lookup</primary>
9900 <secondary>DNS</secondary>
9901 </indexterm>
9902 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9903 are given in the supplied query. The resulting data is the contents of the
9904 records. See section <xref linkend="SECTdnsdb"/>.
9905 </para>
9906 </listitem>
9907 <listitem>
9908 <para>
9909 <indexterm role="concept">
9910 <primary>InterBase lookup type</primary>
9911 </indexterm>
9912 <indexterm role="concept">
9913 <primary>lookup</primary>
9914 <secondary>InterBase</secondary>
9915 </indexterm>
9916 <command>ibase</command>: This does a lookup in an InterBase database.
9917 </para>
9918 </listitem>
9919 <listitem>
9920 <para>
9921 <indexterm role="concept">
9922 <primary>LDAP</primary>
9923 <secondary>lookup type</secondary>
9924 </indexterm>
9925 <indexterm role="concept">
9926 <primary>lookup</primary>
9927 <secondary>LDAP</secondary>
9928 </indexterm>
9929 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9930 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9931 that permits values from multiple entries to be returned. A third variant
9932 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9933 any attribute values. See section <xref linkend="SECTldap"/>.
9934 </para>
9935 </listitem>
9936 <listitem>
9937 <para>
9938 <indexterm role="concept">
9939 <primary>MySQL</primary>
9940 <secondary>lookup type</secondary>
9941 </indexterm>
9942 <indexterm role="concept">
9943 <primary>lookup</primary>
9944 <secondary>MySQL</secondary>
9945 </indexterm>
9946 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9947 MySQL database. See section <xref linkend="SECTsql"/>.
9948 </para>
9949 </listitem>
9950 <listitem>
9951 <para>
9952 <indexterm role="concept">
9953 <primary>NIS+ lookup type</primary>
9954 </indexterm>
9955 <indexterm role="concept">
9956 <primary>lookup</primary>
9957 <secondary>NIS+</secondary>
9958 </indexterm>
9959 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9960 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9961 </para>
9962 </listitem>
9963 <listitem>
9964 <para>
9965 <indexterm role="concept">
9966 <primary>Oracle</primary>
9967 <secondary>lookup type</secondary>
9968 </indexterm>
9969 <indexterm role="concept">
9970 <primary>lookup</primary>
9971 <secondary>Oracle</secondary>
9972 </indexterm>
9973 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9974 Oracle database. See section <xref linkend="SECTsql"/>.
9975 </para>
9976 </listitem>
9977 <listitem>
9978 <para>
9979 <indexterm role="concept">
9980 <primary>lookup</primary>
9981 <secondary>passwd</secondary>
9982 </indexterm>
9983 <indexterm role="concept">
9984 <primary>passwd lookup type</primary>
9985 </indexterm>
9986 <indexterm role="concept">
9987 <primary><filename>/etc/passwd</filename></primary>
9988 </indexterm>
9989 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9990 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9991 success, the result string is the same as you would get from an <command>lsearch</command>
9992 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9993 password value. For example:
9994 </para>
9995 <literallayout class="monospaced">
9996 *:42:42:King Rat:/home/kr:/bin/bash
9997 </literallayout>
9998 </listitem>
9999 <listitem>
10000 <para>
10001 <indexterm role="concept">
10002 <primary>PostgreSQL lookup type</primary>
10003 </indexterm>
10004 <indexterm role="concept">
10005 <primary>lookup</primary>
10006 <secondary>PostgreSQL</secondary>
10007 </indexterm>
10008 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10009 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10010 </para>
10011 </listitem>
10012 <listitem>
10013 <para>
10014 <indexterm role="concept">
10015 <primary>sqlite lookup type</primary>
10016 </indexterm>
10017 <indexterm role="concept">
10018 <primary>lookup</primary>
10019 <secondary>sqlite</secondary>
10020 </indexterm>
10021 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10022 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10023 </para>
10024 </listitem>
10025 <listitem>
10026 <para>
10027 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10028 not likely to be useful in normal operation.
10029 </para>
10030 </listitem>
10031 <listitem>
10032 <para>
10033 <indexterm role="concept">
10034 <primary>whoson lookup type</primary>
10035 </indexterm>
10036 <indexterm role="concept">
10037 <primary>lookup</primary>
10038 <secondary>whoson</secondary>
10039 </indexterm>
10040 <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
10041 allows a server to check whether a particular (dynamically allocated) IP
10042 address is currently allocated to a known (trusted) user and, optionally, to
10043 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10044 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10045 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10046 <quote>POP before SMTP</quote> checking using ACL statements such as
10047 </para>
10048 <literallayout class="monospaced">
10049 require condition = \
10050   ${lookup whoson {$sender_host_address}{yes}{no}}
10051 </literallayout>
10052 <para>
10053 The query consists of a single IP address. The value returned is the name of
10054 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10055 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10056 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10057 </para>
10058 </listitem>
10059 </itemizedlist>
10060 </section>
10061 <section id="SECID63">
10062 <title>Temporary errors in lookups</title>
10063 <para>
10064 <indexterm role="concept">
10065 <primary>lookup</primary>
10066 <secondary>temporary error in</secondary>
10067 </indexterm>
10068 Lookup functions can return temporary error codes if the lookup cannot be
10069 completed. For example, an SQL or LDAP database might be unavailable. For this
10070 reason, it is not advisable to use a lookup that might do this for critical
10071 options such as a list of local domains.
10072 </para>
10073 <para>
10074 When a lookup cannot be completed in a router or transport, delivery
10075 of the message (to the relevant address) is deferred, as for any other
10076 temporary error. In other circumstances Exim may assume the lookup has failed,
10077 or may give up altogether.
10078 </para>
10079 </section>
10080 <section id="SECTdefaultvaluelookups">
10081 <title>Default values in single-key lookups</title>
10082 <para>
10083 <indexterm role="concept">
10084 <primary>wildcard lookups</primary>
10085 </indexterm>
10086 <indexterm role="concept">
10087 <primary>lookup</primary>
10088 <secondary>default values</secondary>
10089 </indexterm>
10090 <indexterm role="concept">
10091 <primary>lookup</primary>
10092 <secondary>wildcard</secondary>
10093 </indexterm>
10094 <indexterm role="concept">
10095 <primary>lookup</primary>
10096 <secondary>* added to type</secondary>
10097 </indexterm>
10098 <indexterm role="concept">
10099 <primary>default</primary>
10100 <secondary>in single-key lookups</secondary>
10101 </indexterm>
10102 In this context, a <quote>default value</quote> is a value specified by the administrator
10103 that is to be used if a lookup fails.
10104 </para>
10105 <para>
10106 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10107 lookups, the facilities of the query language must be used. An attempt to
10108 specify a default for a query-style lookup provokes an error.
10109 </para>
10110 <para>
10111 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10112 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10113 provide a default value. See also the section on partial matching below.
10114 </para>
10115 <para>
10116 <indexterm role="concept">
10117 <primary>*@ with single-key lookup</primary>
10118 </indexterm>
10119 <indexterm role="concept">
10120 <primary>lookup</primary>
10121 <secondary>*@ added to type</secondary>
10122 </indexterm>
10123 <indexterm role="concept">
10124 <primary>alias file</primary>
10125 <secondary>per-domain default</secondary>
10126 </indexterm>
10127 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10128 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10129 character, a second lookup is done with everything before the last @ replaced
10130 by *. This makes it possible to provide per-domain defaults in alias files
10131 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10132 take place because there is no @ in the key), <quote>*</quote> is looked up.
10133 For example, a <command>redirect</command> router might contain:
10134 </para>
10135 <literallayout class="monospaced">
10136 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10137 </literallayout>
10138 <para>
10139 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10140 looks up these keys, in this order:
10141 </para>
10142 <literallayout class="monospaced">
10143 jane@eyre.example
10144 *@eyre.example
10145 *
10146 </literallayout>
10147 <para>
10148 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10149 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10150 complete scan is done for each key, and only if it is not found at all does
10151 Exim move on to try the next key.
10152 </para>
10153 </section>
10154 <section id="SECTpartiallookup">
10155 <title>Partial matching in single-key lookups</title>
10156 <para>
10157 <indexterm role="concept">
10158 <primary>partial matching</primary>
10159 </indexterm>
10160 <indexterm role="concept">
10161 <primary>wildcard lookups</primary>
10162 </indexterm>
10163 <indexterm role="concept">
10164 <primary>lookup</primary>
10165 <secondary>partial matching</secondary>
10166 </indexterm>
10167 <indexterm role="concept">
10168 <primary>lookup</primary>
10169 <secondary>wildcard</secondary>
10170 </indexterm>
10171 <indexterm role="concept">
10172 <primary>asterisk</primary>
10173 <secondary>in search type</secondary>
10174 </indexterm>
10175 The normal operation of a single-key lookup is to search the file for an exact
10176 match with the given key. However, in a number of situations where domains are
10177 being looked up, it is useful to be able to do partial matching. In this case,
10178 information in the file that has a key starting with <quote>*.</quote> is matched by any
10179 domain that ends with the components that follow the full stop. For example, if
10180 a key in a DBM file is
10181 </para>
10182 <literallayout class="monospaced">
10183 *.dates.fict.example
10184 </literallayout>
10185 <para>
10186 then when partial matching is enabled this is matched by (amongst others)
10187 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10188 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10189 file.
10190 </para>
10191 <para>
10192 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10193 also not available for any lookup items in address lists (see section
10194 <xref linkend="SECTaddresslist"/>).
10195 </para>
10196 <para>
10197 Partial matching is implemented by doing a series of separate lookups using
10198 keys constructed by modifying the original subject key. This means that it can
10199 be used with any of the single-key lookup types, provided that
10200 partial matching keys
10201 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10202 Keys in the file that do not begin with the prefix are matched only by
10203 unmodified subject keys when partial matching is in use.
10204 </para>
10205 <para>
10206 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10207 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10208 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10209 is added at the start of the subject key, and it is looked up again. If that
10210 fails, further lookups are tried with dot-separated components removed from the
10211 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10212 remains.
10213 </para>
10214 <para>
10215 A minimum number of two non-* components are required. This can be adjusted
10216 by including a number before the hyphen in the search type. For example,
10217 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10218 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10219 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10220 up when the minimum number of non-* components is two:
10221 </para>
10222 <literallayout class="monospaced">
10223 2250.dates.fict.example
10224 *.2250.dates.fict.example
10225 *.dates.fict.example
10226 *.fict.example
10227 </literallayout>
10228 <para>
10229 As soon as one key in the sequence is successfully looked up, the lookup
10230 finishes.
10231 </para>
10232 <para>
10233 <indexterm role="concept">
10234 <primary>lookup</primary>
10235 <secondary>partial matching &ndash; changing prefix</secondary>
10236 </indexterm>
10237 <indexterm role="concept">
10238 <primary>prefix</primary>
10239 <secondary>for partial matching</secondary>
10240 </indexterm>
10241 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10242 changed. The motivation for this feature is to allow Exim to operate with file
10243 formats that are used by other MTAs. A different prefix can be supplied in
10244 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10245 </para>
10246 <literallayout class="monospaced">
10247 domains = partial(.)lsearch;/some/file
10248 </literallayout>
10249 <para>
10250 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10251 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10252 components is unchanged). The prefix may consist of any punctuation characters
10253 other than a closing parenthesis. It may be empty, for example:
10254 </para>
10255 <literallayout class="monospaced">
10256 domains = partial1()cdb;/some/file
10257 </literallayout>
10258 <para>
10259 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10260 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10261 </para>
10262 <para>
10263 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10264 just one non-wild component has failed, and the original key is shortened right
10265 down to the null string) depends on the prefix:
10266 </para>
10267 <itemizedlist>
10268 <listitem>
10269 <para>
10270 If the prefix has zero length, the whole lookup fails.
10271 </para>
10272 </listitem>
10273 <listitem>
10274 <para>
10275 If the prefix has length 1, a lookup for just the prefix is done. For
10276 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10277 </para>
10278 </listitem>
10279 <listitem>
10280 <para>
10281 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10282 remainder is looked up. With the default prefix, therefore, the final lookup is
10283 for <quote>*</quote> on its own.
10284 </para>
10285 </listitem>
10286 <listitem>
10287 <para>
10288 Otherwise, the whole prefix is looked up.
10289 </para>
10290 </listitem>
10291 </itemizedlist>
10292 <para>
10293 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10294 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10295 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10296 specified, adding <quote>*</quote> to the search type has no effect with the default
10297 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10298 lookups. However, there might be a use for lookup types such as
10299 <quote>partial0(.)lsearch*</quote>.
10300 </para>
10301 <para>
10302 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10303 in domain lists and the like. Partial matching works only in terms of
10304 dot-separated components; a key such as <literal>*fict.example</literal>
10305 in a database file is useless, because the asterisk in a partial matching
10306 subject key is always followed by a dot.
10307 </para>
10308 </section>
10309 <section id="SECID64">
10310 <title>Lookup caching</title>
10311 <para>
10312 <indexterm role="concept">
10313 <primary>lookup</primary>
10314 <secondary>caching</secondary>
10315 </indexterm>
10316 <indexterm role="concept">
10317 <primary>caching</primary>
10318 <secondary>lookup data</secondary>
10319 </indexterm>
10320 Exim caches all lookup results in order to avoid needless repetition of
10321 lookups. However, because (apart from the daemon) Exim operates as a collection
10322 of independent, short-lived processes, this caching applies only within a
10323 single Exim process. There is no inter-process lookup caching facility.
10324 </para>
10325 <para>
10326 For single-key lookups, Exim keeps the relevant files open in case there is
10327 another lookup that needs them. In some types of configuration this can lead to
10328 many files being kept open for messages with many recipients. To avoid hitting
10329 the operating system limit on the number of simultaneously open files, Exim
10330 closes the least recently used file when it needs to open more files than its
10331 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10332 </para>
10333 <para>
10334 The single-key lookup files are closed and the lookup caches are flushed at
10335 strategic points during delivery &ndash; for example, after all routing is
10336 complete.
10337 </para>
10338 </section>
10339 <section id="SECID65">
10340 <title>Quoting lookup data</title>
10341 <para>
10342 <indexterm role="concept">
10343 <primary>lookup</primary>
10344 <secondary>quoting</secondary>
10345 </indexterm>
10346 <indexterm role="concept">
10347 <primary>quoting</primary>
10348 <secondary>in lookups</secondary>
10349 </indexterm>
10350 When data from an incoming message is included in a query-style lookup, there
10351 is the possibility of special characters in the data messing up the syntax of
10352 the query. For example, a NIS+ query that contains
10353 </para>
10354 <literallayout class="monospaced">
10355 [name=$local_part]
10356 </literallayout>
10357 <para>
10358 will be broken if the local part happens to contain a closing square bracket.
10359 For NIS+, data can be enclosed in double quotes like this:
10360 </para>
10361 <literallayout class="monospaced">
10362 [name="$local_part"]
10363 </literallayout>
10364 <para>
10365 but this still leaves the problem of a double quote in the data. The rule for
10366 NIS+ is that double quotes must be doubled. Other lookup types have different
10367 rules, and to cope with the differing requirements, an expansion operator
10368 of the following form is provided:
10369 </para>
10370 <literallayout class="monospaced">
10371 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10372 </literallayout>
10373 <para>
10374 For example, the safest way to write the NIS+ query is
10375 </para>
10376 <literallayout class="monospaced">
10377 [name="${quote_nisplus:$local_part}"]
10378 </literallayout>
10379 <para>
10380 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10381 operator can be used for all lookup types, but has no effect for single-key
10382 lookups, since no quoting is ever needed in their key strings.
10383 </para>
10384 </section>
10385 <section id="SECTdnsdb">
10386 <title>More about dnsdb</title>
10387 <para>
10388 <indexterm role="concept">
10389 <primary>dnsdb lookup</primary>
10390 </indexterm>
10391 <indexterm role="concept">
10392 <primary>lookup</primary>
10393 <secondary>dnsdb</secondary>
10394 </indexterm>
10395 <indexterm role="concept">
10396 <primary>DNS</primary>
10397 <secondary>as a lookup type</secondary>
10398 </indexterm>
10399 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10400 of a record type and a domain name, separated by an equals sign. For example,
10401 an expansion string could contain:
10402 </para>
10403 <literallayout class="monospaced">
10404 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10405 </literallayout>
10406 <para>
10407 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10408 is used on its own as the result. If the lookup does not succeed, the
10409 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10410 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10411 </para>
10412 <para>
10413 The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, TLSA and TXT,
10414 and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10415 configured). If no type is given, TXT is assumed. When the type is PTR,
10416 the data can be an IP address, written as normal; inversion and the addition of
10417 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10418 </para>
10419 <literallayout class="monospaced">
10420 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10421 </literallayout>
10422 <para>
10423 If the data for a PTR record is not a syntactically valid IP address, it is not
10424 altered and nothing is added.
10425 </para>
10426 <para>
10427 For any record type, if multiple records are found (or, for A6 lookups, if a
10428 single record leads to multiple addresses), the data is returned as a
10429 concatenation, with newline as the default separator. The order, of course,
10430 depends on the DNS resolver. You can specify a different separator character
10431 between multiple records by putting a right angle-bracket followed immediately
10432 by the new separator at the start of the query. For example:
10433 </para>
10434 <literallayout class="monospaced">
10435 ${lookup dnsdb{&gt;: a=host1.example}}
10436 </literallayout>
10437 <para>
10438 It is permitted to specify a space as the separator character. Further
10439 white space is ignored.
10440 </para>
10441 <para>
10442 <indexterm role="concept">
10443 <primary>MX record</primary>
10444 <secondary>in <command>dnsdb</command> lookup</secondary>
10445 </indexterm>
10446 <indexterm role="concept">
10447 <primary>SRV record</primary>
10448 <secondary>in <command>dnsdb</command> lookup</secondary>
10449 </indexterm>
10450 For an MX lookup, both the preference value and the host name are returned for
10451 each record, separated by a space. For an SRV lookup, the priority, weight,
10452 port, and host name are returned for each record, separated by spaces.
10453 </para>
10454 <para revisionflag="changed">
10455 An alternate field separator can be specified using a comma after the main
10456 separator character, followed immediately by the field separator.
10457 </para>
10458 <para>
10459 <indexterm role="concept">
10460 <primary>TXT record</primary>
10461 <secondary>in <command>dnsdb</command> lookup</secondary>
10462 </indexterm>
10463 <indexterm role="concept">
10464 <primary>SPF record</primary>
10465 <secondary>in <command>dnsdb</command> lookup</secondary>
10466 </indexterm>
10467 For TXT records with multiple items of data, only the first item is returned,
10468 unless a separator for them is specified using a comma after the separator
10469 character followed immediately by the TXT record item separator. To concatenate
10470 items without a separator, use a semicolon instead. For SPF records the
10471 default behaviour is to concatenate multiple items without using a separator.
10472 </para>
10473 <literallayout class="monospaced">
10474 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10475 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10476 ${lookup dnsdb{spf=example.org}}
10477 </literallayout>
10478 <para>
10479 It is permitted to specify a space as the separator character. Further
10480 white space is ignored.
10481 </para>
10482 </section>
10483 <section id="SECTdnsdb_mod">
10484 <title>Dnsdb lookup modifiers</title>
10485 <para>
10486 <indexterm role="concept">
10487 <primary>dnsdb modifiers</primary>
10488 </indexterm>
10489 <indexterm role="concept">
10490 <primary>modifiers</primary>
10491 <secondary>dnsdb</secondary>
10492 </indexterm>
10493 <indexterm role="concept">
10494 <primary>options</primary>
10495 <secondary>dnsdb</secondary>
10496 </indexterm>
10497 Modifiers for <command>dnsdb</command> lookups are givien by optional keywords,
10498 each followed by a comma,
10499 that may appear before the record type.
10500 </para>
10501 <para>
10502 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10503 temporary DNS error for any of them, the behaviour is controlled by
10504 a defer-option modifier.
10505 The possible keywords are
10506 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10507 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10508 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10509 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10510 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10511 error causes the whole lookup to defer only if none of the other lookups
10512 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10513 </para>
10514 <literallayout class="monospaced">
10515 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10516 ${lookup dnsdb{a=one.host.com:two.host.com}}
10517 </literallayout>
10518 <para>
10519 Thus, in the default case, as long as at least one of the DNS lookups
10520 yields some data, the lookup succeeds.
10521 </para>
10522 <para>
10523 <indexterm role="concept">
10524 <primary>DNSSEC</primary>
10525 <secondary>dns lookup</secondary>
10526 </indexterm>
10527 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10528 The possible keywords are
10529 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10530 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10531 with the lookup.
10532 With <quote>strict</quote> a response from the DNS resolver that
10533 is not labelled as authenticated data
10534 is treated as equivalent to a temporary DNS error.
10535 The default is <quote>never</quote>.
10536 </para>
10537 <para>
10538 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10539 </para>
10540 </section>
10541 <section id="SECID66">
10542 <title>Pseudo dnsdb record types</title>
10543 <para>
10544 <indexterm role="concept">
10545 <primary>MX record</primary>
10546 <secondary>in <command>dnsdb</command> lookup</secondary>
10547 </indexterm>
10548 By default, both the preference value and the host name are returned for
10549 each MX record, separated by a space. If you want only host names, you can use
10550 the pseudo-type MXH:
10551 </para>
10552 <literallayout class="monospaced">
10553 ${lookup dnsdb{mxh=a.b.example}}
10554 </literallayout>
10555 <para>
10556 In this case, the preference values are omitted, and just the host names are
10557 returned.
10558 </para>
10559 <para>
10560 <indexterm role="concept">
10561 <primary>name server for enclosing domain</primary>
10562 </indexterm>
10563 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10564 records on the given domain, but if none are found, it removes the first
10565 component of the domain name, and tries again. This process continues until NS
10566 records are found or there are no more components left (or there is a DNS
10567 error). In other words, it may return the name servers for a top-level domain,
10568 but it never returns the root name servers. If there are no NS records for the
10569 top-level domain, the lookup fails. Consider these examples:
10570 </para>
10571 <literallayout class="monospaced">
10572 ${lookup dnsdb{zns=xxx.quercite.com}}
10573 ${lookup dnsdb{zns=xxx.edu}}
10574 </literallayout>
10575 <para>
10576 Assuming that in each case there are no NS records for the full domain name,
10577 the first returns the name servers for <option>quercite.com</option>, and the second returns
10578 the name servers for <option>edu</option>.
10579 </para>
10580 <para>
10581 You should be careful about how you use this lookup because, unless the
10582 top-level domain does not exist, the lookup always returns some host names. The
10583 sort of use to which this might be put is for seeing if the name servers for a
10584 given domain are on a blacklist. You can probably assume that the name servers
10585 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10586 such a list.
10587 </para>
10588 <para>
10589 <indexterm role="concept">
10590 <primary>CSA</primary>
10591 <secondary>in <command>dnsdb</command> lookup</secondary>
10592 </indexterm>
10593 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10594 records according to the CSA rules, which are described in section
10595 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10596 not sufficient because of the extra parent domain search behaviour of CSA. The
10597 result of a successful lookup such as:
10598 </para>
10599 <literallayout class="monospaced">
10600 ${lookup dnsdb {csa=$sender_helo_name}}
10601 </literallayout>
10602 <para>
10603 has two space-separated fields: an authorization code and a target host name.
10604 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10605 authorization required but absent, or <quote>?</quote> for unknown.
10606 </para>
10607 <para>
10608 <indexterm role="concept">
10609 <primary>A+</primary>
10610 <secondary>in <command>dnsdb</command> lookup</secondary>
10611 </indexterm>
10612 The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA
10613 and then an A lookup.  All results are returned; defer processing
10614 (see below) is handled separately for each lookup.  Example:
10615 </para>
10616 <literallayout class="monospaced">
10617 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10618 </literallayout>
10619 </section>
10620 <section id="SECID67">
10621 <title>Multiple dnsdb lookups</title>
10622 <para>
10623 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10624 However, you can specify a list of domains or IP addresses in a single
10625 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10626 the default separator, but with the ability to change this. For example:
10627 </para>
10628 <literallayout class="monospaced">
10629 ${lookup dnsdb{one.domain.com:two.domain.com}}
10630 ${lookup dnsdb{a=one.host.com:two.host.com}}
10631 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10632 </literallayout>
10633 <para>
10634 In order to retain backwards compatibility, there is one special case: if
10635 the lookup type is PTR and no change of separator is specified, Exim looks
10636 to see if the rest of the string is precisely one IPv6 address. In this
10637 case, it does not treat it as a list.
10638 </para>
10639 <para>
10640 The data from each lookup is concatenated, with newline separators by default,
10641 in the same way that multiple DNS records for a single item are handled. A
10642 different separator can be specified, as described above.
10643 </para>
10644 </section>
10645 <section id="SECTldap">
10646 <title>More about LDAP</title>
10647 <para>
10648 <indexterm role="concept">
10649 <primary>LDAP</primary>
10650 <secondary>lookup, more about</secondary>
10651 </indexterm>
10652 <indexterm role="concept">
10653 <primary>lookup</primary>
10654 <secondary>LDAP</secondary>
10655 </indexterm>
10656 <indexterm role="concept">
10657 <primary>Solaris</primary>
10658 <secondary>LDAP</secondary>
10659 </indexterm>
10660 The original LDAP implementation came from the University of Michigan; this has
10661 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10662 implementation comes from Netscape, and Solaris 7 and subsequent releases
10663 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10664 the lookup function level, their error handling is different. For this reason
10665 it is necessary to set a compile-time variable when building Exim with LDAP, to
10666 indicate which LDAP library is in use. One of the following should appear in
10667 your <filename>Local/Makefile</filename>:
10668 </para>
10669 <literallayout class="monospaced">
10670 LDAP_LIB_TYPE=UMICHIGAN
10671 LDAP_LIB_TYPE=OPENLDAP1
10672 LDAP_LIB_TYPE=OPENLDAP2
10673 LDAP_LIB_TYPE=NETSCAPE
10674 LDAP_LIB_TYPE=SOLARIS
10675 </literallayout>
10676 <para>
10677 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10678 same interface as the University of Michigan version.
10679 </para>
10680 <para>
10681 There are three LDAP lookup types in Exim. These behave slightly differently in
10682 the way they handle the results of a query:
10683 </para>
10684 <itemizedlist>
10685 <listitem>
10686 <para>
10687 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10688 gives an error.
10689 </para>
10690 </listitem>
10691 <listitem>
10692 <para>
10693 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10694 Distinguished Name that is returned rather than any attribute values.
10695 </para>
10696 </listitem>
10697 <listitem>
10698 <para>
10699 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10700 from all of them are returned.
10701 </para>
10702 </listitem>
10703 </itemizedlist>
10704 <para>
10705 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10706 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10707 the data returned by a successful lookup is described in the next section.
10708 First we explain how LDAP queries are coded.
10709 </para>
10710 </section>
10711 <section id="SECTforldaque">
10712 <title>Format of LDAP queries</title>
10713 <para>
10714 <indexterm role="concept">
10715 <primary>LDAP</primary>
10716 <secondary>query format</secondary>
10717 </indexterm>
10718 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10719 the configuration of a <command>redirect</command> router one might have this setting:
10720 </para>
10721 <literallayout class="monospaced">
10722 data = ${lookup ldap \
10723   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10724   c=UK?mailbox?base?}}
10725 </literallayout>
10726 <para>
10727 <indexterm role="concept">
10728 <primary>LDAP</primary>
10729 <secondary>with TLS</secondary>
10730 </indexterm>
10731 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10732 secure (encrypted) LDAP connections. The second of these ensures that an
10733 encrypted TLS connection is used.
10734 </para>
10735 <para>
10736 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10737 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10738 See the <option>ldap_start_tls</option> option.
10739 </para>
10740 <para>
10741 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10742 controlled. Every part of the TLS configuration can be configured by settings in
10743 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10744 your system, some of the initialization may have required setting options in
10745 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
10746 certificates. This revealed a nuance where the current UID that exim was
10747 running as could affect which config files it read. With Exim 4.83, these
10748 methods become optional, only taking effect if not specifically set in
10749 <filename>exim.conf</filename>.
10750 </para>
10751 </section>
10752 <section id="SECID68">
10753 <title>LDAP quoting</title>
10754 <para>
10755 <indexterm role="concept">
10756 <primary>LDAP</primary>
10757 <secondary>quoting</secondary>
10758 </indexterm>
10759 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10760 and the second because the LDAP query is represented as a URL. Furthermore,
10761 within an LDAP query, two different kinds of quoting are required. For this
10762 reason, there are two different LDAP-specific quoting operators.
10763 </para>
10764 <para>
10765 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10766 filter specifications. Conceptually, it first does the following conversions on
10767 the string:
10768 </para>
10769 <literallayout class="monospaced">
10770 *   =&gt;   \2A
10771 (   =&gt;   \28
10772 )   =&gt;   \29
10773 \   =&gt;   \5C
10774 </literallayout>
10775 <para>
10776 in accordance with RFC 2254. The resulting string is then quoted according
10777 to the rules for URLs, that is, all non-alphanumeric characters except
10778 </para>
10779 <literallayout class="monospaced">
10780 ! $ ' - . _ ( ) * +
10781 </literallayout>
10782 <para>
10783 are converted to their hex values, preceded by a percent sign. For example:
10784 </para>
10785 <literallayout class="monospaced">
10786 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10787 </literallayout>
10788 <para>
10789 yields
10790 </para>
10791 <literallayout class="monospaced">
10792 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10793 </literallayout>
10794 <para>
10795 Removing the URL quoting, this is (with a leading and a trailing space):
10796 </para>
10797 <literallayout class="monospaced">
10798 a\28bc\29\2A, a&lt;yz&gt;;
10799 </literallayout>
10800 <para>
10801 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10802 base DN specifications in queries. Conceptually, it first converts the string
10803 by inserting a backslash in front of any of the following characters:
10804 </para>
10805 <literallayout class="monospaced">
10806 , + " \ &lt; &gt; ;
10807 </literallayout>
10808 <para>
10809 It also inserts a backslash before any leading spaces or # characters, and
10810 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10811 is then quoted according to the rules for URLs. For example:
10812 </para>
10813 <literallayout class="monospaced">
10814 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10815 </literallayout>
10816 <para>
10817 yields
10818 </para>
10819 <literallayout class="monospaced">
10820 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10821 </literallayout>
10822 <para>
10823 Removing the URL quoting, this is (with a trailing space):
10824 </para>
10825 <literallayout class="monospaced">
10826 \ a(bc)*\, a\&lt;yz\&gt;\;\
10827 </literallayout>
10828 <para>
10829 There are some further comments about quoting in the section on LDAP
10830 authentication below.
10831 </para>
10832 </section>
10833 <section id="SECID69">
10834 <title>LDAP connections</title>
10835 <para>
10836 <indexterm role="concept">
10837 <primary>LDAP</primary>
10838 <secondary>connections</secondary>
10839 </indexterm>
10840 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10841 is in use, via a Unix domain socket. The example given above does not specify
10842 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10843 by starting it with
10844 </para>
10845 <literallayout class="monospaced">
10846 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10847 </literallayout>
10848 <para>
10849 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10850 used. When no server is specified in a query, a list of default servers is
10851 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10852 colon-separated list of servers which are tried in turn until one successfully
10853 handles a query, or there is a serious error. Successful handling either
10854 returns the requested data, or indicates that it does not exist. Serious errors
10855 are syntactical, or multiple values when only a single value is expected.
10856 Errors which cause the next server to be tried are connection failures, bind
10857 failures, and timeouts.
10858 </para>
10859 <para>
10860 For each server name in the list, a port number can be given. The standard way
10861 of specifying a host and port is to use a colon separator (RFC 1738). Because
10862 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10863 doubled. For example
10864 </para>
10865 <literallayout class="monospaced">
10866 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10867 </literallayout>
10868 <para>
10869 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10870 to the LDAP library with no server name, and the library&#x2019;s default (normally
10871 the local host) is used.
10872 </para>
10873 <para>
10874 If you are using the OpenLDAP library, you can connect to an LDAP server using
10875 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10876 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10877 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10878 not available.
10879 </para>
10880 <para>
10881 For this type of connection, instead of a host name for the server, a pathname
10882 for the socket is required, and the port number is not relevant. The pathname
10883 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10884 the query. In the former case, you can have settings such as
10885 </para>
10886 <literallayout class="monospaced">
10887 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10888 </literallayout>
10889 <para>
10890 When the pathname is given in the query, you have to escape the slashes as
10891 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10892 </para>
10893 <literallayout class="monospaced">
10894 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10895 </literallayout>
10896 <para>
10897 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10898 a pathname, it uses the Unix domain socket code, even if the query actually
10899 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10900 socket connection. This behaviour means that you can use a setting of
10901 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10902 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10903 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10904 backup host.
10905 </para>
10906 <para>
10907 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10908 specified, an error is diagnosed. However, if there are more items in
10909 <option>ldap_default_servers</option>, they are tried. In other words:
10910 </para>
10911 <itemizedlist>
10912 <listitem>
10913 <para>
10914 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10915 interface.
10916 </para>
10917 </listitem>
10918 <listitem>
10919 <para>
10920 Using <literal>ldapi</literal> with a host name causes an error.
10921 </para>
10922 </listitem>
10923 </itemizedlist>
10924 <para>
10925 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10926 <option>ldap_default_servers</option>, does whatever the library does by default.
10927 </para>
10928 </section>
10929 <section id="SECID70">
10930 <title>LDAP authentication and control information</title>
10931 <para>
10932 <indexterm role="concept">
10933 <primary>LDAP</primary>
10934 <secondary>authentication</secondary>
10935 </indexterm>
10936 The LDAP URL syntax provides no way of passing authentication and other control
10937 information to the server. To make this possible, the URL in an LDAP query may
10938 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10939 spaces. If a value contains spaces it must be enclosed in double quotes, and
10940 when double quotes are used, backslash is interpreted in the usual way inside
10941 them. The following names are recognized:
10942 </para>
10943 <literallayout>
10944 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10945 <literal>NETTIME    </literal>  set a timeout for a network operation
10946 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10947 <literal>PASS       </literal>  set the password, likewise
10948 <literal>REFERRALS  </literal>  set the referrals parameter
10949 <literal>SERVERS    </literal>  set alternate server list for this query only
10950 <literal>SIZE       </literal>  set the limit for the number of entries returned
10951 <literal>TIME       </literal>  set the maximum waiting time for a query
10952 </literallayout>
10953 <para>
10954 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10955 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10956 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10957 library from trying to follow referrals issued by the LDAP server.
10958 </para>
10959 <para>
10960 The name CONNECT is an obsolete name for NETTIME, retained for
10961 backwards compatibility. This timeout (specified as a number of seconds) is
10962 enforced from the client end for operations that can be carried out over a
10963 network. Specifically, it applies to network connections and calls to the
10964 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10965 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10966 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10967 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10968 Netscape SDK; for OpenLDAP no action is taken.
10969 </para>
10970 <para>
10971 The TIME parameter (also a number of seconds) is passed to the server to
10972 set a server-side limit on the time taken to complete a search.
10973 </para>
10974 <para>
10975 The SERVERS parameter allows you to specify an alternate list of ldap servers
10976 to use for an individual lookup.  The global ldap_servers option provides a
10977 default list of ldap servers, and a single lookup can specify a single ldap
10978 server to use.  But when you need to do a lookup with a list of servers that is
10979 different than the default list (maybe different order, maybe a completely
10980 different set of servers), the SERVERS parameter allows you to specify this
10981 alternate list (colon-separated).
10982 </para>
10983 <para>
10984 Here is an example of an LDAP query in an Exim lookup that uses some of these
10985 values. This is a single line, folded to fit on the page:
10986 </para>
10987 <literallayout class="monospaced">
10988 ${lookup ldap
10989   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10990   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10991   {$value}fail}
10992 </literallayout>
10993 <para>
10994 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10995 any of the auxiliary data. Exim configuration settings that include lookups
10996 which contain password information should be preceded by <quote>hide</quote> to prevent
10997 non-admin users from using the <option>-bP</option> option to see their values.
10998 </para>
10999 <para>
11000 The auxiliary data items may be given in any order. The default is no
11001 connection timeout (the system timeout is used), no user or password, no limit
11002 on the number of entries returned, and no time limit on queries.
11003 </para>
11004 <para>
11005 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11006 removes any URL quoting that it may contain before passing it LDAP. Apparently
11007 some libraries do this for themselves, but some do not. Removing the URL
11008 quoting has two advantages:
11009 </para>
11010 <itemizedlist>
11011 <listitem>
11012 <para>
11013 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11014 DNs as with DNs inside actual queries.
11015 </para>
11016 </listitem>
11017 <listitem>
11018 <para>
11019 It permits spaces inside USER= DNs.
11020 </para>
11021 </listitem>
11022 </itemizedlist>
11023 <para>
11024 For example, a setting such as
11025 </para>
11026 <literallayout class="monospaced">
11027 USER=cn=${quote_ldap_dn:$1}
11028 </literallayout>
11029 <para>
11030 should work even if <varname>$1</varname> contains spaces.
11031 </para>
11032 <para>
11033 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11034 expansion operator, rather than the LDAP quote operators. The only reason this
11035 field needs quoting is to ensure that it conforms to the Exim syntax, which
11036 does not allow unquoted spaces. For example:
11037 </para>
11038 <literallayout class="monospaced">
11039 PASS=${quote:$3}
11040 </literallayout>
11041 <para>
11042 The LDAP authentication mechanism can be used to check passwords as part of
11043 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11044 <xref linkend="CHAPexpand"/>.
11045 </para>
11046 </section>
11047 <section id="SECID71">
11048 <title>Format of data returned by LDAP</title>
11049 <para>
11050 <indexterm role="concept">
11051 <primary>LDAP</primary>
11052 <secondary>returned data formats</secondary>
11053 </indexterm>
11054 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11055 as a sequence of values, for example
11056 </para>
11057 <literallayout class="monospaced">
11058 cn=manager, o=University of Cambridge, c=UK
11059 </literallayout>
11060 <para>
11061 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11062 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11063 the result between the data from different entries. It is possible for multiple
11064 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11065 you know that whatever values are returned all came from a single entry in the
11066 directory.
11067 </para>
11068 <para>
11069 In the common case where you specify a single attribute in your LDAP query, the
11070 result is not quoted, and does not contain the attribute name. If the attribute
11071 has multiple values, they are separated by commas.
11072 </para>
11073 <para>
11074 If you specify multiple attributes, the result contains space-separated, quoted
11075 strings, each preceded by the attribute name and an equals sign. Within the
11076 quotes, the quote character, backslash, and newline are escaped with
11077 backslashes, and commas are used to separate multiple values for the attribute.
11078 </para>
11079 <para revisionflag="changed">
11080 Any commas in attribute values are doubled
11081 (permitting treatment of the values as a comma-separated list).
11082 </para>
11083 <para>
11084 Apart from the escaping, the string within quotes takes the same form as the
11085 output when a single attribute is requested. Specifying no attributes is the
11086 same as specifying all of an entry&#x2019;s attributes.
11087 </para>
11088 <para revisionflag="changed">
11089 Here are some examples of the output format. The first line of each pair is an
11090 LDAP query, and the second is the data that is returned. The attribute called
11091 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11092 <option>attr2</option> has only one value:
11093 </para>
11094 <literallayout class="monospaced" revisionflag="changed">
11095 ldap:///o=base?attr1?sub?(uid=fred)
11096 value1.1,value1,,2
11097
11098 ldap:///o=base?attr2?sub?(uid=fred)
11099 value two
11100
11101 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11102 attr1="value1.1,value1,,2" attr2="value two"
11103
11104 ldap:///o=base??sub?(uid=fred)
11105 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11106 </literallayout>
11107 <para>
11108 You can
11109 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11110 results of LDAP lookups.
11111 The <option>extract</option> operator in string expansions can be used to pick out
11112 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11113 </para>
11114 <para revisionflag="changed">
11115 The <option>listextract</option> operator should be used to pick out individual values
11116 of attributes, even when only a single value is expected.
11117 The doubling of embedded commas allows you to use the returned data as a
11118 comma separated list (using the "&lt;," syntax for changing the input list separator).
11119 </para>
11120 </section>
11121 <section id="SECTnisplus">
11122 <title>More about NIS+</title>
11123 <para>
11124 <indexterm role="concept">
11125 <primary>NIS+ lookup type</primary>
11126 </indexterm>
11127 <indexterm role="concept">
11128 <primary>lookup</primary>
11129 <secondary>NIS+</secondary>
11130 </indexterm>
11131 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11132 and field name. If this is given, the result of a successful query is the
11133 contents of the named field; otherwise the result consists of a concatenation
11134 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11135 values containing spaces are quoted. For example, the query
11136 </para>
11137 <literallayout class="monospaced">
11138 [name=mg1456],passwd.org_dir
11139 </literallayout>
11140 <para>
11141 might return the string
11142 </para>
11143 <literallayout class="monospaced">
11144 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11145 home=/home/mg1456 shell=/bin/bash shadow=""
11146 </literallayout>
11147 <para>
11148 (split over two lines here to fit on the page), whereas
11149 </para>
11150 <literallayout class="monospaced">
11151 [name=mg1456],passwd.org_dir:gcos
11152 </literallayout>
11153 <para>
11154 would just return
11155 </para>
11156 <literallayout class="monospaced">
11157 Martin Guerre
11158 </literallayout>
11159 <para>
11160 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11161 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11162 operator is to double any quote characters within the text.
11163 </para>
11164 </section>
11165 <section id="SECTsql">
11166 <title>SQL lookups</title>
11167 <para>
11168 <indexterm role="concept">
11169 <primary>SQL lookup types</primary>
11170 </indexterm>
11171 <indexterm role="concept">
11172 <primary>MySQL</primary>
11173 <secondary>lookup type</secondary>
11174 </indexterm>
11175 <indexterm role="concept">
11176 <primary>PostgreSQL lookup type</primary>
11177 </indexterm>
11178 <indexterm role="concept">
11179 <primary>lookup</primary>
11180 <secondary>MySQL</secondary>
11181 </indexterm>
11182 <indexterm role="concept">
11183 <primary>lookup</primary>
11184 <secondary>PostgreSQL</secondary>
11185 </indexterm>
11186 <indexterm role="concept">
11187 <primary>Oracle</primary>
11188 <secondary>lookup type</secondary>
11189 </indexterm>
11190 <indexterm role="concept">
11191 <primary>lookup</primary>
11192 <secondary>Oracle</secondary>
11193 </indexterm>
11194 <indexterm role="concept">
11195 <primary>InterBase lookup type</primary>
11196 </indexterm>
11197 <indexterm role="concept">
11198 <primary>lookup</primary>
11199 <secondary>InterBase</secondary>
11200 </indexterm>
11201 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11202 databases. Queries for these databases contain SQL statements, so an example
11203 might be
11204 </para>
11205 <literallayout class="monospaced">
11206 ${lookup mysql{select mailbox from users where id='userx'}\
11207   {$value}fail}
11208 </literallayout>
11209 <para>
11210 If the result of the query contains more than one field, the data for each
11211 field in the row is returned, preceded by its name, so the result of
11212 </para>
11213 <literallayout class="monospaced">
11214 ${lookup pgsql{select home,name from users where id='userx'}\
11215   {$value}}
11216 </literallayout>
11217 <para>
11218 might be
11219 </para>
11220 <literallayout class="monospaced">
11221 home=/home/userx name="Mister X"
11222 </literallayout>
11223 <para>
11224 Empty values and values containing spaces are double quoted, with embedded
11225 quotes escaped by a backslash. If the result of the query contains just one
11226 field, the value is passed back verbatim, without a field name, for example:
11227 </para>
11228 <literallayout class="monospaced">
11229 Mister X
11230 </literallayout>
11231 <para>
11232 If the result of the query yields more than one row, it is all concatenated,
11233 with a newline between the data for each row.
11234 </para>
11235 </section>
11236 <section id="SECID72">
11237 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11238 <para>
11239 <indexterm role="concept">
11240 <primary>MySQL</primary>
11241 <secondary>lookup type</secondary>
11242 </indexterm>
11243 <indexterm role="concept">
11244 <primary>PostgreSQL lookup type</primary>
11245 </indexterm>
11246 <indexterm role="concept">
11247 <primary>lookup</primary>
11248 <secondary>MySQL</secondary>
11249 </indexterm>
11250 <indexterm role="concept">
11251 <primary>lookup</primary>
11252 <secondary>PostgreSQL</secondary>
11253 </indexterm>
11254 <indexterm role="concept">
11255 <primary>Oracle</primary>
11256 <secondary>lookup type</secondary>
11257 </indexterm>
11258 <indexterm role="concept">
11259 <primary>lookup</primary>
11260 <secondary>Oracle</secondary>
11261 </indexterm>
11262 <indexterm role="concept">
11263 <primary>InterBase lookup type</primary>
11264 </indexterm>
11265 <indexterm role="concept">
11266 <primary>lookup</primary>
11267 <secondary>InterBase</secondary>
11268 </indexterm>
11269 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11270 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11271 option (as appropriate) must be set to a colon-separated list of server
11272 information.
11273 (For MySQL and PostgreSQL only, the global option need not be set if all
11274 queries contain their own server information &ndash; see section
11275 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11276 items: host name, database name, user name, and password. In the case of
11277 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11278 name field is not used and should be empty. For example:
11279 </para>
11280 <literallayout class="monospaced">
11281 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11282 </literallayout>
11283 <para>
11284 Because password data is sensitive, you should always precede the setting with
11285 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11286 option. Here is an example where two MySQL servers are listed:
11287 </para>
11288 <literallayout class="monospaced">
11289 hide mysql_servers = localhost/users/root/secret:\
11290                      otherhost/users/root/othersecret
11291 </literallayout>
11292 <para>
11293 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11294 because this is a colon-separated list, the colon has to be doubled. For each
11295 query, these parameter groups are tried in order until a connection is made and
11296 a query is successfully processed. The result of a query may be that no data is
11297 found, but that is still a successful query. In other words, the list of
11298 servers provides a backup facility, not a list of different places to look.
11299 </para>
11300 <para>
11301 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11302 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11303 respectively, and the characters single-quote, double-quote, and backslash
11304 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11305 addition, escapes the percent and underscore characters. This cannot be done
11306 for MySQL because these escapes are not recognized in contexts where these
11307 characters are not special.
11308 </para>
11309 </section>
11310 <section id="SECTspeserque">
11311 <title>Specifying the server in the query</title>
11312 <para>
11313 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11314 it is possible to specify a list of servers with an individual query. This is
11315 done by starting the query with
11316 </para>
11317 <literallayout>
11318 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11319 </literallayout>
11320 <para>
11321 Each item in the list may take one of two forms:
11322 </para>
11323 <orderedlist numeration="arabic">
11324 <listitem>
11325 <para>
11326 If it contains no slashes it is assumed to be just a host name. The appropriate
11327 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11328 of the same name, and the remaining parameters (database, user, password) are
11329 taken from there.
11330 </para>
11331 </listitem>
11332 <listitem>
11333 <para>
11334 If it contains any slashes, it is taken as a complete parameter set.
11335 </para>
11336 </listitem>
11337 </orderedlist>
11338 <para>
11339 The list of servers is used in exactly the same way as the global list.
11340 Once a connection to a server has happened and a query has been
11341 successfully executed, processing of the lookup ceases.
11342 </para>
11343 <para>
11344 This feature is intended for use in master/slave situations where updates
11345 are occurring and you want to update the master rather than a slave. If the
11346 master is in the list as a backup for reading, you might have a global setting
11347 like this:
11348 </para>
11349 <literallayout class="monospaced">
11350 mysql_servers = slave1/db/name/pw:\
11351                 slave2/db/name/pw:\
11352                 master/db/name/pw
11353 </literallayout>
11354 <para>
11355 In an updating lookup, you could then write:
11356 </para>
11357 <literallayout class="monospaced">
11358 ${lookup mysql{servers=master; UPDATE ...} }
11359 </literallayout>
11360 <para>
11361 That query would then be sent only to the master server. If, on the other hand,
11362 the master is not to be used for reading, and so is not present in the global
11363 option, you can still update it by a query of this form:
11364 </para>
11365 <literallayout class="monospaced">
11366 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11367 </literallayout>
11368 </section>
11369 <section id="SECID73">
11370 <title>Special MySQL features</title>
11371 <para>
11372 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11373 causes a connection to the server on the local host by means of a Unix domain
11374 socket. An alternate socket can be specified in parentheses. The full syntax of
11375 each item in <option>mysql_servers</option> is:
11376 </para>
11377 <literallayout>
11378 &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;
11379 </literallayout>
11380 <para>
11381 Any of the three sub-parts of the first field can be omitted. For normal use on
11382 the local host it can be left blank or set to just <quote>localhost</quote>.
11383 </para>
11384 <para>
11385 No database need be supplied &ndash; but if it is absent here, it must be given in
11386 the queries.
11387 </para>
11388 <para>
11389 If a MySQL query is issued that does not request any data (an insert, update,
11390 or delete command), the result of the lookup is the number of rows affected.
11391 </para>
11392 <para>
11393 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11394 anything (for example, setting a field to the value it already has), the result
11395 is zero because no rows are affected.
11396 </para>
11397 </section>
11398 <section id="SECID74">
11399 <title>Special PostgreSQL features</title>
11400 <para>
11401 PostgreSQL lookups can also use Unix domain socket connections to the database.
11402 This is usually faster and costs less CPU time than a TCP/IP connection.
11403 However it can be used only if the mail server runs on the same machine as the
11404 database server. A configuration line for PostgreSQL via Unix domain sockets
11405 looks like this:
11406 </para>
11407 <literallayout class="monospaced">
11408 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11409 </literallayout>
11410 <para>
11411 In other words, instead of supplying a host name, a path to the socket is
11412 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11413 visually confused with the delimiters for the other server parameters.
11414 </para>
11415 <para>
11416 If a PostgreSQL query is issued that does not request any data (an insert,
11417 update, or delete command), the result of the lookup is the number of rows
11418 affected.
11419 </para>
11420 </section>
11421 <section id="SECTsqlite">
11422 <title>More about SQLite</title>
11423 <para>
11424 <indexterm role="concept">
11425 <primary>lookup</primary>
11426 <secondary>SQLite</secondary>
11427 </indexterm>
11428 <indexterm role="concept">
11429 <primary>sqlite lookup type</primary>
11430 </indexterm>
11431 SQLite is different to the other SQL lookups because a file name is required in
11432 addition to the SQL query. An SQLite database is a single file, and there is no
11433 daemon as in the other SQL databases. The interface to Exim requires the name
11434 of the file, as an absolute path, to be given at the start of the query. It is
11435 separated from the query by white space. This means that the path name cannot
11436 contain white space. Here is a lookup expansion example:
11437 </para>
11438 <literallayout class="monospaced">
11439 ${lookup sqlite {/some/thing/sqlitedb \
11440   select name from aliases where id='userx';}}
11441 </literallayout>
11442 <para>
11443 In a list, the syntax is similar. For example:
11444 </para>
11445 <literallayout class="monospaced">
11446 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11447    select * from relays where ip='$sender_host_address';
11448 </literallayout>
11449 <para>
11450 The only character affected by the <option>quote_sqlite</option> operator is a single
11451 quote, which it doubles.
11452 </para>
11453 <para>
11454 The SQLite library handles multiple simultaneous accesses to the database
11455 internally. Multiple readers are permitted, but only one process can
11456 update at once. Attempts to access the database while it is being updated
11457 are rejected after a timeout period, during which the SQLite library
11458 waits for the lock to be released. In Exim, the default timeout is set
11459 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11460 option.
11461 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11462 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11463 </para>
11464 </section>
11465 </chapter>
11466
11467 <chapter id="CHAPdomhosaddlists">
11468 <title>Domain, host, address, and local part lists</title>
11469 <titleabbrev>Domain, host, and address lists</titleabbrev>
11470 <para>
11471 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11472 <primary>lists of domains; hosts; etc.</primary>
11473 </indexterm>
11474 A number of Exim configuration options contain lists of domains, hosts,
11475 email addresses, or local parts. For example, the <option>hold_domains</option> option
11476 contains a list of domains whose delivery is currently suspended. These lists
11477 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11478 arguments to expansion conditions such as <option>match_domain</option>.
11479 </para>
11480 <para>
11481 Each item in one of these lists is a pattern to be matched against a domain,
11482 host, email address, or local part, respectively. In the sections below, the
11483 different types of pattern for each case are described, but first we cover some
11484 general facilities that apply to all four kinds of list.
11485 </para>
11486 <section id="SECID75">
11487 <title>Expansion of lists</title>
11488 <para>
11489 <indexterm role="concept">
11490 <primary>expansion</primary>
11491 <secondary>of lists</secondary>
11492 </indexterm>
11493 Each list is expanded as a single string before it is used. The result of
11494 expansion must be a list, possibly containing empty items, which is split up
11495 into separate items for matching. By default, colon is the separator character,
11496 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11497 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11498 discusses the way to specify empty list items.
11499 </para>
11500 <para>
11501 If the string expansion is forced to fail, Exim behaves as if the item it is
11502 testing (domain, host, address, or local part) is not in the list. Other
11503 expansion failures cause temporary errors.
11504 </para>
11505 <para>
11506 If an item in a list is a regular expression, backslashes, dollars and possibly
11507 other special characters in the expression must be protected against
11508 misinterpretation by the string expander. The easiest way to do this is to use
11509 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11510 expression should not be expanded. For example, in an ACL you might have:
11511 </para>
11512 <literallayout class="monospaced">
11513 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11514                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11515 </literallayout>
11516 <para>
11517 The first item is a regular expression that is protected from expansion by
11518 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11519 senders based on the receiving domain.
11520 </para>
11521 </section>
11522 <section id="SECID76">
11523 <title>Negated items in lists</title>
11524 <para>
11525 <indexterm role="concept">
11526 <primary>list</primary>
11527 <secondary>negation</secondary>
11528 </indexterm>
11529 <indexterm role="concept">
11530 <primary>negation</primary>
11531 <secondary>in lists</secondary>
11532 </indexterm>
11533 Items in a list may be positive or negative. Negative items are indicated by a
11534 leading exclamation mark, which may be followed by optional white space. A list
11535 defines a set of items (domains, etc). When Exim processes one of these lists,
11536 it is trying to find out whether a domain, host, address, or local part
11537 (respectively) is in the set that is defined by the list. It works like this:
11538 </para>
11539 <para>
11540 The list is scanned from left to right. If a positive item is matched, the
11541 subject that is being checked is in the set; if a negative item is matched, the
11542 subject is not in the set. If the end of the list is reached without the
11543 subject having matched any of the patterns, it is in the set if the last item
11544 was a negative one, but not if it was a positive one. For example, the list in
11545 </para>
11546 <literallayout class="monospaced">
11547 domainlist relay_to_domains = !a.b.c : *.b.c
11548 </literallayout>
11549 <para>
11550 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11551 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11552 list is positive. However, if the setting were
11553 </para>
11554 <literallayout class="monospaced">
11555 domainlist relay_to_domains = !a.b.c
11556 </literallayout>
11557 <para>
11558 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11559 list is negative. In other words, a list that ends with a negative item behaves
11560 as if it had an extra item <literal>:*</literal> on the end.
11561 </para>
11562 <para>
11563 Another way of thinking about positive and negative items in lists is to read
11564 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11565 item.
11566 </para>
11567 </section>
11568 <section id="SECTfilnamlis">
11569 <title>File names in lists</title>
11570 <para>
11571 <indexterm role="concept">
11572 <primary>list</primary>
11573 <secondary>file name in</secondary>
11574 </indexterm>
11575 If an item in a domain, host, address, or local part list is an absolute file
11576 name (beginning with a slash character), each line of the file is read and
11577 processed as if it were an independent item in the list, except that further
11578 file names are not allowed,
11579 and no expansion of the data from the file takes place.
11580 Empty lines in the file are ignored, and the file may also contain comment
11581 lines:
11582 </para>
11583 <itemizedlist>
11584 <listitem>
11585 <para>
11586 For domain and host lists, if a # character appears anywhere in a line of the
11587 file, it and all following characters are ignored.
11588 </para>
11589 </listitem>
11590 <listitem>
11591 <para>
11592 Because local parts may legitimately contain # characters, a comment in an
11593 address list or local part list file is recognized only if # is preceded by
11594 white space or the start of the line. For example:
11595 </para>
11596 <literallayout class="monospaced">
11597 not#comment@x.y.z   # but this is a comment
11598 </literallayout>
11599 </listitem>
11600 </itemizedlist>
11601 <para>
11602 Putting a file name in a list has the same effect as inserting each line of the
11603 file as an item in the list (blank lines and comments excepted). However, there
11604 is one important difference: the file is read each time the list is processed,
11605 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11606 </para>
11607 <para>
11608 If a file name is preceded by an exclamation mark, the sense of any match
11609 within the file is inverted. For example, if
11610 </para>
11611 <literallayout class="monospaced">
11612 hold_domains = !/etc/nohold-domains
11613 </literallayout>
11614 <para>
11615 and the file contains the lines
11616 </para>
11617 <literallayout class="monospaced">
11618 !a.b.c
11619 *.b.c
11620 </literallayout>
11621 <para>
11622 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11623 any domain matching <literal>*.b.c</literal> is not.
11624 </para>
11625 </section>
11626 <section id="SECID77">
11627 <title>An lsearch file is not an out-of-line list</title>
11628 <para>
11629 As will be described in the sections that follow, lookups can be used in lists
11630 to provide indexed methods of checking list membership. There has been some
11631 confusion about the way <command>lsearch</command> lookups work in lists. Because
11632 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11633 sometimes thought that it is allowed to contain wild cards and other kinds of
11634 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11635 always fixed strings, just as for any other single-key lookup type.
11636 </para>
11637 <para>
11638 If you want to use a file to contain wild-card patterns that form part of a
11639 list, just give the file name on its own, without a search type, as described
11640 in the previous section. You could also use the <command>wildlsearch</command> or
11641 <command>nwildlsearch</command>, but there is no advantage in doing this.
11642 </para>
11643 </section>
11644 <section id="SECTnamedlists">
11645 <title>Named lists</title>
11646 <para>
11647 <indexterm role="concept">
11648 <primary>named lists</primary>
11649 </indexterm>
11650 <indexterm role="concept">
11651 <primary>list</primary>
11652 <secondary>named</secondary>
11653 </indexterm>
11654 A list of domains, hosts, email addresses, or local parts can be given a name
11655 which is then used to refer to the list elsewhere in the configuration. This is
11656 particularly convenient if the same list is required in several different
11657 places. It also allows lists to be given meaningful names, which can improve
11658 the readability of the configuration. For example, it is conventional to define
11659 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11660 locally on a host, using a configuration line such as
11661 </para>
11662 <literallayout class="monospaced">
11663 domainlist local_domains = localhost:my.dom.example
11664 </literallayout>
11665 <para>
11666 Named lists are referenced by giving their name preceded by a plus sign, so,
11667 for example, a router that is intended to handle local domains would be
11668 configured with the line
11669 </para>
11670 <literallayout class="monospaced">
11671 domains = +local_domains
11672 </literallayout>
11673 <para>
11674 The first router in a configuration is often one that handles all domains
11675 except the local ones, using a configuration with a negated item like this:
11676 </para>
11677 <literallayout class="monospaced">
11678 dnslookup:
11679   driver = dnslookup
11680   domains = ! +local_domains
11681   transport = remote_smtp
11682   no_more
11683 </literallayout>
11684 <para>
11685 The four kinds of named list are created by configuration lines starting with
11686 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11687 respectively. Then there follows the name that you are defining, followed by an
11688 equals sign and the list itself. For example:
11689 </para>
11690 <literallayout class="monospaced">
11691 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11692 addresslist bad_senders = cdb;/etc/badsenders
11693 </literallayout>
11694 <para>
11695 A named list may refer to other named lists:
11696 </para>
11697 <literallayout class="monospaced">
11698 domainlist  dom1 = first.example : second.example
11699 domainlist  dom2 = +dom1 : third.example
11700 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11701 </literallayout>
11702 <para>
11703 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11704 effect may not be what you intended, because the negation does not propagate
11705 out to the higher level. For example, consider:
11706 </para>
11707 <literallayout class="monospaced">
11708 domainlist  dom1 = !a.b
11709 domainlist  dom2 = +dom1 : *.b
11710 </literallayout>
11711 <para>
11712 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11713 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11714 means it matches the second list as well. The effect is not the same as
11715 </para>
11716 <literallayout class="monospaced">
11717 domainlist  dom2 = !a.b : *.b
11718 </literallayout>
11719 <para>
11720 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11721 referenced lists if you can.
11722 </para>
11723 <para>
11724 Named lists may have a performance advantage. When Exim is routing an
11725 address or checking an incoming message, it caches the result of tests on named
11726 lists. So, if you have a setting such as
11727 </para>
11728 <literallayout class="monospaced">
11729 domains = +local_domains
11730 </literallayout>
11731 <para>
11732 on several of your routers
11733 or in several ACL statements,
11734 the actual test is done only for the first one. However, the caching works only
11735 if there are no expansions within the list itself or any sublists that it
11736 references. In other words, caching happens only for lists that are known to be
11737 the same each time they are referenced.
11738 </para>
11739 <para>
11740 By default, there may be up to 16 named lists of each type. This limit can be
11741 extended by changing a compile-time variable. The use of domain and host lists
11742 is recommended for concepts such as local domains, relay domains, and relay
11743 hosts. The default configuration is set up like this.
11744 </para>
11745 </section>
11746 <section id="SECID78">
11747 <title>Named lists compared with macros</title>
11748 <para>
11749 <indexterm role="concept">
11750 <primary>list</primary>
11751 <secondary>named compared with macro</secondary>
11752 </indexterm>
11753 <indexterm role="concept">
11754 <primary>macro</primary>
11755 <secondary>compared with named list</secondary>
11756 </indexterm>
11757 At first sight, named lists might seem to be no different from macros in the
11758 configuration file. However, macros are just textual substitutions. If you
11759 write
11760 </para>
11761 <literallayout class="monospaced">
11762 ALIST = host1 : host2
11763 auth_advertise_hosts = !ALIST
11764 </literallayout>
11765 <para>
11766 it probably won&#x2019;t do what you want, because that is exactly the same as
11767 </para>
11768 <literallayout class="monospaced">
11769 auth_advertise_hosts = !host1 : host2
11770 </literallayout>
11771 <para>
11772 Notice that the second host name is not negated. However, if you use a host
11773 list, and write
11774 </para>
11775 <literallayout class="monospaced">
11776 hostlist alist = host1 : host2
11777 auth_advertise_hosts = ! +alist
11778 </literallayout>
11779 <para>
11780 the negation applies to the whole list, and so that is equivalent to
11781 </para>
11782 <literallayout class="monospaced">
11783 auth_advertise_hosts = !host1 : !host2
11784 </literallayout>
11785 </section>
11786 <section id="SECID79">
11787 <title>Named list caching</title>
11788 <para>
11789 <indexterm role="concept">
11790 <primary>list</primary>
11791 <secondary>caching of named</secondary>
11792 </indexterm>
11793 <indexterm role="concept">
11794 <primary>caching</primary>
11795 <secondary>named lists</secondary>
11796 </indexterm>
11797 While processing a message, Exim caches the result of checking a named list if
11798 it is sure that the list is the same each time. In practice, this means that
11799 the cache operates only if the list contains no $ characters, which guarantees
11800 that it will not change when it is expanded. Sometimes, however, you may have
11801 an expanded list that you know will be the same each time within a given
11802 message. For example:
11803 </para>
11804 <literallayout class="monospaced">
11805 domainlist special_domains = \
11806            ${lookup{$sender_host_address}cdb{/some/file}}
11807 </literallayout>
11808 <para>
11809 This provides a list of domains that depends only on the sending host&#x2019;s IP
11810 address. If this domain list is referenced a number of times (for example,
11811 in several ACL lines, or in several routers) the result of the check is not
11812 cached by default, because Exim does not know that it is going to be the
11813 same list each time.
11814 </para>
11815 <para>
11816 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11817 cache the result anyway. For example:
11818 </para>
11819 <literallayout class="monospaced">
11820 domainlist_cache special_domains = ${lookup{...
11821 </literallayout>
11822 <para>
11823 If you do this, you should be absolutely sure that caching is going to do
11824 the right thing in all cases. When in doubt, leave it out.
11825 </para>
11826 </section>
11827 <section id="SECTdomainlist">
11828 <title>Domain lists</title>
11829 <para>
11830 <indexterm role="concept">
11831 <primary>domain list</primary>
11832 <secondary>patterns for</secondary>
11833 </indexterm>
11834 <indexterm role="concept">
11835 <primary>list</primary>
11836 <secondary>domain list</secondary>
11837 </indexterm>
11838 Domain lists contain patterns that are to be matched against a mail domain.
11839 The following types of item may appear in domain lists:
11840 </para>
11841 <itemizedlist>
11842 <listitem>
11843 <para>
11844 <indexterm role="concept">
11845 <primary>primary host name</primary>
11846 </indexterm>
11847 <indexterm role="concept">
11848 <primary>host name</primary>
11849 <secondary>matched in domain list</secondary>
11850 </indexterm>
11851 <indexterm role="option">
11852 <primary><option>primary_hostname</option></primary>
11853 </indexterm>
11854 <indexterm role="concept">
11855 <primary>domain list</primary>
11856 <secondary>matching primary host name</secondary>
11857 </indexterm>
11858 <indexterm role="concept">
11859 <primary>@ in a domain list</primary>
11860 </indexterm>
11861 If a pattern consists of a single @ character, it matches the local host name,
11862 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11863 possible to use the same configuration file on several different hosts that
11864 differ only in their names.
11865 </para>
11866 </listitem>
11867 <listitem>
11868 <para>
11869 <indexterm role="concept">
11870 <primary>@[] in a domain list</primary>
11871 </indexterm>
11872 <indexterm role="concept">
11873 <primary>domain list</primary>
11874 <secondary>matching local IP interfaces</secondary>
11875 </indexterm>
11876 <indexterm role="concept">
11877 <primary>domain literal</primary>
11878 </indexterm>
11879 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11880 in square brackets (as in an email address that contains a domain literal), but
11881 only if that IP address is recognized as local for email routing purposes. The
11882 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11883 control which of a host&#x2019;s several IP addresses are treated as local.
11884 In today&#x2019;s Internet, the use of domain literals is controversial.
11885 </para>
11886 </listitem>
11887 <listitem>
11888 <para>
11889 <indexterm role="concept">
11890 <primary>@mx_any</primary>
11891 </indexterm>
11892 <indexterm role="concept">
11893 <primary>@mx_primary</primary>
11894 </indexterm>
11895 <indexterm role="concept">
11896 <primary>@mx_secondary</primary>
11897 </indexterm>
11898 <indexterm role="concept">
11899 <primary>domain list</primary>
11900 <secondary>matching MX pointers to local host</secondary>
11901 </indexterm>
11902 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11903 has an MX record pointing to the local host or to any host that is listed in
11904 <indexterm role="option">
11905 <primary><option>hosts_treat_as_local</option></primary>
11906 </indexterm>
11907 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11908 are similar, except that the first matches only when a primary MX target is the
11909 local host, and the second only when no primary MX target is the local host,
11910 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11911 preference value &ndash; there may of course be more than one of them.
11912 </para>
11913 <para>
11914 The MX lookup that takes place when matching a pattern of this type is
11915 performed with the resolver options for widening names turned off. Thus, for
11916 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11917 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11918 options of the <command>dnslookup</command> router for a discussion of domain widening.
11919 </para>
11920 <para>
11921 Sometimes you may want to ignore certain IP addresses when using one of these
11922 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11923 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11924 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11925 on a router). For example:
11926 </para>
11927 <literallayout class="monospaced">
11928 domains = @mx_any/ignore=127.0.0.1
11929 </literallayout>
11930 <para>
11931 This example matches any domain that has an MX record pointing to one of
11932 the local host&#x2019;s IP addresses other than 127.0.0.1.
11933 </para>
11934 <para>
11935 The list of IP addresses is in fact processed by the same code that processes
11936 host lists, so it may contain CIDR-coded network specifications and it may also
11937 contain negative items.
11938 </para>
11939 <para>
11940 Because the list of IP addresses is a sublist within a domain list, you have to
11941 be careful about delimiters if there is more than one address. Like any other
11942 list, the default delimiter can be changed. Thus, you might have:
11943 </para>
11944 <literallayout class="monospaced">
11945 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11946           an.other.domain : ...
11947 </literallayout>
11948 <para>
11949 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11950 involved, it is easiest to change the delimiter for the main list as well:
11951 </para>
11952 <literallayout class="monospaced">
11953 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11954           an.other.domain ? ...
11955 </literallayout>
11956 </listitem>
11957 <listitem>
11958 <para>
11959 <indexterm role="concept">
11960 <primary>asterisk</primary>
11961 <secondary>in domain list</secondary>
11962 </indexterm>
11963 <indexterm role="concept">
11964 <primary>domain list</primary>
11965 <secondary>asterisk in</secondary>
11966 </indexterm>
11967 <indexterm role="concept">
11968 <primary>domain list</primary>
11969 <secondary>matching <quote>ends with</quote></secondary>
11970 </indexterm>
11971 If a pattern starts with an asterisk, the remaining characters of the pattern
11972 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11973 domain lists differs from its use in partial matching lookups. In a domain
11974 list, the character following the asterisk need not be a dot, whereas partial
11975 matching works only in terms of dot-separated components. For example, a domain
11976 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11977 <emphasis>cipher.key.ex</emphasis>.
11978 </para>
11979 </listitem>
11980 <listitem>
11981 <para>
11982 <indexterm role="concept">
11983 <primary>regular expressions</primary>
11984 <secondary>in domain list</secondary>
11985 </indexterm>
11986 <indexterm role="concept">
11987 <primary>domain list</primary>
11988 <secondary>matching regular expression</secondary>
11989 </indexterm>
11990 If a pattern starts with a circumflex character, it is treated as a regular
11991 expression, and matched against the domain using a regular expression matching
11992 function. The circumflex is treated as part of the regular expression.
11993 Email domains are case-independent, so this regular expression match is by
11994 default case-independent, but you can make it case-dependent by starting it
11995 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11996 are given in chapter <xref linkend="CHAPregexp"/>.
11997 </para>
11998 <para>
11999 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12000 must escape any backslash and dollar characters in the regular expression, or
12001 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12002 it is not to be expanded (unless you really do want to build a regular
12003 expression by expansion, of course).
12004 </para>
12005 </listitem>
12006 <listitem>
12007 <para>
12008 <indexterm role="concept">
12009 <primary>lookup</primary>
12010 <secondary>in domain list</secondary>
12011 </indexterm>
12012 <indexterm role="concept">
12013 <primary>domain list</primary>
12014 <secondary>matching by lookup</secondary>
12015 </indexterm>
12016 If a pattern starts with the name of a single-key lookup type followed by a
12017 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12018 must be a file name in a suitable format for the lookup type. For example, for
12019 <quote>cdb;</quote> it must be an absolute path:
12020 </para>
12021 <literallayout class="monospaced">
12022 domains = cdb;/etc/mail/local_domains.cdb
12023 </literallayout>
12024 <para>
12025 The appropriate type of lookup is done on the file using the domain name as the
12026 key. In most cases, the data that is looked up is not used; Exim is interested
12027 only in whether or not the key is present in the file. However, when a lookup
12028 is used for the <option>domains</option> option on a router
12029 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12030 <varname>$domain_data</varname> variable and can be referred to in other router options or
12031 other statements in the same ACL.
12032 </para>
12033 </listitem>
12034 <listitem>
12035 <para>
12036 Any of the single-key lookup type names may be preceded by
12037 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12038 </para>
12039 <literallayout class="monospaced">
12040 domains = partial-dbm;/partial/domains
12041 </literallayout>
12042 <para>
12043 This causes partial matching logic to be invoked; a description of how this
12044 works is given in section <xref linkend="SECTpartiallookup"/>.
12045 </para>
12046 </listitem>
12047 <listitem>
12048 <para>
12049 <indexterm role="concept">
12050 <primary>asterisk</primary>
12051 <secondary>in lookup type</secondary>
12052 </indexterm>
12053 Any of the single-key lookup types may be followed by an asterisk. This causes
12054 a default lookup for a key consisting of a single asterisk to be done if the
12055 original lookup fails. This is not a useful feature when using a domain list to
12056 select particular domains (because any domain would match), but it might have
12057 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12058 expansion variable.
12059 </para>
12060 </listitem>
12061 <listitem>
12062 <para>
12063 If the pattern starts with the name of a query-style lookup type followed by a
12064 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12065 pattern must be an appropriate query for the lookup type, as described in
12066 chapter <xref linkend="CHAPfdlookup"/>. For example:
12067 </para>
12068 <literallayout class="monospaced">
12069 hold_domains = mysql;select domain from holdlist \
12070   where domain = '${quote_mysql:$domain}';
12071 </literallayout>
12072 <para>
12073 In most cases, the data that is looked up is not used (so for an SQL query, for
12074 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12075 whether or not the query succeeds. However, when a lookup is used for the
12076 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12077 variable and can be referred to in other options.
12078 </para>
12079 </listitem>
12080 <listitem>
12081 <para>
12082 <indexterm role="concept">
12083 <primary>domain list</primary>
12084 <secondary>matching literal domain name</secondary>
12085 </indexterm>
12086 If none of the above cases apply, a caseless textual comparison is made
12087 between the pattern and the domain.
12088 </para>
12089 </listitem>
12090 </itemizedlist>
12091 <para>
12092 Here is an example that uses several different kinds of pattern:
12093 </para>
12094 <literallayout class="monospaced">
12095 domainlist funny_domains = \
12096   @ : \
12097   lib.unseen.edu : \
12098   *.foundation.fict.example : \
12099   \N^[1-2]\d{3}\.fict\.example$\N : \
12100   partial-dbm;/opt/data/penguin/book : \
12101   nis;domains.byname : \
12102   nisplus;[name=$domain,status=local],domains.org_dir
12103 </literallayout>
12104 <para>
12105 There are obvious processing trade-offs among the various matching modes. Using
12106 an asterisk is faster than a regular expression, and listing a few names
12107 explicitly probably is too. The use of a file or database lookup is expensive,
12108 but may be the only option if hundreds of names are required. Because the
12109 patterns are tested in order, it makes sense to put the most commonly matched
12110 patterns earlier.
12111 </para>
12112 </section>
12113 <section id="SECThostlist">
12114 <title>Host lists</title>
12115 <para>
12116 <indexterm role="concept">
12117 <primary>host list</primary>
12118 <secondary>patterns in</secondary>
12119 </indexterm>
12120 <indexterm role="concept">
12121 <primary>list</primary>
12122 <secondary>host list</secondary>
12123 </indexterm>
12124 Host lists are used to control what remote hosts are allowed to do. For
12125 example, some hosts may be allowed to use the local host as a relay, and some
12126 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12127 two different ways, by name or by IP address. In a host list, some types of
12128 pattern are matched to a host name, and some are matched to an IP address.
12129 You need to be particularly careful with this when single-key lookups are
12130 involved, to ensure that the right value is being used as the key.
12131 </para>
12132 </section>
12133 <section id="SECID80">
12134 <title>Special host list patterns</title>
12135 <para>
12136 <indexterm role="concept">
12137 <primary>empty item in hosts list</primary>
12138 </indexterm>
12139 <indexterm role="concept">
12140 <primary>host list</primary>
12141 <secondary>empty string in</secondary>
12142 </indexterm>
12143 If a host list item is the empty string, it matches only when no remote host is
12144 involved. This is the case when a message is being received from a local
12145 process using SMTP on the standard input, that is, when a TCP/IP connection is
12146 not used.
12147 </para>
12148 <para>
12149 <indexterm role="concept">
12150 <primary>asterisk</primary>
12151 <secondary>in host list</secondary>
12152 </indexterm>
12153 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12154 the IP address nor the name is actually inspected.
12155 </para>
12156 </section>
12157 <section id="SECThoslispatip">
12158 <title>Host list patterns that match by IP address</title>
12159 <para>
12160 <indexterm role="concept">
12161 <primary>host list</primary>
12162 <secondary>matching IP addresses</secondary>
12163 </indexterm>
12164 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12165 the incoming address actually appears in the IPv6 host as
12166 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12167 list, it is converted into a traditional IPv4 address first. (Not all operating
12168 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12169 concerns.)
12170 </para>
12171 <para>
12172 The following types of pattern in a host list check the remote host by
12173 inspecting its IP address:
12174 </para>
12175 <itemizedlist>
12176 <listitem>
12177 <para>
12178 If the pattern is a plain domain name (not a regular expression, not starting
12179 with *, not a lookup of any kind), Exim calls the operating system function
12180 to find the associated IP address(es). Exim uses the newer
12181 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12182 This typically causes a forward DNS lookup of the name. The result is compared
12183 with the IP address of the subject host.
12184 </para>
12185 <para>
12186 If there is a temporary problem (such as a DNS timeout) with the host name
12187 lookup, a temporary error occurs. For example, if the list is being used in an
12188 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12189 temporary SMTP error code. If no IP address can be found for the host name,
12190 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12191 </para>
12192 </listitem>
12193 <listitem>
12194 <para>
12195 <indexterm role="concept">
12196 <primary>@ in a host list</primary>
12197 </indexterm>
12198 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12199 domain name, as just described.
12200 </para>
12201 </listitem>
12202 <listitem>
12203 <para>
12204 If the pattern is an IP address, it is matched against the IP address of the
12205 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12206 IPv6 addresses can be given in colon-separated format, but the colons have to
12207 be doubled so as not to be taken as item separators when the default list
12208 separator is used. IPv6 addresses are recognized even when Exim is compiled
12209 without IPv6 support. This means that if they appear in a host list on an
12210 IPv4-only host, Exim will not treat them as host names. They are just addresses
12211 that can never match a client host.
12212 </para>
12213 </listitem>
12214 <listitem>
12215 <para>
12216 <indexterm role="concept">
12217 <primary>@[] in a host list</primary>
12218 </indexterm>
12219 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12220 the local host. For example, if the local host is an IPv4 host with one
12221 interface address 10.45.23.56, these two ACL statements have the same effect:
12222 </para>
12223 <literallayout class="monospaced">
12224 accept hosts = 127.0.0.1 : 10.45.23.56
12225 accept hosts = @[]
12226 </literallayout>
12227 </listitem>
12228 <listitem>
12229 <para>
12230 <indexterm role="concept">
12231 <primary>CIDR notation</primary>
12232 </indexterm>
12233 If the pattern is an IP address followed by a slash and a mask length (for
12234 example 10.11.42.0/24), it is matched against the IP address of the subject
12235 host under the given mask. This allows, an entire network of hosts to be
12236 included (or excluded) by a single item. The mask uses CIDR notation; it
12237 specifies the number of address bits that must match, starting from the most
12238 significant end of the address.
12239 </para>
12240 <para>
12241 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12242 of a range of addresses. It is the number of bits in the network portion of the
12243 address. The above example specifies a 24-bit netmask, so it matches all 256
12244 addresses in the 10.11.42.0 network. An item such as
12245 </para>
12246 <literallayout class="monospaced">
12247 192.168.23.236/31
12248 </literallayout>
12249 <para>
12250 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12251 32 for an IPv4 address is the same as no mask at all; just a single address
12252 matches.
12253 </para>
12254 <para>
12255 Here is another example which shows an IPv4 and an IPv6 network:
12256 </para>
12257 <literallayout class="monospaced">
12258 recipient_unqualified_hosts = 192.168.0.0/16: \
12259                               3ffe::ffff::836f::::/48
12260 </literallayout>
12261 <para>
12262 The doubling of list separator characters applies only when these items
12263 appear inline in a host list. It is not required when indirecting via a file.
12264 For example:
12265 </para>
12266 <literallayout class="monospaced">
12267 recipient_unqualified_hosts = /opt/exim/unqualnets
12268 </literallayout>
12269 <para>
12270 could make use of a file containing
12271 </para>
12272 <literallayout class="monospaced">
12273 172.16.0.0/12
12274 3ffe:ffff:836f::/48
12275 </literallayout>
12276 <para>
12277 to have exactly the same effect as the previous example. When listing IPv6
12278 addresses inline, it is usually more convenient to use the facility for
12279 changing separator characters. This list contains the same two networks:
12280 </para>
12281 <literallayout class="monospaced">
12282 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12283                                  3ffe:ffff:836f::/48
12284 </literallayout>
12285 <para>
12286 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12287 list.
12288 </para>
12289 </listitem>
12290 </itemizedlist>
12291 </section>
12292 <section id="SECThoslispatsikey">
12293 <title>Host list patterns for single-key lookups by host address</title>
12294 <para>
12295 <indexterm role="concept">
12296 <primary>host list</primary>
12297 <secondary>lookup of IP address</secondary>
12298 </indexterm>
12299 When a host is to be identified by a single-key lookup of its complete IP
12300 address, the pattern takes this form:
12301 </para>
12302 <literallayout>
12303 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12304 </literallayout>
12305 <para>
12306 For example:
12307 </para>
12308 <literallayout class="monospaced">
12309 hosts_lookup = net-cdb;/hosts-by-ip.db
12310 </literallayout>
12311 <para>
12312 The text form of the IP address of the subject host is used as the lookup key.
12313 IPv6 addresses are converted to an unabbreviated form, using lower case
12314 letters, with dots as separators because colon is the key terminator in
12315 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12316 quoting the keys, but this is a facility that was added later.] The data
12317 returned by the lookup is not used.
12318 </para>
12319 <para>
12320 <indexterm role="concept">
12321 <primary>IP address</primary>
12322 <secondary>masking</secondary>
12323 </indexterm>
12324 <indexterm role="concept">
12325 <primary>host list</primary>
12326 <secondary>masked IP address</secondary>
12327 </indexterm>
12328 Single-key lookups can also be performed using masked IP addresses, using
12329 patterns of this form:
12330 </para>
12331 <literallayout>
12332 <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>
12333 </literallayout>
12334 <para>
12335 For example:
12336 </para>
12337 <literallayout class="monospaced">
12338 net24-dbm;/networks.db
12339 </literallayout>
12340 <para>
12341 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12342 length. A textual string is constructed from the masked value, followed by the
12343 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12344 is 192.168.34.6, the key that is looked up for the above example is
12345 <quote>192.168.34.0/24</quote>.
12346 </para>
12347 <para>
12348 When an IPv6 address is converted to a string, dots are normally used instead
12349 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12350 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12351 to quote keys was made available in <command>lsearch</command> files. However, the more
12352 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12353 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12354 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12355 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12356 addresses are always used.
12357 </para>
12358 <para>
12359 Ideally, it would be nice to tidy up this anomalous situation by changing to
12360 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12361 However, this would be an incompatible change that might break some existing
12362 configurations.
12363 </para>
12364 <para>
12365 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12366 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12367 the former case the key strings include the mask value, whereas in the latter
12368 case the IP address is used on its own.
12369 </para>
12370 </section>
12371 <section id="SECThoslispatnam">
12372 <title>Host list patterns that match by host name</title>
12373 <para>
12374 <indexterm role="concept">
12375 <primary>host</primary>
12376 <secondary>lookup failures</secondary>
12377 </indexterm>
12378 <indexterm role="concept">
12379 <primary>unknown host name</primary>
12380 </indexterm>
12381 <indexterm role="concept">
12382 <primary>host list</primary>
12383 <secondary>matching host name</secondary>
12384 </indexterm>
12385 There are several types of pattern that require Exim to know the name of the
12386 remote host. These are either wildcard patterns or lookups by name. (If a
12387 complete hostname is given without any wildcarding, it is used to find an IP
12388 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12389 above.)
12390 </para>
12391 <para>
12392 If the remote host name is not already known when Exim encounters one of these
12393 patterns, it has to be found from the IP address.
12394 Although many sites on the Internet are conscientious about maintaining reverse
12395 DNS data for their hosts, there are also many that do not do this.
12396 Consequently, a name cannot always be found, and this may lead to unwanted
12397 effects. Take care when configuring host lists with wildcarded name patterns.
12398 Consider what will happen if a name cannot be found.
12399 </para>
12400 <para>
12401 Because of the problems of determining host names from IP addresses, matching
12402 against host names is not as common as matching against IP addresses.
12403 </para>
12404 <para>
12405 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12406 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12407 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12408 are done can be changed by setting the <option>host_lookup_order</option> option. For
12409 security, once Exim has found one or more names, it looks up the IP addresses
12410 for these names and compares them with the IP address that it started with.
12411 Only those names whose IP addresses match are accepted. Any other names are
12412 discarded. If no names are left, Exim behaves as if the host name cannot be
12413 found. In the most common case there is only one name and one IP address.
12414 </para>
12415 <para>
12416 There are some options that control what happens if a host name cannot be
12417 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12418 </para>
12419 <para>
12420 <indexterm role="concept">
12421 <primary>host</primary>
12422 <secondary>alias for</secondary>
12423 </indexterm>
12424 <indexterm role="concept">
12425 <primary>alias for host</primary>
12426 </indexterm>
12427 As a result of aliasing, hosts may have more than one name. When processing any
12428 of the following types of pattern, all the host&#x2019;s names are checked:
12429 </para>
12430 <itemizedlist>
12431 <listitem>
12432 <para>
12433 <indexterm role="concept">
12434 <primary>asterisk</primary>
12435 <secondary>in host list</secondary>
12436 </indexterm>
12437 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12438 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12439 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12440 requirement. Other kinds of wildcarding require the use of a regular
12441 expression.
12442 </para>
12443 </listitem>
12444 <listitem>
12445 <para>
12446 <indexterm role="concept">
12447 <primary>regular expressions</primary>
12448 <secondary>in host list</secondary>
12449 </indexterm>
12450 <indexterm role="concept">
12451 <primary>host list</primary>
12452 <secondary>regular expression in</secondary>
12453 </indexterm>
12454 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12455 matched against the host name. Host names are case-independent, so this regular
12456 expression match is by default case-independent, but you can make it
12457 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12458 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12459 example,
12460 </para>
12461 <literallayout class="monospaced">
12462 ^(a|b)\.c\.d$
12463 </literallayout>
12464 <para>
12465 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12466 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12467 that backslash and dollar characters are not misinterpreted as part of the
12468 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12469 part of the string as non-expandable. For example:
12470 </para>
12471 <literallayout class="monospaced">
12472 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12473 </literallayout>
12474 <para>
12475 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12476 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12477 example. Without it, a match at the start of the host name is all that is
12478 required.
12479 </para>
12480 </listitem>
12481 </itemizedlist>
12482 </section>
12483 <section id="SECTbehipnot">
12484 <title>Behaviour when an IP address or name cannot be found</title>
12485 <para>
12486 <indexterm role="concept">
12487 <primary>host</primary>
12488 <secondary>lookup failures, permanent</secondary>
12489 </indexterm>
12490 While processing a host list, Exim may need to look up an IP address from a
12491 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12492 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12493 behaviour when it fails to find the information it is seeking is the same.
12494 </para>
12495 <para>
12496 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12497 apply to temporary DNS errors, whose handling is described in the next section.
12498 </para>
12499 <para>
12500 <indexterm role="concept">
12501 <primary><literal>+include_unknown</literal></primary>
12502 </indexterm>
12503 <indexterm role="concept">
12504 <primary><literal>+ignore_unknown</literal></primary>
12505 </indexterm>
12506 Exim parses a host list from left to right. If it encounters a permanent
12507 lookup failure in any item in the host list before it has found a match,
12508 Exim treats it as a failure and the default behavior is as if the host
12509 does not match the list. This may not always be what you want to happen.
12510 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12511 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12512 not recognized in an indirected file).
12513 </para>
12514 <itemizedlist>
12515 <listitem>
12516 <para>
12517 If any item that follows <literal>+include_unknown</literal> requires information that
12518 cannot found, Exim behaves as if the host does match the list. For example,
12519 </para>
12520 <literallayout class="monospaced">
12521 host_reject_connection = +include_unknown:*.enemy.ex
12522 </literallayout>
12523 <para>
12524 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12525 any hosts whose name it cannot find.
12526 </para>
12527 </listitem>
12528 <listitem>
12529 <para>
12530 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12531 be found, Exim ignores that item and proceeds to the rest of the list. For
12532 example:
12533 </para>
12534 <literallayout class="monospaced">
12535 accept hosts = +ignore_unknown : friend.example : \
12536                192.168.4.5
12537 </literallayout>
12538 <para>
12539 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12540 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12541 name can be found for 192.168.4.5, it is rejected.
12542 </para>
12543 </listitem>
12544 </itemizedlist>
12545 <para>
12546 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12547 list. The effect of each one lasts until the next, or until the end of the
12548 list.
12549 </para>
12550 </section>
12551 <section id="SECTmixwilhos">
12552 <title>Mixing wildcarded host names and addresses in host lists</title>
12553 <para>
12554 <indexterm role="concept">
12555 <primary>host list</primary>
12556 <secondary>mixing names and addresses in</secondary>
12557 </indexterm>
12558 </para>
12559 <para>
12560 This section explains the host/ip processing logic with the same concepts
12561 as the previous section, but specifically addresses what happens when a
12562 wildcarded hostname is one of the items in the hostlist.
12563 </para>
12564 <itemizedlist>
12565 <listitem>
12566 <para>
12567 If you have name lookups or wildcarded host names and
12568 IP addresses in the same host list, you should normally put the IP
12569 addresses first. For example, in an ACL you could have:
12570 </para>
12571 <literallayout class="monospaced">
12572 accept hosts = 10.9.8.7 : *.friend.example
12573 </literallayout>
12574 <para>
12575 The reason you normally would order it this way lies in the
12576 left-to-right way that Exim processes lists.  It can test IP addresses
12577 without doing any DNS lookups, but when it reaches an item that requires
12578 a host name, it fails if it cannot find a host name to compare with the
12579 pattern. If the above list is given in the opposite order, the
12580 <option>accept</option> statement fails for a host whose name cannot be found, even
12581 if its IP address is 10.9.8.7.
12582 </para>
12583 </listitem>
12584 <listitem>
12585 <para>
12586 If you really do want to do the name check first, and still recognize the IP
12587 address, you can rewrite the ACL like this:
12588 </para>
12589 <literallayout class="monospaced">
12590 accept hosts = *.friend.example
12591 accept hosts = 10.9.8.7
12592 </literallayout>
12593 <para>
12594 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12595 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12596 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12597 this section.
12598 </para>
12599 </listitem>
12600 </itemizedlist>
12601 </section>
12602 <section id="SECTtemdnserr">
12603 <title>Temporary DNS errors when looking up host information</title>
12604 <para>
12605 <indexterm role="concept">
12606 <primary>host</primary>
12607 <secondary>lookup failures, temporary</secondary>
12608 </indexterm>
12609 <indexterm role="concept">
12610 <primary><literal>+include_defer</literal></primary>
12611 </indexterm>
12612 <indexterm role="concept">
12613 <primary><literal>+ignore_defer</literal></primary>
12614 </indexterm>
12615 A temporary DNS lookup failure normally causes a defer action (except when
12616 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12617 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12618 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12619 section. These options should be used with care, probably only in non-critical
12620 host lists such as whitelists.
12621 </para>
12622 </section>
12623 <section id="SECThoslispatnamsk">
12624 <title>Host list patterns for single-key lookups by host name</title>
12625 <para>
12626 <indexterm role="concept">
12627 <primary>unknown host name</primary>
12628 </indexterm>
12629 <indexterm role="concept">
12630 <primary>host list</primary>
12631 <secondary>matching host name</secondary>
12632 </indexterm>
12633 If a pattern is of the form
12634 </para>
12635 <literallayout>
12636 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12637 </literallayout>
12638 <para>
12639 for example
12640 </para>
12641 <literallayout class="monospaced">
12642 dbm;/host/accept/list
12643 </literallayout>
12644 <para>
12645 a single-key lookup is performed, using the host name as its key. If the
12646 lookup succeeds, the host matches the item. The actual data that is looked up
12647 is not used.
12648 </para>
12649 <para>
12650 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12651 keys in the file, not IP addresses. If you want to do lookups based on IP
12652 addresses, you must precede the search type with <quote>net-</quote> (see section
12653 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12654 two items in the same list, one doing an address lookup and one doing a name
12655 lookup, both using the same file.
12656 </para>
12657 </section>
12658 <section id="SECID81">
12659 <title>Host list patterns for query-style lookups</title>
12660 <para>
12661 If a pattern is of the form
12662 </para>
12663 <literallayout>
12664 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12665 </literallayout>
12666 <para>
12667 the query is obeyed, and if it succeeds, the host matches the item. The actual
12668 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12669 <varname>$sender_host_name</varname> can be used in the query. For example:
12670 </para>
12671 <literallayout class="monospaced">
12672 hosts_lookup = pgsql;\
12673   select ip from hostlist where ip='$sender_host_address'
12674 </literallayout>
12675 <para>
12676 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12677 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12678 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12679 operator.
12680 </para>
12681 <para>
12682 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12683 looks up the host name if it has not already done so. (See section
12684 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12685 </para>
12686 <para>
12687 Historical note: prior to release 4.30, Exim would always attempt to find a
12688 host name before running the query, unless the search type was preceded by
12689 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12690 still recognized for query-style lookups, but its presence or absence has no
12691 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12692 See section <xref linkend="SECThoslispatsikey"/>.)
12693 </para>
12694 </section>
12695 <section id="SECTaddresslist">
12696 <title>Address lists</title>
12697 <para>
12698 <indexterm role="concept">
12699 <primary>list</primary>
12700 <secondary>address list</secondary>
12701 </indexterm>
12702 <indexterm role="concept">
12703 <primary>address list</primary>
12704 <secondary>empty item</secondary>
12705 </indexterm>
12706 <indexterm role="concept">
12707 <primary>address list</primary>
12708 <secondary>patterns</secondary>
12709 </indexterm>
12710 Address lists contain patterns that are matched against mail addresses. There
12711 is one special case to be considered: the sender address of a bounce message is
12712 always empty. You can test for this by providing an empty item in an address
12713 list. For example, you can set up a router to process bounce messages by
12714 using this option setting:
12715 </para>
12716 <literallayout class="monospaced">
12717 senders = :
12718 </literallayout>
12719 <para>
12720 The presence of the colon creates an empty item. If you do not provide any
12721 data, the list is empty and matches nothing. The empty sender can also be
12722 detected by a regular expression that matches an empty string,
12723 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12724 </para>
12725 <para>
12726 Non-empty items in an address list can be straightforward email addresses. For
12727 example:
12728 </para>
12729 <literallayout class="monospaced">
12730 senders = jbc@askone.example : hs@anacreon.example
12731 </literallayout>
12732 <para>
12733 A certain amount of wildcarding is permitted. If a pattern contains an @
12734 character, but is not a regular expression and does not begin with a
12735 semicolon-terminated lookup type (described below), the local part of the
12736 subject address is compared with the local part of the pattern, which may start
12737 with an asterisk. If the local parts match, the domain is checked in exactly
12738 the same way as for a pattern in a domain list. For example, the domain can be
12739 wildcarded, refer to a named list, or be a lookup:
12740 </para>
12741 <literallayout class="monospaced">
12742 deny senders = *@*.spamming.site:\
12743                *@+hostile_domains:\
12744                bozo@partial-lsearch;/list/of/dodgy/sites:\
12745                *@dbm;/bad/domains.db
12746 </literallayout>
12747 <para>
12748 <indexterm role="concept">
12749 <primary>local part</primary>
12750 <secondary>starting with !</secondary>
12751 </indexterm>
12752 <indexterm role="concept">
12753 <primary>address list</primary>
12754 <secondary>local part starting with !</secondary>
12755 </indexterm>
12756 If a local part that begins with an exclamation mark is required, it has to be
12757 specified using a regular expression, because otherwise the exclamation mark is
12758 treated as a sign of negation, as is standard in lists.
12759 </para>
12760 <para>
12761 If a non-empty pattern that is not a regular expression or a lookup does not
12762 contain an @ character, it is matched against the domain part of the subject
12763 address. The only two formats that are recognized this way are a literal
12764 domain, or a domain pattern that starts with *. In both these cases, the effect
12765 is the same as if <literal>*@</literal> preceded the pattern. For example:
12766 </para>
12767 <literallayout class="monospaced">
12768 deny senders = enemy.domain : *.enemy.domain
12769 </literallayout>
12770 <para>
12771 The following kinds of more complicated address list pattern can match any
12772 address, including the empty address that is characteristic of bounce message
12773 senders:
12774 </para>
12775 <itemizedlist>
12776 <listitem>
12777 <para>
12778 <indexterm role="concept">
12779 <primary>regular expressions</primary>
12780 <secondary>in address list</secondary>
12781 </indexterm>
12782 <indexterm role="concept">
12783 <primary>address list</primary>
12784 <secondary>regular expression in</secondary>
12785 </indexterm>
12786 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12787 done against the complete address, with the pattern as the regular expression.
12788 You must take care that backslash and dollar characters are not misinterpreted
12789 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12790 to mark that part of the string as non-expandable. For example:
12791 </para>
12792 <literallayout class="monospaced">
12793 deny senders = \N^.*this.*@example\.com$\N : \
12794                \N^\d{8}.+@spamhaus.example$\N : ...
12795 </literallayout>
12796 <para>
12797 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12798 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12799 </para>
12800 </listitem>
12801 <listitem>
12802 <para>
12803 <indexterm role="concept">
12804 <primary>address list</primary>
12805 <secondary>lookup for complete address</secondary>
12806 </indexterm>
12807 Complete addresses can be looked up by using a pattern that starts with a
12808 lookup type terminated by a semicolon, followed by the data for the lookup. For
12809 example:
12810 </para>
12811 <literallayout class="monospaced">
12812 deny senders = cdb;/etc/blocked.senders : \
12813   mysql;select address from blocked where \
12814   address='${quote_mysql:$sender_address}'
12815 </literallayout>
12816 <para>
12817 Both query-style and single-key lookup types can be used. For a single-key
12818 lookup type, Exim uses the complete address as the key. However, empty keys are
12819 not supported for single-key lookups, so a match against the empty address
12820 always fails. This restriction does not apply to query-style lookups.
12821 </para>
12822 <para>
12823 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12824 cannot be used, and is ignored if specified, with an entry being written to the
12825 panic log.
12826 <indexterm role="concept">
12827 <primary>*@ with single-key lookup</primary>
12828 </indexterm>
12829 However, you can configure lookup defaults, as described in section
12830 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12831 default. For example, with this lookup:
12832 </para>
12833 <literallayout class="monospaced">
12834 accept senders = lsearch*@;/some/file
12835 </literallayout>
12836 <para>
12837 the file could contains lines like this:
12838 </para>
12839 <literallayout class="monospaced">
12840 user1@domain1.example
12841 *@domain2.example
12842 </literallayout>
12843 <para>
12844 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12845 that are tried is:
12846 </para>
12847 <literallayout class="monospaced">
12848 nimrod@jaeger.example
12849 *@jaeger.example
12850 *
12851 </literallayout>
12852 <para>
12853 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12854 would mean that every address matches, thus rendering the test useless.
12855 </para>
12856 <para>
12857 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12858 </para>
12859 <literallayout class="monospaced">
12860 deny recipients = dbm*@;/some/file
12861 deny recipients = *@dbm;/some/file
12862 </literallayout>
12863 <para>
12864 The first does a whole address lookup, with defaulting, as just described,
12865 because it starts with a lookup type. The second matches the local part and
12866 domain independently, as described in a bullet point below.
12867 </para>
12868 </listitem>
12869 </itemizedlist>
12870 <para>
12871 The following kinds of address list pattern can match only non-empty addresses.
12872 If the subject address is empty, a match against any of these pattern types
12873 always fails.
12874 </para>
12875 <itemizedlist>
12876 <listitem>
12877 <para>
12878 <indexterm role="concept">
12879 <primary>@@ with single-key lookup</primary>
12880 </indexterm>
12881 <indexterm role="concept">
12882 <primary>address list</primary>
12883 <secondary>@@ lookup type</secondary>
12884 </indexterm>
12885 <indexterm role="concept">
12886 <primary>address list</primary>
12887 <secondary>split local part and domain</secondary>
12888 </indexterm>
12889 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12890 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12891 split into a local part and a domain. The domain is looked up in the file. If
12892 it is not found, there is no match. If it is found, the data that is looked up
12893 from the file is treated as a colon-separated list of local part patterns, each
12894 of which is matched against the subject local part in turn.
12895 </para>
12896 <para>
12897 <indexterm role="concept">
12898 <primary>asterisk</primary>
12899 <secondary>in address list</secondary>
12900 </indexterm>
12901 The lookup may be a partial one, and/or one involving a search for a default
12902 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12903 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12904 even be further lookups. They may also be independently negated. For example,
12905 with
12906 </para>
12907 <literallayout class="monospaced">
12908 deny senders = @@dbm;/etc/reject-by-domain
12909 </literallayout>
12910 <para>
12911 the data from which the DBM file is built could contain lines like
12912 </para>
12913 <literallayout class="monospaced">
12914 baddomain.com:  !postmaster : *
12915 </literallayout>
12916 <para>
12917 to reject all senders except <option>postmaster</option> from that domain.
12918 </para>
12919 <para>
12920 <indexterm role="concept">
12921 <primary>local part</primary>
12922 <secondary>starting with !</secondary>
12923 </indexterm>
12924 If a local part that actually begins with an exclamation mark is required, it
12925 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12926 may be split over several lines by indenting the second and subsequent lines,
12927 but the separating colon must still be included at line breaks. White space
12928 surrounding the colons is ignored. For example:
12929 </para>
12930 <literallayout class="monospaced">
12931 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12932   spammer3 : spammer4
12933 </literallayout>
12934 <para>
12935 As in all colon-separated lists in Exim, a colon can be included in an item by
12936 doubling.
12937 </para>
12938 <para>
12939 If the last item in the list starts with a right angle-bracket, the remainder
12940 of the item is taken as a new key to look up in order to obtain a continuation
12941 list of local parts. The new key can be any sequence of characters. Thus one
12942 might have entries like
12943 </para>
12944 <literallayout class="monospaced">
12945 aol.com: spammer1 : spammer 2 : &gt;*
12946 xyz.com: spammer3 : &gt;*
12947 *:       ^\d{8}$
12948 </literallayout>
12949 <para>
12950 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12951 local parts for all domains, in addition to the specific local parts listed for
12952 each domain. Of course, using this feature costs another lookup each time a
12953 chain is followed, but the effort needed to maintain the data is reduced.
12954 </para>
12955 <para>
12956 <indexterm role="concept">
12957 <primary>loop</primary>
12958 <secondary>in lookups</secondary>
12959 </indexterm>
12960 It is possible to construct loops using this facility, and in order to catch
12961 them, the chains may be no more than fifty items long.
12962 </para>
12963 </listitem>
12964 <listitem>
12965 <para>
12966 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12967 lookup, but in this case, the chaining facility is not available. The lookup
12968 can only return a single list of local parts.
12969 </para>
12970 </listitem>
12971 </itemizedlist>
12972 <para>
12973 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12974 in these two examples:
12975 </para>
12976 <literallayout class="monospaced">
12977 senders = +my_list
12978 senders = *@+my_list
12979 </literallayout>
12980 <para>
12981 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12982 example it is a named domain list.
12983 </para>
12984 </section>
12985 <section id="SECTcasletadd">
12986 <title>Case of letters in address lists</title>
12987 <para>
12988 <indexterm role="concept">
12989 <primary>case of local parts</primary>
12990 </indexterm>
12991 <indexterm role="concept">
12992 <primary>address list</primary>
12993 <secondary>case forcing</secondary>
12994 </indexterm>
12995 <indexterm role="concept">
12996 <primary>case forcing in address lists</primary>
12997 </indexterm>
12998 Domains in email addresses are always handled caselessly, but for local parts
12999 case may be significant on some systems (see <option>caseful_local_part</option> for how
13000 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13001 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13002 blocking lists should be done in a case-independent manner. Since most address
13003 lists in Exim are used for this kind of control, Exim attempts to do this by
13004 default.
13005 </para>
13006 <para>
13007 The domain portion of an address is always lowercased before matching it to an
13008 address list. The local part is lowercased by default, and any string
13009 comparisons that take place are done caselessly. This means that the data in
13010 the address list itself, in files included as plain file names, and in any file
13011 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13012 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13013 works caselessly) must be in lower case, because these lookups are not
13014 case-independent.
13015 </para>
13016 <para>
13017 <indexterm role="concept">
13018 <primary><literal>+caseful</literal></primary>
13019 </indexterm>
13020 To allow for the possibility of caseful address list matching, if an item in
13021 an address list is the string <quote>+caseful</quote>, the original case of the local
13022 part is restored for any comparisons that follow, and string comparisons are no
13023 longer case-independent. This does not affect the domain, which remains in
13024 lower case. However, although independent matches on the domain alone are still
13025 performed caselessly, regular expressions that match against an entire address
13026 become case-sensitive after <quote>+caseful</quote> has been seen.
13027 </para>
13028 </section>
13029 <section id="SECTlocparlis">
13030 <title>Local part lists</title>
13031 <para>
13032 <indexterm role="concept">
13033 <primary>list</primary>
13034 <secondary>local part list</secondary>
13035 </indexterm>
13036 <indexterm role="concept">
13037 <primary>local part</primary>
13038 <secondary>list</secondary>
13039 </indexterm>
13040 Case-sensitivity in local part lists is handled in the same way as for address
13041 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13042 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13043 set false, the subject is lowercased and the matching is initially
13044 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13045 matching in the local part list, but not elsewhere in the router. If
13046 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13047 option is case-sensitive from the start.
13048 </para>
13049 <para>
13050 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13051 comments are handled in the same way as address lists &ndash; they are recognized
13052 only if the # is preceded by white space or the start of the line.
13053 Otherwise, local part lists are matched in the same way as domain lists, except
13054 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13055 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13056 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13057 types.
13058 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13059 </para>
13060 </section>
13061 </chapter>
13062
13063 <chapter id="CHAPexpand">
13064 <title>String expansions</title>
13065 <para>
13066 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13067 <primary>expansion</primary>
13068 <secondary>of strings</secondary>
13069 </indexterm>
13070 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13071 them are expanded every time they are used; others are expanded only once.
13072 </para>
13073 <para>
13074 When a string is being expanded it is copied verbatim from left to right except
13075 when a dollar or backslash character is encountered. A dollar specifies the
13076 start of a portion of the string that is interpreted and replaced as described
13077 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13078 escape character, as described in the following section.
13079 </para>
13080 <para>
13081 Whether a string is expanded depends upon the context.  Usually this is solely
13082 dependent upon the option for which a value is sought; in this documentation,
13083 options for which string expansion is performed are marked with &dagger; after
13084 the data type.  ACL rules always expand strings.  A couple of expansion
13085 conditions do not expand some of the brace-delimited branches, for security
13086 reasons.
13087 </para>
13088 <section id="SECTlittext">
13089 <title>Literal text in expanded strings</title>
13090 <para>
13091 <indexterm role="concept">
13092 <primary>expansion</primary>
13093 <secondary>including literal text</secondary>
13094 </indexterm>
13095 An uninterpreted dollar can be included in an expanded string by putting a
13096 backslash in front of it. A backslash can be used to prevent any special
13097 character being treated specially in an expansion, including backslash itself.
13098 If the string appears in quotes in the configuration file, two backslashes are
13099 required because the quotes themselves cause interpretation of backslashes when
13100 the string is read in (see section <xref linkend="SECTstrings"/>).
13101 </para>
13102 <para>
13103 <indexterm role="concept">
13104 <primary>expansion</primary>
13105 <secondary>non-expandable substrings</secondary>
13106 </indexterm>
13107 A portion of the string can specified as non-expandable by placing it between
13108 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13109 expressions, which often contain backslashes and dollar signs. For example:
13110 </para>
13111 <literallayout class="monospaced">
13112 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13113 </literallayout>
13114 <para>
13115 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13116 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13117 string.
13118 </para>
13119 </section>
13120 <section id="SECID82">
13121 <title>Character escape sequences in expanded strings</title>
13122 <para>
13123 <indexterm role="concept">
13124 <primary>expansion</primary>
13125 <secondary>escape sequences</secondary>
13126 </indexterm>
13127 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13128 expanded string is recognized as an escape sequence for the character newline,
13129 carriage return, or tab, respectively. A backslash followed by up to three
13130 octal digits is recognized as an octal encoding for a single character, and a
13131 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13132 encoding.
13133 </para>
13134 <para>
13135 These escape sequences are also recognized in quoted strings when they are read
13136 in. Their interpretation in expansions as well is useful for unquoted strings,
13137 and for other cases such as looked-up strings that are then expanded.
13138 </para>
13139 </section>
13140 <section id="SECID83">
13141 <title>Testing string expansions</title>
13142 <para>
13143 <indexterm role="concept">
13144 <primary>expansion</primary>
13145 <secondary>testing</secondary>
13146 </indexterm>
13147 <indexterm role="concept">
13148 <primary>testing</primary>
13149 <secondary>string expansion</secondary>
13150 </indexterm>
13151 <indexterm role="option">
13152 <primary><option>-be</option></primary>
13153 </indexterm>
13154 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13155 takes the command arguments, or lines from the standard input if there are no
13156 arguments, runs them through the string expansion code, and writes the results
13157 to the standard output. Variables based on configuration values are set up, but
13158 since no message is being processed, variables such as <varname>$local_part</varname> have no
13159 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13160 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13161 and <option>nhash</option>.
13162 </para>
13163 <para>
13164 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13165 instead runs under the uid and gid it was called with, to prevent users from
13166 using <option>-be</option> for reading files to which they do not have access.
13167 </para>
13168 <para>
13169 <indexterm role="option">
13170 <primary><option>-bem</option></primary>
13171 </indexterm>
13172 If you want to test expansions that include variables whose values are taken
13173 from a message, there are two other options that can be used. The <option>-bem</option>
13174 option is like <option>-be</option> except that it is followed by a file name. The file is
13175 read as a message before doing the test expansions. For example:
13176 </para>
13177 <literallayout class="monospaced">
13178 exim -bem /tmp/test.message '$h_subject:'
13179 </literallayout>
13180 <para>
13181 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13182 Exim message identifier. For example:
13183 </para>
13184 <literallayout class="monospaced">
13185 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13186 </literallayout>
13187 <para>
13188 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13189 is therefore restricted to admin users.
13190 </para>
13191 </section>
13192 <section id="SECTforexpfai">
13193 <title>Forced expansion failure</title>
13194 <para>
13195 <indexterm role="concept">
13196 <primary>expansion</primary>
13197 <secondary>forced failure</secondary>
13198 </indexterm>
13199 A number of expansions that are described in the following section have
13200 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13201 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13202 used depends on some condition that is evaluated as part of the expansion. If,
13203 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13204 the entire string expansion fails in a way that can be detected by the code
13205 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13206 its consequences depend on the circumstances. In some cases it is no different
13207 from any other expansion failure, but in others a different action may be
13208 taken. Such variations are mentioned in the documentation of the option that is
13209 being expanded.
13210 </para>
13211 </section>
13212 <section id="SECTexpansionitems">
13213 <title>Expansion items</title>
13214 <para>
13215 The following items are recognized in expanded strings. White space may be used
13216 between sub-items that are keywords or substrings enclosed in braces inside an
13217 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13218 white space is significant.
13219 </para>
13220 <variablelist>
13221 <varlistentry>
13222 <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>
13223 <listitem>
13224 <para>
13225 <indexterm role="concept">
13226 <primary>expansion</primary>
13227 <secondary>variables</secondary>
13228 </indexterm>
13229 Substitute the contents of the named variable, for example:
13230 </para>
13231 <literallayout class="monospaced">
13232 $local_part
13233 ${domain}
13234 </literallayout>
13235 <para>
13236 The second form can be used to separate the name from subsequent alphanumeric
13237 characters. This form (using braces) is available only for variables; it does
13238 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13239 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13240 given, the expansion fails.
13241 </para>
13242 </listitem></varlistentry>
13243 <varlistentry>
13244 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13245 <listitem>
13246 <para>
13247 <indexterm role="concept">
13248 <primary>expansion</primary>
13249 <secondary>operators</secondary>
13250 </indexterm>
13251 The string is first itself expanded, and then the operation specified by
13252 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13253 </para>
13254 <literallayout class="monospaced">
13255 ${lc:$local_part}
13256 </literallayout>
13257 <para>
13258 The string starts with the first character after the colon, which may be
13259 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13260 below. The operator notation is used for simple expansion items that have just
13261 one argument, because it reduces the number of braces and therefore makes the
13262 string easier to understand.
13263 </para>
13264 </listitem></varlistentry>
13265 <varlistentry>
13266 <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>
13267 <listitem>
13268 <para>
13269 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13270 expansion item below.
13271 </para>
13272 </listitem></varlistentry>
13273 <varlistentry>
13274 <term><emphasis role="bold">${acl{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
13275 <listitem>
13276 <para>
13277 <indexterm role="concept">
13278 <primary>expansion</primary>
13279 <secondary>calling an acl</secondary>
13280 </indexterm>
13281 <indexterm role="concept">
13282 <primary><option>acl</option></primary>
13283 <secondary>call from expansion</secondary>
13284 </indexterm>
13285 The name and zero to nine argument strings are first expanded separately.  The expanded
13286 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13287 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13288 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13289 and may use the variables; if another acl expansion is used the values
13290 are restored after it returns.  If the ACL sets
13291 a value using a "message =" modifier and returns accept or deny, the value becomes
13292 the result of the expansion.
13293 If no message is set and the ACL returns accept or deny
13294 the expansion result is an empty string.
13295 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13296 </para>
13297 </listitem></varlistentry>
13298 <varlistentry>
13299 <term><emphasis role="bold">${certextract{</emphasis>&lt;<emphasis>field</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>certificate</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>
13300 <listitem>
13301 <para>
13302 <indexterm role="concept">
13303 <primary>expansion</primary>
13304 <secondary>extracting cerificate fields</secondary>
13305 </indexterm>
13306 <indexterm role="concept">
13307 <primary><option>certextract</option></primary>
13308 <secondary>certificate fields</secondary>
13309 </indexterm>
13310 <indexterm role="concept">
13311 <primary>certificate</primary>
13312 <secondary>extracting fields</secondary>
13313 </indexterm>
13314 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13315 The field name is expanded and used to retrive the relevant field from
13316 the certificate.  Supported fields are:
13317 </para>
13318 <literallayout>
13319 <literal>version        </literal>
13320 <literal>serial_number  </literal>
13321 <literal>subject        </literal> RFC4514 DN
13322 <literal>issuer         </literal> RFC4514 DN
13323 <literal>notbefore      </literal> time
13324 <literal>notafter       </literal> time
13325 <literal>sig_algorithm  </literal>
13326 <literal>signature      </literal>
13327 <literal>subj_altname   </literal> tagged list
13328 <literal>ocsp_uri       </literal> list
13329 <literal>crl_uri        </literal> list
13330 </literallayout>
13331 <para>
13332 If the field is found,
13333 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13334 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13335 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13336 is restored to any previous value it might have had.
13337 </para>
13338 <para>
13339 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13340 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13341 extracted is used.
13342 </para>
13343 <para>
13344 Some field names take optional modifiers, appended and separated by commas.
13345 </para>
13346 <para>
13347 The field selectors marked as "RFC4514" above
13348 output a Distinguished Name string which is
13349 not quite
13350 parseable by Exim as a comma-separated tagged list
13351 (the exceptions being elements containin commas).
13352 RDN elements of a single type may be selected by
13353 a modifier of the type label; if so the expansion
13354 result is a list (newline-separated by default).
13355 The separator may be changed by another modifer of
13356 a right angle-bracket followed immediately by the new separator.
13357 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13358 </para>
13359 <para>
13360 The field selectors marked as "time" above
13361 take an optional modifier of "int"
13362 for which the result is the number of seconds since epoch.
13363 Otherwise the result is a human-readable string
13364 in the timezone selected by the main "timezone" option.
13365 </para>
13366 <para>
13367 The field selectors marked as "list" above return a list,
13368 newline-separated by default,
13369 (embedded separator characters in elements are doubled).
13370 The separator may be changed by a modifier of
13371 a right angle-bracket followed immediately by the new separator.
13372 </para>
13373 <para>
13374 The field selectors marked as "tagged" above
13375 prefix each list element with a type string and an equals sign.
13376 Elements of only one type may be selected by a modifier
13377 which is one of "dns", "uri" or "mail";
13378 if so the elenment tags are omitted.
13379 </para>
13380 <para>
13381 If not otherwise noted field values are presented in human-readable form.
13382 </para>
13383 </listitem></varlistentry>
13384 <varlistentry>
13385 <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>
13386 <listitem>
13387 <para>
13388 <indexterm role="concept">
13389 <primary><option>dlfunc</option></primary>
13390 </indexterm>
13391 This expansion dynamically loads and then calls a locally-written C function.
13392 This functionality is available only if Exim is compiled with
13393 </para>
13394 <literallayout class="monospaced">
13395 EXPAND_DLFUNC=yes
13396 </literallayout>
13397 <para>
13398 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13399 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13400 (but of course Exim does start new processes frequently).
13401 </para>
13402 <para>
13403 There may be from zero to eight arguments to the function. When compiling
13404 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13405 included. The Exim variables and functions that are defined by that API
13406 are also available for dynamically loaded functions. The function itself
13407 must have the following type:
13408 </para>
13409 <literallayout class="monospaced">
13410 int dlfunction(uschar **yield, int argc, uschar *argv[])
13411 </literallayout>
13412 <para>
13413 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13414 function should return one of the following values:
13415 </para>
13416 <para>
13417 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13418 into the expanded string that is being built.
13419 </para>
13420 <para>
13421 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13422 from <emphasis>yield</emphasis>, if it is set.
13423 </para>
13424 <para>
13425 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13426 taken from <emphasis>yield</emphasis> if it is set.
13427 </para>
13428 <para>
13429 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13430 </para>
13431 <para>
13432 When compiling a function that is to be used in this way with gcc,
13433 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13434 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13435 </para>
13436 </listitem></varlistentry>
13437 <varlistentry>
13438 <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>
13439 <listitem>
13440 <para>
13441 <indexterm role="concept">
13442 <primary>expansion</primary>
13443 <secondary>extracting substrings by key</secondary>
13444 </indexterm>
13445 <indexterm role="concept">
13446 <primary><option>extract</option></primary>
13447 <secondary>substrings by key</secondary>
13448 </indexterm>
13449 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13450 white space is removed from the key (but not from any of the strings). The key
13451 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13452 form:
13453 </para>
13454 <literallayout>
13455 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13456 </literallayout>
13457 <para>
13458 <indexterm role="variable">
13459 <primary><varname>$value</varname></primary>
13460 </indexterm>
13461 where the equals signs and spaces (but not both) are optional. If any of the
13462 values contain white space, they must be enclosed in double quotes, and any
13463 values that are enclosed in double quotes are subject to escape processing as
13464 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13465 for the value that corresponds to the key. The search is case-insensitive. If
13466 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13467 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13468 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13469 is restored to any previous value it might have had.
13470 </para>
13471 <para>
13472 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13473 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13474 extracted is used. Thus, for example, these two expansions are identical, and
13475 yield <quote>2001</quote>:
13476 </para>
13477 <literallayout class="monospaced">
13478 ${extract{gid}{uid=1984 gid=2001}}
13479 ${extract{gid}{uid=1984 gid=2001}{$value}}
13480 </literallayout>
13481 <para>
13482 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13483 appear, for example:
13484 </para>
13485 <literallayout class="monospaced">
13486 ${extract{Z}{A=... B=...}{$value} fail }
13487 </literallayout>
13488 <para>
13489 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13490 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13491 </para>
13492 </listitem></varlistentry>
13493 <varlistentry>
13494 <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>
13495 <listitem>
13496 <para>
13497 <indexterm role="concept">
13498 <primary>expansion</primary>
13499 <secondary>extracting substrings by number</secondary>
13500 </indexterm>
13501 <indexterm role="concept">
13502 <primary><option>extract</option></primary>
13503 <secondary>substrings by number</secondary>
13504 </indexterm>
13505 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13506 apart from leading and trailing white space, which is ignored.
13507 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13508 behaves in the same way, except that, instead of extracting a named field, it
13509 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13510 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13511 &lt;<emphasis>string3</emphasis>&gt; as before.
13512 </para>
13513 <para>
13514 The fields in the string are separated by any one of the characters in the
13515 separator string. These may include space or tab characters.
13516 The first field is numbered one. If the number is negative, the fields are
13517 counted from the end of the string, with the rightmost one numbered -1. If the
13518 number given is zero, the entire string is returned. If the modulus of the
13519 number is greater than the number of fields in the string, the result is the
13520 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13521 provided. For example:
13522 </para>
13523 <literallayout class="monospaced">
13524 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13525 </literallayout>
13526 <para>
13527 yields <quote>42</quote>, and
13528 </para>
13529 <literallayout class="monospaced">
13530 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13531 </literallayout>
13532 <para>
13533 yields <quote>99</quote>. Two successive separators mean that the field between them is
13534 empty (for example, the fifth field above).
13535 </para>
13536 </listitem></varlistentry>
13537 <varlistentry>
13538 <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>
13539 <listitem>
13540 <para>
13541 <indexterm role="concept">
13542 <primary>list</primary>
13543 <secondary>selecting by condition</secondary>
13544 </indexterm>
13545 <indexterm role="concept">
13546 <primary>expansion</primary>
13547 <secondary>selecting from list by condition</secondary>
13548 </indexterm>
13549 <indexterm role="variable">
13550 <primary><varname>$item</varname></primary>
13551 </indexterm>
13552 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13553 default, but the separator can be changed in the usual way. For each item
13554 in this list, its value is place in <varname>$item</varname>, and then the condition is
13555 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13556 item in a new list; if the condition is false, the item is discarded. The
13557 separator used for the output list is the same as the one used for the
13558 input, but a separator setting is not included in the output. For example:
13559 </para>
13560 <literallayout class="monospaced">
13561 ${filter{a:b:c}{!eq{$item}{b}}
13562 </literallayout>
13563 <para>
13564 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13565 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13566 </para>
13567 </listitem></varlistentry>
13568 <varlistentry>
13569 <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>
13570 <listitem>
13571 <para>
13572 <indexterm role="concept">
13573 <primary>hash function</primary>
13574 <secondary>textual</secondary>
13575 </indexterm>
13576 <indexterm role="concept">
13577 <primary>expansion</primary>
13578 <secondary>textual hash</secondary>
13579 </indexterm>
13580 This is a textual hashing function, and was the first to be implemented in
13581 early versions of Exim. In current releases, there are other hashing functions
13582 (numeric, MD5, and SHA-1), which are described below.
13583 </para>
13584 <para>
13585 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13586 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13587 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13588 use the simpler operator notation that avoids some of the braces:
13589 </para>
13590 <literallayout class="monospaced">
13591 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13592 </literallayout>
13593 <para>
13594 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13595 or equal to the length of the string, the expansion item returns the string.
13596 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13597 function to the string. The new string consists of characters taken from the
13598 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13599 </para>
13600 <literallayout class="monospaced">
13601 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13602 </literallayout>
13603 <para>
13604 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13605 letters appear. For example:
13606 </para>
13607 <literallayout>
13608 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13609 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13610 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13611 </literallayout>
13612 </listitem></varlistentry>
13613 <varlistentry>
13614 <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>
13615 <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>
13616 <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>
13617 <listitem>
13618 <para>
13619 <indexterm role="concept">
13620 <primary>expansion</primary>
13621 <secondary>header insertion</secondary>
13622 </indexterm>
13623 <indexterm role="variable">
13624 <primary><varname>$header_</varname></primary>
13625 </indexterm>
13626 <indexterm role="variable">
13627 <primary><varname>$bheader_</varname></primary>
13628 </indexterm>
13629 <indexterm role="variable">
13630 <primary><varname>$rheader_</varname></primary>
13631 </indexterm>
13632 <indexterm role="concept">
13633 <primary>header lines</primary>
13634 <secondary>in expansion strings</secondary>
13635 </indexterm>
13636 <indexterm role="concept">
13637 <primary>header lines</primary>
13638 <secondary>character sets</secondary>
13639 </indexterm>
13640 <indexterm role="concept">
13641 <primary>header lines</primary>
13642 <secondary>decoding</secondary>
13643 </indexterm>
13644 Substitute the contents of the named message header line, for example
13645 </para>
13646 <literallayout class="monospaced">
13647 $header_reply-to:
13648 </literallayout>
13649 <para>
13650 The newline that terminates a header line is not included in the expansion, but
13651 internal newlines (caused by splitting the header line over several physical
13652 lines) may be present.
13653 </para>
13654 <para>
13655 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13656 the data in the header line is interpreted.
13657 </para>
13658 <itemizedlist>
13659 <listitem>
13660 <para>
13661 <indexterm role="concept">
13662 <primary>white space</primary>
13663 <secondary>in header lines</secondary>
13664 </indexterm>
13665 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13666 processing at all, and without the removal of leading and trailing white space.
13667 </para>
13668 </listitem>
13669 <listitem>
13670 <para>
13671 <indexterm role="concept">
13672 <primary>base64 encoding</primary>
13673 <secondary>in header lines</secondary>
13674 </indexterm>
13675 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13676 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13677 character set translation. If decoding of what looks superficially like a MIME
13678 <quote>word</quote> fails, the raw string is returned. If decoding
13679 <indexterm role="concept">
13680 <primary>binary zero</primary>
13681 <secondary>in header line</secondary>
13682 </indexterm>
13683 produces a binary zero character, it is replaced by a question mark &ndash; this is
13684 what Exim does for binary zeros that are actually received in header lines.
13685 </para>
13686 </listitem>
13687 <listitem>
13688 <para>
13689 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13690 standard character set. This is an attempt to produce the same string as would
13691 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13692 returned. Translation is attempted only on operating systems that support the
13693 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13694 a system Makefile or in <filename>Local/Makefile</filename>.
13695 </para>
13696 </listitem>
13697 </itemizedlist>
13698 <para>
13699 In a filter file, the target character set for <option>header</option> can be specified by a
13700 command of the following form:
13701 </para>
13702 <literallayout class="monospaced">
13703 headers charset "UTF-8"
13704 </literallayout>
13705 <para>
13706 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13707 subsequently obeyed filter commands. In the absence of this command, the target
13708 character set in a filter is taken from the setting of the <option>headers_charset</option>
13709 option in the runtime configuration. The value of this option defaults to the
13710 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13711 ISO-8859-1.
13712 </para>
13713 <para>
13714 Header names follow the syntax of RFC 2822, which states that they may contain
13715 any printing characters except space and colon. Consequently, curly brackets
13716 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13717 if they were variables. Attempting to do so causes a syntax error.
13718 </para>
13719 <para>
13720 Only header lines that are common to all copies of a message are visible to
13721 this mechanism. These are the original header lines that are received with the
13722 message, and any that are added by an ACL statement or by a system
13723 filter. Header lines that are added to a particular copy of a message by a
13724 router or transport are not accessible.
13725 </para>
13726 <para>
13727 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13728 before the DATA ACL, because the header structure is not set up until the
13729 message is received. Header lines that are added in a RCPT ACL (for example)
13730 are saved until the message&#x2019;s incoming header lines are available, at which
13731 point they are added. When a DATA ACL is running, however, header lines added
13732 by earlier ACLs are visible.
13733 </para>
13734 <para>
13735 Upper case and lower case letters are synonymous in header names. If the
13736 following character is white space, the terminating colon may be omitted, but
13737 this is not recommended, because you may then forget it when it is needed. When
13738 white space terminates the header name, it is included in the expanded string.
13739 If the message does not contain the given header, the expansion item is
13740 replaced by an empty string. (See the <option>def</option> condition in section
13741 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13742 </para>
13743 <para>
13744 If there is more than one header with the same name, they are all concatenated
13745 to form the substitution string, up to a maximum length of 64K. Unless
13746 <option>rheader</option> is being used, leading and trailing white space is removed from
13747 each header before concatenation, and a completely empty header is ignored. A
13748 newline character is then inserted between non-empty headers, but there is no
13749 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13750 those headers that contain lists of addresses, a comma is also inserted at the
13751 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13752 </para>
13753 </listitem></varlistentry>
13754 <varlistentry>
13755 <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>
13756 <listitem>
13757 <para>
13758 <indexterm role="concept">
13759 <primary>expansion</primary>
13760 <secondary>hmac hashing</secondary>
13761 </indexterm>
13762 <indexterm role="concept">
13763 <primary><option>hmac</option></primary>
13764 </indexterm>
13765 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13766 shared secret and some text into a message authentication code, as specified in
13767 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13768 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13769 cryptographic hash, allowing for authentication that is not possible with MD5
13770 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13771 present. For example:
13772 </para>
13773 <literallayout class="monospaced">
13774 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13775 </literallayout>
13776 <para>
13777 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13778 produces:
13779 </para>
13780 <literallayout class="monospaced">
13781 dd97e3ba5d1a61b5006108f8c8252953
13782 </literallayout>
13783 <para>
13784 As an example of how this might be used, you might put in the main part of
13785 an Exim configuration:
13786 </para>
13787 <literallayout class="monospaced">
13788 SPAMSCAN_SECRET=cohgheeLei2thahw
13789 </literallayout>
13790 <para>
13791 In a router or a transport you could then have:
13792 </para>
13793 <literallayout class="monospaced">
13794 headers_add = \
13795   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13796   ${hmac{md5}{SPAMSCAN_SECRET}\
13797   {${primary_hostname},${message_exim_id},$h_message-id:}}
13798 </literallayout>
13799 <para>
13800 Then given a message, you can check where it was scanned by looking at the
13801 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13802 this header line is authentic by recomputing the authentication code from the
13803 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13804 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13805 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13806 </para>
13807 </listitem></varlistentry>
13808 <varlistentry>
13809 <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>
13810 <listitem>
13811 <para>
13812 <indexterm role="concept">
13813 <primary>expansion</primary>
13814 <secondary>conditional</secondary>
13815 </indexterm>
13816 <indexterm role="concept">
13817 <primary><option>if</option>, expansion item</primary>
13818 </indexterm>
13819 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13820 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13821 in section <xref linkend="SECTexpcond"/> below. For example:
13822 </para>
13823 <literallayout class="monospaced">
13824 ${if eq {$local_part}{postmaster} {yes}{no} }
13825 </literallayout>
13826 <para>
13827 The second string need not be present; if it is not and the condition is not
13828 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13829 be present instead of the second string (without any curly brackets). In this
13830 case, the expansion is forced to fail if the condition is not true (see section
13831 <xref linkend="SECTforexpfai"/>).
13832 </para>
13833 <para>
13834 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13835 is true, and the empty string if the condition is false. This makes it less
13836 cumbersome to write custom ACL and router conditions. For example, instead of
13837 </para>
13838 <literallayout class="monospaced">
13839 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13840 </literallayout>
13841 <para>
13842 you can use
13843 </para>
13844 <literallayout class="monospaced">
13845 condition = ${if &gt;{$acl_m4}{3}}
13846 </literallayout>
13847 </listitem></varlistentry>
13848 <varlistentry>
13849 <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>
13850 <listitem>
13851 <para>
13852 <indexterm role="concept">
13853 <primary>expansion</primary>
13854 <secondary>string truncation</secondary>
13855 </indexterm>
13856 <indexterm role="concept">
13857 <primary><option>length</option> expansion item</primary>
13858 </indexterm>
13859 The <option>length</option> item is used to extract the initial portion of a string. Both
13860 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13861 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13862 change when expanded, you can use the simpler operator notation that avoids
13863 some of the braces:
13864 </para>
13865 <literallayout class="monospaced">
13866 ${length_&lt;n&gt;:&lt;string&gt;}
13867 </literallayout>
13868 <para>
13869 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13870 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13871 <option>strlen</option>, which gives the length of a string.
13872 </para>
13873 </listitem></varlistentry>
13874 <varlistentry>
13875 <term><emphasis role="bold">${listextract{</emphasis>&lt;<emphasis>number</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>
13876 <listitem>
13877 <para>
13878 <indexterm role="concept">
13879 <primary>expansion</primary>
13880 <secondary>extracting list elements by number</secondary>
13881 </indexterm>
13882 <indexterm role="concept">
13883 <primary><option>listextract</option></primary>
13884 <secondary>extract list elements by number</secondary>
13885 </indexterm>
13886 <indexterm role="concept">
13887 <primary>list</primary>
13888 <secondary>extracting elements by number</secondary>
13889 </indexterm>
13890 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13891 apart from an optional leading minus,
13892 and leading and trailing white space (which is ignored).
13893 </para>
13894 <para>
13895 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13896 default, but the separator can be changed in the usual way.
13897 </para>
13898 <para>
13899 The first field of the list is numbered one.
13900 If the number is negative, the fields are
13901 counted from the end of the list, with the rightmost one numbered -1.
13902 The numbered element of the list is extracted and placed in <varname>$value</varname>,
13903 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
13904 </para>
13905 <para>
13906 If the modulus of the
13907 number is zero or greater than the number of fields in the string,
13908 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
13909 </para>
13910 <para>
13911 For example:
13912 </para>
13913 <literallayout class="monospaced">
13914 ${listextract{2}{x:42:99}}
13915 </literallayout>
13916 <para>
13917 yields <quote>42</quote>, and
13918 </para>
13919 <literallayout class="monospaced">
13920 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
13921 </literallayout>
13922 <para>
13923 yields <quote>result: 99</quote>.
13924 </para>
13925 <para>
13926 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
13927 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13928 extracted is used.
13929 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
13930 </para>
13931 </listitem></varlistentry>
13932 <varlistentry>
13933 <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>
13934 <listitem>
13935 <para>
13936 This is the first of one of two different types of lookup item, which are both
13937 described in the next item.
13938 </para>
13939 </listitem></varlistentry>
13940 <varlistentry>
13941 <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>
13942 <listitem>
13943 <para>
13944 <indexterm role="concept">
13945 <primary>expansion</primary>
13946 <secondary>lookup in</secondary>
13947 </indexterm>
13948 <indexterm role="concept">
13949 <primary>file</primary>
13950 <secondary>lookups</secondary>
13951 </indexterm>
13952 <indexterm role="concept">
13953 <primary>lookup</primary>
13954 <secondary>in expanded string</secondary>
13955 </indexterm>
13956 The two forms of lookup item specify data lookups in files and databases, as
13957 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13958 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13959 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13960 </para>
13961 <para>
13962 If there is any white space in a lookup item which is part of a filter command,
13963 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13964 other place where white space is significant, the lookup item must be enclosed
13965 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13966 out by the system administrator.
13967 </para>
13968 <para>
13969 <indexterm role="variable">
13970 <primary><varname>$value</varname></primary>
13971 </indexterm>
13972 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13973 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13974 lookup. Afterwards it reverts to the value it had previously (at the outer
13975 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13976 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13977 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13978 lookup, thus providing a mechanism for looking up a default value when the
13979 original lookup fails.
13980 </para>
13981 <para>
13982 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13983 data for the outer lookup while the parameters of the second lookup are
13984 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13985 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13986 appear, and in this case, if the lookup fails, the entire expansion is forced
13987 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13988 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13989 successful lookup, and nothing in the case of failure.
13990 </para>
13991 <para>
13992 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13993 search type in order to do partial matching, and * or *@ may follow a search
13994 type to request default lookups if the key does not match (see sections
13995 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13996 </para>
13997 <para>
13998 <indexterm role="concept">
13999 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14000 <secondary>in lookup expansion</secondary>
14001 </indexterm>
14002 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14003 and non-wild parts of the key during the expansion of the replacement text.
14004 They return to their previous values at the end of the lookup item.
14005 </para>
14006 <para>
14007 This example looks up the postmaster alias in the conventional alias file:
14008 </para>
14009 <literallayout class="monospaced">
14010 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14011 </literallayout>
14012 <para>
14013 This example uses NIS+ to look up the full name of the user corresponding to
14014 the local part of an address, forcing the expansion to fail if it is not found:
14015 </para>
14016 <literallayout class="monospaced">
14017 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14018   {$value}fail}
14019 </literallayout>
14020 </listitem></varlistentry>
14021 <varlistentry>
14022 <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>
14023 <listitem>
14024 <para>
14025 <indexterm role="concept">
14026 <primary>expansion</primary>
14027 <secondary>list creation</secondary>
14028 </indexterm>
14029 <indexterm role="variable">
14030 <primary><varname>$item</varname></primary>
14031 </indexterm>
14032 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14033 default, but the separator can be changed in the usual way. For each item
14034 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14035 expanded and added to the output as an item in a new list. The separator used
14036 for the output list is the same as the one used for the input, but a separator
14037 setting is not included in the output. For example:
14038 </para>
14039 <literallayout class="monospaced">
14040 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14041 </literallayout>
14042 <para>
14043 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14044 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14045 and <emphasis role="bold">reduce</emphasis> expansion items.
14046 </para>
14047 </listitem></varlistentry>
14048 <varlistentry>
14049 <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>
14050 <listitem>
14051 <para>
14052 <indexterm role="concept">
14053 <primary>expansion</primary>
14054 <secondary>numeric hash</secondary>
14055 </indexterm>
14056 <indexterm role="concept">
14057 <primary>hash function</primary>
14058 <secondary>numeric</secondary>
14059 </indexterm>
14060 The three strings are expanded; the first two must yield numbers. Call them
14061 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14062 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14063 can use the simpler operator notation that avoids some of the braces:
14064 </para>
14065 <literallayout class="monospaced">
14066 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14067 </literallayout>
14068 <para>
14069 The second number is optional (in both notations). If there is only one number,
14070 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14071 processed by a div/mod hash function that returns two numbers, separated by a
14072 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14073 example,
14074 </para>
14075 <literallayout class="monospaced">
14076 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14077 </literallayout>
14078 <para>
14079 returns the string <quote>6/33</quote>.
14080 </para>
14081 </listitem></varlistentry>
14082 <varlistentry>
14083 <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>
14084 <listitem>
14085 <para>
14086 <indexterm role="concept">
14087 <primary>Perl</primary>
14088 <secondary>use in expanded string</secondary>
14089 </indexterm>
14090 <indexterm role="concept">
14091 <primary>expansion</primary>
14092 <secondary>calling Perl from</secondary>
14093 </indexterm>
14094 This item is available only if Exim has been built to include an embedded Perl
14095 interpreter. The subroutine name and the arguments are first separately
14096 expanded, and then the Perl subroutine is called with those arguments. No
14097 additional arguments need be given; the maximum number permitted, including the
14098 name of the subroutine, is nine.
14099 </para>
14100 <para>
14101 The return value of the subroutine is inserted into the expanded string, unless
14102 the return value is <option>undef</option>. In that case, the expansion fails in the same
14103 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14104 Whatever you return is evaluated in a scalar context. For example, if you
14105 return the name of a Perl vector, the return value is the size of the vector,
14106 not its contents.
14107 </para>
14108 <para>
14109 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14110 with the error message that was passed to <option>die</option>. More details of the embedded
14111 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14112 </para>
14113 <para>
14114 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14115 out the use of this expansion item in filter files.
14116 </para>
14117 </listitem></varlistentry>
14118 <varlistentry>
14119 <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>
14120 <listitem>
14121 <para>
14122 <indexterm role="concept">
14123 <primary><option>prvs</option> expansion item</primary>
14124 </indexterm>
14125 The first argument is a complete email address and the second is secret
14126 keystring. The third argument, specifying a key number, is optional. If absent,
14127 it defaults to 0. The result of the expansion is a prvs-signed email address,
14128 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14129 as part of a bounce address tag validation (BATV) scheme. For more discussion
14130 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14131 </para>
14132 </listitem></varlistentry>
14133 <varlistentry>
14134 <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>
14135 <listitem>
14136 <para>
14137 <indexterm role="concept">
14138 <primary><option>prvscheck</option> expansion item</primary>
14139 </indexterm>
14140 This expansion item is the complement of the <option>prvs</option> item. It is used for
14141 checking prvs-signed addresses. If the expansion of the first argument does not
14142 yield a syntactically valid prvs-signed address, the whole item expands to the
14143 empty string. When the first argument does expand to a syntactically valid
14144 prvs-signed address, the second argument is expanded, with the prvs-decoded
14145 version of the address and the key number extracted from the address in the
14146 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14147 </para>
14148 <para>
14149 These two variables can be used in the expansion of the second argument to
14150 retrieve the secret. The validity of the prvs-signed address is then checked
14151 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14152 which is empty for failure or <quote>1</quote> for success.
14153 </para>
14154 <para>
14155 The third argument is optional; if it is missing, it defaults to an empty
14156 string. This argument is now expanded. If the result is an empty string, the
14157 result of the expansion is the decoded version of the address. This is the case
14158 whether or not the signature was valid. Otherwise, the result of the expansion
14159 is the expansion of the third argument.
14160 </para>
14161 <para>
14162 All three variables can be used in the expansion of the third argument.
14163 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14164 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14165 </para>
14166 </listitem></varlistentry>
14167 <varlistentry>
14168 <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>
14169 <listitem>
14170 <para>
14171 <indexterm role="concept">
14172 <primary>expansion</primary>
14173 <secondary>inserting an entire file</secondary>
14174 </indexterm>
14175 <indexterm role="concept">
14176 <primary>file</primary>
14177 <secondary>inserting into expansion</secondary>
14178 </indexterm>
14179 <indexterm role="concept">
14180 <primary><option>readfile</option> expansion item</primary>
14181 </indexterm>
14182 The file name and end-of-line string are first expanded separately. The file is
14183 then read, and its contents replace the entire item. All newline characters in
14184 the file are replaced by the end-of-line string if it is present. Otherwise,
14185 newlines are left in the string.
14186 String expansion is not applied to the contents of the file. If you want this,
14187 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14188 the string expansion fails.
14189 </para>
14190 <para>
14191 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14192 locks out the use of this expansion item in filter files.
14193 </para>
14194 </listitem></varlistentry>
14195 <varlistentry>
14196 <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>
14197 <listitem>
14198 <para>
14199 <indexterm role="concept">
14200 <primary>expansion</primary>
14201 <secondary>inserting from a socket</secondary>
14202 </indexterm>
14203 <indexterm role="concept">
14204 <primary>socket, use of in expansion</primary>
14205 </indexterm>
14206 <indexterm role="concept">
14207 <primary><option>readsocket</option> expansion item</primary>
14208 </indexterm>
14209 This item inserts data from a Unix domain or TCP socket into the expanded
14210 string. The minimal way of using it uses just two arguments, as in these
14211 examples:
14212 </para>
14213 <literallayout class="monospaced">
14214 ${readsocket{/socket/name}{request string}}
14215 ${readsocket{inet:some.host:1234}{request string}}
14216 </literallayout>
14217 <para>
14218 For a Unix domain socket, the first substring must be the path to the socket.
14219 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14220 a host name or IP address, followed by a colon and a port, which can be a
14221 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14222 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14223 example:
14224 </para>
14225 <literallayout class="monospaced">
14226 ${readsocket{inet:[::1]:1234}{request string}}
14227 </literallayout>
14228 <para>
14229 Only a single host name may be given, but if looking it up yields more than
14230 one IP address, they are each tried in turn until a connection is made. For
14231 both kinds of socket, Exim makes a connection, writes the request string
14232 (unless it is an empty string) and reads from the socket until an end-of-file
14233 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14234 extend what can be done. Firstly, you can vary the timeout. For example:
14235 </para>
14236 <literallayout class="monospaced">
14237 ${readsocket{/socket/name}{request string}{3s}}
14238 </literallayout>
14239 <para>
14240 A fourth argument allows you to change any newlines that are in the data
14241 that is read, in the same way as for <option>readfile</option> (see above). This example
14242 turns them into spaces:
14243 </para>
14244 <literallayout class="monospaced">
14245 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14246 </literallayout>
14247 <para>
14248 As with all expansions, the substrings are expanded before the processing
14249 happens. Errors in these sub-expansions cause the expansion to fail. In
14250 addition, the following errors can occur:
14251 </para>
14252 <itemizedlist>
14253 <listitem>
14254 <para>
14255 Failure to create a socket file descriptor;
14256 </para>
14257 </listitem>
14258 <listitem>
14259 <para>
14260 Failure to connect the socket;
14261 </para>
14262 </listitem>
14263 <listitem>
14264 <para>
14265 Failure to write the request string;
14266 </para>
14267 </listitem>
14268 <listitem>
14269 <para>
14270 Timeout on reading from the socket.
14271 </para>
14272 </listitem>
14273 </itemizedlist>
14274 <para>
14275 By default, any of these errors causes the expansion to fail. However, if
14276 you supply a fifth substring, it is expanded and used when any of the above
14277 errors occurs. For example:
14278 </para>
14279 <literallayout class="monospaced">
14280 ${readsocket{/socket/name}{request string}{3s}{\n}\
14281   {socket failure}}
14282 </literallayout>
14283 <para>
14284 You can test for the existence of a Unix domain socket by wrapping this
14285 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14286 and the actual opening of the socket, so it is safer to use the fifth argument
14287 if you want to be absolutely sure of avoiding an expansion error for a
14288 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14289 </para>
14290 <para>
14291 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14292 locks out the use of this expansion item in filter files.
14293 </para>
14294 </listitem></varlistentry>
14295 <varlistentry>
14296 <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>
14297 <listitem>
14298 <para>
14299 <indexterm role="concept">
14300 <primary>expansion</primary>
14301 <secondary>reducing a list to a scalar</secondary>
14302 </indexterm>
14303 <indexterm role="concept">
14304 <primary>list</primary>
14305 <secondary>reducing to a scalar</secondary>
14306 </indexterm>
14307 <indexterm role="variable">
14308 <primary><varname>$value</varname></primary>
14309 </indexterm>
14310 <indexterm role="variable">
14311 <primary><varname>$item</varname></primary>
14312 </indexterm>
14313 This operation reduces a list to a single, scalar string. After expansion,
14314 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14315 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14316 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14317 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14318 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14319 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14320 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14321 number of ways. For example, to add up a list of numbers:
14322 </para>
14323 <literallayout class="monospaced">
14324 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14325 </literallayout>
14326 <para>
14327 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14328 can be found:
14329 </para>
14330 <literallayout class="monospaced">
14331 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14332 </literallayout>
14333 <para>
14334 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14335 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14336 expansion items.
14337 </para>
14338 </listitem></varlistentry>
14339 <varlistentry>
14340 <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>
14341 <listitem>
14342 <para>
14343 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14344 expansion item above.
14345 </para>
14346 </listitem></varlistentry>
14347 <varlistentry>
14348 <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>
14349 <listitem>
14350 <para>
14351 <indexterm role="concept">
14352 <primary>expansion</primary>
14353 <secondary>running a command</secondary>
14354 </indexterm>
14355 <indexterm role="concept">
14356 <primary><option>run</option> expansion item</primary>
14357 </indexterm>
14358 The command and its arguments are first expanded as one string. The string is
14359 split apart into individual arguments by spaces, and then the command is run
14360 in a separate process, but under the same uid and gid.  As in other command
14361 executions from Exim, a shell is not used by default. If the command requires
14362 a shell, you must explicitly code it.
14363 </para>
14364 <para>
14365 Since the arguments are split by spaces, when there is a variable expansion
14366 which has an empty result, it will cause the situation that the argument will
14367 simply be omitted when the program is actually executed by Exim. If the
14368 script/program requires a specific number of arguments and the expanded
14369 variable could possibly result in this empty expansion, the variable must be
14370 quoted. This is more difficult if the expanded variable itself could result
14371 in a string containing quotes, because it would interfere with the quotes
14372 around the command arguments. A possible guard against this is to wrap the
14373 variable in the <option>sg</option> operator to change any quote marks to some other
14374 character.
14375 </para>
14376 <para>
14377 The standard input for the command exists, but is empty. The standard output
14378 and standard error are set to the same file descriptor.
14379 <indexterm role="concept">
14380 <primary>return code</primary>
14381 <secondary>from <option>run</option> expansion</secondary>
14382 </indexterm>
14383 <indexterm role="variable">
14384 <primary><varname>$value</varname></primary>
14385 </indexterm>
14386 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14387 and replaces the entire item; during this expansion, the standard output/error
14388 from the command is in the variable <varname>$value</varname>. If the command fails,
14389 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14390 expansion, the standard output/error from the command is in the variable
14391 <varname>$value</varname>.
14392 </para>
14393 <para>
14394 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14395 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14396 command does not succeed. If both strings are omitted, the result is contents
14397 of the standard output/error on success, and nothing on failure.
14398 </para>
14399 <para>
14400 <indexterm role="variable">
14401 <primary><varname>$run_in_acl</varname></primary>
14402 </indexterm>
14403 The standard output/error of the command is put in the variable <varname>$value</varname>.
14404 In this ACL example, the output of a command is logged for the admin to
14405 troubleshoot:
14406 </para>
14407 <literallayout class="monospaced">
14408 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14409       log_message  = Output of id: $value
14410 </literallayout>
14411 <para>
14412 If the command requires shell idioms, such as the &gt; redirect operator, the
14413 shell must be invoked directly, such as with:
14414 </para>
14415 <literallayout class="monospaced">
14416 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14417 </literallayout>
14418 <para>
14419 <indexterm role="variable">
14420 <primary><varname>$runrc</varname></primary>
14421 </indexterm>
14422 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14423 remains set afterwards, so in a filter file you can do things like this:
14424 </para>
14425 <literallayout class="monospaced">
14426 if "${run{x y z}{}}$runrc" is 1 then ...
14427   elif $runrc is 2 then ...
14428   ...
14429 endif
14430 </literallayout>
14431 <para>
14432 If execution of the command fails (for example, the command does not exist),
14433 the return code is 127 &ndash; the same code that shells use for non-existent
14434 commands.
14435 </para>
14436 <para>
14437 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14438 option values are expanded, except for those preconditions whose order of
14439 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14440 by the expansion of one option, and use it in another.
14441 </para>
14442 <para>
14443 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14444 out the use of this expansion item in filter files.
14445 </para>
14446 </listitem></varlistentry>
14447 <varlistentry>
14448 <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>
14449 <listitem>
14450 <para>
14451 <indexterm role="concept">
14452 <primary>expansion</primary>
14453 <secondary>string substitution</secondary>
14454 </indexterm>
14455 <indexterm role="concept">
14456 <primary><option>sg</option> expansion item</primary>
14457 </indexterm>
14458 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14459 option; hence its name. However, unlike the Perl equivalent, Exim does not
14460 modify the subject string; instead it returns the modified string for insertion
14461 into the overall expansion. The item takes three arguments: the subject string,
14462 a regular expression, and a substitution string. For example:
14463 </para>
14464 <literallayout class="monospaced">
14465 ${sg{abcdefabcdef}{abc}{xyz}}
14466 </literallayout>
14467 <para>
14468 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14469 if any $ or \ characters are required in the regular expression or in the
14470 substitution string, they have to be escaped. For example:
14471 </para>
14472 <literallayout class="monospaced">
14473 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14474 </literallayout>
14475 <para>
14476 yields <quote>defabc</quote>, and
14477 </para>
14478 <literallayout class="monospaced">
14479 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14480 </literallayout>
14481 <para>
14482 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14483 the regular expression from string expansion.
14484 </para>
14485 </listitem></varlistentry>
14486 <varlistentry revisionflag="changed">
14487 <term><emphasis role="bold">${sort{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>comparator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>extractor</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14488 <listitem>
14489 <para revisionflag="changed">
14490 <indexterm role="concept">
14491 <primary>sorting</primary>
14492 <secondary>a</secondary>
14493 </indexterm>
14494 <indexterm role="concept">
14495 <primary>list</primary>
14496 <secondary>sorting</secondary>
14497 </indexterm>
14498 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14499 default, but the separator can be changed in the usual way.
14500 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14501 of a two-argument expansion condition.
14502 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14503 The comparison should return true when applied to two values
14504 if the first value should sort before the second value.
14505 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14506 the element being placed in <varname>$item</varname>,
14507 to give values for comparison.
14508 </para>
14509 <para revisionflag="changed">
14510 The item result is a sorted list,
14511 with the original list separator,
14512 of the list elements (in full) of the original.
14513 </para>
14514 <para revisionflag="changed">
14515 Examples:
14516 </para>
14517 <literallayout class="monospaced" revisionflag="changed">
14518 ${sort{3:2:1:4}{&lt;}{$item}}
14519 </literallayout>
14520 <para revisionflag="changed">
14521 sorts a list of numbers, and
14522 </para>
14523 <literallayout class="monospaced" revisionflag="changed">
14524 ${sort {$lookup dnsdb{&gt;:,,mx=example.com}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14525 </literallayout>
14526 <para revisionflag="changed">
14527 will sort an MX lookup into priority order.
14528 </para>
14529 </listitem></varlistentry>
14530 <varlistentry>
14531 <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>
14532 <listitem>
14533 <para>
14534 <indexterm role="concept">
14535 <primary><option>substr</option> expansion item</primary>
14536 </indexterm>
14537 <indexterm role="concept">
14538 <primary>substring extraction</primary>
14539 </indexterm>
14540 <indexterm role="concept">
14541 <primary>expansion</primary>
14542 <secondary>substring extraction</secondary>
14543 </indexterm>
14544 The three strings are expanded; the first two must yield numbers. Call them
14545 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14546 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14547 can use the simpler operator notation that avoids some of the braces:
14548 </para>
14549 <literallayout class="monospaced">
14550 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14551 </literallayout>
14552 <para>
14553 The second number is optional (in both notations).
14554 If it is absent in the simpler format, the preceding underscore must also be
14555 omitted.
14556 </para>
14557 <para>
14558 The <option>substr</option> item can be used to extract more general substrings than
14559 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14560 length required. For example
14561 </para>
14562 <literallayout class="monospaced">
14563 ${substr{3}{2}{$local_part}}
14564 </literallayout>
14565 <para>
14566 If the starting offset is greater than the string length the result is the
14567 null string; if the length plus starting offset is greater than the string
14568 length, the result is the right-hand part of the string, starting from the
14569 given offset. The first character in the string has offset zero.
14570 </para>
14571 <para>
14572 The <option>substr</option> expansion item can take negative offset values to count
14573 from the right-hand end of its operand. The last character is offset -1, the
14574 second-last is offset -2, and so on. Thus, for example,
14575 </para>
14576 <literallayout class="monospaced">
14577 ${substr{-5}{2}{1234567}}
14578 </literallayout>
14579 <para>
14580 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14581 length of the string, the substring starts at the beginning of the string, and
14582 the length is reduced by the amount of overshoot. Thus, for example,
14583 </para>
14584 <literallayout class="monospaced">
14585 ${substr{-5}{2}{12}}
14586 </literallayout>
14587 <para>
14588 yields an empty string, but
14589 </para>
14590 <literallayout class="monospaced">
14591 ${substr{-3}{2}{12}}
14592 </literallayout>
14593 <para>
14594 yields <quote>1</quote>.
14595 </para>
14596 <para>
14597 When the second number is omitted from <option>substr</option>, the remainder of the string
14598 is taken if the offset is positive. If it is negative, all characters in the
14599 string preceding the offset point are taken. For example, an offset of -1 and
14600 no length, as in these semantically identical examples:
14601 </para>
14602 <literallayout class="monospaced">
14603 ${substr_-1:abcde}
14604 ${substr{-1}{abcde}}
14605 </literallayout>
14606 <para>
14607 yields all but the last character of the string, that is, <quote>abcd</quote>.
14608 </para>
14609 </listitem></varlistentry>
14610 <varlistentry>
14611 <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>
14612 <listitem>
14613 <para>
14614 <indexterm role="concept">
14615 <primary>expansion</primary>
14616 <secondary>character translation</secondary>
14617 </indexterm>
14618 <indexterm role="concept">
14619 <primary><option>tr</option> expansion item</primary>
14620 </indexterm>
14621 This item does single-character translation on its subject string. The second
14622 argument is a list of characters to be translated in the subject string. Each
14623 matching character is replaced by the corresponding character from the
14624 replacement list. For example
14625 </para>
14626 <literallayout class="monospaced">
14627 ${tr{abcdea}{ac}{13}}
14628 </literallayout>
14629 <para>
14630 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14631 last occurrence is used. If the third string is shorter than the second, its
14632 last character is replicated. However, if it is empty, no translation takes
14633 place.
14634 </para>
14635 </listitem></varlistentry>
14636 </variablelist>
14637 </section>
14638 <section id="SECTexpop">
14639 <title>Expansion operators</title>
14640 <para>
14641 <indexterm role="concept">
14642 <primary>expansion</primary>
14643 <secondary>operators</secondary>
14644 </indexterm>
14645 For expansion items that perform transformations on a single argument string,
14646 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14647 The substring is first expanded before the operation is applied to it. The
14648 following operations can be performed:
14649 </para>
14650 <variablelist>
14651 <varlistentry>
14652 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14653 <listitem>
14654 <para>
14655 <indexterm role="concept">
14656 <primary>expansion</primary>
14657 <secondary>RFC 2822 address handling</secondary>
14658 </indexterm>
14659 <indexterm role="concept">
14660 <primary><option>address</option> expansion item</primary>
14661 </indexterm>
14662 The string is interpreted as an RFC 2822 address, as it might appear in a
14663 header line, and the effective address is extracted from it. If the string does
14664 not parse successfully, the result is empty.
14665 </para>
14666 </listitem></varlistentry>
14667 <varlistentry>
14668 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14669 <listitem>
14670 <para>
14671 <indexterm role="concept">
14672 <primary>expansion</primary>
14673 <secondary>RFC 2822 address handling</secondary>
14674 </indexterm>
14675 <indexterm role="concept">
14676 <primary><option>addresses</option> expansion item</primary>
14677 </indexterm>
14678 The string (after expansion) is interpreted as a list of addresses in RFC
14679 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14680 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14681 result of the expansion is a colon-separated list, with appropriate
14682 doubling of colons should any happen to be present in the email addresses.
14683 Syntactically invalid RFC2822 address items are omitted from the output.
14684 </para>
14685 <para>
14686 It is possible to specify a character other than colon for the output
14687 separator by starting the string with &gt; followed by the new separator
14688 character. For example:
14689 </para>
14690 <literallayout class="monospaced">
14691 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14692 </literallayout>
14693 <para>
14694 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14695 expansion item, which extracts the working address from a single RFC2822
14696 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14697 processing lists.
14698 </para>
14699 <para>
14700 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14701 a strict interpretation of header line formatting.  Exim parses the bare,
14702 unquoted portion of an email address and if it finds a comma, treats it as an
14703 email address seperator. For the example header line:
14704 </para>
14705 <literallayout class="monospaced">
14706 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14707 </literallayout>
14708 <para>
14709 The first example below demonstrates that Q-encoded email addresses are parsed
14710 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14711 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14712 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14713 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14714 The third example shows that the presence of a comma is skipped when it is
14715 quoted.
14716 </para>
14717 <literallayout class="monospaced">
14718 # exim -be '${addresses:From: \
14719 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14720 user@example.com
14721 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14722 Last:user@example.com
14723 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14724 user@example.com
14725 </literallayout>
14726 </listitem></varlistentry>
14727 <varlistentry>
14728 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14729 <listitem>
14730 <para>
14731 <indexterm role="concept">
14732 <primary><option>base62</option> expansion item</primary>
14733 </indexterm>
14734 <indexterm role="concept">
14735 <primary>expansion</primary>
14736 <secondary>conversion to base 62</secondary>
14737 </indexterm>
14738 The string must consist entirely of decimal digits. The number is converted to
14739 base 62 and output as a string of six characters, including leading zeros. In
14740 the few operating environments where Exim uses base 36 instead of base 62 for
14741 its message identifiers (because those systems do not have case-sensitive file
14742 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14743 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14744 </para>
14745 </listitem></varlistentry>
14746 <varlistentry>
14747 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14748 <listitem>
14749 <para>
14750 <indexterm role="concept">
14751 <primary><option>base62d</option> expansion item</primary>
14752 </indexterm>
14753 <indexterm role="concept">
14754 <primary>expansion</primary>
14755 <secondary>conversion to base 62</secondary>
14756 </indexterm>
14757 The string must consist entirely of base-62 digits, or, in operating
14758 environments where Exim uses base 36 instead of base 62 for its message
14759 identifiers, base-36 digits. The number is converted to decimal and output as a
14760 string.
14761 </para>
14762 </listitem></varlistentry>
14763 <varlistentry>
14764 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14765 <listitem>
14766 <para>
14767 <indexterm role="concept">
14768 <primary>domain</primary>
14769 <secondary>extraction</secondary>
14770 </indexterm>
14771 <indexterm role="concept">
14772 <primary>expansion</primary>
14773 <secondary>domain extraction</secondary>
14774 </indexterm>
14775 The string is interpreted as an RFC 2822 address and the domain is extracted
14776 from it. If the string does not parse successfully, the result is empty.
14777 </para>
14778 </listitem></varlistentry>
14779 <varlistentry>
14780 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14781 <listitem>
14782 <para>
14783 <indexterm role="concept">
14784 <primary>expansion</primary>
14785 <secondary>escaping non-printing characters</secondary>
14786 </indexterm>
14787 <indexterm role="concept">
14788 <primary><option>escape</option> expansion item</primary>
14789 </indexterm>
14790 If the string contains any non-printing characters, they are converted to
14791 escape sequences starting with a backslash. Whether characters with the most
14792 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14793 is controlled by the <option>print_topbitchars</option> option.
14794 </para>
14795 </listitem></varlistentry>
14796 <varlistentry>
14797 <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>
14798 <listitem>
14799 <para>
14800 <indexterm role="concept">
14801 <primary>expansion</primary>
14802 <secondary>expression evaluation</secondary>
14803 </indexterm>
14804 <indexterm role="concept">
14805 <primary>expansion</primary>
14806 <secondary>arithmetic expression</secondary>
14807 </indexterm>
14808 <indexterm role="concept">
14809 <primary><option>eval</option> expansion item</primary>
14810 </indexterm>
14811 These items supports simple arithmetic and bitwise logical operations in
14812 expansion strings. The string (after expansion) must be a conventional
14813 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14814 logical operators, and parentheses. All operations are carried out using
14815 integer arithmetic. The operator priorities are as follows (the same as in the
14816 C programming language):
14817 </para>
14818 <informaltable frame="none">
14819 <tgroup cols="2" colsep="0" rowsep="0">
14820 <colspec colwidth="70pt" align="left"/>
14821 <colspec colwidth="300pt" align="left"/>
14822 <tbody>
14823 <row>
14824 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14825 <entry>not (~), negate (-)</entry>
14826 </row>
14827 <row>
14828 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14829 <entry>multiply (*), divide (/), remainder (%)</entry>
14830 </row>
14831 <row>
14832 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14833 <entry>plus (+), minus (-)</entry>
14834 </row>
14835 <row>
14836 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14837 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14838 </row>
14839 <row>
14840 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14841 <entry>and (&amp;)</entry>
14842 </row>
14843 <row>
14844 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14845 <entry>xor (^)</entry>
14846 </row>
14847 <row>
14848 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14849 <entry>or (|)</entry>
14850 </row>
14851 </tbody>
14852 </tgroup>
14853 </informaltable>
14854 <para>
14855 Binary operators with the same priority are evaluated from left to right. White
14856 space is permitted before or after operators.
14857 </para>
14858 <para>
14859 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14860 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14861 decimal, even if they start with a leading zero; hexadecimal numbers are not
14862 permitted. This can be useful when processing numbers extracted from dates or
14863 times, which often do have leading zeros.
14864 </para>
14865 <para>
14866 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14867 or 1024*1024*1024,
14868 respectively. Negative numbers are supported. The result of the computation is
14869 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14870 </para>
14871 <literallayout>
14872 <literal>${eval:1+1}            </literal>  yields 2
14873 <literal>${eval:1+2*3}          </literal>  yields 7
14874 <literal>${eval:(1+2)*3}        </literal>  yields 9
14875 <literal>${eval:2+42%5}         </literal>  yields 4
14876 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14877 <literal>${eval:0xc|5}          </literal>  yields 13
14878 <literal>${eval:0xc^5}          </literal>  yields 9
14879 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14880 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14881 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14882 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14883 </literallayout>
14884 <para>
14885 As a more realistic example, in an ACL you might have
14886 </para>
14887 <literallayout class="monospaced">
14888 deny   message = Too many bad recipients
14889        condition =                    \
14890          ${if and {                   \
14891            {&gt;{$rcpt_count}{10}}       \
14892            {                          \
14893            &lt;                          \
14894              {$recipients_count}      \
14895              {${eval:$rcpt_count/2}}  \
14896            }                          \
14897          }{yes}{no}}
14898 </literallayout>
14899 <para>
14900 The condition is true if there have been more than 10 RCPT commands and
14901 fewer than half of them have resulted in a valid recipient.
14902 </para>
14903 </listitem></varlistentry>
14904 <varlistentry>
14905 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14906 <listitem>
14907 <para>
14908 <indexterm role="concept">
14909 <primary>expansion</primary>
14910 <secondary>re-expansion of substring</secondary>
14911 </indexterm>
14912 The <option>expand</option> operator causes a string to be expanded for a second time. For
14913 example,
14914 </para>
14915 <literallayout class="monospaced">
14916 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14917 </literallayout>
14918 <para>
14919 first looks up a string in a file while expanding the operand for <option>expand</option>,
14920 and then re-expands what it has found.
14921 </para>
14922 </listitem></varlistentry>
14923 <varlistentry>
14924 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14925 <listitem>
14926 <para>
14927 <indexterm role="concept">
14928 <primary>Unicode</primary>
14929 </indexterm>
14930 <indexterm role="concept">
14931 <primary>UTF-8</primary>
14932 <secondary>conversion from</secondary>
14933 </indexterm>
14934 <indexterm role="concept">
14935 <primary>expansion</primary>
14936 <secondary>UTF-8 conversion</secondary>
14937 </indexterm>
14938 <indexterm role="concept">
14939 <primary><option>from_utf8</option> expansion item</primary>
14940 </indexterm>
14941 The world is slowly moving towards Unicode, although there are no standards for
14942 email yet. However, other applications (including some databases) are starting
14943 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14944 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14945 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14946 the result is an undefined sequence of bytes.
14947 </para>
14948 <para>
14949 Unicode code points with values less than 256 are compatible with ASCII and
14950 ISO-8859-1 (also known as Latin-1).
14951 For example, character 169 is the copyright symbol in both cases, though the
14952 way it is encoded is different. In UTF-8, more than one byte is needed for
14953 characters with code values greater than 127, whereas ISO-8859-1 is a
14954 single-byte encoding (but thereby limited to 256 characters). This makes
14955 translation from UTF-8 to ISO-8859-1 straightforward.
14956 </para>
14957 </listitem></varlistentry>
14958 <varlistentry>
14959 <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>
14960 <listitem>
14961 <para>
14962 <indexterm role="concept">
14963 <primary>hash function</primary>
14964 <secondary>textual</secondary>
14965 </indexterm>
14966 <indexterm role="concept">
14967 <primary>expansion</primary>
14968 <secondary>textual hash</secondary>
14969 </indexterm>
14970 The <option>hash</option> operator is a simpler interface to the hashing function that can
14971 be used when the two parameters are fixed numbers (as opposed to strings that
14972 change when expanded). The effect is the same as
14973 </para>
14974 <literallayout class="monospaced">
14975 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14976 </literallayout>
14977 <para>
14978 See the description of the general <option>hash</option> item above for details. The
14979 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14980 </para>
14981 </listitem></varlistentry>
14982 <varlistentry>
14983 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14984 <listitem>
14985 <para>
14986 <indexterm role="concept">
14987 <primary>base64 encoding</primary>
14988 <secondary>conversion from hex</secondary>
14989 </indexterm>
14990 <indexterm role="concept">
14991 <primary>expansion</primary>
14992 <secondary>hex to base64</secondary>
14993 </indexterm>
14994 <indexterm role="concept">
14995 <primary><option>hex2b64</option> expansion item</primary>
14996 </indexterm>
14997 This operator converts a hex string into one that is base64 encoded. This can
14998 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14999 </para>
15000 </listitem></varlistentry>
15001 <varlistentry>
15002 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15003 <listitem>
15004 <para>
15005 <indexterm role="concept">
15006 <primary>quoting</primary>
15007 <secondary>hex-encoded unprintable characters</secondary>
15008 </indexterm>
15009 <indexterm role="concept">
15010 <primary><option>hexquote</option> expansion item</primary>
15011 </indexterm>
15012 This operator converts non-printable characters in a string into a hex
15013 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15014 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15015 byte value 127 is converted to <literal>\x7f</literal>.
15016 </para>
15017 </listitem></varlistentry>
15018 <varlistentry>
15019 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15020 <listitem>
15021 <para>
15022 <indexterm role="concept">
15023 <primary>case forcing in strings</primary>
15024 </indexterm>
15025 <indexterm role="concept">
15026 <primary>string</primary>
15027 <secondary>case forcing</secondary>
15028 </indexterm>
15029 <indexterm role="concept">
15030 <primary>lower casing</primary>
15031 </indexterm>
15032 <indexterm role="concept">
15033 <primary>expansion</primary>
15034 <secondary>case forcing</secondary>
15035 </indexterm>
15036 <indexterm role="concept">
15037 <primary><option>lc</option> expansion item</primary>
15038 </indexterm>
15039 This forces the letters in the string into lower-case, for example:
15040 </para>
15041 <literallayout class="monospaced">
15042 ${lc:$local_part}
15043 </literallayout>
15044 </listitem></varlistentry>
15045 <varlistentry>
15046 <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>
15047 <listitem>
15048 <para>
15049 <indexterm role="concept">
15050 <primary>expansion</primary>
15051 <secondary>string truncation</secondary>
15052 </indexterm>
15053 <indexterm role="concept">
15054 <primary><option>length</option> expansion item</primary>
15055 </indexterm>
15056 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15057 can be used when the parameter is a fixed number (as opposed to a string that
15058 changes when expanded). The effect is the same as
15059 </para>
15060 <literallayout class="monospaced">
15061 ${length{&lt;number&gt;}{&lt;string&gt;}}
15062 </literallayout>
15063 <para>
15064 See the description of the general <option>length</option> item above for details. Note that
15065 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15066 when <option>length</option> is used as an operator.
15067 </para>
15068 </listitem></varlistentry>
15069 <varlistentry>
15070 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15071 <listitem>
15072 <para>
15073 <indexterm role="concept">
15074 <primary>expansion</primary>
15075 <secondary>list item count</secondary>
15076 </indexterm>
15077 <indexterm role="concept">
15078 <primary>list</primary>
15079 <secondary>item count</secondary>
15080 </indexterm>
15081 <indexterm role="concept">
15082 <primary>list</primary>
15083 <secondary>count of items</secondary>
15084 </indexterm>
15085 <indexterm role="concept">
15086 <primary><option>listcount</option> expansion item</primary>
15087 </indexterm>
15088 The string is interpreted as a list and the number of items is returned.
15089 </para>
15090 </listitem></varlistentry>
15091 <varlistentry>
15092 <term><emphasis role="bold">${listnamed:</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}</emphasis>&nbsp;and&nbsp;<emphasis role="bold">${listnamed_</emphasis>&lt;<emphasis>type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15093 <listitem>
15094 <para>
15095 <indexterm role="concept">
15096 <primary>expansion</primary>
15097 <secondary>named list</secondary>
15098 </indexterm>
15099 <indexterm role="concept">
15100 <primary><option>listnamed</option> expansion item</primary>
15101 </indexterm>
15102 The name is interpreted as a named list and the content of the list is returned,
15103 expanding any referenced lists, re-quoting as needed for colon-separation.
15104 If the optional type is given it must be one of "a", "d", "h" or "l"
15105 and selects address-, domain-, host- or localpart- lists to search among respectively.
15106 Otherwise all types are searched in an undefined order and the first
15107 matching list is returned.
15108 </para>
15109 </listitem></varlistentry>
15110 <varlistentry>
15111 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15112 <listitem>
15113 <para>
15114 <indexterm role="concept">
15115 <primary>expansion</primary>
15116 <secondary>local part extraction</secondary>
15117 </indexterm>
15118 <indexterm role="concept">
15119 <primary><option>local_part</option> expansion item</primary>
15120 </indexterm>
15121 The string is interpreted as an RFC 2822 address and the local part is
15122 extracted from it. If the string does not parse successfully, the result is
15123 empty.
15124 </para>
15125 </listitem></varlistentry>
15126 <varlistentry>
15127 <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>
15128 <listitem>
15129 <para>
15130 <indexterm role="concept">
15131 <primary>masked IP address</primary>
15132 </indexterm>
15133 <indexterm role="concept">
15134 <primary>IP address</primary>
15135 <secondary>masking</secondary>
15136 </indexterm>
15137 <indexterm role="concept">
15138 <primary>CIDR notation</primary>
15139 </indexterm>
15140 <indexterm role="concept">
15141 <primary>expansion</primary>
15142 <secondary>IP address masking</secondary>
15143 </indexterm>
15144 <indexterm role="concept">
15145 <primary><option>mask</option> expansion item</primary>
15146 </indexterm>
15147 If the form of the string to be operated on is not an IP address followed by a
15148 slash and an integer (that is, a network address in CIDR notation), the
15149 expansion fails. Otherwise, this operator converts the IP address to binary,
15150 masks off the least significant bits according to the bit count, and converts
15151 the result back to text, with mask appended. For example,
15152 </para>
15153 <literallayout class="monospaced">
15154 ${mask:10.111.131.206/28}
15155 </literallayout>
15156 <para>
15157 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15158 be mostly used for looking up masked addresses in files, the result for an IPv6
15159 address uses dots to separate components instead of colons, because colon
15160 terminates a key string in lsearch files. So, for example,
15161 </para>
15162 <literallayout class="monospaced">
15163 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15164 </literallayout>
15165 <para>
15166 returns the string
15167 </para>
15168 <literallayout class="monospaced">
15169 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15170 </literallayout>
15171 <para>
15172 Letters in IPv6 addresses are always output in lower case.
15173 </para>
15174 </listitem></varlistentry>
15175 <varlistentry>
15176 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15177 <listitem>
15178 <para>
15179 <indexterm role="concept">
15180 <primary>MD5 hash</primary>
15181 </indexterm>
15182 <indexterm role="concept">
15183 <primary>expansion</primary>
15184 <secondary>MD5 hash</secondary>
15185 </indexterm>
15186 <indexterm role="concept">
15187 <primary>certificate fingerprint</primary>
15188 </indexterm>
15189 <indexterm role="concept">
15190 <primary><option>md5</option> expansion item</primary>
15191 </indexterm>
15192 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15193 as a 32-digit hexadecimal number, in which any letters are in lower case.
15194 </para>
15195 </listitem></varlistentry>
15196 <varlistentry>
15197 <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>
15198 <listitem>
15199 <para>
15200 <indexterm role="concept">
15201 <primary>expansion</primary>
15202 <secondary>numeric hash</secondary>
15203 </indexterm>
15204 <indexterm role="concept">
15205 <primary>hash function</primary>
15206 <secondary>numeric</secondary>
15207 </indexterm>
15208 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15209 that can be used when the two parameters are fixed numbers (as opposed to
15210 strings that change when expanded). The effect is the same as
15211 </para>
15212 <literallayout class="monospaced">
15213 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15214 </literallayout>
15215 <para>
15216 See the description of the general <option>nhash</option> item above for details.
15217 </para>
15218 </listitem></varlistentry>
15219 <varlistentry>
15220 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15221 <listitem>
15222 <para>
15223 <indexterm role="concept">
15224 <primary>quoting</primary>
15225 <secondary>in string expansions</secondary>
15226 </indexterm>
15227 <indexterm role="concept">
15228 <primary>expansion</primary>
15229 <secondary>quoting</secondary>
15230 </indexterm>
15231 <indexterm role="concept">
15232 <primary><option>quote</option> expansion item</primary>
15233 </indexterm>
15234 The <option>quote</option> operator puts its argument into double quotes if it
15235 is an empty string or
15236 contains anything other than letters, digits, underscores, dots, and hyphens.
15237 Any occurrences of double quotes and backslashes are escaped with a backslash.
15238 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15239 respectively For example,
15240 </para>
15241 <literallayout class="monospaced">
15242 ${quote:ab"*"cd}
15243 </literallayout>
15244 <para>
15245 becomes
15246 </para>
15247 <literallayout class="monospaced">
15248 "ab\"*\"cd"
15249 </literallayout>
15250 <para>
15251 The place where this is useful is when the argument is a substitution from a
15252 variable or a message header.
15253 </para>
15254 </listitem></varlistentry>
15255 <varlistentry>
15256 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15257 <listitem>
15258 <para>
15259 <indexterm role="concept">
15260 <primary><option>quote_local_part</option> expansion item</primary>
15261 </indexterm>
15262 This operator is like <option>quote</option>, except that it quotes the string only if
15263 required to do so by the rules of RFC 2822 for quoting local parts. For
15264 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15265 If you are creating a new email address from the contents of <varname>$local_part</varname>
15266 (or any other unknown data), you should always use this operator.
15267 </para>
15268 </listitem></varlistentry>
15269 <varlistentry>
15270 <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>
15271 <listitem>
15272 <para>
15273 <indexterm role="concept">
15274 <primary>quoting</primary>
15275 <secondary>lookup-specific</secondary>
15276 </indexterm>
15277 This operator applies lookup-specific quoting rules to the string. Each
15278 query-style lookup type has its own quoting rules which are described with
15279 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15280 </para>
15281 <literallayout class="monospaced">
15282 ${quote_ldap:two * two}
15283 </literallayout>
15284 <para>
15285 returns
15286 </para>
15287 <literallayout class="monospaced">
15288 two%20%5C2A%20two
15289 </literallayout>
15290 <para>
15291 For single-key lookup types, no quoting is ever necessary and this operator
15292 yields an unchanged string.
15293 </para>
15294 </listitem></varlistentry>
15295 <varlistentry>
15296 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15297 <listitem>
15298 <para>
15299 <indexterm role="concept">
15300 <primary>random number</primary>
15301 </indexterm>
15302 This operator returns a somewhat random number which is less than the
15303 supplied number and is at least 0.  The quality of this randomness depends
15304 on how Exim was built; the values are not suitable for keying material.
15305 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15306 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15307 for versions of GnuTLS with that function.
15308 Otherwise, the implementation may be arc4random(), random() seeded by
15309 srandomdev() or srandom(), or a custom implementation even weaker than
15310 random().
15311 </para>
15312 </listitem></varlistentry>
15313 <varlistentry>
15314 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15315 <listitem>
15316 <para>
15317 <indexterm role="concept">
15318 <primary>expansion</primary>
15319 <secondary>IP address</secondary>
15320 </indexterm>
15321 This operator reverses an IP address; for IPv4 addresses, the result is in
15322 dotted-quad decimal form, while for IPv6 addreses the result is in
15323 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15324 for DNS.  For example,
15325 </para>
15326 <literallayout class="monospaced">
15327 ${reverse_ip:192.0.2.4}
15328 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15329 </literallayout>
15330 <para>
15331 returns
15332 </para>
15333 <literallayout class="monospaced">
15334 4.2.0.192
15335 f.7.2.0.0.0.0.c.d.c.b.a.1.0.0.0.9.0.0.0.2.4.c.0.8.b.d.0.1.0.0.2
15336 </literallayout>
15337 </listitem></varlistentry>
15338 <varlistentry>
15339 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15340 <listitem>
15341 <para>
15342 <indexterm role="concept">
15343 <primary>expansion</primary>
15344 <secondary>RFC 2047</secondary>
15345 </indexterm>
15346 <indexterm role="concept">
15347 <primary>RFC 2047</primary>
15348 <secondary>expansion operator</secondary>
15349 </indexterm>
15350 <indexterm role="concept">
15351 <primary><option>rfc2047</option> expansion item</primary>
15352 </indexterm>
15353 This operator encodes text according to the rules of RFC 2047. This is an
15354 encoding that is used in header lines to encode non-ASCII characters. It is
15355 assumed that the input string is in the encoding specified by the
15356 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15357 contains only characters in the range 33&ndash;126, and no instances of the
15358 characters
15359 </para>
15360 <literallayout class="monospaced">
15361 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15362 </literallayout>
15363 <para>
15364 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15365 string, using as many <quote>encoded words</quote> as necessary to encode all the
15366 characters.
15367 </para>
15368 </listitem></varlistentry>
15369 <varlistentry>
15370 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15371 <listitem>
15372 <para>
15373 <indexterm role="concept">
15374 <primary>expansion</primary>
15375 <secondary>RFC 2047</secondary>
15376 </indexterm>
15377 <indexterm role="concept">
15378 <primary>RFC 2047</primary>
15379 <secondary>decoding</secondary>
15380 </indexterm>
15381 <indexterm role="concept">
15382 <primary><option>rfc2047d</option> expansion item</primary>
15383 </indexterm>
15384 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15385 bytes are replaced by question marks. Characters are converted into the
15386 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15387 not recognized unless <option>check_rfc2047_length</option> is set false.
15388 </para>
15389 <para>
15390 <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
15391 access a header line, RFC 2047 decoding is done automatically. You do not need
15392 to use this operator as well.
15393 </para>
15394 </listitem></varlistentry>
15395 <varlistentry>
15396 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15397 <listitem>
15398 <para>
15399 <indexterm role="concept">
15400 <primary>quoting</primary>
15401 <secondary>in regular expressions</secondary>
15402 </indexterm>
15403 <indexterm role="concept">
15404 <primary>regular expressions</primary>
15405 <secondary>quoting</secondary>
15406 </indexterm>
15407 <indexterm role="concept">
15408 <primary><option>rxquote</option> expansion item</primary>
15409 </indexterm>
15410 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15411 characters in its argument. This is useful when substituting the values of
15412 variables or headers inside regular expressions.
15413 </para>
15414 </listitem></varlistentry>
15415 <varlistentry>
15416 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15417 <listitem>
15418 <para>
15419 <indexterm role="concept">
15420 <primary>SHA-1 hash</primary>
15421 </indexterm>
15422 <indexterm role="concept">
15423 <primary>expansion</primary>
15424 <secondary>SHA-1 hashing</secondary>
15425 </indexterm>
15426 <indexterm role="concept">
15427 <primary>certificate fingerprint</primary>
15428 </indexterm>
15429 <indexterm role="concept">
15430 <primary><option>sha2</option> expansion item</primary>
15431 </indexterm>
15432 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15433 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15434 </para>
15435 </listitem></varlistentry>
15436 <varlistentry>
15437 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>certificate</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15438 <listitem>
15439 <para>
15440 <indexterm role="concept">
15441 <primary>SHA-256 hash</primary>
15442 </indexterm>
15443 <indexterm role="concept">
15444 <primary>certificate fingerprint</primary>
15445 </indexterm>
15446 <indexterm role="concept">
15447 <primary>expansion</primary>
15448 <secondary>SHA-256 hashing</secondary>
15449 </indexterm>
15450 <indexterm role="concept">
15451 <primary><option>sha256</option> expansion item</primary>
15452 </indexterm>
15453 The <option>sha256</option> operator computes the SHA-256 hash fingerprint of the
15454 certificate,
15455 and returns
15456 it as a 64-digit hexadecimal number, in which any letters are in upper case.
15457 Only arguments which are a single variable of certificate type are supported.
15458 </para>
15459 </listitem></varlistentry>
15460 <varlistentry>
15461 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15462 <listitem>
15463 <para>
15464 <indexterm role="concept">
15465 <primary>expansion</primary>
15466 <secondary>statting a file</secondary>
15467 </indexterm>
15468 <indexterm role="concept">
15469 <primary>file</primary>
15470 <secondary>extracting characteristics</secondary>
15471 </indexterm>
15472 <indexterm role="concept">
15473 <primary><option>stat</option> expansion item</primary>
15474 </indexterm>
15475 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15476 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15477 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15478 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15479 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15480 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15481 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15482 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15483 can extract individual fields using the <option>extract</option> expansion item.
15484 </para>
15485 <para>
15486 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15487 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15488 systems for files larger than 2GB.
15489 </para>
15490 </listitem></varlistentry>
15491 <varlistentry>
15492 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15493 <listitem>
15494 <para>
15495 <indexterm role="concept">
15496 <primary>expansion</primary>
15497 <secondary>base64 encoding</secondary>
15498 </indexterm>
15499 <indexterm role="concept">
15500 <primary>base64 encoding</primary>
15501 <secondary>in string expansion</secondary>
15502 </indexterm>
15503 <indexterm role="concept">
15504 <primary><option>str2b64</option> expansion item</primary>
15505 </indexterm>
15506 This operator converts a string into one that is base64 encoded.
15507 </para>
15508 </listitem></varlistentry>
15509 <varlistentry>
15510 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15511 <listitem>
15512 <para>
15513 <indexterm role="concept">
15514 <primary>expansion</primary>
15515 <secondary>string length</secondary>
15516 </indexterm>
15517 <indexterm role="concept">
15518 <primary>string</primary>
15519 <secondary>length in expansion</secondary>
15520 </indexterm>
15521 <indexterm role="concept">
15522 <primary><option>strlen</option> expansion item</primary>
15523 </indexterm>
15524 The item is replace by the length of the expanded string, expressed as a
15525 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15526 </para>
15527 </listitem></varlistentry>
15528 <varlistentry>
15529 <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>
15530 <listitem>
15531 <para>
15532 <indexterm role="concept">
15533 <primary><option>substr</option> expansion item</primary>
15534 </indexterm>
15535 <indexterm role="concept">
15536 <primary>substring extraction</primary>
15537 </indexterm>
15538 <indexterm role="concept">
15539 <primary>expansion</primary>
15540 <secondary>substring expansion</secondary>
15541 </indexterm>
15542 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15543 can be used when the two parameters are fixed numbers (as opposed to strings
15544 that change when expanded). The effect is the same as
15545 </para>
15546 <literallayout class="monospaced">
15547 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15548 </literallayout>
15549 <para>
15550 See the description of the general <option>substr</option> item above for details. The
15551 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15552 </para>
15553 </listitem></varlistentry>
15554 <varlistentry>
15555 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15556 <listitem>
15557 <para>
15558 <indexterm role="concept">
15559 <primary><option>time_eval</option> expansion item</primary>
15560 </indexterm>
15561 <indexterm role="concept">
15562 <primary>time interval</primary>
15563 <secondary>decoding</secondary>
15564 </indexterm>
15565 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15566 seconds.
15567 </para>
15568 </listitem></varlistentry>
15569 <varlistentry>
15570 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15571 <listitem>
15572 <para>
15573 <indexterm role="concept">
15574 <primary><option>time_interval</option> expansion item</primary>
15575 </indexterm>
15576 <indexterm role="concept">
15577 <primary>time interval</primary>
15578 <secondary>formatting</secondary>
15579 </indexterm>
15580 The argument (after sub-expansion) must be a sequence of decimal digits that
15581 represents an interval of time as a number of seconds. It is converted into a
15582 number of larger units and output in Exim&#x2019;s normal time format, for example,
15583 <literal>1w3d4h2m6s</literal>.
15584 </para>
15585 </listitem></varlistentry>
15586 <varlistentry>
15587 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15588 <listitem>
15589 <para>
15590 <indexterm role="concept">
15591 <primary>case forcing in strings</primary>
15592 </indexterm>
15593 <indexterm role="concept">
15594 <primary>string</primary>
15595 <secondary>case forcing</secondary>
15596 </indexterm>
15597 <indexterm role="concept">
15598 <primary>upper casing</primary>
15599 </indexterm>
15600 <indexterm role="concept">
15601 <primary>expansion</primary>
15602 <secondary>case forcing</secondary>
15603 </indexterm>
15604 <indexterm role="concept">
15605 <primary><option>uc</option> expansion item</primary>
15606 </indexterm>
15607 This forces the letters in the string into upper-case.
15608 </para>
15609 </listitem></varlistentry>
15610 <varlistentry>
15611 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15612 <listitem>
15613 <para>
15614 <indexterm role="concept">
15615 <primary>correction of invalid utf-8 sequences in strings</primary>
15616 </indexterm>
15617 <indexterm role="concept">
15618 <primary>utf-8</primary>
15619 <secondary>utf-8 sequences</secondary>
15620 </indexterm>
15621 <indexterm role="concept">
15622 <primary>incorrect utf-8</primary>
15623 </indexterm>
15624 <indexterm role="concept">
15625 <primary>expansion</primary>
15626 <secondary>utf-8 forcing</secondary>
15627 </indexterm>
15628 <indexterm role="concept">
15629 <primary><option>utf8clean</option> expansion item</primary>
15630 </indexterm>
15631 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
15632 </para>
15633 </listitem></varlistentry>
15634 </variablelist>
15635 </section>
15636 <section id="SECTexpcond">
15637 <title>Expansion conditions</title>
15638 <para>
15639 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15640 <primary>expansion</primary>
15641 <secondary>conditions</secondary>
15642 </indexterm>
15643 The following conditions are available for testing by the <option>${if</option> construct
15644 while expanding strings:
15645 </para>
15646 <variablelist>
15647 <varlistentry>
15648 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15649 <listitem>
15650 <para>
15651 <indexterm role="concept">
15652 <primary>expansion</primary>
15653 <secondary>negating a condition</secondary>
15654 </indexterm>
15655 <indexterm role="concept">
15656 <primary>negation</primary>
15657 <secondary>in expansion condition</secondary>
15658 </indexterm>
15659 Preceding any condition with an exclamation mark negates the result of the
15660 condition.
15661 </para>
15662 </listitem></varlistentry>
15663 <varlistentry>
15664 <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>
15665 <listitem>
15666 <para>
15667 <indexterm role="concept">
15668 <primary>numeric comparison</primary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary>expansion</primary>
15672 <secondary>numeric comparison</secondary>
15673 </indexterm>
15674 There are a number of symbolic operators for doing numeric comparisons. They
15675 are:
15676 </para>
15677 <literallayout>
15678 <literal>=   </literal>   equal
15679 <literal>==  </literal>   equal
15680 <literal>&gt;   </literal>   greater
15681 <literal>&gt;=  </literal>   greater or equal
15682 <literal>&lt;   </literal>   less
15683 <literal>&lt;=  </literal>   less or equal
15684 </literallayout>
15685 <para>
15686 For example:
15687 </para>
15688 <literallayout class="monospaced">
15689 ${if &gt;{$message_size}{10M} ...
15690 </literallayout>
15691 <para>
15692 Note that the general negation operator provides for inequality testing. The
15693 two strings must take the form of optionally signed decimal integers,
15694 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15695 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15696 As a special case, the numerical value of an empty string is taken as
15697 zero.
15698 </para>
15699 <para>
15700 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15701 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15702 10M, not if 10M is larger than <varname>$message_size</varname>.
15703 </para>
15704 </listitem></varlistentry>
15705 <varlistentry>
15706 <term><emphasis role="bold">acl&nbsp;{{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
15707 <listitem>
15708 <para>
15709 <indexterm role="concept">
15710 <primary>expansion</primary>
15711 <secondary>calling an acl</secondary>
15712 </indexterm>
15713 <indexterm role="concept">
15714 <primary><option>acl</option></primary>
15715 <secondary>expansion condition</secondary>
15716 </indexterm>
15717 The name and zero to nine argument strings are first expanded separately.  The expanded
15718 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15719 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15720 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15721 and may use the variables; if another acl expansion is used the values
15722 are restored after it returns.  If the ACL sets
15723 a value using a "message =" modifier the variable $value becomes
15724 the result of the expansion, otherwise it is empty.
15725 If the ACL returns accept the condition is true; if deny, false.
15726 If the ACL returns defer the result is a forced-fail.
15727 </para>
15728 </listitem></varlistentry>
15729 <varlistentry>
15730 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15731 <listitem>
15732 <para>
15733 <indexterm role="concept">
15734 <primary>expansion</primary>
15735 <secondary>boolean parsing</secondary>
15736 </indexterm>
15737 <indexterm role="concept">
15738 <primary><option>bool</option> expansion condition</primary>
15739 </indexterm>
15740 This condition turns a string holding a true or false representation into
15741 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15742 (case-insensitively); also integer numbers map to true if non-zero,
15743 false if zero.
15744 An empty string is treated as false.
15745 Leading and trailing whitespace is ignored;
15746 thus a string consisting only of whitespace is false.
15747 All other string values will result in expansion failure.
15748 </para>
15749 <para>
15750 When combined with ACL variables, this expansion condition will let you
15751 make decisions in one place and act on those decisions in another place.
15752 For example:
15753 </para>
15754 <literallayout class="monospaced">
15755 ${if bool{$acl_m_privileged_sender} ...
15756 </literallayout>
15757 </listitem></varlistentry>
15758 <varlistentry>
15759 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15760 <listitem>
15761 <para>
15762 <indexterm role="concept">
15763 <primary>expansion</primary>
15764 <secondary>boolean parsing</secondary>
15765 </indexterm>
15766 <indexterm role="concept">
15767 <primary><option>bool_lax</option> expansion condition</primary>
15768 </indexterm>
15769 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15770 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15771 loose definition that the Router <option>condition</option> option uses.  The empty string
15772 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15773 true.  Leading and trailing whitespace is ignored.
15774 </para>
15775 <para>
15776 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15777 </para>
15778 </listitem></varlistentry>
15779 <varlistentry>
15780 <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>
15781 <listitem>
15782 <para>
15783 <indexterm role="concept">
15784 <primary>expansion</primary>
15785 <secondary>encrypted comparison</secondary>
15786 </indexterm>
15787 <indexterm role="concept">
15788 <primary>encrypted strings, comparing</primary>
15789 </indexterm>
15790 <indexterm role="concept">
15791 <primary><option>crypteq</option> expansion condition</primary>
15792 </indexterm>
15793 This condition is included in the Exim binary if it is built to support any
15794 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15795 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15796 included in the binary.
15797 </para>
15798 <para>
15799 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15800 compared against the second, which is already encrypted. The second string may
15801 be in the LDAP form for storing encrypted strings, which starts with the
15802 encryption type in curly brackets, followed by the data. If the second string
15803 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15804 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15805 Typically this will be a field from a password file. An example of an encrypted
15806 string in LDAP form is:
15807 </para>
15808 <literallayout class="monospaced">
15809 {md5}CY9rzUYh03PK3k6DJie09g==
15810 </literallayout>
15811 <para>
15812 If such a string appears directly in an expansion, the curly brackets have to
15813 be quoted, because they are part of the expansion syntax. For example:
15814 </para>
15815 <literallayout class="monospaced">
15816 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15817 </literallayout>
15818 <para>
15819 The following encryption types (whose names are matched case-independently) are
15820 supported:
15821 </para>
15822 <itemizedlist>
15823 <listitem>
15824 <para>
15825 <indexterm role="concept">
15826 <primary>MD5 hash</primary>
15827 </indexterm>
15828 <indexterm role="concept">
15829 <primary>base64 encoding</primary>
15830 <secondary>in encrypted password</secondary>
15831 </indexterm>
15832 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15833 printable characters to compare with the remainder of the second string. If the
15834 length of the comparison string is 24, Exim assumes that it is base64 encoded
15835 (as in the above example). If the length is 32, Exim assumes that it is a
15836 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15837 comparison fails.
15838 </para>
15839 </listitem>
15840 <listitem>
15841 <para>
15842 <indexterm role="concept">
15843 <primary>SHA-1 hash</primary>
15844 </indexterm>
15845 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15846 printable characters to compare with the remainder of the second string. If the
15847 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15848 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15849 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15850 </para>
15851 </listitem>
15852 <listitem>
15853 <para>
15854 <indexterm role="concept">
15855 <primary><function>crypt()</function></primary>
15856 </indexterm>
15857 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15858 only the first eight characters of the password. However, in modern operating
15859 systems this is no longer true, and in many cases the entire password is used,
15860 whatever its length.
15861 </para>
15862 </listitem>
15863 <listitem>
15864 <para>
15865 <indexterm role="concept">
15866 <primary><function>crypt16()</function></primary>
15867 </indexterm>
15868 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15869 use up to 16 characters of the password in some operating systems. Again, in
15870 modern operating systems, more characters may be used.
15871 </para>
15872 </listitem>
15873 </itemizedlist>
15874 <para>
15875 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15876 <function>crypt()</function>. For operating systems that have their own version, setting
15877 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15878 operating system version instead of its own. This option is set by default in
15879 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15880 support <function>crypt16()</function>.
15881 </para>
15882 <para>
15883 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15884 it was not using the same algorithm as some operating systems&#x2019; versions. It
15885 turns out that as well as <function>crypt16()</function> there is a function called
15886 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15887 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15888 </para>
15889 <para>
15890 However, since there is now a move away from the traditional <function>crypt()</function>
15891 functions towards using SHA1 and other algorithms, tidying up this area of
15892 Exim is seen as very low priority.
15893 </para>
15894 <para>
15895 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15896 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15897 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15898 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15899 function by specifying it explicitly in curly brackets.
15900 </para>
15901 </listitem></varlistentry>
15902 <varlistentry>
15903 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15904 <listitem>
15905 <para>
15906 <indexterm role="concept">
15907 <primary>expansion</primary>
15908 <secondary>checking for empty variable</secondary>
15909 </indexterm>
15910 <indexterm role="concept">
15911 <primary><option>def</option> expansion condition</primary>
15912 </indexterm>
15913 The <option>def</option> condition must be followed by the name of one of the expansion
15914 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15915 variable does not contain the empty string. For example:
15916 </para>
15917 <literallayout class="monospaced">
15918 ${if def:sender_ident {from $sender_ident}}
15919 </literallayout>
15920 <para>
15921 Note that the variable name is given without a leading <option>$</option> character. If the
15922 variable does not exist, the expansion fails.
15923 </para>
15924 </listitem></varlistentry>
15925 <varlistentry>
15926 <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>
15927 <listitem>
15928 <para>
15929 <indexterm role="concept">
15930 <primary>expansion</primary>
15931 <secondary>checking header line existence</secondary>
15932 </indexterm>
15933 This condition is true if a message is being processed and the named header
15934 exists in the message. For example,
15935 </para>
15936 <literallayout class="monospaced">
15937 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15938 </literallayout>
15939 <para>
15940 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15941 the header name must be terminated by a colon if white space does not follow.
15942 </para>
15943 </listitem></varlistentry>
15944 <varlistentry>
15945 <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>
15946 <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>
15947 <listitem>
15948 <para>
15949 <indexterm role="concept">
15950 <primary>string</primary>
15951 <secondary>comparison</secondary>
15952 </indexterm>
15953 <indexterm role="concept">
15954 <primary>expansion</primary>
15955 <secondary>string comparison</secondary>
15956 </indexterm>
15957 <indexterm role="concept">
15958 <primary><option>eq</option> expansion condition</primary>
15959 </indexterm>
15960 <indexterm role="concept">
15961 <primary><option>eqi</option> expansion condition</primary>
15962 </indexterm>
15963 The two substrings are first expanded. The condition is true if the two
15964 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15965 letters, whereas for <option>eqi</option> the comparison is case-independent.
15966 </para>
15967 </listitem></varlistentry>
15968 <varlistentry>
15969 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15970 <listitem>
15971 <para>
15972 <indexterm role="concept">
15973 <primary>expansion</primary>
15974 <secondary>file existence test</secondary>
15975 </indexterm>
15976 <indexterm role="concept">
15977 <primary>file</primary>
15978 <secondary>existence test</secondary>
15979 </indexterm>
15980 <indexterm role="concept">
15981 <primary><option>exists</option>, expansion condition</primary>
15982 </indexterm>
15983 The substring is first expanded and then interpreted as an absolute path. The
15984 condition is true if the named file (or directory) exists. The existence test
15985 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15986 users&#x2019; filter files may be locked out by the system administrator.
15987 </para>
15988 </listitem></varlistentry>
15989 <varlistentry>
15990 <term><emphasis role="bold">first_delivery</emphasis></term>
15991 <listitem>
15992 <para>
15993 <indexterm role="concept">
15994 <primary>delivery</primary>
15995 <secondary>first</secondary>
15996 </indexterm>
15997 <indexterm role="concept">
15998 <primary>first delivery</primary>
15999 </indexterm>
16000 <indexterm role="concept">
16001 <primary>expansion</primary>
16002 <secondary>first delivery test</secondary>
16003 </indexterm>
16004 <indexterm role="concept">
16005 <primary><option>first_delivery</option> expansion condition</primary>
16006 </indexterm>
16007 This condition, which has no data, is true during a message&#x2019;s first delivery
16008 attempt. It is false during any subsequent delivery attempts.
16009 </para>
16010 </listitem></varlistentry>
16011 <varlistentry>
16012 <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>
16013 <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>
16014 <listitem>
16015 <para>
16016 <indexterm role="concept">
16017 <primary>list</primary>
16018 <secondary>iterative conditions</secondary>
16019 </indexterm>
16020 <indexterm role="concept">
16021 <primary>expansion</primary>
16022 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16023 </indexterm>
16024 <indexterm role="concept">
16025 <primary>expansion</primary>
16026 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16027 </indexterm>
16028 <indexterm role="variable">
16029 <primary><varname>$item</varname></primary>
16030 </indexterm>
16031 These conditions iterate over a list. The first argument is expanded to form
16032 the list. By default, the list separator is a colon, but it can be changed by
16033 the normal method. The second argument is interpreted as a condition that is to
16034 be applied to each item in the list in turn. During the interpretation of the
16035 condition, the current list item is placed in a variable called <varname>$item</varname>.
16036 </para>
16037 <itemizedlist>
16038 <listitem>
16039 <para>
16040 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16041 the result of the whole condition is true. If the condition is false for all
16042 items in the list, the overall condition is false.
16043 </para>
16044 </listitem>
16045 <listitem>
16046 <para>
16047 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16048 and the result of the whole condition is false. If the condition is true for
16049 all items in the list, the overall condition is true.
16050 </para>
16051 </listitem>
16052 </itemizedlist>
16053 <para>
16054 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16055 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16056 that the condition must be false for at least one item. In this example, the
16057 list separator is changed to a comma:
16058 </para>
16059 <literallayout class="monospaced">
16060 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16061 </literallayout>
16062 <para>
16063 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16064 being processed, to enable these expansion items to be nested.
16065 </para>
16066 <para>
16067 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16068 </para>
16069 </listitem></varlistentry>
16070 <varlistentry>
16071 <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>
16072 <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>
16073 <listitem>
16074 <para>
16075 <indexterm role="concept">
16076 <primary>string</primary>
16077 <secondary>comparison</secondary>
16078 </indexterm>
16079 <indexterm role="concept">
16080 <primary>expansion</primary>
16081 <secondary>string comparison</secondary>
16082 </indexterm>
16083 <indexterm role="concept">
16084 <primary><option>ge</option> expansion condition</primary>
16085 </indexterm>
16086 <indexterm role="concept">
16087 <primary><option>gei</option> expansion condition</primary>
16088 </indexterm>
16089 The two substrings are first expanded. The condition is true if the first
16090 string is lexically greater than or equal to the second string. For <option>ge</option> the
16091 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16092 case-independent.
16093 </para>
16094 </listitem></varlistentry>
16095 <varlistentry>
16096 <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>
16097 <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>
16098 <listitem>
16099 <para>
16100 <indexterm role="concept">
16101 <primary>string</primary>
16102 <secondary>comparison</secondary>
16103 </indexterm>
16104 <indexterm role="concept">
16105 <primary>expansion</primary>
16106 <secondary>string comparison</secondary>
16107 </indexterm>
16108 <indexterm role="concept">
16109 <primary><option>gt</option> expansion condition</primary>
16110 </indexterm>
16111 <indexterm role="concept">
16112 <primary><option>gti</option> expansion condition</primary>
16113 </indexterm>
16114 The two substrings are first expanded. The condition is true if the first
16115 string is lexically greater than the second string. For <option>gt</option> the comparison
16116 includes the case of letters, whereas for <option>gti</option> the comparison is
16117 case-independent.
16118 </para>
16119 </listitem></varlistentry>
16120 <varlistentry>
16121 <term><emphasis role="bold">inlist&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16122 <term><emphasis role="bold">inlisti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16123 <listitem>
16124 <para>
16125 <indexterm role="concept">
16126 <primary>string</primary>
16127 <secondary>comparison</secondary>
16128 </indexterm>
16129 <indexterm role="concept">
16130 <primary>list</primary>
16131 <secondary>iterative conditions</secondary>
16132 </indexterm>
16133 Both strings are expanded; the second string is treated as a list of simple
16134 strings; if the first string is a member of the second, then the condition
16135 is true.
16136 </para>
16137 <para>
16138 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16139 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16140 </para>
16141 <literallayout class="monospaced">
16142 ${if inlist{needle}{foo:needle:bar}}
16143   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16144 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16145   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16146 </literallayout>
16147 </listitem></varlistentry>
16148 <varlistentry>
16149 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16150 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16151 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16152 <listitem>
16153 <para>
16154 <indexterm role="concept">
16155 <primary>IP address</primary>
16156 <secondary>testing string format</secondary>
16157 </indexterm>
16158 <indexterm role="concept">
16159 <primary>string</primary>
16160 <secondary>testing for IP address</secondary>
16161 </indexterm>
16162 <indexterm role="concept">
16163 <primary><option>isip</option> expansion condition</primary>
16164 </indexterm>
16165 <indexterm role="concept">
16166 <primary><option>isip4</option> expansion condition</primary>
16167 </indexterm>
16168 <indexterm role="concept">
16169 <primary><option>isip6</option> expansion condition</primary>
16170 </indexterm>
16171 The substring is first expanded, and then tested to see if it has the form of
16172 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16173 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16174 </para>
16175 <para>
16176 For an IPv4 address, the test is for four dot-separated components, each of
16177 which consists of from one to three digits. For an IPv6 address, up to eight
16178 colon-separated components are permitted, each containing from one to four
16179 hexadecimal digits. There may be fewer than eight components if an empty
16180 component (adjacent colons) is present. Only one empty component is permitted.
16181 </para>
16182 <para>
16183 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16184 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16185 check. The main use of these tests is to distinguish between IP addresses and
16186 host names, or between IPv4 and IPv6 addresses. For example, you could use
16187 </para>
16188 <literallayout class="monospaced">
16189 ${if isip4{$sender_host_address}...
16190 </literallayout>
16191 <para>
16192 to test which IP version an incoming SMTP connection is using.
16193 </para>
16194 </listitem></varlistentry>
16195 <varlistentry>
16196 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16197 <listitem>
16198 <para>
16199 <indexterm role="concept">
16200 <primary>LDAP</primary>
16201 <secondary>use for authentication</secondary>
16202 </indexterm>
16203 <indexterm role="concept">
16204 <primary>expansion</primary>
16205 <secondary>LDAP authentication test</secondary>
16206 </indexterm>
16207 <indexterm role="concept">
16208 <primary><option>ldapauth</option> expansion condition</primary>
16209 </indexterm>
16210 This condition supports user authentication using LDAP. See section
16211 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16212 queries. For this use, the query must contain a user name and password. The
16213 query itself is not used, and can be empty. The condition is true if the
16214 password is not empty, and the user name and password are accepted by the LDAP
16215 server. An empty password is rejected without calling LDAP because LDAP binds
16216 with an empty password are considered anonymous regardless of the username, and
16217 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16218 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16219 this can be used.
16220 </para>
16221 </listitem></varlistentry>
16222 <varlistentry>
16223 <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>
16224 <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>
16225 <listitem>
16226 <para>
16227 <indexterm role="concept">
16228 <primary>string</primary>
16229 <secondary>comparison</secondary>
16230 </indexterm>
16231 <indexterm role="concept">
16232 <primary>expansion</primary>
16233 <secondary>string comparison</secondary>
16234 </indexterm>
16235 <indexterm role="concept">
16236 <primary><option>le</option> expansion condition</primary>
16237 </indexterm>
16238 <indexterm role="concept">
16239 <primary><option>lei</option> expansion condition</primary>
16240 </indexterm>
16241 The two substrings are first expanded. The condition is true if the first
16242 string is lexically less than or equal to the second string. For <option>le</option> the
16243 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16244 case-independent.
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <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>
16249 <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>
16250 <listitem>
16251 <para>
16252 <indexterm role="concept">
16253 <primary>string</primary>
16254 <secondary>comparison</secondary>
16255 </indexterm>
16256 <indexterm role="concept">
16257 <primary>expansion</primary>
16258 <secondary>string comparison</secondary>
16259 </indexterm>
16260 <indexterm role="concept">
16261 <primary><option>lt</option> expansion condition</primary>
16262 </indexterm>
16263 <indexterm role="concept">
16264 <primary><option>lti</option> expansion condition</primary>
16265 </indexterm>
16266 The two substrings are first expanded. The condition is true if the first
16267 string is lexically less than the second string. For <option>lt</option> the comparison
16268 includes the case of letters, whereas for <option>lti</option> the comparison is
16269 case-independent.
16270 </para>
16271 </listitem></varlistentry>
16272 <varlistentry>
16273 <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>
16274 <listitem>
16275 <para>
16276 <indexterm role="concept">
16277 <primary>expansion</primary>
16278 <secondary>regular expression comparison</secondary>
16279 </indexterm>
16280 <indexterm role="concept">
16281 <primary>regular expressions</primary>
16282 <secondary>match in expanded string</secondary>
16283 </indexterm>
16284 <indexterm role="concept">
16285 <primary><option>match</option> expansion condition</primary>
16286 </indexterm>
16287 The two substrings are first expanded. The second is then treated as a regular
16288 expression and applied to the first. Because of the pre-expansion, if the
16289 regular expression contains dollar, or backslash characters, they must be
16290 escaped. Care must also be taken if the regular expression contains braces
16291 (curly brackets). A closing brace must be escaped so that it is not taken as a
16292 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16293 <literal>\N</literal> feature to disable expansion of the regular expression.
16294 For example,
16295 </para>
16296 <literallayout class="monospaced">
16297 ${if match {$local_part}{\N^\d{3}\N} ...
16298 </literallayout>
16299 <para>
16300 If the whole expansion string is in double quotes, further escaping of
16301 backslashes is also required.
16302 </para>
16303 <para>
16304 The condition is true if the regular expression match succeeds.
16305 The regular expression is not required to begin with a circumflex
16306 metacharacter, but if there is no circumflex, the expression is not anchored,
16307 and it may match anywhere in the subject, not just at the start. If you want
16308 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16309 metacharacter at an appropriate point.
16310 </para>
16311 <para>
16312 <indexterm role="concept">
16313 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16314 <secondary>in <option>if</option> expansion</secondary>
16315 </indexterm>
16316 At the start of an <option>if</option> expansion the values of the numeric variable
16317 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16318 succeeds causes them to be reset to the substrings of that condition and they
16319 will have these values during the expansion of the success string. At the end
16320 of the <option>if</option> expansion, the previous values are restored. After testing a
16321 combination of conditions using <option>or</option>, the subsequent values of the numeric
16322 variables are those of the condition that succeeded.
16323 </para>
16324 </listitem></varlistentry>
16325 <varlistentry>
16326 <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>
16327 <listitem>
16328 <para>
16329 <indexterm role="concept">
16330 <primary><option>match_address</option> expansion condition</primary>
16331 </indexterm>
16332 See <emphasis role="bold">match_local_part</emphasis>.
16333 </para>
16334 </listitem></varlistentry>
16335 <varlistentry>
16336 <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>
16337 <listitem>
16338 <para>
16339 <indexterm role="concept">
16340 <primary><option>match_domain</option> expansion condition</primary>
16341 </indexterm>
16342 See <emphasis role="bold">match_local_part</emphasis>.
16343 </para>
16344 </listitem></varlistentry>
16345 <varlistentry>
16346 <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>
16347 <listitem>
16348 <para>
16349 <indexterm role="concept">
16350 <primary><option>match_ip</option> expansion condition</primary>
16351 </indexterm>
16352 This condition matches an IP address to a list of IP address patterns. It must
16353 be followed by two argument strings. The first (after expansion) must be an IP
16354 address or an empty string. The second (not expanded) is a restricted host
16355 list that can match only an IP address, not a host name. For example:
16356 </para>
16357 <literallayout class="monospaced">
16358 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16359 </literallayout>
16360 <para>
16361 The specific types of host list item that are permitted in the list are:
16362 </para>
16363 <itemizedlist>
16364 <listitem>
16365 <para>
16366 An IP address, optionally with a CIDR mask.
16367 </para>
16368 </listitem>
16369 <listitem>
16370 <para>
16371 A single asterisk, which matches any IP address.
16372 </para>
16373 </listitem>
16374 <listitem>
16375 <para>
16376 An empty item, which matches only if the IP address is empty. This could be
16377 useful for testing for a locally submitted message or one from specific hosts
16378 in a single test such as
16379 </para>
16380 <literallayout class="monospaced">
16381   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16382 </literallayout>
16383 <para>
16384 where the first item in the list is the empty string.
16385 </para>
16386 </listitem>
16387 <listitem>
16388 <para>
16389 The item @[] matches any of the local host&#x2019;s interface addresses.
16390 </para>
16391 </listitem>
16392 <listitem>
16393 <para>
16394 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16395 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16396 address into a host name. The most common type of linear search for
16397 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16398 masks. For example:
16399 </para>
16400 <literallayout class="monospaced">
16401   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16402 </literallayout>
16403 <para>
16404 It is of course possible to use other kinds of lookup, and in such a case, you
16405 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16406 address mask, for example:
16407 </para>
16408 <literallayout class="monospaced">
16409   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16410 </literallayout>
16411 <para>
16412 However, unless you are combining a <option>match_ip</option> condition with others, it is
16413 just as easy to use the fact that a lookup is itself a condition, and write:
16414 </para>
16415 <literallayout class="monospaced">
16416   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16417 </literallayout>
16418 </listitem>
16419 </itemizedlist>
16420 <para>
16421 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16422 Exim was built with the EXPAND_LISTMATCH_RHS option.
16423 </para>
16424 <para>
16425 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16426 </para>
16427 </listitem></varlistentry>
16428 <varlistentry>
16429 <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>
16430 <listitem>
16431 <para>
16432 <indexterm role="concept">
16433 <primary>domain list</primary>
16434 <secondary>in expansion condition</secondary>
16435 </indexterm>
16436 <indexterm role="concept">
16437 <primary>address list</primary>
16438 <secondary>in expansion condition</secondary>
16439 </indexterm>
16440 <indexterm role="concept">
16441 <primary>local part</primary>
16442 <secondary>list, in expansion condition</secondary>
16443 </indexterm>
16444 <indexterm role="concept">
16445 <primary><option>match_local_part</option> expansion condition</primary>
16446 </indexterm>
16447 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16448 possible to test domain, address, and local part lists within expansions. Each
16449 condition requires two arguments: an item and a list to match. A trivial
16450 example is:
16451 </para>
16452 <literallayout class="monospaced">
16453 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16454 </literallayout>
16455 <para>
16456 In each case, the second argument may contain any of the allowable items for a
16457 list of the appropriate type. Also, because the second argument (after
16458 expansion) is a standard form of list, it is possible to refer to a named list.
16459 Thus, you can use conditions like this:
16460 </para>
16461 <literallayout class="monospaced">
16462 ${if match_domain{$domain}{+local_domains}{...
16463 </literallayout>
16464 <para>
16465 <indexterm role="concept">
16466 <primary><literal>+caseful</literal></primary>
16467 </indexterm>
16468 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16469 item can be used, as in all address lists, to cause subsequent items to
16470 have their local parts matched casefully. Domains are always matched
16471 caselessly.
16472 </para>
16473 <para>
16474 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16475 Exim was built with the EXPAND_LISTMATCH_RHS option.
16476 </para>
16477 <para>
16478 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16479 hosts have two identities: a name and an IP address, and it is not clear
16480 how to specify cleanly how such a test would work. However, IP addresses can be
16481 matched using <option>match_ip</option>.
16482 </para>
16483 </listitem></varlistentry>
16484 <varlistentry>
16485 <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>
16486 <listitem>
16487 <para>
16488 <indexterm role="concept">
16489 <primary>PAM authentication</primary>
16490 </indexterm>
16491 <indexterm role="concept">
16492 <primary>AUTH</primary>
16493 <secondary>with PAM</secondary>
16494 </indexterm>
16495 <indexterm role="concept">
16496 <primary>Solaris</primary>
16497 <secondary>PAM support</secondary>
16498 </indexterm>
16499 <indexterm role="concept">
16500 <primary>expansion</primary>
16501 <secondary>PAM authentication test</secondary>
16502 </indexterm>
16503 <indexterm role="concept">
16504 <primary><option>pam</option> expansion condition</primary>
16505 </indexterm>
16506 <emphasis>Pluggable Authentication Modules</emphasis>
16507 (<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
16508 available in the latest releases of Solaris and in some GNU/Linux
16509 distributions. The Exim support, which is intended for use in conjunction with
16510 the SMTP AUTH command, is available only if Exim is compiled with
16511 </para>
16512 <literallayout class="monospaced">
16513 SUPPORT_PAM=yes
16514 </literallayout>
16515 <para>
16516 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16517 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16518 </para>
16519 <para>
16520 The argument string is first expanded, and the result must be a
16521 colon-separated list of strings. Leading and trailing white space is ignored.
16522 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16523 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16524 The remaining items in the data string are passed over in response to requests
16525 from the authentication function. In the simple case there will only be one
16526 request, for a password, so the data consists of just two strings.
16527 </para>
16528 <para>
16529 There can be problems if any of the strings are permitted to contain colon
16530 characters. In the usual way, these have to be doubled to avoid being taken as
16531 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16532 item can be used to double any existing colons. For example, the configuration
16533 of a LOGIN authenticator might contain this setting:
16534 </para>
16535 <literallayout class="monospaced">
16536 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16537 </literallayout>
16538 <para>
16539 For a PLAIN authenticator you could use:
16540 </para>
16541 <literallayout class="monospaced">
16542 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16543 </literallayout>
16544 <para>
16545 In some operating systems, PAM authentication can be done only from a process
16546 running as root. Since Exim is running as the Exim user when receiving
16547 messages, this means that PAM cannot be used directly in those systems.
16548 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16549 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>.
16550 The patched module allows one special uid/gid combination, in addition to root,
16551 to authenticate. If you build the patched module to allow the Exim user and
16552 group, PAM can then be used from an Exim authenticator.
16553 </para>
16554 </listitem></varlistentry>
16555 <varlistentry>
16556 <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>
16557 <listitem>
16558 <para>
16559 <indexterm role="concept">
16560 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16561 </indexterm>
16562 <indexterm role="concept">
16563 <primary>Cyrus</primary>
16564 </indexterm>
16565 <indexterm role="concept">
16566 <primary>expansion</primary>
16567 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16568 </indexterm>
16569 <indexterm role="concept">
16570 <primary><option>pwcheck</option> expansion condition</primary>
16571 </indexterm>
16572 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16573 This is one way of making it possible for passwords to be checked by a process
16574 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16575 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16576 </para>
16577 <para>
16578 The pwcheck support is not included in Exim by default. You need to specify
16579 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16580 building Exim. For example:
16581 </para>
16582 <literallayout class="monospaced">
16583 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16584 </literallayout>
16585 <para>
16586 You do not need to install the full Cyrus software suite in order to use
16587 the pwcheck daemon. You can compile and install just the daemon alone
16588 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16589 access to the <filename>/var/pwcheck</filename> directory.
16590 </para>
16591 <para>
16592 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16593 password, separated by a colon. For example, in a LOGIN authenticator
16594 configuration, you might have this:
16595 </para>
16596 <literallayout class="monospaced">
16597 server_condition = ${if pwcheck{$auth1:$auth2}}
16598 </literallayout>
16599 <para>
16600 Again, for a PLAIN authenticator configuration, this would be:
16601 </para>
16602 <literallayout class="monospaced">
16603 server_condition = ${if pwcheck{$auth2:$auth3}}
16604 </literallayout>
16605 </listitem></varlistentry>
16606 <varlistentry>
16607 <term><emphasis role="bold">queue_running</emphasis></term>
16608 <listitem>
16609 <para>
16610 <indexterm role="concept">
16611 <primary>queue runner</primary>
16612 <secondary>detecting when delivering from</secondary>
16613 </indexterm>
16614 <indexterm role="concept">
16615 <primary>expansion</primary>
16616 <secondary>queue runner test</secondary>
16617 </indexterm>
16618 <indexterm role="concept">
16619 <primary><option>queue_running</option> expansion condition</primary>
16620 </indexterm>
16621 This condition, which has no data, is true during delivery attempts that are
16622 initiated by queue runner processes, and false otherwise.
16623 </para>
16624 </listitem></varlistentry>
16625 <varlistentry>
16626 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16627 <listitem>
16628 <para>
16629 <indexterm role="concept">
16630 <primary>Radius</primary>
16631 </indexterm>
16632 <indexterm role="concept">
16633 <primary>expansion</primary>
16634 <secondary>Radius authentication</secondary>
16635 </indexterm>
16636 <indexterm role="concept">
16637 <primary><option>radius</option> expansion condition</primary>
16638 </indexterm>
16639 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16640 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16641 the Radius client configuration file in order to build Exim with Radius
16642 support.
16643 </para>
16644 <para>
16645 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16646 library, using the original API. If you are using release 0.4.0 or later of
16647 this library, you need to set
16648 </para>
16649 <literallayout class="monospaced">
16650 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16651 </literallayout>
16652 <para>
16653 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16654 <option>libradius</option> library that comes with FreeBSD. To do this, set
16655 </para>
16656 <literallayout class="monospaced">
16657 RADIUS_LIB_TYPE=RADLIB
16658 </literallayout>
16659 <para>
16660 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16661 You may also have to supply a suitable setting in EXTRALIBS so that the
16662 Radius library can be found when Exim is linked.
16663 </para>
16664 <para>
16665 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16666 Radius client library, which calls the Radius server. The condition is true if
16667 the authentication is successful. For example:
16668 </para>
16669 <literallayout class="monospaced">
16670 server_condition = ${if radius{&lt;arguments&gt;}}
16671 </literallayout>
16672 </listitem></varlistentry>
16673 <varlistentry>
16674 <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>
16675 <listitem>
16676 <para>
16677 <indexterm role="concept">
16678 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16679 </indexterm>
16680 <indexterm role="concept">
16681 <primary>Cyrus</primary>
16682 </indexterm>
16683 <indexterm role="concept">
16684 <primary>expansion</primary>
16685 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16686 </indexterm>
16687 <indexterm role="concept">
16688 <primary><option>saslauthd</option> expansion condition</primary>
16689 </indexterm>
16690 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16691 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16692 Using this daemon is one way of making it possible for passwords to be checked
16693 by a process that is not running as root.
16694 </para>
16695 <para>
16696 The saslauthd support is not included in Exim by default. You need to specify
16697 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16698 building Exim. For example:
16699 </para>
16700 <literallayout class="monospaced">
16701 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16702 </literallayout>
16703 <para>
16704 You do not need to install the full Cyrus software suite in order to use
16705 the saslauthd daemon. You can compile and install just the daemon alone
16706 from the Cyrus SASL library.
16707 </para>
16708 <para>
16709 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16710 two are mandatory. For example:
16711 </para>
16712 <literallayout class="monospaced">
16713 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16714 </literallayout>
16715 <para>
16716 The service and the realm are optional (which is why the arguments are enclosed
16717 in their own set of braces). For details of the meaning of the service and
16718 realm, and how to run the daemon, consult the Cyrus documentation.
16719 </para>
16720 </listitem></varlistentry>
16721 </variablelist>
16722 </section>
16723 <section id="SECID84">
16724 <title>Combining expansion conditions</title>
16725 <para>
16726 <indexterm role="concept">
16727 <primary>expansion</primary>
16728 <secondary>combining conditions</secondary>
16729 </indexterm>
16730 Several conditions can be tested at once by combining them using the <option>and</option>
16731 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16732 conditions on their own, and precede their lists of sub-conditions. Each
16733 sub-condition must be enclosed in braces within the overall braces that contain
16734 the list. No repetition of <option>if</option> is used.
16735 </para>
16736 <variablelist>
16737 <varlistentry>
16738 <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>
16739 <listitem>
16740 <para>
16741 <indexterm role="concept">
16742 <primary><quote>or</quote> expansion condition</primary>
16743 </indexterm>
16744 <indexterm role="concept">
16745 <primary>expansion</primary>
16746 <secondary><quote>or</quote> of conditions</secondary>
16747 </indexterm>
16748 The sub-conditions are evaluated from left to right. The condition is true if
16749 any one of the sub-conditions is true.
16750 For example,
16751 </para>
16752 <literallayout class="monospaced">
16753 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16754 </literallayout>
16755 <para>
16756 When a true sub-condition is found, the following ones are parsed but not
16757 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16758 numeric variables afterwards are taken from the first one that succeeds.
16759 </para>
16760 </listitem></varlistentry>
16761 <varlistentry>
16762 <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>
16763 <listitem>
16764 <para>
16765 <indexterm role="concept">
16766 <primary><quote>and</quote> expansion condition</primary>
16767 </indexterm>
16768 <indexterm role="concept">
16769 <primary>expansion</primary>
16770 <secondary><quote>and</quote> of conditions</secondary>
16771 </indexterm>
16772 The sub-conditions are evaluated from left to right. The condition is true if
16773 all of the sub-conditions are true. If there are several <quote>match</quote>
16774 sub-conditions, the values of the numeric variables afterwards are taken from
16775 the last one. When a false sub-condition is found, the following ones are
16776 parsed but not evaluated.
16777 </para>
16778 </listitem></varlistentry>
16779 </variablelist>
16780 <para>
16781 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16782 </para>
16783 </section>
16784 <section id="SECTexpvar">
16785 <title>Expansion variables</title>
16786 <para>
16787 <indexterm role="concept">
16788 <primary>expansion</primary>
16789 <secondary>variables, list of</secondary>
16790 </indexterm>
16791 This section contains an alphabetical list of all the expansion variables. Some
16792 of them are available only when Exim is compiled with specific options such as
16793 support for TLS or the content scanning extension.
16794 </para>
16795 <variablelist>
16796 <varlistentry>
16797 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16798 <listitem>
16799 <para>
16800 <indexterm role="concept">
16801 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16802 </indexterm>
16803 When a <option>match</option> expansion condition succeeds, these variables contain the
16804 captured substrings identified by the regular expression during subsequent
16805 processing of the success string of the containing <option>if</option> expansion item.
16806 However, they do not retain their values afterwards; in fact, their previous
16807 values are restored at the end of processing an <option>if</option> item. The numerical
16808 variables may also be set externally by some other matching process which
16809 precedes the expansion of the string. For example, the commands available in
16810 Exim filter files include an <option>if</option> command with its own regular expression
16811 matching condition.
16812 </para>
16813 </listitem></varlistentry>
16814 <varlistentry>
16815 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
16816 <listitem>
16817 <para>
16818 Within an acl condition, expansion condition or expansion item
16819 any arguments are copied to these variables,
16820 any unused variables being made empty.
16821 </para>
16822 </listitem></varlistentry>
16823 <varlistentry>
16824 <term><varname>$acl_c...</varname></term>
16825 <listitem>
16826 <para>
16827 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16828 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16829 long, but the sixth character must be either a digit or an underscore. For
16830 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16831 variables persist throughout the lifetime of an SMTP connection. They can be
16832 used to pass information between ACLs and between different invocations of the
16833 same ACL. When a message is received, the values of these variables are saved
16834 with the message, and can be accessed by filters, routers, and transports
16835 during subsequent delivery.
16836 </para>
16837 </listitem></varlistentry>
16838 <varlistentry>
16839 <term><varname>$acl_m...</varname></term>
16840 <listitem>
16841 <para>
16842 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16843 are reset after a message has been received. Thus, if several messages are
16844 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16845 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16846 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16847 message is received, the values of these variables are saved with the message,
16848 and can be accessed by filters, routers, and transports during subsequent
16849 delivery.
16850 </para>
16851 </listitem></varlistentry>
16852 <varlistentry>
16853 <term><varname>$acl_narg</varname></term>
16854 <listitem>
16855 <para>
16856 Within an acl condition, expansion condition or expansion item
16857 this variable has the number of arguments.
16858 </para>
16859 </listitem></varlistentry>
16860 <varlistentry>
16861 <term><varname>$acl_verify_message</varname></term>
16862 <listitem>
16863 <para>
16864 <indexterm role="variable">
16865 <primary><varname>$acl_verify_message</varname></primary>
16866 </indexterm>
16867 After an address verification has failed, this variable contains the failure
16868 message. It retains its value for use in subsequent modifiers. The message can
16869 be preserved by coding like this:
16870 </para>
16871 <literallayout class="monospaced">
16872 warn !verify = sender
16873      set acl_m0 = $acl_verify_message
16874 </literallayout>
16875 <para>
16876 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16877 <option>log_message</option> modifiers, to include information about the verification
16878 failure.
16879 </para>
16880 </listitem></varlistentry>
16881 <varlistentry>
16882 <term><varname>$address_data</varname></term>
16883 <listitem>
16884 <para>
16885 <indexterm role="variable">
16886 <primary><varname>$address_data</varname></primary>
16887 </indexterm>
16888 This variable is set by means of the <option>address_data</option> option in routers. The
16889 value then remains with the address while it is processed by subsequent routers
16890 and eventually a transport. If the transport is handling multiple addresses,
16891 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16892 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16893 user filter files.
16894 </para>
16895 <para>
16896 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16897 a recipient address, the final value is still in the variable for subsequent
16898 conditions and modifiers of the ACL statement. If routing the address caused it
16899 to be redirected to just one address, the child address is also routed as part
16900 of the verification, and in this case the final value of <varname>$address_data</varname> is
16901 from the child&#x2019;s routing.
16902 </para>
16903 <para>
16904 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16905 sender address, the final value is also preserved, but this time in
16906 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16907 address.
16908 </para>
16909 <para>
16910 In both cases (recipient and sender verification), the value does not persist
16911 after the end of the current ACL statement. If you want to preserve
16912 these values for longer, you can save them in ACL variables.
16913 </para>
16914 </listitem></varlistentry>
16915 <varlistentry>
16916 <term><varname>$address_file</varname></term>
16917 <listitem>
16918 <para>
16919 <indexterm role="variable">
16920 <primary><varname>$address_file</varname></primary>
16921 </indexterm>
16922 When, as a result of aliasing, forwarding, or filtering, a message is directed
16923 to a specific file, this variable holds the name of the file when the transport
16924 is running. At other times, the variable is empty. For example, using the
16925 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16926 </para>
16927 <literallayout class="monospaced">
16928 /home/r2d2/savemail
16929 </literallayout>
16930 <para>
16931 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16932 contains the text string <literal>/home/r2d2/savemail</literal>.
16933 <indexterm role="concept">
16934 <primary>Sieve filter</primary>
16935 <secondary>value of <varname>$address_file</varname></secondary>
16936 </indexterm>
16937 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16938 then up to the transport configuration to generate an appropriate absolute path
16939 to the relevant file.
16940 </para>
16941 </listitem></varlistentry>
16942 <varlistentry>
16943 <term><varname>$address_pipe</varname></term>
16944 <listitem>
16945 <para>
16946 <indexterm role="variable">
16947 <primary><varname>$address_pipe</varname></primary>
16948 </indexterm>
16949 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16950 this variable holds the pipe command when the transport is running.
16951 </para>
16952 </listitem></varlistentry>
16953 <varlistentry>
16954 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16955 <listitem>
16956 <para>
16957 <indexterm role="variable">
16958 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16959 </indexterm>
16960 These variables are used in SMTP authenticators (see chapters
16961 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16962 </para>
16963 </listitem></varlistentry>
16964 <varlistentry>
16965 <term><varname>$authenticated_id</varname></term>
16966 <listitem>
16967 <para>
16968 <indexterm role="concept">
16969 <primary>authentication</primary>
16970 <secondary>id</secondary>
16971 </indexterm>
16972 <indexterm role="variable">
16973 <primary><varname>$authenticated_id</varname></primary>
16974 </indexterm>
16975 When a server successfully authenticates a client it may be configured to
16976 preserve some of the authentication information in the variable
16977 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16978 user/password authenticator configuration might preserve the user name for use
16979 in the routers. Note that this is not the same information that is saved in
16980 <varname>$sender_host_authenticated</varname>.
16981 When a message is submitted locally (that is, not over a TCP connection)
16982 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16983 process. However, a trusted user can override this by means of the <option>-oMai</option>
16984 command line option.
16985 </para>
16986 </listitem></varlistentry>
16987 <varlistentry>
16988 <term><varname>$authenticated_fail_id</varname></term>
16989 <listitem>
16990 <para>
16991 <indexterm role="concept">
16992 <primary>authentication</primary>
16993 <secondary>fail</secondary>
16994 </indexterm>
16995 <indexterm role="variable">
16996 <primary><varname>$authenticated_fail_id</varname></primary>
16997 </indexterm>
16998 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
16999 will contain the failed authentication id. If more than one authentication
17000 id is attempted, it will contain only the last one. The variable is
17001 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17002 A message to a local recipient could still be accepted without requiring
17003 authentication, which means this variable could also be visible in all of
17004 the ACL&#x2019;s as well.
17005 </para>
17006 </listitem></varlistentry>
17007 <varlistentry>
17008 <term><varname>$authenticated_sender</varname></term>
17009 <listitem>
17010 <para>
17011 <indexterm role="concept">
17012 <primary>sender</primary>
17013 <secondary>authenticated</secondary>
17014 </indexterm>
17015 <indexterm role="concept">
17016 <primary>authentication</primary>
17017 <secondary>sender</secondary>
17018 </indexterm>
17019 <indexterm role="concept">
17020 <primary>AUTH</primary>
17021 <secondary>on MAIL command</secondary>
17022 </indexterm>
17023 <indexterm role="variable">
17024 <primary><varname>$authenticated_sender</varname></primary>
17025 </indexterm>
17026 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17027 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17028 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17029 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17030 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17031 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17032 </para>
17033 <para>
17034 <indexterm role="variable">
17035 <primary><varname>$qualify_domain</varname></primary>
17036 </indexterm>
17037 When a message is submitted locally (that is, not over a TCP connection), the
17038 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17039 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17040 can override this by means of the <option>-oMas</option> command line option.
17041 </para>
17042 </listitem></varlistentry>
17043 <varlistentry>
17044 <term><varname>$authentication_failed</varname></term>
17045 <listitem>
17046 <para>
17047 <indexterm role="concept">
17048 <primary>authentication</primary>
17049 <secondary>failure</secondary>
17050 </indexterm>
17051 <indexterm role="variable">
17052 <primary><varname>$authentication_failed</varname></primary>
17053 </indexterm>
17054 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17055 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17056 possible to distinguish between <quote>did not try to authenticate</quote>
17057 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17058 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17059 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17060 negative response to an AUTH command, including (for example) an attempt to use
17061 an undefined mechanism.
17062 </para>
17063 </listitem></varlistentry>
17064 <varlistentry>
17065 <term><varname>$av_failed</varname></term>
17066 <listitem>
17067 <para>
17068 <indexterm role="concept">
17069 <primary>content scanning</primary>
17070 <secondary>AV scanner failure</secondary>
17071 </indexterm>
17072 This variable is available when Exim is compiled with the content-scanning
17073 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17074 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17075 the ACL malware condition.
17076 </para>
17077 </listitem></varlistentry>
17078 <varlistentry>
17079 <term><varname>$body_linecount</varname></term>
17080 <listitem>
17081 <para>
17082 <indexterm role="concept">
17083 <primary>message body</primary>
17084 <secondary>line count</secondary>
17085 </indexterm>
17086 <indexterm role="concept">
17087 <primary>body of message</primary>
17088 <secondary>line count</secondary>
17089 </indexterm>
17090 <indexterm role="variable">
17091 <primary><varname>$body_linecount</varname></primary>
17092 </indexterm>
17093 When a message is being received or delivered, this variable contains the
17094 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17095 </para>
17096 </listitem></varlistentry>
17097 <varlistentry>
17098 <term><varname>$body_zerocount</varname></term>
17099 <listitem>
17100 <para>
17101 <indexterm role="concept">
17102 <primary>message body</primary>
17103 <secondary>binary zero count</secondary>
17104 </indexterm>
17105 <indexterm role="concept">
17106 <primary>body of message</primary>
17107 <secondary>binary zero count</secondary>
17108 </indexterm>
17109 <indexterm role="concept">
17110 <primary>binary zero</primary>
17111 <secondary>in message body</secondary>
17112 </indexterm>
17113 <indexterm role="variable">
17114 <primary><varname>$body_zerocount</varname></primary>
17115 </indexterm>
17116 When a message is being received or delivered, this variable contains the
17117 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17118 </para>
17119 </listitem></varlistentry>
17120 <varlistentry>
17121 <term><varname>$bounce_recipient</varname></term>
17122 <listitem>
17123 <para>
17124 <indexterm role="variable">
17125 <primary><varname>$bounce_recipient</varname></primary>
17126 </indexterm>
17127 This is set to the recipient address of a bounce message while Exim is creating
17128 it. It is useful if a customized bounce message text file is in use (see
17129 chapter <xref linkend="CHAPemsgcust"/>).
17130 </para>
17131 </listitem></varlistentry>
17132 <varlistentry>
17133 <term><varname>$bounce_return_size_limit</varname></term>
17134 <listitem>
17135 <para>
17136 <indexterm role="variable">
17137 <primary><varname>$bounce_return_size_limit</varname></primary>
17138 </indexterm>
17139 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17140 up to a multiple of 1000. It is useful when a customized error message text
17141 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17142 </para>
17143 </listitem></varlistentry>
17144 <varlistentry>
17145 <term><varname>$caller_gid</varname></term>
17146 <listitem>
17147 <para>
17148 <indexterm role="concept">
17149 <primary>gid (group id)</primary>
17150 <secondary>caller</secondary>
17151 </indexterm>
17152 <indexterm role="variable">
17153 <primary><varname>$caller_gid</varname></primary>
17154 </indexterm>
17155 The real group id under which the process that called Exim was running. This is
17156 not the same as the group id of the originator of a message (see
17157 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17158 incarnation normally contains the Exim gid.
17159 </para>
17160 </listitem></varlistentry>
17161 <varlistentry>
17162 <term><varname>$caller_uid</varname></term>
17163 <listitem>
17164 <para>
17165 <indexterm role="concept">
17166 <primary>uid (user id)</primary>
17167 <secondary>caller</secondary>
17168 </indexterm>
17169 <indexterm role="variable">
17170 <primary><varname>$caller_uid</varname></primary>
17171 </indexterm>
17172 The real user id under which the process that called Exim was running. This is
17173 not the same as the user id of the originator of a message (see
17174 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17175 incarnation normally contains the Exim uid.
17176 </para>
17177 </listitem></varlistentry>
17178 <varlistentry>
17179 <term><varname>$compile_date</varname></term>
17180 <listitem>
17181 <para>
17182 <indexterm role="variable">
17183 <primary><varname>$compile_date</varname></primary>
17184 </indexterm>
17185 The date on which the Exim binary was compiled.
17186 </para>
17187 </listitem></varlistentry>
17188 <varlistentry>
17189 <term><varname>$compile_number</varname></term>
17190 <listitem>
17191 <para>
17192 <indexterm role="variable">
17193 <primary><varname>$compile_number</varname></primary>
17194 </indexterm>
17195 The building process for Exim keeps a count of the number
17196 of times it has been compiled. This serves to distinguish different
17197 compilations of the same version of the program.
17198 </para>
17199 </listitem></varlistentry>
17200 <varlistentry>
17201 <term><varname>$demime_errorlevel</varname></term>
17202 <listitem>
17203 <para>
17204 <indexterm role="variable">
17205 <primary><varname>$demime_errorlevel</varname></primary>
17206 </indexterm>
17207 This variable is available when Exim is compiled with
17208 the content-scanning extension and the obsolete <option>demime</option> condition. For
17209 details, see section <xref linkend="SECTdemimecond"/>.
17210 </para>
17211 </listitem></varlistentry>
17212 <varlistentry>
17213 <term><varname>$demime_reason</varname></term>
17214 <listitem>
17215 <para>
17216 <indexterm role="variable">
17217 <primary><varname>$demime_reason</varname></primary>
17218 </indexterm>
17219 This variable is available when Exim is compiled with the
17220 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17221 see section <xref linkend="SECTdemimecond"/>.
17222 </para>
17223 </listitem></varlistentry>
17224 <varlistentry>
17225 <term><varname>$dnslist_domain</varname></term>
17226 <term><varname>$dnslist_matched</varname></term>
17227 <term><varname>$dnslist_text</varname></term>
17228 <term><varname>$dnslist_value</varname></term>
17229 <listitem>
17230 <para>
17231 <indexterm role="variable">
17232 <primary><varname>$dnslist_domain</varname></primary>
17233 </indexterm>
17234 <indexterm role="variable">
17235 <primary><varname>$dnslist_matched</varname></primary>
17236 </indexterm>
17237 <indexterm role="variable">
17238 <primary><varname>$dnslist_text</varname></primary>
17239 </indexterm>
17240 <indexterm role="variable">
17241 <primary><varname>$dnslist_value</varname></primary>
17242 </indexterm>
17243 <indexterm role="concept">
17244 <primary>black list (DNS)</primary>
17245 </indexterm>
17246 When a DNS (black) list lookup succeeds, these variables are set to contain
17247 the following data from the lookup: the list&#x2019;s domain name, the key that was
17248 looked up, the contents of any associated TXT record, and the value from the
17249 main A record. See section <xref linkend="SECID204"/> for more details.
17250 </para>
17251 </listitem></varlistentry>
17252 <varlistentry>
17253 <term><varname>$domain</varname></term>
17254 <listitem>
17255 <para>
17256 <indexterm role="variable">
17257 <primary><varname>$domain</varname></primary>
17258 </indexterm>
17259 When an address is being routed, or delivered on its own, this variable
17260 contains the domain. Uppercase letters in the domain are converted into lower
17261 case for <varname>$domain</varname>.
17262 </para>
17263 <para>
17264 Global address rewriting happens when a message is received, so the value of
17265 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17266 is set during user filtering, but not during system filtering, because a
17267 message may have many recipients and the system filter is called just once.
17268 </para>
17269 <para>
17270 When more than one address is being delivered at once (for example, several
17271 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17272 have the same domain. Transports can be restricted to handling only one domain
17273 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17274 the default for local transports. For further details of the environment in
17275 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17276 </para>
17277 <para>
17278 <indexterm role="option">
17279 <primary><option>delay_warning_condition</option></primary>
17280 </indexterm>
17281 At the end of a delivery, if all deferred addresses have the same domain, it is
17282 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17283 </para>
17284 <para>
17285 The <varname>$domain</varname> variable is also used in some other circumstances:
17286 </para>
17287 <itemizedlist>
17288 <listitem>
17289 <para>
17290 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17291 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17292 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17293 normally set during the running of the MAIL ACL. However, if the sender address
17294 is verified with a callout during the MAIL ACL, the sender domain is placed in
17295 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17296 the <command>smtp</command> transport.
17297 </para>
17298 </listitem>
17299 <listitem>
17300 <para>
17301 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17302 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17303 it can be used in the expansion of the replacement address, for example, to
17304 rewrite domains by file lookup.
17305 </para>
17306 </listitem>
17307 <listitem>
17308 <para>
17309 With one important exception, whenever a domain list is being scanned,
17310 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17311 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17312 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17313 that, in a RCPT ACL, the sender domain list can be dependent on the
17314 recipient domain (which is what is in <varname>$domain</varname> at this time).
17315 </para>
17316 </listitem>
17317 <listitem>
17318 <para>
17319 <indexterm role="concept">
17320 <primary>ETRN</primary>
17321 <secondary>value of <varname>$domain</varname></secondary>
17322 </indexterm>
17323 <indexterm role="option">
17324 <primary><option>smtp_etrn_command</option></primary>
17325 </indexterm>
17326 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17327 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17328 </para>
17329 </listitem>
17330 </itemizedlist>
17331 </listitem></varlistentry>
17332 <varlistentry>
17333 <term><varname>$domain_data</varname></term>
17334 <listitem>
17335 <para>
17336 <indexterm role="variable">
17337 <primary><varname>$domain_data</varname></primary>
17338 </indexterm>
17339 When the <option>domains</option> option on a router matches a domain by
17340 means of a lookup, the data read by the lookup is available during the running
17341 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
17342 address to a transport, the value is available in that transport. If the
17343 transport is handling multiple addresses, the value from the first address is
17344 used.
17345 </para>
17346 <para>
17347 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
17348 domain by means of a lookup. The data read by the lookup is available during
17349 the rest of the ACL statement. In all other situations, this variable expands
17350 to nothing.
17351 </para>
17352 </listitem></varlistentry>
17353 <varlistentry>
17354 <term><varname>$exim_gid</varname></term>
17355 <listitem>
17356 <para>
17357 <indexterm role="variable">
17358 <primary><varname>$exim_gid</varname></primary>
17359 </indexterm>
17360 This variable contains the numerical value of the Exim group id.
17361 </para>
17362 </listitem></varlistentry>
17363 <varlistentry>
17364 <term><varname>$exim_path</varname></term>
17365 <listitem>
17366 <para>
17367 <indexterm role="variable">
17368 <primary><varname>$exim_path</varname></primary>
17369 </indexterm>
17370 This variable contains the path to the Exim binary.
17371 </para>
17372 </listitem></varlistentry>
17373 <varlistentry>
17374 <term><varname>$exim_uid</varname></term>
17375 <listitem>
17376 <para>
17377 <indexterm role="variable">
17378 <primary><varname>$exim_uid</varname></primary>
17379 </indexterm>
17380 This variable contains the numerical value of the Exim user id.
17381 </para>
17382 </listitem></varlistentry>
17383 <varlistentry>
17384 <term><varname>$found_extension</varname></term>
17385 <listitem>
17386 <para>
17387 <indexterm role="variable">
17388 <primary><varname>$found_extension</varname></primary>
17389 </indexterm>
17390 This variable is available when Exim is compiled with the
17391 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17392 see section <xref linkend="SECTdemimecond"/>.
17393 </para>
17394 </listitem></varlistentry>
17395 <varlistentry>
17396 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17397 <listitem>
17398 <para>
17399 This is not strictly an expansion variable. It is expansion syntax for
17400 inserting the message header line with the given name. Note that the name must
17401 be terminated by colon or white space, because it may contain a wide variety of
17402 characters. Note also that braces must <emphasis>not</emphasis> be used.
17403 </para>
17404 </listitem></varlistentry>
17405 <varlistentry>
17406 <term><varname>$headers_added</varname></term>
17407 <listitem>
17408 <para>
17409 <indexterm role="variable">
17410 <primary><varname>$headers_added</varname></primary>
17411 </indexterm>
17412 Within an ACL this variable contains the headers added so far by
17413 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17414 The headers are a newline-separated list.
17415 </para>
17416 </listitem></varlistentry>
17417 <varlistentry>
17418 <term><varname>$home</varname></term>
17419 <listitem>
17420 <para>
17421 <indexterm role="variable">
17422 <primary><varname>$home</varname></primary>
17423 </indexterm>
17424 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17425 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17426 means it is set during the running of users&#x2019; filter files. A router may also
17427 explicitly set a home directory for use by a transport; this can be overridden
17428 by a setting on the transport itself.
17429 </para>
17430 <para>
17431 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17432 of the environment variable HOME.
17433 </para>
17434 </listitem></varlistentry>
17435 <varlistentry>
17436 <term><varname>$host</varname></term>
17437 <listitem>
17438 <para>
17439 <indexterm role="variable">
17440 <primary><varname>$host</varname></primary>
17441 </indexterm>
17442 If a router assigns an address to a transport (any transport), and passes a
17443 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17444 to run is the name of the first host on the list. Note that this applies both
17445 to local and remote transports.
17446 </para>
17447 <para>
17448 <indexterm role="concept">
17449 <primary>transport</primary>
17450 <secondary>filter</secondary>
17451 </indexterm>
17452 <indexterm role="concept">
17453 <primary>filter</primary>
17454 <secondary>transport filter</secondary>
17455 </indexterm>
17456 For the <command>smtp</command> transport, if there is more than one host, the value of
17457 <varname>$host</varname> changes as the transport works its way through the list. In
17458 particular, when the <command>smtp</command> transport is expanding its options for encryption
17459 using TLS, or for specifying a transport filter (see chapter
17460 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17461 is connected.
17462 </para>
17463 <para>
17464 When used in the client part of an authenticator configuration (see chapter
17465 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17466 client is connected.
17467 </para>
17468 </listitem></varlistentry>
17469 <varlistentry>
17470 <term><varname>$host_address</varname></term>
17471 <listitem>
17472 <para>
17473 <indexterm role="variable">
17474 <primary><varname>$host_address</varname></primary>
17475 </indexterm>
17476 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17477 for a remote connection. It is also set to the IP address that is being checked
17478 when the <option>ignore_target_hosts</option> option is being processed.
17479 </para>
17480 </listitem></varlistentry>
17481 <varlistentry>
17482 <term><varname>$host_data</varname></term>
17483 <listitem>
17484 <para>
17485 <indexterm role="variable">
17486 <primary><varname>$host_data</varname></primary>
17487 </indexterm>
17488 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17489 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17490 allows you, for example, to do things like this:
17491 </para>
17492 <literallayout class="monospaced">
17493 deny  hosts = net-lsearch;/some/file
17494 message = $host_data
17495 </literallayout>
17496 </listitem></varlistentry>
17497 <varlistentry>
17498 <term><varname>$host_lookup_deferred</varname></term>
17499 <listitem>
17500 <para>
17501 <indexterm role="concept">
17502 <primary>host name</primary>
17503 <secondary>lookup, failure of</secondary>
17504 </indexterm>
17505 <indexterm role="variable">
17506 <primary><varname>$host_lookup_deferred</varname></primary>
17507 </indexterm>
17508 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17509 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17510 name from its IP address, and the attempt is not successful, one of these
17511 variables is set to <quote>1</quote>.
17512 </para>
17513 <itemizedlist>
17514 <listitem>
17515 <para>
17516 If the lookup receives a definite negative response (for example, a DNS lookup
17517 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17518 </para>
17519 </listitem>
17520 <listitem>
17521 <para>
17522 If there is any kind of problem during the lookup, such that Exim cannot
17523 tell whether or not the host name is defined (for example, a timeout for a DNS
17524 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17525 </para>
17526 </listitem>
17527 </itemizedlist>
17528 <para>
17529 Looking up a host&#x2019;s name from its IP address consists of more than just a
17530 single reverse lookup. Exim checks that a forward lookup of at least one of the
17531 names it receives from a reverse lookup yields the original IP address. If this
17532 is not the case, Exim does not accept the looked up name(s), and
17533 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17534 IP address (for example, the existence of a PTR record in the DNS) is not
17535 sufficient on its own for the success of a host name lookup. If the reverse
17536 lookup succeeds, but there is a lookup problem such as a timeout when checking
17537 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17538 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17539 </para>
17540 </listitem></varlistentry>
17541 <varlistentry>
17542 <term><varname>$host_lookup_failed</varname></term>
17543 <listitem>
17544 <para>
17545 <indexterm role="variable">
17546 <primary><varname>$host_lookup_failed</varname></primary>
17547 </indexterm>
17548 See <varname>$host_lookup_deferred</varname>.
17549 </para>
17550 </listitem></varlistentry>
17551 <varlistentry>
17552 <term><varname>$host_port</varname></term>
17553 <listitem>
17554 <para>
17555 <indexterm role="variable">
17556 <primary><varname>$host_port</varname></primary>
17557 </indexterm>
17558 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
17559 for an outbound connection.
17560 </para>
17561 </listitem></varlistentry>
17562 <varlistentry>
17563 <term><varname>$inode</varname></term>
17564 <listitem>
17565 <para>
17566 <indexterm role="variable">
17567 <primary><varname>$inode</varname></primary>
17568 </indexterm>
17569 The only time this variable is set is while expanding the <option>directory_file</option>
17570 option in the <command>appendfile</command> transport. The variable contains the inode number
17571 of the temporary file which is about to be renamed. It can be used to construct
17572 a unique name for the file.
17573 </para>
17574 </listitem></varlistentry>
17575 <varlistentry>
17576 <term><varname>$interface_address</varname></term>
17577 <listitem>
17578 <para>
17579 <indexterm role="variable">
17580 <primary><varname>$interface_address</varname></primary>
17581 </indexterm>
17582 This is an obsolete name for <varname>$received_ip_address</varname>.
17583 </para>
17584 </listitem></varlistentry>
17585 <varlistentry>
17586 <term><varname>$interface_port</varname></term>
17587 <listitem>
17588 <para>
17589 <indexterm role="variable">
17590 <primary><varname>$interface_port</varname></primary>
17591 </indexterm>
17592 This is an obsolete name for <varname>$received_port</varname>.
17593 </para>
17594 </listitem></varlistentry>
17595 <varlistentry>
17596 <term><varname>$item</varname></term>
17597 <listitem>
17598 <para>
17599 <indexterm role="variable">
17600 <primary><varname>$item</varname></primary>
17601 </indexterm>
17602 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17603 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17604 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17605 empty.
17606 </para>
17607 </listitem></varlistentry>
17608 <varlistentry>
17609 <term><varname>$ldap_dn</varname></term>
17610 <listitem>
17611 <para>
17612 <indexterm role="variable">
17613 <primary><varname>$ldap_dn</varname></primary>
17614 </indexterm>
17615 This variable, which is available only when Exim is compiled with LDAP support,
17616 contains the DN from the last entry in the most recently successful LDAP
17617 lookup.
17618 </para>
17619 </listitem></varlistentry>
17620 <varlistentry>
17621 <term><varname>$load_average</varname></term>
17622 <listitem>
17623 <para>
17624 <indexterm role="variable">
17625 <primary><varname>$load_average</varname></primary>
17626 </indexterm>
17627 This variable contains the system load average, multiplied by 1000 so that it
17628 is an integer. For example, if the load average is 0.21, the value of the
17629 variable is 210. The value is recomputed every time the variable is referenced.
17630 </para>
17631 </listitem></varlistentry>
17632 <varlistentry>
17633 <term><varname>$local_part</varname></term>
17634 <listitem>
17635 <para>
17636 <indexterm role="variable">
17637 <primary><varname>$local_part</varname></primary>
17638 </indexterm>
17639 When an address is being routed, or delivered on its own, this
17640 variable contains the local part. When a number of addresses are being
17641 delivered together (for example, multiple RCPT commands in an SMTP
17642 session), <varname>$local_part</varname> is not set.
17643 </para>
17644 <para>
17645 Global address rewriting happens when a message is received, so the value of
17646 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17647 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17648 because a message may have many recipients and the system filter is called just
17649 once.
17650 </para>
17651 <para>
17652 <indexterm role="variable">
17653 <primary><varname>$local_part_prefix</varname></primary>
17654 </indexterm>
17655 <indexterm role="variable">
17656 <primary><varname>$local_part_suffix</varname></primary>
17657 </indexterm>
17658 If a local part prefix or suffix has been recognized, it is not included in the
17659 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17660 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17661 <varname>$local_part_suffix</varname>, respectively.
17662 </para>
17663 <para>
17664 When a message is being delivered to a file, pipe, or autoreply transport as a
17665 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17666 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17667 <varname>$address_pipe</varname>).
17668 </para>
17669 <para>
17670 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17671 local part of the recipient address.
17672 </para>
17673 <para>
17674 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17675 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17676 it can be used in the expansion of the replacement address, for example.
17677 </para>
17678 <para>
17679 In all cases, all quoting is removed from the local part. For example, for both
17680 the addresses
17681 </para>
17682 <literallayout class="monospaced">
17683 "abc:xyz"@test.example
17684 abc\:xyz@test.example
17685 </literallayout>
17686 <para>
17687 the value of <varname>$local_part</varname> is
17688 </para>
17689 <literallayout class="monospaced">
17690 abc:xyz
17691 </literallayout>
17692 <para>
17693 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17694 inside a quoting operator. For example, in a <command>redirect</command> router you could
17695 have:
17696 </para>
17697 <literallayout class="monospaced">
17698 data = ${quote_local_part:$local_part}@new.domain.example
17699 </literallayout>
17700 <para>
17701 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17702 to process local parts in a case-dependent manner in a router, you can set the
17703 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17704 </para>
17705 </listitem></varlistentry>
17706 <varlistentry>
17707 <term><varname>$local_part_data</varname></term>
17708 <listitem>
17709 <para>
17710 <indexterm role="variable">
17711 <primary><varname>$local_part_data</varname></primary>
17712 </indexterm>
17713 When the <option>local_parts</option> option on a router matches a local part by means of a
17714 lookup, the data read by the lookup is available during the running of the
17715 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17716 to a transport, the value is available in that transport. If the transport is
17717 handling multiple addresses, the value from the first address is used.
17718 </para>
17719 <para>
17720 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17721 matches a local part by means of a lookup. The data read by the lookup is
17722 available during the rest of the ACL statement. In all other situations, this
17723 variable expands to nothing.
17724 </para>
17725 </listitem></varlistentry>
17726 <varlistentry>
17727 <term><varname>$local_part_prefix</varname></term>
17728 <listitem>
17729 <para>
17730 <indexterm role="variable">
17731 <primary><varname>$local_part_prefix</varname></primary>
17732 </indexterm>
17733 When an address is being routed or delivered, and a
17734 specific prefix for the local part was recognized, it is available in this
17735 variable, having been removed from <varname>$local_part</varname>.
17736 </para>
17737 </listitem></varlistentry>
17738 <varlistentry>
17739 <term><varname>$local_part_suffix</varname></term>
17740 <listitem>
17741 <para>
17742 <indexterm role="variable">
17743 <primary><varname>$local_part_suffix</varname></primary>
17744 </indexterm>
17745 When an address is being routed or delivered, and a
17746 specific suffix for the local part was recognized, it is available in this
17747 variable, having been removed from <varname>$local_part</varname>.
17748 </para>
17749 </listitem></varlistentry>
17750 <varlistentry>
17751 <term><varname>$local_scan_data</varname></term>
17752 <listitem>
17753 <para>
17754 <indexterm role="variable">
17755 <primary><varname>$local_scan_data</varname></primary>
17756 </indexterm>
17757 This variable contains the text returned by the <function>local_scan()</function> function when
17758 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17759 </para>
17760 </listitem></varlistentry>
17761 <varlistentry>
17762 <term><varname>$local_user_gid</varname></term>
17763 <listitem>
17764 <para>
17765 <indexterm role="variable">
17766 <primary><varname>$local_user_gid</varname></primary>
17767 </indexterm>
17768 See <varname>$local_user_uid</varname>.
17769 </para>
17770 </listitem></varlistentry>
17771 <varlistentry>
17772 <term><varname>$local_user_uid</varname></term>
17773 <listitem>
17774 <para>
17775 <indexterm role="variable">
17776 <primary><varname>$local_user_uid</varname></primary>
17777 </indexterm>
17778 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17779 <option>check_local_user</option> router precondition succeeds. This means that their values
17780 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17781 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17782 router-specific expansions. At all other times, the values in these variables
17783 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17784 </para>
17785 </listitem></varlistentry>
17786 <varlistentry>
17787 <term><varname>$localhost_number</varname></term>
17788 <listitem>
17789 <para>
17790 <indexterm role="variable">
17791 <primary><varname>$localhost_number</varname></primary>
17792 </indexterm>
17793 This contains the expanded value of the
17794 <option>localhost_number</option> option. The expansion happens after the main options have
17795 been read.
17796 </para>
17797 </listitem></varlistentry>
17798 <varlistentry>
17799 <term><varname>$log_inodes</varname></term>
17800 <listitem>
17801 <para>
17802 <indexterm role="variable">
17803 <primary><varname>$log_inodes</varname></primary>
17804 </indexterm>
17805 The number of free inodes in the disk partition where Exim&#x2019;s
17806 log files are being written. The value is recalculated whenever the variable is
17807 referenced. If the relevant file system does not have the concept of inodes,
17808 the value of is -1. See also the <option>check_log_inodes</option> option.
17809 </para>
17810 </listitem></varlistentry>
17811 <varlistentry>
17812 <term><varname>$log_space</varname></term>
17813 <listitem>
17814 <para>
17815 <indexterm role="variable">
17816 <primary><varname>$log_space</varname></primary>
17817 </indexterm>
17818 The amount of free space (as a number of kilobytes) in the disk
17819 partition where Exim&#x2019;s log files are being written. The value is recalculated
17820 whenever the variable is referenced. If the operating system does not have the
17821 ability to find the amount of free space (only true for experimental systems),
17822 the space value is -1. See also the <option>check_log_space</option> option.
17823 </para>
17824 </listitem></varlistentry>
17825 <varlistentry>
17826 <term><varname>$lookup_dnssec_authenticated</varname></term>
17827 <listitem>
17828 <para>
17829 <indexterm role="variable">
17830 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
17831 </indexterm>
17832 This variable is set after a DNS lookup done by
17833 a dnsdb lookup expansion, dnslookup router or smtp transport.
17834 It will be empty if <command>DNSSEC</command> was not requested,
17835 <quote>no</quote> if the result was not labelled as authenticated data
17836 and <quote>yes</quote> if it was.
17837 </para>
17838 </listitem></varlistentry>
17839 <varlistentry>
17840 <term><varname>$mailstore_basename</varname></term>
17841 <listitem>
17842 <para>
17843 <indexterm role="variable">
17844 <primary><varname>$mailstore_basename</varname></primary>
17845 </indexterm>
17846 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17847 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17848 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17849 contains the basename of the files that are being written, that is, the name
17850 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17851 variable is empty.
17852 </para>
17853 </listitem></varlistentry>
17854 <varlistentry>
17855 <term><varname>$malware_name</varname></term>
17856 <listitem>
17857 <para>
17858 <indexterm role="variable">
17859 <primary><varname>$malware_name</varname></primary>
17860 </indexterm>
17861 This variable is available when Exim is compiled with the
17862 content-scanning extension. It is set to the name of the virus that was found
17863 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17864 </para>
17865 </listitem></varlistentry>
17866 <varlistentry>
17867 <term><varname>$max_received_linelength</varname></term>
17868 <listitem>
17869 <para>
17870 <indexterm role="variable">
17871 <primary><varname>$max_received_linelength</varname></primary>
17872 </indexterm>
17873 <indexterm role="concept">
17874 <primary>maximum</primary>
17875 <secondary>line length</secondary>
17876 </indexterm>
17877 <indexterm role="concept">
17878 <primary>line length</primary>
17879 <secondary>maximum</secondary>
17880 </indexterm>
17881 This variable contains the number of bytes in the longest line that was
17882 received as part of the message, not counting the line termination
17883 character(s).
17884 </para>
17885 </listitem></varlistentry>
17886 <varlistentry>
17887 <term><varname>$message_age</varname></term>
17888 <listitem>
17889 <para>
17890 <indexterm role="concept">
17891 <primary>message</primary>
17892 <secondary>age of</secondary>
17893 </indexterm>
17894 <indexterm role="variable">
17895 <primary><varname>$message_age</varname></primary>
17896 </indexterm>
17897 This variable is set at the start of a delivery attempt to contain the number
17898 of seconds since the message was received. It does not change during a single
17899 delivery attempt.
17900 </para>
17901 </listitem></varlistentry>
17902 <varlistentry>
17903 <term><varname>$message_body</varname></term>
17904 <listitem>
17905 <para>
17906 <indexterm role="concept">
17907 <primary>body of message</primary>
17908 <secondary>expansion variable</secondary>
17909 </indexterm>
17910 <indexterm role="concept">
17911 <primary>message body</primary>
17912 <secondary>in expansion</secondary>
17913 </indexterm>
17914 <indexterm role="concept">
17915 <primary>binary zero</primary>
17916 <secondary>in message body</secondary>
17917 </indexterm>
17918 <indexterm role="variable">
17919 <primary><varname>$message_body</varname></primary>
17920 </indexterm>
17921 <indexterm role="option">
17922 <primary><option>message_body_visible</option></primary>
17923 </indexterm>
17924 This variable contains the initial portion of a message&#x2019;s body while it is
17925 being delivered, and is intended mainly for use in filter files. The maximum
17926 number of characters of the body that are put into the variable is set by the
17927 <option>message_body_visible</option> configuration option; the default is 500.
17928 </para>
17929 <para>
17930 <indexterm role="option">
17931 <primary><option>message_body_newlines</option></primary>
17932 </indexterm>
17933 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17934 easier to search for phrases that might be split over a line break. However,
17935 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17936 zeros are always converted into spaces.
17937 </para>
17938 </listitem></varlistentry>
17939 <varlistentry>
17940 <term><varname>$message_body_end</varname></term>
17941 <listitem>
17942 <para>
17943 <indexterm role="concept">
17944 <primary>body of message</primary>
17945 <secondary>expansion variable</secondary>
17946 </indexterm>
17947 <indexterm role="concept">
17948 <primary>message body</primary>
17949 <secondary>in expansion</secondary>
17950 </indexterm>
17951 <indexterm role="variable">
17952 <primary><varname>$message_body_end</varname></primary>
17953 </indexterm>
17954 This variable contains the final portion of a message&#x2019;s
17955 body while it is being delivered. The format and maximum size are as for
17956 <varname>$message_body</varname>.
17957 </para>
17958 </listitem></varlistentry>
17959 <varlistentry>
17960 <term><varname>$message_body_size</varname></term>
17961 <listitem>
17962 <para>
17963 <indexterm role="concept">
17964 <primary>body of message</primary>
17965 <secondary>size</secondary>
17966 </indexterm>
17967 <indexterm role="concept">
17968 <primary>message body</primary>
17969 <secondary>size</secondary>
17970 </indexterm>
17971 <indexterm role="variable">
17972 <primary><varname>$message_body_size</varname></primary>
17973 </indexterm>
17974 When a message is being delivered, this variable contains the size of the body
17975 in bytes. The count starts from the character after the blank line that
17976 separates the body from the header. Newlines are included in the count. See
17977 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17978 </para>
17979 </listitem></varlistentry>
17980 <varlistentry>
17981 <term><varname>$message_exim_id</varname></term>
17982 <listitem>
17983 <para>
17984 <indexterm role="variable">
17985 <primary><varname>$message_exim_id</varname></primary>
17986 </indexterm>
17987 When a message is being received or delivered, this variable contains the
17988 unique message id that is generated and used by Exim to identify the message.
17989 An id is not created for a message until after its header has been successfully
17990 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17991 line; it is the local id that Exim assigns to the message, for example:
17992 <literal>1BXTIK-0001yO-VA</literal>.
17993 </para>
17994 </listitem></varlistentry>
17995 <varlistentry>
17996 <term><varname>$message_headers</varname></term>
17997 <listitem>
17998 <para>
17999 <indexterm role="variable">
18000 <primary><varname>$message_headers</varname></primary>
18001 </indexterm>
18002 This variable contains a concatenation of all the header lines when a message
18003 is being processed, except for lines added by routers or transports. The header
18004 lines are separated by newline characters. Their contents are decoded in the
18005 same way as a header line that is inserted by <option>bheader</option>.
18006 </para>
18007 </listitem></varlistentry>
18008 <varlistentry>
18009 <term><varname>$message_headers_raw</varname></term>
18010 <listitem>
18011 <para>
18012 <indexterm role="variable">
18013 <primary><varname>$message_headers_raw</varname></primary>
18014 </indexterm>
18015 This variable is like <varname>$message_headers</varname> except that no processing of the
18016 contents of header lines is done.
18017 </para>
18018 </listitem></varlistentry>
18019 <varlistentry>
18020 <term><varname>$message_id</varname></term>
18021 <listitem>
18022 <para>
18023 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18024 </para>
18025 </listitem></varlistentry>
18026 <varlistentry>
18027 <term><varname>$message_linecount</varname></term>
18028 <listitem>
18029 <para>
18030 <indexterm role="variable">
18031 <primary><varname>$message_linecount</varname></primary>
18032 </indexterm>
18033 This variable contains the total number of lines in the header and body of the
18034 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18035 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18036 number of lines received. Before delivery happens (that is, before filters,
18037 routers, and transports run) the count is increased to include the
18038 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18039 lines that are added by ACLs. The blank line that separates the message header
18040 from the body is not counted.
18041 </para>
18042 <para>
18043 As with the special case of <varname>$message_size</varname>, during the expansion of the
18044 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18045 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18046 file that has been written (minus one for the blank line between the
18047 header and the body).
18048 </para>
18049 <para>
18050 Here is an example of the use of this variable in a DATA ACL:
18051 </para>
18052 <literallayout class="monospaced">
18053 deny message   = Too many lines in message header
18054      condition = \
18055       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18056 </literallayout>
18057 <para>
18058 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18059 message has not yet been received.
18060 </para>
18061 </listitem></varlistentry>
18062 <varlistentry>
18063 <term><varname>$message_size</varname></term>
18064 <listitem>
18065 <para>
18066 <indexterm role="concept">
18067 <primary>size</primary>
18068 <secondary>of message</secondary>
18069 </indexterm>
18070 <indexterm role="concept">
18071 <primary>message</primary>
18072 <secondary>size</secondary>
18073 </indexterm>
18074 <indexterm role="variable">
18075 <primary><varname>$message_size</varname></primary>
18076 </indexterm>
18077 When a message is being processed, this variable contains its size in bytes. In
18078 most cases, the size includes those headers that were received with the
18079 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18080 deliveries as they are written. However, there is one special case: during the
18081 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18082 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18083 precise size of the file that has been written. See also
18084 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18085 </para>
18086 <para>
18087 <indexterm role="concept">
18088 <primary>RCPT</primary>
18089 <secondary>value of <varname>$message_size</varname></secondary>
18090 </indexterm>
18091 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18092 contains the size supplied on the MAIL command, or -1 if no size was given. The
18093 value may not, of course, be truthful.
18094 </para>
18095 </listitem></varlistentry>
18096 <varlistentry>
18097 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18098 <listitem>
18099 <para>
18100 A number of variables whose names start with <varname>$mime</varname> are
18101 available when Exim is compiled with the content-scanning extension. For
18102 details, see section <xref linkend="SECTscanmimepart"/>.
18103 </para>
18104 </listitem></varlistentry>
18105 <varlistentry>
18106 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18107 <listitem>
18108 <para>
18109 These variables are counters that can be incremented by means
18110 of the <option>add</option> command in filter files.
18111 </para>
18112 </listitem></varlistentry>
18113 <varlistentry>
18114 <term><varname>$original_domain</varname></term>
18115 <listitem>
18116 <para>
18117 <indexterm role="variable">
18118 <primary><varname>$domain</varname></primary>
18119 </indexterm>
18120 <indexterm role="variable">
18121 <primary><varname>$original_domain</varname></primary>
18122 </indexterm>
18123 When a top-level address is being processed for delivery, this contains the
18124 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18125 generated by an alias, forward, or filter file) is being processed, this
18126 variable contains the domain of the original address (lower cased). This
18127 differs from <varname>$parent_domain</varname> only when there is more than one level of
18128 aliasing or forwarding. When more than one address is being delivered in a
18129 single transport run, <varname>$original_domain</varname> is not set.
18130 </para>
18131 <para>
18132 If a new address is created by means of a <option>deliver</option> command in a system
18133 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18134 part <emphasis>system-filter</emphasis> and the default qualify domain.
18135 </para>
18136 </listitem></varlistentry>
18137 <varlistentry>
18138 <term><varname>$original_local_part</varname></term>
18139 <listitem>
18140 <para>
18141 <indexterm role="variable">
18142 <primary><varname>$local_part</varname></primary>
18143 </indexterm>
18144 <indexterm role="variable">
18145 <primary><varname>$original_local_part</varname></primary>
18146 </indexterm>
18147 When a top-level address is being processed for delivery, this contains the
18148 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18149 local part, because <varname>$original_local_part</varname> always contains the full local
18150 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18151 filter file) is being processed, this variable contains the full local part of
18152 the original address.
18153 </para>
18154 <para>
18155 If the router that did the redirection processed the local part
18156 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18157 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18158 one level of aliasing or forwarding. When more than one address is being
18159 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18160 </para>
18161 <para>
18162 If a new address is created by means of a <option>deliver</option> command in a system
18163 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18164 part <emphasis>system-filter</emphasis> and the default qualify domain.
18165 </para>
18166 </listitem></varlistentry>
18167 <varlistentry>
18168 <term><varname>$originator_gid</varname></term>
18169 <listitem>
18170 <para>
18171 <indexterm role="concept">
18172 <primary>gid (group id)</primary>
18173 <secondary>of originating user</secondary>
18174 </indexterm>
18175 <indexterm role="concept">
18176 <primary>sender</primary>
18177 <secondary>gid</secondary>
18178 </indexterm>
18179 <indexterm role="variable">
18180 <primary><varname>$caller_gid</varname></primary>
18181 </indexterm>
18182 <indexterm role="variable">
18183 <primary><varname>$originator_gid</varname></primary>
18184 </indexterm>
18185 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18186 message was received. For messages received via the command line, this is the
18187 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18188 normally the gid of the Exim user.
18189 </para>
18190 </listitem></varlistentry>
18191 <varlistentry>
18192 <term><varname>$originator_uid</varname></term>
18193 <listitem>
18194 <para>
18195 <indexterm role="concept">
18196 <primary>uid (user id)</primary>
18197 <secondary>of originating user</secondary>
18198 </indexterm>
18199 <indexterm role="concept">
18200 <primary>sender</primary>
18201 <secondary>uid</secondary>
18202 </indexterm>
18203 <indexterm role="variable">
18204 <primary><varname>$caller_uid</varname></primary>
18205 </indexterm>
18206 <indexterm role="variable">
18207 <primary><varname>$originaltor_uid</varname></primary>
18208 </indexterm>
18209 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18210 messages received via the command line, this is the uid of the sending user.
18211 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18212 user.
18213 </para>
18214 </listitem></varlistentry>
18215 <varlistentry>
18216 <term><varname>$parent_domain</varname></term>
18217 <listitem>
18218 <para>
18219 <indexterm role="variable">
18220 <primary><varname>$parent_domain</varname></primary>
18221 </indexterm>
18222 This variable is similar to <varname>$original_domain</varname> (see
18223 above), except that it refers to the immediately preceding parent address.
18224 </para>
18225 </listitem></varlistentry>
18226 <varlistentry>
18227 <term><varname>$parent_local_part</varname></term>
18228 <listitem>
18229 <para>
18230 <indexterm role="variable">
18231 <primary><varname>$parent_local_part</varname></primary>
18232 </indexterm>
18233 This variable is similar to <varname>$original_local_part</varname>
18234 (see above), except that it refers to the immediately preceding parent address.
18235 </para>
18236 </listitem></varlistentry>
18237 <varlistentry>
18238 <term><varname>$pid</varname></term>
18239 <listitem>
18240 <para>
18241 <indexterm role="concept">
18242 <primary>pid (process id)</primary>
18243 <secondary>of current process</secondary>
18244 </indexterm>
18245 <indexterm role="variable">
18246 <primary><varname>$pid</varname></primary>
18247 </indexterm>
18248 This variable contains the current process id.
18249 </para>
18250 </listitem></varlistentry>
18251 <varlistentry>
18252 <term><varname>$pipe_addresses</varname></term>
18253 <listitem>
18254 <para>
18255 <indexterm role="concept">
18256 <primary>filter</primary>
18257 <secondary>transport filter</secondary>
18258 </indexterm>
18259 <indexterm role="concept">
18260 <primary>transport</primary>
18261 <secondary>filter</secondary>
18262 </indexterm>
18263 <indexterm role="variable">
18264 <primary><varname>$pipe_addresses</varname></primary>
18265 </indexterm>
18266 This is not an expansion variable, but is mentioned here because the string
18267 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18268 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18269 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18270 It cannot be used in general expansion strings, and provokes an <quote>unknown
18271 variable</quote> error if encountered.
18272 </para>
18273 </listitem></varlistentry>
18274 <varlistentry>
18275 <term><varname>$primary_hostname</varname></term>
18276 <listitem>
18277 <para>
18278 <indexterm role="variable">
18279 <primary><varname>$primary_hostname</varname></primary>
18280 </indexterm>
18281 This variable contains the value set by <option>primary_hostname</option> in the
18282 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18283 a single-component name, Exim calls <function>gethostbyname()</function> (or
18284 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18285 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18286 </para>
18287 </listitem></varlistentry>
18288 <varlistentry>
18289 <term><varname>$prvscheck_address</varname></term>
18290 <listitem>
18291 <para>
18292 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18293 which is described in sections <xref linkend="SECTexpansionitems"/> and
18294 <xref linkend="SECTverifyPRVS"/>.
18295 </para>
18296 </listitem></varlistentry>
18297 <varlistentry>
18298 <term><varname>$prvscheck_keynum</varname></term>
18299 <listitem>
18300 <para>
18301 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18302 which is described in sections <xref linkend="SECTexpansionitems"/> and
18303 <xref linkend="SECTverifyPRVS"/>.
18304 </para>
18305 </listitem></varlistentry>
18306 <varlistentry>
18307 <term><varname>$prvscheck_result</varname></term>
18308 <listitem>
18309 <para>
18310 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
18311 which is described in sections <xref linkend="SECTexpansionitems"/> and
18312 <xref linkend="SECTverifyPRVS"/>.
18313 </para>
18314 </listitem></varlistentry>
18315 <varlistentry>
18316 <term><varname>$qualify_domain</varname></term>
18317 <listitem>
18318 <para>
18319 <indexterm role="variable">
18320 <primary><varname>$qualify_domain</varname></primary>
18321 </indexterm>
18322 The value set for the <option>qualify_domain</option> option in the configuration file.
18323 </para>
18324 </listitem></varlistentry>
18325 <varlistentry>
18326 <term><varname>$qualify_recipient</varname></term>
18327 <listitem>
18328 <para>
18329 <indexterm role="variable">
18330 <primary><varname>$qualify_recipient</varname></primary>
18331 </indexterm>
18332 The value set for the <option>qualify_recipient</option> option in the configuration file,
18333 or if not set, the value of <varname>$qualify_domain</varname>.
18334 </para>
18335 </listitem></varlistentry>
18336 <varlistentry>
18337 <term><varname>$rcpt_count</varname></term>
18338 <listitem>
18339 <para>
18340 <indexterm role="variable">
18341 <primary><varname>$rcpt_count</varname></primary>
18342 </indexterm>
18343 When a message is being received by SMTP, this variable contains the number of
18344 RCPT commands received for the current message. If this variable is used in a
18345 RCPT ACL, its value includes the current command.
18346 </para>
18347 </listitem></varlistentry>
18348 <varlistentry>
18349 <term><varname>$rcpt_defer_count</varname></term>
18350 <listitem>
18351 <para>
18352 <indexterm role="variable">
18353 <primary><varname>$rcpt_defer_count</varname></primary>
18354 </indexterm>
18355 <indexterm role="concept">
18356 <primary>4<emphasis>xx</emphasis> responses</primary>
18357 <secondary>count of</secondary>
18358 </indexterm>
18359 When a message is being received by SMTP, this variable contains the number of
18360 RCPT commands in the current message that have previously been rejected with a
18361 temporary (4<emphasis>xx</emphasis>) response.
18362 </para>
18363 </listitem></varlistentry>
18364 <varlistentry>
18365 <term><varname>$rcpt_fail_count</varname></term>
18366 <listitem>
18367 <para>
18368 <indexterm role="variable">
18369 <primary><varname>$rcpt_fail_count</varname></primary>
18370 </indexterm>
18371 When a message is being received by SMTP, this variable contains the number of
18372 RCPT commands in the current message that have previously been rejected with a
18373 permanent (5<emphasis>xx</emphasis>) response.
18374 </para>
18375 </listitem></varlistentry>
18376 <varlistentry>
18377 <term><varname>$received_count</varname></term>
18378 <listitem>
18379 <para>
18380 <indexterm role="variable">
18381 <primary><varname>$received_count</varname></primary>
18382 </indexterm>
18383 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18384 including the one added by Exim (so its value is always greater than zero). It
18385 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18386 delivering.
18387 </para>
18388 </listitem></varlistentry>
18389 <varlistentry>
18390 <term><varname>$received_for</varname></term>
18391 <listitem>
18392 <para>
18393 <indexterm role="variable">
18394 <primary><varname>$received_for</varname></primary>
18395 </indexterm>
18396 If there is only a single recipient address in an incoming message, this
18397 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18398 built. The value is copied after recipient rewriting has happened, but before
18399 the <function>local_scan()</function> function is run.
18400 </para>
18401 </listitem></varlistentry>
18402 <varlistentry>
18403 <term><varname>$received_ip_address</varname></term>
18404 <listitem>
18405 <para>
18406 <indexterm role="variable">
18407 <primary><varname>$received_ip_address</varname></primary>
18408 </indexterm>
18409 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18410 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18411 is set to the local port number. (The remote IP address and port are in
18412 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18413 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18414 option.
18415 </para>
18416 <para>
18417 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18418 could be used, for example, to make the file name for a TLS certificate depend
18419 on which interface and/or port is being used for the incoming connection. The
18420 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18421 messages that are received, thus making these variables available at delivery
18422 time.
18423 For outbound connections see <varname>$sending_ip_address</varname>.
18424 </para>
18425 </listitem></varlistentry>
18426 <varlistentry>
18427 <term><varname>$received_port</varname></term>
18428 <listitem>
18429 <para>
18430 <indexterm role="variable">
18431 <primary><varname>$received_port</varname></primary>
18432 </indexterm>
18433 See <varname>$received_ip_address</varname>.
18434 </para>
18435 </listitem></varlistentry>
18436 <varlistentry>
18437 <term><varname>$received_protocol</varname></term>
18438 <listitem>
18439 <para>
18440 <indexterm role="variable">
18441 <primary><varname>$received_protocol</varname></primary>
18442 </indexterm>
18443 When a message is being processed, this variable contains the name of the
18444 protocol by which it was received. Most of the names used by Exim are defined
18445 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18446 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18447 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18448 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18449 connection and the client was successfully authenticated.
18450 </para>
18451 <para>
18452 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18453 automatically set up on connection without the use of STARTTLS (see
18454 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18455 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18456 where the client initially uses EHLO, sets up an encrypted connection using
18457 STARTTLS, and then uses HELO afterwards.
18458 </para>
18459 <para>
18460 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18461 messages that are injected locally by trusted callers. This is commonly used to
18462 identify messages that are being re-injected after some kind of scanning.
18463 </para>
18464 </listitem></varlistentry>
18465 <varlistentry>
18466 <term><varname>$received_time</varname></term>
18467 <listitem>
18468 <para>
18469 <indexterm role="variable">
18470 <primary><varname>$received_time</varname></primary>
18471 </indexterm>
18472 This variable contains the date and time when the current message was received,
18473 as a number of seconds since the start of the Unix epoch.
18474 </para>
18475 </listitem></varlistentry>
18476 <varlistentry>
18477 <term><varname>$recipient_data</varname></term>
18478 <listitem>
18479 <para>
18480 <indexterm role="variable">
18481 <primary><varname>$recipient_data</varname></primary>
18482 </indexterm>
18483 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18484 condition. It contains the data from the lookup, and the value remains set
18485 until the next <option>recipients</option> test. Thus, you can do things like this:
18486 </para>
18487 <literallayout>
18488 <literal>require recipients  = cdb*@;/some/file</literal>
18489 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18490 </literallayout>
18491 <para>
18492 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18493 method in the address list, using the semicolon syntax as in the example above.
18494 The variable is not set for a lookup that is used as part of the string
18495 expansion that all such lists undergo before being interpreted.
18496 </para>
18497 </listitem></varlistentry>
18498 <varlistentry>
18499 <term><varname>$recipient_verify_failure</varname></term>
18500 <listitem>
18501 <para>
18502 <indexterm role="variable">
18503 <primary><varname>$recipient_verify_failure</varname></primary>
18504 </indexterm>
18505 In an ACL, when a recipient verification fails, this variable contains
18506 information about the failure. It is set to one of the following words:
18507 </para>
18508 <itemizedlist>
18509 <listitem>
18510 <para>
18511 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18512 was neither local nor came from an exempted host.
18513 </para>
18514 </listitem>
18515 <listitem>
18516 <para>
18517 <quote>route</quote>: Routing failed.
18518 </para>
18519 </listitem>
18520 <listitem>
18521 <para>
18522 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18523 or before the MAIL command (that is, on initial connection, HELO, or
18524 MAIL).
18525 </para>
18526 </listitem>
18527 <listitem>
18528 <para>
18529 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18530 </para>
18531 </listitem>
18532 <listitem>
18533 <para>
18534 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18535 </para>
18536 </listitem>
18537 </itemizedlist>
18538 <para>
18539 The main use of this variable is expected to be to distinguish between
18540 rejections of MAIL and rejections of RCPT.
18541 </para>
18542 </listitem></varlistentry>
18543 <varlistentry>
18544 <term><varname>$recipients</varname></term>
18545 <listitem>
18546 <para>
18547 <indexterm role="variable">
18548 <primary><varname>$recipients</varname></primary>
18549 </indexterm>
18550 This variable contains a list of envelope recipients for a message. A comma and
18551 a space separate the addresses in the replacement text. However, the variable
18552 is not generally available, to prevent exposure of Bcc recipients in
18553 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18554 cases:
18555 </para>
18556 <orderedlist numeration="arabic">
18557 <listitem>
18558 <para>
18559 In a system filter file.
18560 </para>
18561 </listitem>
18562 <listitem>
18563 <para>
18564 In the ACLs associated with the DATA command and with non-SMTP messages, that
18565 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18566 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18567 <option>acl_not_smtp_mime</option>.
18568 </para>
18569 </listitem>
18570 <listitem>
18571 <para>
18572 From within a <function>local_scan()</function> function.
18573 </para>
18574 </listitem>
18575 </orderedlist>
18576 </listitem></varlistentry>
18577 <varlistentry>
18578 <term><varname>$recipients_count</varname></term>
18579 <listitem>
18580 <para>
18581 <indexterm role="variable">
18582 <primary><varname>$recipients_count</varname></primary>
18583 </indexterm>
18584 When a message is being processed, this variable contains the number of
18585 envelope recipients that came with the message. Duplicates are not excluded
18586 from the count. While a message is being received over SMTP, the number
18587 increases for each accepted recipient. It can be referenced in an ACL.
18588 </para>
18589 </listitem></varlistentry>
18590 <varlistentry>
18591 <term><varname>$regex_match_string</varname></term>
18592 <listitem>
18593 <para>
18594 <indexterm role="variable">
18595 <primary><varname>$regex_match_string</varname></primary>
18596 </indexterm>
18597 This variable is set to contain the matching regular expression after a
18598 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18599 </para>
18600 </listitem></varlistentry>
18601 <varlistentry>
18602 <term><varname>$reply_address</varname></term>
18603 <listitem>
18604 <para>
18605 <indexterm role="variable">
18606 <primary><varname>$reply_address</varname></primary>
18607 </indexterm>
18608 When a message is being processed, this variable contains the contents of the
18609 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18610 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18611 white space, the value is not processed in any way. In particular, no RFC 2047
18612 decoding or character code translation takes place.
18613 </para>
18614 </listitem></varlistentry>
18615 <varlistentry>
18616 <term><varname>$return_path</varname></term>
18617 <listitem>
18618 <para>
18619 <indexterm role="variable">
18620 <primary><varname>$return_path</varname></primary>
18621 </indexterm>
18622 When a message is being delivered, this variable contains the return path &ndash;
18623 the sender field that will be sent as part of the envelope. It is not enclosed
18624 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18625 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18626 mailing list has been expanded by a router which specifies a different address
18627 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18628 address, whereas <varname>$sender_address</varname> always contains the original sender address
18629 that was received with the message. In other words, <varname>$sender_address</varname> contains
18630 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18631 envelope sender.
18632 </para>
18633 </listitem></varlistentry>
18634 <varlistentry>
18635 <term><varname>$return_size_limit</varname></term>
18636 <listitem>
18637 <para>
18638 <indexterm role="variable">
18639 <primary><varname>$return_size_limit</varname></primary>
18640 </indexterm>
18641 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18642 </para>
18643 </listitem></varlistentry>
18644 <varlistentry>
18645 <term><varname>$router_name</varname></term>
18646 <listitem>
18647 <para>
18648 <indexterm role="concept">
18649 <primary>router</primary>
18650 <secondary>name</secondary>
18651 </indexterm>
18652 <indexterm role="concept">
18653 <primary>name</primary>
18654 <secondary>of router</secondary>
18655 </indexterm>
18656 <indexterm role="variable">
18657 <primary><varname>$router_name</varname></primary>
18658 </indexterm>
18659 During the running of a router this variable contains its name.
18660 </para>
18661 </listitem></varlistentry>
18662 <varlistentry>
18663 <term><varname>$runrc</varname></term>
18664 <listitem>
18665 <para>
18666 <indexterm role="concept">
18667 <primary>return code</primary>
18668 <secondary>from <option>run</option> expansion</secondary>
18669 </indexterm>
18670 <indexterm role="variable">
18671 <primary><varname>$runrc</varname></primary>
18672 </indexterm>
18673 This variable contains the return code from a command that is run by the
18674 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18675 assume the order in which option values are expanded, except for those
18676 preconditions whose order of testing is documented. Therefore, you cannot
18677 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18678 another.
18679 </para>
18680 </listitem></varlistentry>
18681 <varlistentry>
18682 <term><varname>$self_hostname</varname></term>
18683 <listitem>
18684 <para>
18685 <indexterm role="option">
18686 <primary><option>self</option></primary>
18687 <secondary>value of host name</secondary>
18688 </indexterm>
18689 <indexterm role="variable">
18690 <primary><varname>$self_hostname</varname></primary>
18691 </indexterm>
18692 When an address is routed to a supposedly remote host that turns out to be the
18693 local host, what happens is controlled by the <option>self</option> generic router option.
18694 One of its values causes the address to be passed to another router. When this
18695 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18696 original router encountered. In other circumstances its contents are null.
18697 </para>
18698 </listitem></varlistentry>
18699 <varlistentry>
18700 <term><varname>$sender_address</varname></term>
18701 <listitem>
18702 <para>
18703 <indexterm role="variable">
18704 <primary><varname>$sender_address</varname></primary>
18705 </indexterm>
18706 When a message is being processed, this variable contains the sender&#x2019;s address
18707 that was received in the message&#x2019;s envelope. The case of letters in the address
18708 is retained, in both the local part and the domain. For bounce messages, the
18709 value of this variable is the empty string. See also <varname>$return_path</varname>.
18710 </para>
18711 </listitem></varlistentry>
18712 <varlistentry>
18713 <term><varname>$sender_address_data</varname></term>
18714 <listitem>
18715 <para>
18716 <indexterm role="variable">
18717 <primary><varname>$address_data</varname></primary>
18718 </indexterm>
18719 <indexterm role="variable">
18720 <primary><varname>$sender_address_data</varname></primary>
18721 </indexterm>
18722 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18723 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18724 distinguish it from data from a recipient address. The value does not persist
18725 after the end of the current ACL statement. If you want to preserve it for
18726 longer, you can save it in an ACL variable.
18727 </para>
18728 </listitem></varlistentry>
18729 <varlistentry>
18730 <term><varname>$sender_address_domain</varname></term>
18731 <listitem>
18732 <para>
18733 <indexterm role="variable">
18734 <primary><varname>$sender_address_domain</varname></primary>
18735 </indexterm>
18736 The domain portion of <varname>$sender_address</varname>.
18737 </para>
18738 </listitem></varlistentry>
18739 <varlistentry>
18740 <term><varname>$sender_address_local_part</varname></term>
18741 <listitem>
18742 <para>
18743 <indexterm role="variable">
18744 <primary><varname>$sender_address_local_part</varname></primary>
18745 </indexterm>
18746 The local part portion of <varname>$sender_address</varname>.
18747 </para>
18748 </listitem></varlistentry>
18749 <varlistentry>
18750 <term><varname>$sender_data</varname></term>
18751 <listitem>
18752 <para>
18753 <indexterm role="variable">
18754 <primary><varname>$sender_data</varname></primary>
18755 </indexterm>
18756 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18757 in a router <option>senders</option> option. It contains the data from the lookup, and the
18758 value remains set until the next <option>senders</option> test. Thus, you can do things like
18759 this:
18760 </para>
18761 <literallayout>
18762 <literal>require senders      = cdb*@;/some/file</literal>
18763 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18764 </literallayout>
18765 <para>
18766 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18767 method in the address list, using the semicolon syntax as in the example above.
18768 The variable is not set for a lookup that is used as part of the string
18769 expansion that all such lists undergo before being interpreted.
18770 </para>
18771 </listitem></varlistentry>
18772 <varlistentry>
18773 <term><varname>$sender_fullhost</varname></term>
18774 <listitem>
18775 <para>
18776 <indexterm role="variable">
18777 <primary><varname>$sender_fullhost</varname></primary>
18778 </indexterm>
18779 When a message is received from a remote host, this variable contains the host
18780 name and IP address in a single string. It ends with the IP address in square
18781 brackets, followed by a colon and a port number if the logging of ports is
18782 enabled. The format of the rest of the string depends on whether the host
18783 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18784 looking up its IP address. (Looking up the IP address can be forced by the
18785 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18786 start of the string is a verified host name; if this is not present,
18787 verification either failed or was not requested. A host name in parentheses is
18788 the argument of a HELO or EHLO command. This is omitted if it is identical to
18789 the verified host name or to the host&#x2019;s IP address in square brackets.
18790 </para>
18791 </listitem></varlistentry>
18792 <varlistentry>
18793 <term><varname>$sender_helo_name</varname></term>
18794 <listitem>
18795 <para>
18796 <indexterm role="variable">
18797 <primary><varname>$sender_helo_name</varname></primary>
18798 </indexterm>
18799 When a message is received from a remote host that has issued a HELO or EHLO
18800 command, the argument of that command is placed in this variable. It is also
18801 set if HELO or EHLO is used when a message is received using SMTP locally via
18802 the <option>-bs</option> or <option>-bS</option> options.
18803 </para>
18804 </listitem></varlistentry>
18805 <varlistentry>
18806 <term><varname>$sender_host_address</varname></term>
18807 <listitem>
18808 <para>
18809 <indexterm role="variable">
18810 <primary><varname>$sender_host_address</varname></primary>
18811 </indexterm>
18812 When a message is received from a remote host using SMTP,
18813 this variable contains that
18814 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
18815 </para>
18816 </listitem></varlistentry>
18817 <varlistentry>
18818 <term><varname>$sender_host_authenticated</varname></term>
18819 <listitem>
18820 <para>
18821 <indexterm role="variable">
18822 <primary><varname>$sender_host_authenticated</varname></primary>
18823 </indexterm>
18824 This variable contains the name (not the public name) of the authenticator
18825 driver that successfully authenticated the client from which the message was
18826 received. It is empty if there was no successful authentication. See also
18827 <varname>$authenticated_id</varname>.
18828 </para>
18829 </listitem></varlistentry>
18830 <varlistentry>
18831 <term><varname>$sender_host_dnssec</varname></term>
18832 <listitem>
18833 <para>
18834 <indexterm role="variable">
18835 <primary><varname>$sender_host_dnssec</varname></primary>
18836 </indexterm>
18837 If an attempt to populate <varname>$sender_host_name</varname> has been made
18838 (by reference, <option>hosts_lookup</option> or
18839 otherwise) then this boolean will have been set true if, and only if, the
18840 resolver library states that the reverse DNS was authenticated data.  At all
18841 other times, this variable is false.
18842 </para>
18843 <para>
18844 It is likely that you will need to coerce DNSSEC support on in the resolver
18845 library, by setting:
18846 </para>
18847 <literallayout class="monospaced">
18848 dns_dnssec_ok = 1
18849 </literallayout>
18850 <para>
18851 Exim does not perform DNSSEC validation itself, instead leaving that to a
18852 validating resolver (eg, unbound, or bind with suitable configuration).
18853 </para>
18854 <para>
18855 Exim does not (currently) check to see if the forward DNS was also secured
18856 with DNSSEC, only the reverse DNS.
18857 </para>
18858 <para>
18859 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
18860 mechanism in the list, then this variable will be false.
18861 </para>
18862 </listitem></varlistentry>
18863 <varlistentry>
18864 <term><varname>$sender_host_name</varname></term>
18865 <listitem>
18866 <para>
18867 <indexterm role="variable">
18868 <primary><varname>$sender_host_name</varname></primary>
18869 </indexterm>
18870 When a message is received from a remote host, this variable contains the
18871 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18872 other means, this variable is empty.
18873 </para>
18874 <para>
18875 <indexterm role="variable">
18876 <primary><varname>$host_lookup_failed</varname></primary>
18877 </indexterm>
18878 If the host name has not previously been looked up, a reference to
18879 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18880 A looked up name is accepted only if it leads back to the original IP address
18881 via a forward lookup. If either the reverse or the forward lookup fails to find
18882 any data, or if the forward lookup does not yield the original IP address,
18883 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18884 </para>
18885 <para>
18886 <indexterm role="variable">
18887 <primary><varname>$host_lookup_deferred</varname></primary>
18888 </indexterm>
18889 However, if either of the lookups cannot be completed (for example, there is a
18890 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18891 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18892 </para>
18893 <para>
18894 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18895 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18896 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18897 is set to <quote>1</quote>.
18898 </para>
18899 <para>
18900 Exim does not automatically look up every calling host&#x2019;s name. If you want
18901 maximum efficiency, you should arrange your configuration so that it avoids
18902 these lookups altogether. The lookup happens only if one or more of the
18903 following are true:
18904 </para>
18905 <itemizedlist>
18906 <listitem>
18907 <para>
18908 A string containing <varname>$sender_host_name</varname> is expanded.
18909 </para>
18910 </listitem>
18911 <listitem>
18912 <para>
18913 The calling host matches the list in <option>host_lookup</option>. In the default
18914 configuration, this option is set to *, so it must be changed if lookups are
18915 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18916 </para>
18917 </listitem>
18918 <listitem>
18919 <para>
18920 Exim needs the host name in order to test an item in a host list. The items
18921 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18922 <xref linkend="SECThoslispatnamsk"/>.
18923 </para>
18924 </listitem>
18925 <listitem>
18926 <para>
18927 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18928 In this case, the host name is required to compare with the name quoted in any
18929 EHLO or HELO commands that the client issues.
18930 </para>
18931 </listitem>
18932 <listitem>
18933 <para>
18934 The remote host issues a EHLO or HELO command that quotes one of the
18935 domains in <option>helo_lookup_domains</option>. The default value of this option is
18936 </para>
18937 <literallayout class="monospaced">
18938   helo_lookup_domains = @ : @[]
18939 </literallayout>
18940 <para>
18941 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18942 IP address in an EHLO or HELO command.
18943 </para>
18944 </listitem>
18945 </itemizedlist>
18946 </listitem></varlistentry>
18947 <varlistentry>
18948 <term><varname>$sender_host_port</varname></term>
18949 <listitem>
18950 <para>
18951 <indexterm role="variable">
18952 <primary><varname>$sender_host_port</varname></primary>
18953 </indexterm>
18954 When a message is received from a remote host, this variable contains the port
18955 number that was used on the remote host.
18956 </para>
18957 </listitem></varlistentry>
18958 <varlistentry>
18959 <term><varname>$sender_ident</varname></term>
18960 <listitem>
18961 <para>
18962 <indexterm role="variable">
18963 <primary><varname>$sender_ident</varname></primary>
18964 </indexterm>
18965 When a message is received from a remote host, this variable contains the
18966 identification received in response to an RFC 1413 request. When a message has
18967 been received locally, this variable contains the login name of the user that
18968 called Exim.
18969 </para>
18970 </listitem></varlistentry>
18971 <varlistentry>
18972 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18973 <listitem>
18974 <para>
18975 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18976 <option>ratelimit</option> ACL condition. Details are given in section
18977 <xref linkend="SECTratelimiting"/>.
18978 </para>
18979 </listitem></varlistentry>
18980 <varlistentry>
18981 <term><varname>$sender_rcvhost</varname></term>
18982 <listitem>
18983 <para>
18984 <indexterm role="concept">
18985 <primary>DNS</primary>
18986 <secondary>reverse lookup</secondary>
18987 </indexterm>
18988 <indexterm role="concept">
18989 <primary>reverse DNS lookup</primary>
18990 </indexterm>
18991 <indexterm role="variable">
18992 <primary><varname>$sender_rcvhost</varname></primary>
18993 </indexterm>
18994 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18995 either the verified host name (as obtained from a reverse DNS lookup) or, if
18996 there is no verified host name, the IP address in square brackets. After that
18997 there may be text in parentheses. When the first item is a verified host name,
18998 the first thing in the parentheses is the IP address in square brackets,
18999 followed by a colon and a port number if port logging is enabled. When the
19000 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19001 the parentheses.
19002 </para>
19003 <para>
19004 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19005 was used and its argument was not identical to the real host name or IP
19006 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19007 all three items are present in the parentheses, a newline and tab are inserted
19008 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19009 </para>
19010 </listitem></varlistentry>
19011 <varlistentry>
19012 <term><varname>$sender_verify_failure</varname></term>
19013 <listitem>
19014 <para>
19015 <indexterm role="variable">
19016 <primary><varname>$sender_verify_failure</varname></primary>
19017 </indexterm>
19018 In an ACL, when a sender verification fails, this variable contains information
19019 about the failure. The details are the same as for
19020 <varname>$recipient_verify_failure</varname>.
19021 </para>
19022 </listitem></varlistentry>
19023 <varlistentry>
19024 <term><varname>$sending_ip_address</varname></term>
19025 <listitem>
19026 <para>
19027 <indexterm role="variable">
19028 <primary><varname>$sending_ip_address</varname></primary>
19029 </indexterm>
19030 This variable is set whenever an outgoing SMTP connection to another host has
19031 been set up. It contains the IP address of the local interface that is being
19032 used. This is useful if a host that has more than one IP address wants to take
19033 on different personalities depending on which one is being used. For incoming
19034 connections, see <varname>$received_ip_address</varname>.
19035 </para>
19036 </listitem></varlistentry>
19037 <varlistentry>
19038 <term><varname>$sending_port</varname></term>
19039 <listitem>
19040 <para>
19041 <indexterm role="variable">
19042 <primary><varname>$sending_port</varname></primary>
19043 </indexterm>
19044 This variable is set whenever an outgoing SMTP connection to another host has
19045 been set up. It contains the local port that is being used. For incoming
19046 connections, see <varname>$received_port</varname>.
19047 </para>
19048 </listitem></varlistentry>
19049 <varlistentry>
19050 <term><varname>$smtp_active_hostname</varname></term>
19051 <listitem>
19052 <para>
19053 <indexterm role="variable">
19054 <primary><varname>$smtp_active_hostname</varname></primary>
19055 </indexterm>
19056 During an incoming SMTP session, this variable contains the value of the active
19057 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19058 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19059 value can be consulted during routing and delivery.
19060 </para>
19061 </listitem></varlistentry>
19062 <varlistentry>
19063 <term><varname>$smtp_command</varname></term>
19064 <listitem>
19065 <para>
19066 <indexterm role="variable">
19067 <primary><varname>$smtp_command</varname></primary>
19068 </indexterm>
19069 During the processing of an incoming SMTP command, this variable contains the
19070 entire command. This makes it possible to distinguish between HELO and EHLO in
19071 the HELO ACL, and also to distinguish between commands such as these:
19072 </para>
19073 <literallayout class="monospaced">
19074 MAIL FROM:&lt;&gt;
19075 MAIL FROM: &lt;&gt;
19076 </literallayout>
19077 <para>
19078 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19079 command, the address in <varname>$smtp_command</varname> is the original address before any
19080 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19081 the address after SMTP-time rewriting.
19082 </para>
19083 </listitem></varlistentry>
19084 <varlistentry>
19085 <term><varname>$smtp_command_argument</varname></term>
19086 <listitem>
19087 <para>
19088 <indexterm role="concept">
19089 <primary>SMTP</primary>
19090 <secondary>command, argument for</secondary>
19091 </indexterm>
19092 <indexterm role="variable">
19093 <primary><varname>$smtp_command_argument</varname></primary>
19094 </indexterm>
19095 While an ACL is running to check an SMTP command, this variable contains the
19096 argument, that is, the text that follows the command name, with leading white
19097 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19098 somewhat redundant, but is retained for backwards compatibility.
19099 </para>
19100 </listitem></varlistentry>
19101 <varlistentry>
19102 <term><varname>$smtp_count_at_connection_start</varname></term>
19103 <listitem>
19104 <para>
19105 <indexterm role="variable">
19106 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19107 </indexterm>
19108 This variable is set greater than zero only in processes spawned by the Exim
19109 daemon for handling incoming SMTP connections. The name is deliberately long,
19110 in order to emphasize what the contents are. When the daemon accepts a new
19111 connection, it increments this variable. A copy of the variable is passed to
19112 the child process that handles the connection, but its value is fixed, and
19113 never changes. It is only an approximation of how many incoming connections
19114 there actually are, because many other connections may come and go while a
19115 single connection is being processed. When a child process terminates, the
19116 daemon decrements its copy of the variable.
19117 </para>
19118 </listitem></varlistentry>
19119 <varlistentry>
19120 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19121 <listitem>
19122 <para>
19123 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19124 that were current at the end of the system filter file. This allows a system
19125 filter file to set values that can be tested in users&#x2019; filter files. For
19126 example, a system filter could set a value indicating how likely it is that a
19127 message is junk mail.
19128 </para>
19129 </listitem></varlistentry>
19130 <varlistentry>
19131 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19132 <listitem>
19133 <para>
19134 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19135 is compiled with the content-scanning extension. For details, see section
19136 <xref linkend="SECTscanspamass"/>.
19137 </para>
19138 </listitem></varlistentry>
19139 <varlistentry>
19140 <term><varname>$spool_directory</varname></term>
19141 <listitem>
19142 <para>
19143 <indexterm role="variable">
19144 <primary><varname>$spool_directory</varname></primary>
19145 </indexterm>
19146 The name of Exim&#x2019;s spool directory.
19147 </para>
19148 </listitem></varlistentry>
19149 <varlistentry>
19150 <term><varname>$spool_inodes</varname></term>
19151 <listitem>
19152 <para>
19153 <indexterm role="variable">
19154 <primary><varname>$spool_inodes</varname></primary>
19155 </indexterm>
19156 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19157 being written. The value is recalculated whenever the variable is referenced.
19158 If the relevant file system does not have the concept of inodes, the value of
19159 is -1. See also the <option>check_spool_inodes</option> option.
19160 </para>
19161 </listitem></varlistentry>
19162 <varlistentry>
19163 <term><varname>$spool_space</varname></term>
19164 <listitem>
19165 <para>
19166 <indexterm role="variable">
19167 <primary><varname>$spool_space</varname></primary>
19168 </indexterm>
19169 The amount of free space (as a number of kilobytes) in the disk partition where
19170 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19171 variable is referenced. If the operating system does not have the ability to
19172 find the amount of free space (only true for experimental systems), the space
19173 value is -1. For example, to check in an ACL that there is at least 50
19174 megabytes free on the spool, you could write:
19175 </para>
19176 <literallayout class="monospaced">
19177 condition = ${if &gt; {$spool_space}{50000}}
19178 </literallayout>
19179 <para>
19180 See also the <option>check_spool_space</option> option.
19181 </para>
19182 </listitem></varlistentry>
19183 <varlistentry>
19184 <term><varname>$thisaddress</varname></term>
19185 <listitem>
19186 <para>
19187 <indexterm role="variable">
19188 <primary><varname>$thisaddress</varname></primary>
19189 </indexterm>
19190 This variable is set only during the processing of the <option>foranyaddress</option>
19191 command in a filter file. Its use is explained in the description of that
19192 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19193 interfaces to mail filtering</emphasis>.
19194 </para>
19195 </listitem></varlistentry>
19196 <varlistentry>
19197 <term><varname>$tls_in_bits</varname></term>
19198 <listitem>
19199 <para>
19200 <indexterm role="variable">
19201 <primary><varname>$tls_in_bits</varname></primary>
19202 </indexterm>
19203 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19204 on the inbound connection; the meaning of
19205 this depends upon the TLS implementation used.
19206 If TLS has not been negotiated, the value will be 0.
19207 The value of this is automatically fed into the Cyrus SASL authenticator
19208 when acting as a server, to specify the "external SSF" (a SASL term).
19209 </para>
19210 <para>
19211 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19212 except when used in the context of an outbound SMTP delivery, when it refers to
19213 the outbound.
19214 </para>
19215 </listitem></varlistentry>
19216 <varlistentry>
19217 <term><varname>$tls_out_bits</varname></term>
19218 <listitem>
19219 <para>
19220 <indexterm role="variable">
19221 <primary><varname>$tls_out_bits</varname></primary>
19222 </indexterm>
19223 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19224 on an outbound SMTP connection; the meaning of
19225 this depends upon the TLS implementation used.
19226 If TLS has not been negotiated, the value will be 0.
19227 </para>
19228 </listitem></varlistentry>
19229 <varlistentry>
19230 <term><varname>$tls_in_ourcert</varname></term>
19231 <listitem>
19232 <para>
19233 <indexterm role="variable">
19234 <primary><varname>$tls_in_ourcert</varname></primary>
19235 </indexterm>
19236 This variable refers to the certificate presented to the peer of an
19237 inbound connection when the message was received.
19238 It is only useful as the argument of a
19239 </para>
19240 <para revisionflag="changed">
19241 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19242 </para>
19243 <para>
19244 or a <option>def</option> condition.
19245 </para>
19246 </listitem></varlistentry>
19247 <varlistentry>
19248 <term><varname>$tls_in_peercert</varname></term>
19249 <listitem>
19250 <para>
19251 <indexterm role="variable">
19252 <primary><varname>$tls_in_peercert</varname></primary>
19253 </indexterm>
19254 This variable refers to the certificate presented by the peer of an
19255 inbound connection when the message was received.
19256 It is only useful as the argument of a
19257 </para>
19258 <para revisionflag="changed">
19259 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19260 </para>
19261 <para>
19262 or a <option>def</option> condition.
19263 </para>
19264 </listitem></varlistentry>
19265 <varlistentry>
19266 <term><varname>$tls_out_ourcert</varname></term>
19267 <listitem>
19268 <para>
19269 <indexterm role="variable">
19270 <primary><varname>$tls_out_ourcert</varname></primary>
19271 </indexterm>
19272 This variable refers to the certificate presented to the peer of an
19273 outbound connection.  It is only useful as the argument of a
19274 </para>
19275 <para revisionflag="changed">
19276 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19277 </para>
19278 <para>
19279 or a <option>def</option> condition.
19280 </para>
19281 </listitem></varlistentry>
19282 <varlistentry>
19283 <term><varname>$tls_out_peercert</varname></term>
19284 <listitem>
19285 <para>
19286 <indexterm role="variable">
19287 <primary><varname>$tls_out_peercert</varname></primary>
19288 </indexterm>
19289 This variable refers to the certificate presented by the peer of an
19290 outbound connection.  It is only useful as the argument of a
19291 </para>
19292 <para revisionflag="changed">
19293 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
19294 </para>
19295 <para>
19296 or a <option>def</option> condition.
19297 </para>
19298 </listitem></varlistentry>
19299 <varlistentry>
19300 <term><varname>$tls_in_certificate_verified</varname></term>
19301 <listitem>
19302 <para>
19303 <indexterm role="variable">
19304 <primary><varname>$tls_in_certificate_verified</varname></primary>
19305 </indexterm>
19306 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
19307 message was received, and <quote>0</quote> otherwise.
19308 </para>
19309 <para>
19310 The deprecated <varname>$tls_certificate_verfied</varname> variable refers to the inbound side
19311 except when used in the context of an outbound SMTP delivery, when it refers to
19312 the outbound.
19313 </para>
19314 </listitem></varlistentry>
19315 <varlistentry>
19316 <term><varname>$tls_out_certificate_verified</varname></term>
19317 <listitem>
19318 <para>
19319 <indexterm role="variable">
19320 <primary><varname>$tls_out_certificate_verified</varname></primary>
19321 </indexterm>
19322 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
19323 outbound SMTP connection was made,
19324 and <quote>0</quote> otherwise.
19325 </para>
19326 </listitem></varlistentry>
19327 <varlistentry>
19328 <term><varname>$tls_in_cipher</varname></term>
19329 <listitem>
19330 <para>
19331 <indexterm role="variable">
19332 <primary><varname>$tls_in_cipher</varname></primary>
19333 </indexterm>
19334 <indexterm role="variable">
19335 <primary><varname>$tls_cipher</varname></primary>
19336 </indexterm>
19337 When a message is received from a remote host over an encrypted SMTP
19338 connection, this variable is set to the cipher suite that was negotiated, for
19339 example DES-CBC3-SHA. In other circumstances, in particular, for message
19340 received over unencrypted connections, the variable is empty. Testing
19341 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
19342 non-encrypted connections during ACL processing.
19343 </para>
19344 <para>
19345 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
19346 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
19347 becomes the same as <varname>$tls_out_cipher</varname>.
19348 </para>
19349 </listitem></varlistentry>
19350 <varlistentry>
19351 <term><varname>$tls_out_cipher</varname></term>
19352 <listitem>
19353 <para>
19354 <indexterm role="variable">
19355 <primary><varname>$tls_out_cipher</varname></primary>
19356 </indexterm>
19357 This variable is
19358 cleared before any outgoing SMTP connection is made,
19359 and then set to the outgoing cipher suite if one is negotiated. See chapter
19360 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
19361 details of the <command>smtp</command> transport.
19362 </para>
19363 </listitem></varlistentry>
19364 <varlistentry>
19365 <term><varname>$tls_in_ocsp</varname></term>
19366 <listitem>
19367 <para>
19368 <indexterm role="variable">
19369 <primary><varname>$tls_in_ocsp</varname></primary>
19370 </indexterm>
19371 When a message is received from a remote client connection
19372 the result of any OCSP request from the client is encoded in this variable:
19373 </para>
19374 <literallayout class="monospaced">
19375 0 OCSP proof was not requested (default value)
19376 1 No response to request
19377 2 Response not verified
19378 3 Verification failed
19379 4 Verification succeeded
19380 </literallayout>
19381 </listitem></varlistentry>
19382 <varlistentry>
19383 <term><varname>$tls_out_ocsp</varname></term>
19384 <listitem>
19385 <para>
19386 <indexterm role="variable">
19387 <primary><varname>$tls_out_ocsp</varname></primary>
19388 </indexterm>
19389 When a message is sent to a remote host connection
19390 the result of any OCSP request made is encoded in this variable.
19391 See <varname>$tls_in_ocsp</varname> for values.
19392 </para>
19393 </listitem></varlistentry>
19394 <varlistentry>
19395 <term><varname>$tls_in_peerdn</varname></term>
19396 <listitem>
19397 <para>
19398 <indexterm role="variable">
19399 <primary><varname>$tls_in_peerdn</varname></primary>
19400 </indexterm>
19401 <indexterm role="variable">
19402 <primary><varname>$tls_peerdn</varname></primary>
19403 </indexterm>
19404 When a message is received from a remote host over an encrypted SMTP
19405 connection, and Exim is configured to request a certificate from the client,
19406 the value of the Distinguished Name of the certificate is made available in the
19407 <varname>$tls_in_peerdn</varname> during subsequent processing.
19408 </para>
19409 <para>
19410 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
19411 except when used in the context of an outbound SMTP delivery, when it refers to
19412 the outbound.
19413 </para>
19414 </listitem></varlistentry>
19415 <varlistentry>
19416 <term><varname>$tls_out_peerdn</varname></term>
19417 <listitem>
19418 <para>
19419 <indexterm role="variable">
19420 <primary><varname>$tls_out_peerdn</varname></primary>
19421 </indexterm>
19422 When a message is being delivered to a remote host over an encrypted SMTP
19423 connection, and Exim is configured to request a certificate from the server,
19424 the value of the Distinguished Name of the certificate is made available in the
19425 <varname>$tls_out_peerdn</varname> during subsequent processing.
19426 </para>
19427 </listitem></varlistentry>
19428 <varlistentry>
19429 <term><varname>$tls_in_sni</varname></term>
19430 <listitem>
19431 <para>
19432 <indexterm role="variable">
19433 <primary><varname>$tls_in_sni</varname></primary>
19434 </indexterm>
19435 <indexterm role="variable">
19436 <primary><varname>$tls_sni</varname></primary>
19437 </indexterm>
19438 <indexterm role="concept">
19439 <primary>TLS</primary>
19440 <secondary>Server Name Indication</secondary>
19441 </indexterm>
19442 When a TLS session is being established, if the client sends the Server
19443 Name Indication extension, the value will be placed in this variable.
19444 If the variable appears in <option>tls_certificate</option> then this option and
19445 some others, described in <xref linkend="SECTtlssni"/>,
19446 will be re-expanded early in the TLS session, to permit
19447 a different certificate to be presented (and optionally a different key to be
19448 used) to the client, based upon the value of the SNI extension.
19449 </para>
19450 <para>
19451 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
19452 except when used in the context of an outbound SMTP delivery, when it refers to
19453 the outbound.
19454 </para>
19455 </listitem></varlistentry>
19456 <varlistentry>
19457 <term><varname>$tls_out_sni</varname></term>
19458 <listitem>
19459 <para>
19460 <indexterm role="variable">
19461 <primary><varname>$tls_out_sni</varname></primary>
19462 </indexterm>
19463 <indexterm role="concept">
19464 <primary>TLS</primary>
19465 <secondary>Server Name Indication</secondary>
19466 </indexterm>
19467 During outbound
19468 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
19469 the transport.
19470 </para>
19471 </listitem></varlistentry>
19472 <varlistentry>
19473 <term><varname>$tod_bsdinbox</varname></term>
19474 <listitem>
19475 <para>
19476 <indexterm role="variable">
19477 <primary><varname>$tod_bsdinbox</varname></primary>
19478 </indexterm>
19479 The time of day and the date, in the format required for BSD-style mailbox
19480 files, for example: Thu Oct 17 17:14:09 1995.
19481 </para>
19482 </listitem></varlistentry>
19483 <varlistentry>
19484 <term><varname>$tod_epoch</varname></term>
19485 <listitem>
19486 <para>
19487 <indexterm role="variable">
19488 <primary><varname>$tod_epoch</varname></primary>
19489 </indexterm>
19490 The time and date as a number of seconds since the start of the Unix epoch.
19491 </para>
19492 </listitem></varlistentry>
19493 <varlistentry>
19494 <term><varname>$tod_epoch_l</varname></term>
19495 <listitem>
19496 <para>
19497 <indexterm role="variable">
19498 <primary><varname>$tod_epoch_l</varname></primary>
19499 </indexterm>
19500 The time and date as a number of microseconds since the start of the Unix epoch.
19501 </para>
19502 </listitem></varlistentry>
19503 <varlistentry>
19504 <term><varname>$tod_full</varname></term>
19505 <listitem>
19506 <para>
19507 <indexterm role="variable">
19508 <primary><varname>$tod_full</varname></primary>
19509 </indexterm>
19510 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19511 +0100. The timezone is always given as a numerical offset from UTC, with
19512 positive values used for timezones that are ahead (east) of UTC, and negative
19513 values for those that are behind (west).
19514 </para>
19515 </listitem></varlistentry>
19516 <varlistentry>
19517 <term><varname>$tod_log</varname></term>
19518 <listitem>
19519 <para>
19520 <indexterm role="variable">
19521 <primary><varname>$tod_log</varname></primary>
19522 </indexterm>
19523 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19524 1995-10-12 15:32:29, but without a timezone.
19525 </para>
19526 </listitem></varlistentry>
19527 <varlistentry>
19528 <term><varname>$tod_logfile</varname></term>
19529 <listitem>
19530 <para>
19531 <indexterm role="variable">
19532 <primary><varname>$tod_logfile</varname></primary>
19533 </indexterm>
19534 This variable contains the date in the format yyyymmdd. This is the format that
19535 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19536 flag.
19537 </para>
19538 </listitem></varlistentry>
19539 <varlistentry>
19540 <term><varname>$tod_zone</varname></term>
19541 <listitem>
19542 <para>
19543 <indexterm role="variable">
19544 <primary><varname>$tod_zone</varname></primary>
19545 </indexterm>
19546 This variable contains the numerical value of the local timezone, for example:
19547 -0500.
19548 </para>
19549 </listitem></varlistentry>
19550 <varlistentry>
19551 <term><varname>$tod_zulu</varname></term>
19552 <listitem>
19553 <para>
19554 <indexterm role="variable">
19555 <primary><varname>$tod_zulu</varname></primary>
19556 </indexterm>
19557 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19558 by ISO 8601, for example: 20030221154023Z.
19559 </para>
19560 </listitem></varlistentry>
19561 <varlistentry>
19562 <term><varname>$transport_name</varname></term>
19563 <listitem>
19564 <para>
19565 <indexterm role="concept">
19566 <primary>transport</primary>
19567 <secondary>name</secondary>
19568 </indexterm>
19569 <indexterm role="concept">
19570 <primary>name</primary>
19571 <secondary>of transport</secondary>
19572 </indexterm>
19573 <indexterm role="variable">
19574 <primary><varname>$transport_name</varname></primary>
19575 </indexterm>
19576 During the running of a transport, this variable contains its name.
19577 </para>
19578 </listitem></varlistentry>
19579 <varlistentry>
19580 <term><varname>$value</varname></term>
19581 <listitem>
19582 <para>
19583 <indexterm role="variable">
19584 <primary><varname>$value</varname></primary>
19585 </indexterm>
19586 This variable contains the result of an expansion lookup, extraction operation,
19587 or external command, as described above. It is also used during a
19588 <emphasis role="bold">reduce</emphasis> expansion.
19589 </para>
19590 </listitem></varlistentry>
19591 <varlistentry>
19592 <term><varname>$verify_mode</varname></term>
19593 <listitem>
19594 <para>
19595 <indexterm role="variable">
19596 <primary><varname>$verify_mode</varname></primary>
19597 </indexterm>
19598 While a router or transport is being run in verify mode
19599 or for cutthrough delivery,
19600 contains "S" for sender-verification or "R" for recipient-verification.
19601 Otherwise, empty.
19602 </para>
19603 </listitem></varlistentry>
19604 <varlistentry>
19605 <term><varname>$version_number</varname></term>
19606 <listitem>
19607 <para>
19608 <indexterm role="variable">
19609 <primary><varname>$version_number</varname></primary>
19610 </indexterm>
19611 The version number of Exim.
19612 </para>
19613 </listitem></varlistentry>
19614 <varlistentry>
19615 <term><varname>$warn_message_delay</varname></term>
19616 <listitem>
19617 <para>
19618 <indexterm role="variable">
19619 <primary><varname>$warn_message_delay</varname></primary>
19620 </indexterm>
19621 This variable is set only during the creation of a message warning about a
19622 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19623 </para>
19624 </listitem></varlistentry>
19625 <varlistentry>
19626 <term><varname>$warn_message_recipients</varname></term>
19627 <listitem>
19628 <para>
19629 <indexterm role="variable">
19630 <primary><varname>$warn_message_recipients</varname></primary>
19631 </indexterm>
19632 This variable is set only during the creation of a message warning about a
19633 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19634 </para>
19635 </listitem></varlistentry>
19636 </variablelist>
19637 <para>
19638 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19639 </para>
19640 </section>
19641 </chapter>
19642
19643 <chapter id="CHAPperl">
19644 <title>Embedded Perl</title>
19645 <para>
19646 <indexterm role="concept" id="IIDperl" class="startofrange">
19647 <primary>Perl</primary>
19648 <secondary>calling from Exim</secondary>
19649 </indexterm>
19650 Exim can be built to include an embedded Perl interpreter. When this is done,
19651 Perl subroutines can be called as part of the string expansion process. To make
19652 use of the Perl support, you need version 5.004 or later of Perl installed on
19653 your system. To include the embedded interpreter in the Exim binary, include
19654 the line
19655 </para>
19656 <literallayout class="monospaced">
19657 EXIM_PERL = perl.o
19658 </literallayout>
19659 <para>
19660 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19661 </para>
19662 <section id="SECID85">
19663 <title>Setting up so Perl can be used</title>
19664 <para>
19665 <indexterm role="option">
19666 <primary><option>perl_startup</option></primary>
19667 </indexterm>
19668 Access to Perl subroutines is via a global configuration option called
19669 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19670 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19671 interpreter is started and there is almost no overhead for Exim (since none of
19672 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19673 option then the associated value is taken to be Perl code which is executed in
19674 a newly created Perl interpreter.
19675 </para>
19676 <para>
19677 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19678 need backslashes before any characters to escape special meanings. The option
19679 should usually be something like
19680 </para>
19681 <literallayout class="monospaced">
19682 perl_startup = do '/etc/exim.pl'
19683 </literallayout>
19684 <para>
19685 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19686 use from Exim. Exim can be configured either to start up a Perl interpreter as
19687 soon as it is entered, or to wait until the first time it is needed. Starting
19688 the interpreter at the beginning ensures that it is done while Exim still has
19689 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19690 fact used in a particular run. Also, note that this does not mean that Exim is
19691 necessarily running as root when Perl is called at a later time. By default,
19692 the interpreter is started only when it is needed, but this can be changed in
19693 two ways:
19694 </para>
19695 <itemizedlist>
19696 <listitem>
19697 <para>
19698 <indexterm role="option">
19699 <primary><option>perl_at_start</option></primary>
19700 </indexterm>
19701 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19702 a startup when Exim is entered.
19703 </para>
19704 </listitem>
19705 <listitem>
19706 <para>
19707 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19708 overriding the setting of <option>perl_at_start</option>.
19709 </para>
19710 </listitem>
19711 </itemizedlist>
19712 <para>
19713 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19714 initial startup, even if <option>perl_at_start</option> is set.
19715 </para>
19716 </section>
19717 <section id="SECID86">
19718 <title>Calling Perl subroutines</title>
19719 <para>
19720 When the configuration file includes a <option>perl_startup</option> option you can make use
19721 of the string expansion item to call the Perl subroutines that are defined
19722 by the <option>perl_startup</option> code. The operator is used in any of the following
19723 forms:
19724 </para>
19725 <literallayout class="monospaced">
19726 ${perl{foo}}
19727 ${perl{foo}{argument}}
19728 ${perl{foo}{argument1}{argument2} ... }
19729 </literallayout>
19730 <para>
19731 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19732 arguments may be passed. Passing more than this results in an expansion failure
19733 with an error message of the form
19734 </para>
19735 <literallayout class="monospaced">
19736 Too many arguments passed to Perl subroutine "foo" (max is 8)
19737 </literallayout>
19738 <para>
19739 The return value of the Perl subroutine is evaluated in a scalar context before
19740 it is passed back to Exim to be inserted into the expanded string. If the
19741 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19742 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19743 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19744 that was passed to <option>die</option>.
19745 </para>
19746 </section>
19747 <section id="SECID87">
19748 <title>Calling Exim functions from Perl</title>
19749 <para>
19750 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19751 is available to call back into Exim&#x2019;s string expansion function. For example,
19752 the Perl code
19753 </para>
19754 <literallayout class="monospaced">
19755 my $lp = Exim::expand_string('$local_part');
19756 </literallayout>
19757 <para>
19758 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19759 Note those are single quotes and not double quotes to protect against
19760 <varname>$local_part</varname> being interpolated as a Perl variable.
19761 </para>
19762 <para>
19763 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19764 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19765 expansion string, the Perl call from the original expansion string fails with
19766 an appropriate error message, in the same way as if <option>die</option> were used.
19767 </para>
19768 <para>
19769 <indexterm role="concept">
19770 <primary>debugging</primary>
19771 <secondary>from embedded Perl</secondary>
19772 </indexterm>
19773 <indexterm role="concept">
19774 <primary>log</primary>
19775 <secondary>writing from embedded Perl</secondary>
19776 </indexterm>
19777 Two other Exim functions are available for use from within Perl code.
19778 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19779 debugging is enabled. If you want a newline at the end, you must supply it.
19780 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19781 timestamp. In this case, you should not supply a terminating newline.
19782 </para>
19783 </section>
19784 <section id="SECID88">
19785 <title>Use of standard output and error by Perl</title>
19786 <para>
19787 <indexterm role="concept">
19788 <primary>Perl</primary>
19789 <secondary>standard output and error</secondary>
19790 </indexterm>
19791 You should not write to the standard error or output streams from within your
19792 Perl code, as it is not defined how these are set up. In versions of Exim
19793 before 4.50, it is possible for the standard output or error to refer to the
19794 SMTP connection during message reception via the daemon. Writing to this stream
19795 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
19796 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
19797 avoided, but the output is lost.
19798 </para>
19799 <para>
19800 <indexterm role="concept">
19801 <primary>Perl</primary>
19802 <secondary>use of <option>warn</option></secondary>
19803 </indexterm>
19804 The Perl <option>warn</option> statement writes to the standard error stream by default.
19805 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
19806 you have no control. When Exim starts up the Perl interpreter, it arranges for
19807 output from the <option>warn</option> statement to be written to the Exim main log. You can
19808 change this by including appropriate Perl magic somewhere in your Perl code.
19809 For example, to discard <option>warn</option> output completely, you need this:
19810 </para>
19811 <literallayout class="monospaced">
19812 $SIG{__WARN__} = sub { };
19813 </literallayout>
19814 <para>
19815 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
19816 example, the code for the subroutine is empty, so it does nothing, but you can
19817 include any Perl code that you like. The text of the <option>warn</option> message is passed
19818 as the first subroutine argument.
19819 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
19820 </para>
19821 </section>
19822 </chapter>
19823
19824 <chapter id="CHAPinterfaces">
19825 <title>Starting the daemon and the use of network interfaces</title>
19826 <titleabbrev>Starting the daemon</titleabbrev>
19827 <para>
19828 <indexterm role="concept">
19829 <primary>daemon</primary>
19830 <secondary>starting</secondary>
19831 </indexterm>
19832 <indexterm role="concept">
19833 <primary>interface</primary>
19834 <secondary>listening</secondary>
19835 </indexterm>
19836 <indexterm role="concept">
19837 <primary>network interface</primary>
19838 </indexterm>
19839 <indexterm role="concept">
19840 <primary>interface</primary>
19841 <secondary>network</secondary>
19842 </indexterm>
19843 <indexterm role="concept">
19844 <primary>IP address</primary>
19845 <secondary>for listening</secondary>
19846 </indexterm>
19847 <indexterm role="concept">
19848 <primary>daemon</primary>
19849 <secondary>listening IP addresses</secondary>
19850 </indexterm>
19851 <indexterm role="concept">
19852 <primary>TCP/IP</primary>
19853 <secondary>setting listening interfaces</secondary>
19854 </indexterm>
19855 <indexterm role="concept">
19856 <primary>TCP/IP</primary>
19857 <secondary>setting listening ports</secondary>
19858 </indexterm>
19859 A host that is connected to a TCP/IP network may have one or more physical
19860 hardware network interfaces. Each of these interfaces may be configured as one
19861 or more <quote>logical</quote> interfaces, which are the entities that a program actually
19862 works with. Each of these logical interfaces is associated with an IP address.
19863 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
19864 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
19865 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
19866 </para>
19867 <orderedlist numeration="arabic">
19868 <listitem>
19869 <para>
19870 When a listening daemon is started, Exim needs to know which interfaces
19871 and ports to listen on.
19872 </para>
19873 </listitem>
19874 <listitem>
19875 <para>
19876 When Exim is routing an address, it needs to know which IP addresses
19877 are associated with local interfaces. This is required for the correct
19878 processing of MX lists by removing the local host and others with the
19879 same or higher priority values. Also, Exim needs to detect cases
19880 when an address is routed to an IP address that in fact belongs to the
19881 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
19882 option of the smtp transport is set (as appropriate), this is treated
19883 as an error situation.
19884 </para>
19885 </listitem>
19886 <listitem>
19887 <para>
19888 When Exim connects to a remote host, it may need to know which interface to use
19889 for the outgoing connection.
19890 </para>
19891 </listitem>
19892 </orderedlist>
19893 <para>
19894 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
19895 of cases. If your host has only one interface, and you want all its IP
19896 addresses to be treated in the same way, and you are using only the
19897 standard SMTP port, you should not need to take any special action. The
19898 rest of this chapter does not apply to you.
19899 </para>
19900 <para>
19901 In a more complicated situation you may want to listen only on certain
19902 interfaces, or on different ports, and for this reason there are a number of
19903 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
19904 chapter describes how they operate.
19905 </para>
19906 <para>
19907 When a message is received over TCP/IP, the interface and port that were
19908 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19909 </para>
19910 <section id="SECID89">
19911 <title>Starting a listening daemon</title>
19912 <para>
19913 When a listening daemon is started (by means of the <option>-bd</option> command line
19914 option), the interfaces and ports on which it listens are controlled by the
19915 following options:
19916 </para>
19917 <itemizedlist>
19918 <listitem>
19919 <para>
19920 <option>daemon_smtp_ports</option> contains a list of default ports
19921 or service names.
19922 (For backward compatibility, this option can also be specified in the singular.)
19923 </para>
19924 </listitem>
19925 <listitem>
19926 <para>
19927 <option>local_interfaces</option> contains list of interface IP addresses on which to
19928 listen. Each item may optionally also specify a port.
19929 </para>
19930 </listitem>
19931 </itemizedlist>
19932 <para>
19933 The default list separator in both cases is a colon, but this can be changed as
19934 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
19935 it is usually best to change the separator to avoid having to double all the
19936 colons. For example:
19937 </para>
19938 <literallayout class="monospaced">
19939 local_interfaces = &lt;; 127.0.0.1 ; \
19940                       192.168.23.65 ; \
19941                       ::1 ; \
19942                       3ffe:ffff:836f::fe86:a061
19943 </literallayout>
19944 <para>
19945 There are two different formats for specifying a port along with an IP address
19946 in <option>local_interfaces</option>:
19947 </para>
19948 <orderedlist numeration="arabic">
19949 <listitem>
19950 <para>
19951 The port is added onto the address with a dot separator. For example, to listen
19952 on port 1234 on two different IP addresses:
19953 </para>
19954 <literallayout class="monospaced">
19955 local_interfaces = &lt;; 192.168.23.65.1234 ; \
19956                       3ffe:ffff:836f::fe86:a061.1234
19957 </literallayout>
19958 </listitem>
19959 <listitem>
19960 <para>
19961 The IP address is enclosed in square brackets, and the port is added
19962 with a colon separator, for example:
19963 </para>
19964 <literallayout class="monospaced">
19965 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
19966                       [3ffe:ffff:836f::fe86:a061]:1234
19967 </literallayout>
19968 </listitem>
19969 </orderedlist>
19970 <para>
19971 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
19972 default setting contains just one port:
19973 </para>
19974 <literallayout class="monospaced">
19975 daemon_smtp_ports = smtp
19976 </literallayout>
19977 <para>
19978 If more than one port is listed, each interface that does not have its own port
19979 specified listens on all of them. Ports that are listed in
19980 <option>daemon_smtp_ports</option> can be identified either by name (defined in
19981 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
19982 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
19983 </para>
19984 </section>
19985 <section id="SECID90">
19986 <title>Special IP listening addresses</title>
19987 <para>
19988 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
19989 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
19990 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
19991 instead of setting up separate listening sockets for each interface. The
19992 default value of <option>local_interfaces</option> is
19993 </para>
19994 <literallayout class="monospaced">
19995 local_interfaces = 0.0.0.0
19996 </literallayout>
19997 <para>
19998 when Exim is built without IPv6 support; otherwise it is:
19999 </para>
20000 <literallayout class="monospaced">
20001 local_interfaces = &lt;; ::0 ; 0.0.0.0
20002 </literallayout>
20003 <para>
20004 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20005 </para>
20006 </section>
20007 <section id="SECID91">
20008 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20009 <para>
20010 The <option>-oX</option> command line option can be used to override the values of
20011 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20012 instance. Another way of doing this would be to use macros and the <option>-D</option>
20013 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20014 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20015 exim.
20016 </para>
20017 <para>
20018 The value of <option>-oX</option> is a list of items. The default colon separator can be
20019 changed in the usual way if required. If there are any items that do not
20020 contain dots or colons (that is, are not IP addresses), the value of
20021 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20022 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20023 replaced by those items. Thus, for example,
20024 </para>
20025 <literallayout class="monospaced">
20026 -oX 1225
20027 </literallayout>
20028 <para>
20029 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20030 whereas
20031 </para>
20032 <literallayout class="monospaced">
20033 -oX 192.168.34.5.1125
20034 </literallayout>
20035 <para>
20036 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20037 (However, since <option>local_interfaces</option> now contains no items without ports, the
20038 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20039 </para>
20040 </section>
20041 <section id="SECTsupobssmt">
20042 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20043 <para>
20044 <indexterm role="concept">
20045 <primary>ssmtp protocol</primary>
20046 </indexterm>
20047 <indexterm role="concept">
20048 <primary>smtps protocol</primary>
20049 </indexterm>
20050 <indexterm role="concept">
20051 <primary>SMTP</primary>
20052 <secondary>ssmtp protocol</secondary>
20053 </indexterm>
20054 <indexterm role="concept">
20055 <primary>SMTP</primary>
20056 <secondary>smtps protocol</secondary>
20057 </indexterm>
20058 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20059 before the STARTTLS command was standardized for SMTP. Some legacy clients
20060 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20061 list of port numbers or service names,
20062 connections to those ports must use SSMTP. The most
20063 common use of this option is expected to be
20064 </para>
20065 <literallayout class="monospaced">
20066 tls_on_connect_ports = 465
20067 </literallayout>
20068 <para>
20069 because 465 is the usual port number used by the legacy clients. There is also
20070 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20071 this way when a daemon is started.
20072 </para>
20073 <para>
20074 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20075 daemon to listen on those ports. You must still specify them in
20076 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20077 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20078 connections via the daemon.)
20079 </para>
20080 </section>
20081 <section id="SECID92">
20082 <title>IPv6 address scopes</title>
20083 <para>
20084 <indexterm role="concept">
20085 <primary>IPv6</primary>
20086 <secondary>address scopes</secondary>
20087 </indexterm>
20088 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20089 can, in principle, have the same link-local IPv6 address on different
20090 interfaces. Thus, additional information is needed, over and above the IP
20091 address, to distinguish individual interfaces. A convention of using a
20092 percent sign followed by something (often the interface name) has been
20093 adopted in some cases, leading to addresses like this:
20094 </para>
20095 <literallayout class="monospaced">
20096 fe80::202:b3ff:fe03:45c1%eth0
20097 </literallayout>
20098 <para>
20099 To accommodate this usage, a percent sign followed by an arbitrary string is
20100 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20101 to convert a textual IPv6 address for actual use. This function recognizes the
20102 percent convention in operating systems that support it, and it processes the
20103 address appropriately. Unfortunately, some older libraries have problems with
20104 <function>getaddrinfo()</function>. If
20105 </para>
20106 <literallayout class="monospaced">
20107 IPV6_USE_INET_PTON=yes
20108 </literallayout>
20109 <para>
20110 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20111 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20112 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20113 function.) Of course, this means that the additional functionality of
20114 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20115 </para>
20116 </section>
20117 <section id="SECID93">
20118 <title>Disabling IPv6</title>
20119 <para>
20120 <indexterm role="concept">
20121 <primary>IPv6</primary>
20122 <secondary>disabling</secondary>
20123 </indexterm>
20124 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20125 run on a host whose kernel does not support IPv6. The binary will fall back to
20126 using IPv4, but it may waste resources looking up AAAA records, and trying to
20127 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20128 <indexterm role="option">
20129 <primary><option>disable_ipv6</option></primary>
20130 </indexterm>
20131 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20132 activities take place. AAAA records are never looked up, and any IPv6 addresses
20133 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20134 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20135 to handle IPv6 literal addresses.
20136 </para>
20137 <para>
20138 On the other hand, when IPv6 is in use, there may be times when you want to
20139 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20140 option to globally suppress the lookup of AAAA records for specified domains,
20141 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20142 IPv6 addresses in an individual router.
20143 </para>
20144 </section>
20145 <section id="SECID94">
20146 <title>Examples of starting a listening daemon</title>
20147 <para>
20148 The default case in an IPv6 environment is
20149 </para>
20150 <literallayout class="monospaced">
20151 daemon_smtp_ports = smtp
20152 local_interfaces = &lt;; ::0 ; 0.0.0.0
20153 </literallayout>
20154 <para>
20155 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20156 Either one or two sockets may be used, depending on the characteristics of
20157 the TCP/IP stack. (This is complicated and messy; for more information,
20158 read the comments in the <filename>daemon.c</filename> source file.)
20159 </para>
20160 <para>
20161 To specify listening on ports 25 and 26 on all interfaces:
20162 </para>
20163 <literallayout class="monospaced">
20164 daemon_smtp_ports = 25 : 26
20165 </literallayout>
20166 <para>
20167 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20168 </para>
20169 <literallayout class="monospaced">
20170 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20171                       0.0.0.0.25 ; 0.0.0.0.26
20172 </literallayout>
20173 <para>
20174 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20175 IPv4 loopback address only:
20176 </para>
20177 <literallayout class="monospaced">
20178 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20179 </literallayout>
20180 <para>
20181 To specify listening on the default port on specific interfaces only:
20182 </para>
20183 <literallayout class="monospaced">
20184 local_interfaces = 10.0.0.67 : 192.168.34.67
20185 </literallayout>
20186 <para>
20187 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20188 </para>
20189 </section>
20190 <section id="SECTreclocipadd">
20191 <title>Recognizing the local host</title>
20192 <para>
20193 The <option>local_interfaces</option> option is also used when Exim needs to determine
20194 whether or not an IP address refers to the local host. That is, the IP
20195 addresses of all the interfaces on which a daemon is listening are always
20196 treated as local.
20197 </para>
20198 <para>
20199 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20200 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20201 available interfaces from the operating system, and extracts the relevant
20202 (that is, IPv4 or IPv6) addresses to use for checking.
20203 </para>
20204 <para>
20205 Some systems set up large numbers of virtual interfaces in order to provide
20206 many virtual web servers. In this situation, you may want to listen for
20207 email on only a few of the available interfaces, but nevertheless treat all
20208 interfaces as local when routing. You can do this by setting
20209 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20210 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20211 used for listening. Consider this example:
20212 </para>
20213 <literallayout class="monospaced">
20214 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20215                       192.168.53.235 ; \
20216                       3ffe:2101:12:1:a00:20ff:fe86:a061
20217
20218 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20219 </literallayout>
20220 <para>
20221 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
20222 address, but all available interface addresses are treated as local when
20223 Exim is routing.
20224 </para>
20225 <para>
20226 In some environments the local host name may be in an MX list, but with an IP
20227 address that is not assigned to any local interface. In other cases it may be
20228 desirable to treat other host names as if they referred to the local host. Both
20229 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
20230 This contains host names rather than IP addresses. When a host is referenced
20231 during routing, either via an MX record or directly, it is treated as the local
20232 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
20233 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
20234 </para>
20235 </section>
20236 <section id="SECID95">
20237 <title>Delivering to a remote host</title>
20238 <para>
20239 Delivery to a remote host is handled by the smtp transport. By default, it
20240 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
20241 there is more than one) when connecting to a remote host. However, the
20242 <option>interface</option> option can be set to specify which interface is used. See the
20243 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
20244 details.
20245 </para>
20246 </section>
20247 </chapter>
20248
20249 <chapter id="CHAPmainconfig">
20250 <title>Main configuration</title>
20251 <para>
20252 <indexterm role="concept" id="IIDconfima" class="startofrange">
20253 <primary>configuration file</primary>
20254 <secondary>main section</secondary>
20255 </indexterm>
20256 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
20257 <primary>main configuration</primary>
20258 </indexterm>
20259 The first part of the run time configuration file contains three types of item:
20260 </para>
20261 <itemizedlist>
20262 <listitem>
20263 <para>
20264 Macro definitions: These lines start with an upper case letter. See section
20265 <xref linkend="SECTmacrodefs"/> for details of macro processing.
20266 </para>
20267 </listitem>
20268 <listitem>
20269 <para>
20270 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
20271 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
20272 section <xref linkend="SECTnamedlists"/>.
20273 </para>
20274 </listitem>
20275 <listitem>
20276 <para>
20277 Main configuration settings: Each setting occupies one line of the file
20278 (with possible continuations). If any setting is preceded by the word
20279 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
20280 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
20281 settings.
20282 </para>
20283 </listitem>
20284 </itemizedlist>
20285 <para>
20286 This chapter specifies all the main configuration options, along with their
20287 types and default values. For ease of finding a particular option, they appear
20288 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
20289 are now so many options, they are first listed briefly in functional groups, as
20290 an aid to finding the name of the option you are looking for. Some options are
20291 listed in more than one group.
20292 </para>
20293 <section id="SECID96">
20294 <title>Miscellaneous</title>
20295 <informaltable frame="none">
20296 <tgroup cols="2" colsep="0" rowsep="0">
20297 <colspec colwidth="196pt" align="left"/>
20298 <colspec colwidth="254pt" align="left"/>
20299 <tbody>
20300 <row>
20301 <entry><option>bi_command</option></entry>
20302 <entry>to run for <option>-bi</option> command line option</entry>
20303 </row>
20304 <row>
20305 <entry><option>disable_ipv6</option></entry>
20306 <entry>do no IPv6 processing</entry>
20307 </row>
20308 <row>
20309 <entry><option>keep_malformed</option></entry>
20310 <entry>for broken files &ndash; should not happen</entry>
20311 </row>
20312 <row>
20313 <entry><option>localhost_number</option></entry>
20314 <entry>for unique message ids in clusters</entry>
20315 </row>
20316 <row>
20317 <entry><option>message_body_newlines</option></entry>
20318 <entry>retain newlines in <varname>$message_body</varname></entry>
20319 </row>
20320 <row>
20321 <entry><option>message_body_visible</option></entry>
20322 <entry>how much to show in <varname>$message_body</varname></entry>
20323 </row>
20324 <row>
20325 <entry><option>mua_wrapper</option></entry>
20326 <entry>run in <quote>MUA wrapper</quote> mode</entry>
20327 </row>
20328 <row>
20329 <entry><option>print_topbitchars</option></entry>
20330 <entry>top-bit characters are printing</entry>
20331 </row>
20332 <row>
20333 <entry><option>timezone</option></entry>
20334 <entry>force time zone</entry>
20335 </row>
20336 </tbody>
20337 </tgroup>
20338 </informaltable>
20339 </section>
20340 <section id="SECID97">
20341 <title>Exim parameters</title>
20342 <informaltable frame="none">
20343 <tgroup cols="2" colsep="0" rowsep="0">
20344 <colspec colwidth="196pt" align="left"/>
20345 <colspec colwidth="254pt" align="left"/>
20346 <tbody>
20347 <row>
20348 <entry><option>exim_group</option></entry>
20349 <entry>override compiled-in value</entry>
20350 </row>
20351 <row>
20352 <entry><option>exim_path</option></entry>
20353 <entry>override compiled-in value</entry>
20354 </row>
20355 <row>
20356 <entry><option>exim_user</option></entry>
20357 <entry>override compiled-in value</entry>
20358 </row>
20359 <row>
20360 <entry><option>primary_hostname</option></entry>
20361 <entry>default from <function>uname()</function></entry>
20362 </row>
20363 <row>
20364 <entry><option>split_spool_directory</option></entry>
20365 <entry>use multiple directories</entry>
20366 </row>
20367 <row>
20368 <entry><option>spool_directory</option></entry>
20369 <entry>override compiled-in value</entry>
20370 </row>
20371 </tbody>
20372 </tgroup>
20373 </informaltable>
20374 </section>
20375 <section id="SECID98">
20376 <title>Privilege controls</title>
20377 <informaltable frame="none">
20378 <tgroup cols="2" colsep="0" rowsep="0">
20379 <colspec colwidth="196pt" align="left"/>
20380 <colspec colwidth="254pt" align="left"/>
20381 <tbody>
20382 <row>
20383 <entry><option>admin_groups</option></entry>
20384 <entry>groups that are Exim admin users</entry>
20385 </row>
20386 <row>
20387 <entry><option>deliver_drop_privilege</option></entry>
20388 <entry>drop root for delivery processes</entry>
20389 </row>
20390 <row>
20391 <entry><option>local_from_check</option></entry>
20392 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
20393 </row>
20394 <row>
20395 <entry><option>local_from_prefix</option></entry>
20396 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20397 </row>
20398 <row>
20399 <entry><option>local_from_suffix</option></entry>
20400 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
20401 </row>
20402 <row>
20403 <entry><option>local_sender_retain</option></entry>
20404 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
20405 </row>
20406 <row>
20407 <entry><option>never_users</option></entry>
20408 <entry>do not run deliveries as these</entry>
20409 </row>
20410 <row>
20411 <entry><option>prod_requires_admin</option></entry>
20412 <entry>forced delivery requires admin user</entry>
20413 </row>
20414 <row>
20415 <entry><option>queue_list_requires_admin</option></entry>
20416 <entry>queue listing requires admin user</entry>
20417 </row>
20418 <row>
20419 <entry><option>trusted_groups</option></entry>
20420 <entry>groups that are trusted</entry>
20421 </row>
20422 <row>
20423 <entry><option>trusted_users</option></entry>
20424 <entry>users that are trusted</entry>
20425 </row>
20426 </tbody>
20427 </tgroup>
20428 </informaltable>
20429 </section>
20430 <section id="SECID99">
20431 <title>Logging</title>
20432 <informaltable frame="none">
20433 <tgroup cols="2" colsep="0" rowsep="0">
20434 <colspec colwidth="196pt" align="left"/>
20435 <colspec colwidth="254pt" align="left"/>
20436 <tbody>
20437 <row>
20438 <entry><option>hosts_connection_nolog</option></entry>
20439 <entry>exemption from connect logging</entry>
20440 </row>
20441 <row>
20442 <entry><option>log_file_path</option></entry>
20443 <entry>override compiled-in value</entry>
20444 </row>
20445 <row>
20446 <entry><option>log_selector</option></entry>
20447 <entry>set/unset optional logging</entry>
20448 </row>
20449 <row>
20450 <entry><option>log_timezone</option></entry>
20451 <entry>add timezone to log lines</entry>
20452 </row>
20453 <row>
20454 <entry><option>message_logs</option></entry>
20455 <entry>create per-message logs</entry>
20456 </row>
20457 <row>
20458 <entry><option>preserve_message_logs</option></entry>
20459 <entry>after message completion</entry>
20460 </row>
20461 <row>
20462 <entry><option>process_log_path</option></entry>
20463 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
20464 </row>
20465 <row>
20466 <entry><option>syslog_duplication</option></entry>
20467 <entry>controls duplicate log lines on syslog</entry>
20468 </row>
20469 <row>
20470 <entry><option>syslog_facility</option></entry>
20471 <entry>set syslog <quote>facility</quote> field</entry>
20472 </row>
20473 <row>
20474 <entry><option>syslog_processname</option></entry>
20475 <entry>set syslog <quote>ident</quote> field</entry>
20476 </row>
20477 <row>
20478 <entry><option>syslog_timestamp</option></entry>
20479 <entry>timestamp syslog lines</entry>
20480 </row>
20481 <row>
20482 <entry><option>write_rejectlog</option></entry>
20483 <entry>control use of message log</entry>
20484 </row>
20485 </tbody>
20486 </tgroup>
20487 </informaltable>
20488 </section>
20489 <section id="SECID100">
20490 <title>Frozen messages</title>
20491 <informaltable frame="none">
20492 <tgroup cols="2" colsep="0" rowsep="0">
20493 <colspec colwidth="196pt" align="left"/>
20494 <colspec colwidth="254pt" align="left"/>
20495 <tbody>
20496 <row>
20497 <entry><option>auto_thaw</option></entry>
20498 <entry>sets time for retrying frozen messages</entry>
20499 </row>
20500 <row>
20501 <entry><option>freeze_tell</option></entry>
20502 <entry>send message when freezing</entry>
20503 </row>
20504 <row>
20505 <entry><option>move_frozen_messages</option></entry>
20506 <entry>to another directory</entry>
20507 </row>
20508 <row>
20509 <entry><option>timeout_frozen_after</option></entry>
20510 <entry>keep frozen messages only so long</entry>
20511 </row>
20512 </tbody>
20513 </tgroup>
20514 </informaltable>
20515 </section>
20516 <section id="SECID101">
20517 <title>Data lookups</title>
20518 <informaltable frame="none">
20519 <tgroup cols="2" colsep="0" rowsep="0">
20520 <colspec colwidth="196pt" align="left"/>
20521 <colspec colwidth="254pt" align="left"/>
20522 <tbody>
20523 <row>
20524 <entry><option>ibase_servers</option></entry>
20525 <entry>InterBase servers</entry>
20526 </row>
20527 <row>
20528 <entry><option>ldap_ca_cert_dir</option></entry>
20529 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20530 </row>
20531 <row>
20532 <entry><option>ldap_ca_cert_file</option></entry>
20533 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20534 </row>
20535 <row>
20536 <entry><option>ldap_cert_file</option></entry>
20537 <entry>client cert file for LDAP</entry>
20538 </row>
20539 <row>
20540 <entry><option>ldap_cert_key</option></entry>
20541 <entry>client key file for LDAP</entry>
20542 </row>
20543 <row>
20544 <entry><option>ldap_cipher_suite</option></entry>
20545 <entry>TLS negotiation preference control</entry>
20546 </row>
20547 <row>
20548 <entry><option>ldap_default_servers</option></entry>
20549 <entry>used if no server in query</entry>
20550 </row>
20551 <row>
20552 <entry><option>ldap_require_cert</option></entry>
20553 <entry>action to take without LDAP server cert</entry>
20554 </row>
20555 <row>
20556 <entry><option>ldap_start_tls</option></entry>
20557 <entry>require TLS within LDAP</entry>
20558 </row>
20559 <row>
20560 <entry><option>ldap_version</option></entry>
20561 <entry>set protocol version</entry>
20562 </row>
20563 <row>
20564 <entry><option>lookup_open_max</option></entry>
20565 <entry>lookup files held open</entry>
20566 </row>
20567 <row>
20568 <entry><option>mysql_servers</option></entry>
20569 <entry>default MySQL servers</entry>
20570 </row>
20571 <row>
20572 <entry><option>oracle_servers</option></entry>
20573 <entry>Oracle servers</entry>
20574 </row>
20575 <row>
20576 <entry><option>pgsql_servers</option></entry>
20577 <entry>default PostgreSQL servers</entry>
20578 </row>
20579 <row>
20580 <entry><option>sqlite_lock_timeout</option></entry>
20581 <entry>as it says</entry>
20582 </row>
20583 </tbody>
20584 </tgroup>
20585 </informaltable>
20586 </section>
20587 <section id="SECID102">
20588 <title>Message ids</title>
20589 <informaltable frame="none">
20590 <tgroup cols="2" colsep="0" rowsep="0">
20591 <colspec colwidth="196pt" align="left"/>
20592 <colspec colwidth="254pt" align="left"/>
20593 <tbody>
20594 <row>
20595 <entry><option>message_id_header_domain</option></entry>
20596 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20597 </row>
20598 <row>
20599 <entry><option>message_id_header_text</option></entry>
20600 <entry>ditto</entry>
20601 </row>
20602 </tbody>
20603 </tgroup>
20604 </informaltable>
20605 </section>
20606 <section id="SECID103">
20607 <title>Embedded Perl Startup</title>
20608 <informaltable frame="none">
20609 <tgroup cols="2" colsep="0" rowsep="0">
20610 <colspec colwidth="196pt" align="left"/>
20611 <colspec colwidth="254pt" align="left"/>
20612 <tbody>
20613 <row>
20614 <entry><option>perl_at_start</option></entry>
20615 <entry>always start the interpreter</entry>
20616 </row>
20617 <row>
20618 <entry><option>perl_startup</option></entry>
20619 <entry>code to obey when starting Perl</entry>
20620 </row>
20621 </tbody>
20622 </tgroup>
20623 </informaltable>
20624 </section>
20625 <section id="SECID104">
20626 <title>Daemon</title>
20627 <informaltable frame="none">
20628 <tgroup cols="2" colsep="0" rowsep="0">
20629 <colspec colwidth="196pt" align="left"/>
20630 <colspec colwidth="254pt" align="left"/>
20631 <tbody>
20632 <row>
20633 <entry><option>daemon_smtp_ports</option></entry>
20634 <entry>default ports</entry>
20635 </row>
20636 <row>
20637 <entry><option>daemon_startup_retries</option></entry>
20638 <entry>number of times to retry</entry>
20639 </row>
20640 <row>
20641 <entry><option>daemon_startup_sleep</option></entry>
20642 <entry>time to sleep between tries</entry>
20643 </row>
20644 <row>
20645 <entry><option>extra_local_interfaces</option></entry>
20646 <entry>not necessarily listened on</entry>
20647 </row>
20648 <row>
20649 <entry><option>local_interfaces</option></entry>
20650 <entry>on which to listen, with optional ports</entry>
20651 </row>
20652 <row>
20653 <entry><option>pid_file_path</option></entry>
20654 <entry>override compiled-in value</entry>
20655 </row>
20656 <row>
20657 <entry><option>queue_run_max</option></entry>
20658 <entry>maximum simultaneous queue runners</entry>
20659 </row>
20660 </tbody>
20661 </tgroup>
20662 </informaltable>
20663 </section>
20664 <section id="SECID105">
20665 <title>Resource control</title>
20666 <informaltable frame="none">
20667 <tgroup cols="2" colsep="0" rowsep="0">
20668 <colspec colwidth="196pt" align="left"/>
20669 <colspec colwidth="254pt" align="left"/>
20670 <tbody>
20671 <row>
20672 <entry><option>check_log_inodes</option></entry>
20673 <entry>before accepting a message</entry>
20674 </row>
20675 <row>
20676 <entry><option>check_log_space</option></entry>
20677 <entry>before accepting a message</entry>
20678 </row>
20679 <row>
20680 <entry><option>check_spool_inodes</option></entry>
20681 <entry>before accepting a message</entry>
20682 </row>
20683 <row>
20684 <entry><option>check_spool_space</option></entry>
20685 <entry>before accepting a message</entry>
20686 </row>
20687 <row>
20688 <entry><option>deliver_queue_load_max</option></entry>
20689 <entry>no queue deliveries if load high</entry>
20690 </row>
20691 <row>
20692 <entry><option>queue_only_load</option></entry>
20693 <entry>queue incoming if load high</entry>
20694 </row>
20695 <row>
20696 <entry><option>queue_only_load_latch</option></entry>
20697 <entry>don&#x2019;t re-evaluate load for each message</entry>
20698 </row>
20699 <row>
20700 <entry><option>queue_run_max</option></entry>
20701 <entry>maximum simultaneous queue runners</entry>
20702 </row>
20703 <row>
20704 <entry><option>remote_max_parallel</option></entry>
20705 <entry>parallel SMTP delivery per message</entry>
20706 </row>
20707 <row>
20708 <entry><option>smtp_accept_max</option></entry>
20709 <entry>simultaneous incoming connections</entry>
20710 </row>
20711 <row>
20712 <entry><option>smtp_accept_max_nonmail</option></entry>
20713 <entry>non-mail commands</entry>
20714 </row>
20715 <row>
20716 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20717 <entry>hosts to which the limit applies</entry>
20718 </row>
20719 <row>
20720 <entry><option>smtp_accept_max_per_connection</option></entry>
20721 <entry>messages per connection</entry>
20722 </row>
20723 <row>
20724 <entry><option>smtp_accept_max_per_host</option></entry>
20725 <entry>connections from one host</entry>
20726 </row>
20727 <row>
20728 <entry><option>smtp_accept_queue</option></entry>
20729 <entry>queue mail if more connections</entry>
20730 </row>
20731 <row>
20732 <entry><option>smtp_accept_queue_per_connection</option></entry>
20733 <entry>queue if more messages per connection</entry>
20734 </row>
20735 <row>
20736 <entry><option>smtp_accept_reserve</option></entry>
20737 <entry>only reserve hosts if more connections</entry>
20738 </row>
20739 <row>
20740 <entry><option>smtp_check_spool_space</option></entry>
20741 <entry>from SIZE on MAIL command</entry>
20742 </row>
20743 <row>
20744 <entry><option>smtp_connect_backlog</option></entry>
20745 <entry>passed to TCP/IP stack</entry>
20746 </row>
20747 <row>
20748 <entry><option>smtp_load_reserve</option></entry>
20749 <entry>SMTP from reserved hosts if load high</entry>
20750 </row>
20751 <row>
20752 <entry><option>smtp_reserve_hosts</option></entry>
20753 <entry>these are the reserve hosts</entry>
20754 </row>
20755 </tbody>
20756 </tgroup>
20757 </informaltable>
20758 </section>
20759 <section id="SECID106">
20760 <title>Policy controls</title>
20761 <informaltable frame="none">
20762 <tgroup cols="2" colsep="0" rowsep="0">
20763 <colspec colwidth="196pt" align="left"/>
20764 <colspec colwidth="254pt" align="left"/>
20765 <tbody>
20766 <row>
20767 <entry><option>acl_not_smtp</option></entry>
20768 <entry>ACL for non-SMTP messages</entry>
20769 </row>
20770 <row>
20771 <entry><option>acl_not_smtp_mime</option></entry>
20772 <entry>ACL for non-SMTP MIME parts</entry>
20773 </row>
20774 <row>
20775 <entry><option>acl_not_smtp_start</option></entry>
20776 <entry>ACL for start of non-SMTP message</entry>
20777 </row>
20778 <row>
20779 <entry><option>acl_smtp_auth</option></entry>
20780 <entry>ACL for AUTH</entry>
20781 </row>
20782 <row>
20783 <entry><option>acl_smtp_connect</option></entry>
20784 <entry>ACL for connection</entry>
20785 </row>
20786 <row>
20787 <entry><option>acl_smtp_data</option></entry>
20788 <entry>ACL for DATA</entry>
20789 </row>
20790 <row>
20791 <entry><option>acl_smtp_data_prdr</option></entry>
20792 <entry>ACL for DATA, per-recipient</entry>
20793 </row>
20794 <row>
20795 <entry><option>acl_smtp_dkim</option></entry>
20796 <entry>ACL for DKIM verification</entry>
20797 </row>
20798 <row>
20799 <entry><option>acl_smtp_etrn</option></entry>
20800 <entry>ACL for ETRN</entry>
20801 </row>
20802 <row>
20803 <entry><option>acl_smtp_expn</option></entry>
20804 <entry>ACL for EXPN</entry>
20805 </row>
20806 <row>
20807 <entry><option>acl_smtp_helo</option></entry>
20808 <entry>ACL for EHLO or HELO</entry>
20809 </row>
20810 <row>
20811 <entry><option>acl_smtp_mail</option></entry>
20812 <entry>ACL for MAIL</entry>
20813 </row>
20814 <row>
20815 <entry><option>acl_smtp_mailauth</option></entry>
20816 <entry>ACL for AUTH on MAIL command</entry>
20817 </row>
20818 <row>
20819 <entry><option>acl_smtp_mime</option></entry>
20820 <entry>ACL for MIME parts</entry>
20821 </row>
20822 <row>
20823 <entry><option>acl_smtp_predata</option></entry>
20824 <entry>ACL for start of data</entry>
20825 </row>
20826 <row>
20827 <entry><option>acl_smtp_quit</option></entry>
20828 <entry>ACL for QUIT</entry>
20829 </row>
20830 <row>
20831 <entry><option>acl_smtp_rcpt</option></entry>
20832 <entry>ACL for RCPT</entry>
20833 </row>
20834 <row>
20835 <entry><option>acl_smtp_starttls</option></entry>
20836 <entry>ACL for STARTTLS</entry>
20837 </row>
20838 <row>
20839 <entry><option>acl_smtp_vrfy</option></entry>
20840 <entry>ACL for VRFY</entry>
20841 </row>
20842 <row>
20843 <entry><option>av_scanner</option></entry>
20844 <entry>specify virus scanner</entry>
20845 </row>
20846 <row>
20847 <entry><option>check_rfc2047_length</option></entry>
20848 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20849 </row>
20850 <row>
20851 <entry><option>dns_csa_search_limit</option></entry>
20852 <entry>control CSA parent search depth</entry>
20853 </row>
20854 <row>
20855 <entry><option>dns_csa_use_reverse</option></entry>
20856 <entry>en/disable CSA IP reverse search</entry>
20857 </row>
20858 <row>
20859 <entry><option>header_maxsize</option></entry>
20860 <entry>total size of message header</entry>
20861 </row>
20862 <row>
20863 <entry><option>header_line_maxsize</option></entry>
20864 <entry>individual header line limit</entry>
20865 </row>
20866 <row>
20867 <entry><option>helo_accept_junk_hosts</option></entry>
20868 <entry>allow syntactic junk from these hosts</entry>
20869 </row>
20870 <row>
20871 <entry><option>helo_allow_chars</option></entry>
20872 <entry>allow illegal chars in HELO names</entry>
20873 </row>
20874 <row>
20875 <entry><option>helo_lookup_domains</option></entry>
20876 <entry>lookup hostname for these HELO names</entry>
20877 </row>
20878 <row>
20879 <entry><option>helo_try_verify_hosts</option></entry>
20880 <entry>HELO soft-checked for these hosts</entry>
20881 </row>
20882 <row>
20883 <entry><option>helo_verify_hosts</option></entry>
20884 <entry>HELO hard-checked for these hosts</entry>
20885 </row>
20886 <row>
20887 <entry><option>host_lookup</option></entry>
20888 <entry>host name looked up for these hosts</entry>
20889 </row>
20890 <row>
20891 <entry><option>host_lookup_order</option></entry>
20892 <entry>order of DNS and local name lookups</entry>
20893 </row>
20894 <row>
20895 <entry><option>host_reject_connection</option></entry>
20896 <entry>reject connection from these hosts</entry>
20897 </row>
20898 <row>
20899 <entry><option>hosts_treat_as_local</option></entry>
20900 <entry>useful in some cluster configurations</entry>
20901 </row>
20902 <row>
20903 <entry><option>local_scan_timeout</option></entry>
20904 <entry>timeout for <function>local_scan()</function></entry>
20905 </row>
20906 <row>
20907 <entry><option>message_size_limit</option></entry>
20908 <entry>for all messages</entry>
20909 </row>
20910 <row>
20911 <entry><option>percent_hack_domains</option></entry>
20912 <entry>recognize %-hack for these domains</entry>
20913 </row>
20914 <row>
20915 <entry><option>spamd_address</option></entry>
20916 <entry>set interface to SpamAssassin</entry>
20917 </row>
20918 <row>
20919 <entry><option>strict_acl_vars</option></entry>
20920 <entry>object to unset ACL variables</entry>
20921 </row>
20922 </tbody>
20923 </tgroup>
20924 </informaltable>
20925 </section>
20926 <section id="SECID107">
20927 <title>Callout cache</title>
20928 <informaltable frame="none">
20929 <tgroup cols="2" colsep="0" rowsep="0">
20930 <colspec colwidth="196pt" align="left"/>
20931 <colspec colwidth="254pt" align="left"/>
20932 <tbody>
20933 <row>
20934 <entry><option>callout_domain_negative_expire</option></entry>
20935 <entry>timeout for negative domain cache item</entry>
20936 </row>
20937 <row>
20938 <entry><option>callout_domain_positive_expire</option></entry>
20939 <entry>timeout for positive domain cache item</entry>
20940 </row>
20941 <row>
20942 <entry><option>callout_negative_expire</option></entry>
20943 <entry>timeout for negative address cache item</entry>
20944 </row>
20945 <row>
20946 <entry><option>callout_positive_expire</option></entry>
20947 <entry>timeout for positive address cache item</entry>
20948 </row>
20949 <row>
20950 <entry><option>callout_random_local_part</option></entry>
20951 <entry>string to use for <quote>random</quote> testing</entry>
20952 </row>
20953 </tbody>
20954 </tgroup>
20955 </informaltable>
20956 </section>
20957 <section id="SECID108">
20958 <title>TLS</title>
20959 <informaltable frame="none">
20960 <tgroup cols="2" colsep="0" rowsep="0">
20961 <colspec colwidth="196pt" align="left"/>
20962 <colspec colwidth="254pt" align="left"/>
20963 <tbody>
20964 <row>
20965 <entry><option>gnutls_compat_mode</option></entry>
20966 <entry>use GnuTLS compatibility mode</entry>
20967 </row>
20968 <row>
20969 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
20970 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
20971 </row>
20972 <row>
20973 <entry><option>openssl_options</option></entry>
20974 <entry>adjust OpenSSL compatibility options</entry>
20975 </row>
20976 <row>
20977 <entry><option>tls_advertise_hosts</option></entry>
20978 <entry>advertise TLS to these hosts</entry>
20979 </row>
20980 <row>
20981 <entry><option>tls_certificate</option></entry>
20982 <entry>location of server certificate</entry>
20983 </row>
20984 <row>
20985 <entry><option>tls_crl</option></entry>
20986 <entry>certificate revocation list</entry>
20987 </row>
20988 <row>
20989 <entry><option>tls_dh_max_bits</option></entry>
20990 <entry>clamp D-H bit count suggestion</entry>
20991 </row>
20992 <row>
20993 <entry><option>tls_dhparam</option></entry>
20994 <entry>DH parameters for server</entry>
20995 </row>
20996 <row>
20997 <entry><option>tls_ocsp_file</option></entry>
20998 <entry>location of server certificate status proof</entry>
20999 </row>
21000 <row>
21001 <entry><option>tls_on_connect_ports</option></entry>
21002 <entry>specify SSMTP (SMTPS) ports</entry>
21003 </row>
21004 <row>
21005 <entry><option>tls_privatekey</option></entry>
21006 <entry>location of server private key</entry>
21007 </row>
21008 <row>
21009 <entry><option>tls_remember_esmtp</option></entry>
21010 <entry>don&#x2019;t reset after starting TLS</entry>
21011 </row>
21012 <row>
21013 <entry><option>tls_require_ciphers</option></entry>
21014 <entry>specify acceptable ciphers</entry>
21015 </row>
21016 <row>
21017 <entry><option>tls_try_verify_hosts</option></entry>
21018 <entry>try to verify client certificate</entry>
21019 </row>
21020 <row>
21021 <entry><option>tls_verify_certificates</option></entry>
21022 <entry>expected client certificates</entry>
21023 </row>
21024 <row>
21025 <entry><option>tls_verify_hosts</option></entry>
21026 <entry>insist on client certificate verify</entry>
21027 </row>
21028 </tbody>
21029 </tgroup>
21030 </informaltable>
21031 </section>
21032 <section id="SECID109">
21033 <title>Local user handling</title>
21034 <informaltable frame="none">
21035 <tgroup cols="2" colsep="0" rowsep="0">
21036 <colspec colwidth="196pt" align="left"/>
21037 <colspec colwidth="254pt" align="left"/>
21038 <tbody>
21039 <row>
21040 <entry><option>finduser_retries</option></entry>
21041 <entry>useful in NIS environments</entry>
21042 </row>
21043 <row>
21044 <entry><option>gecos_name</option></entry>
21045 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21046 </row>
21047 <row>
21048 <entry><option>gecos_pattern</option></entry>
21049 <entry>ditto</entry>
21050 </row>
21051 <row>
21052 <entry><option>max_username_length</option></entry>
21053 <entry>for systems that truncate</entry>
21054 </row>
21055 <row>
21056 <entry><option>unknown_login</option></entry>
21057 <entry>used when no login name found</entry>
21058 </row>
21059 <row>
21060 <entry><option>unknown_username</option></entry>
21061 <entry>ditto</entry>
21062 </row>
21063 <row>
21064 <entry><option>uucp_from_pattern</option></entry>
21065 <entry>for recognizing <quote>From </quote> lines</entry>
21066 </row>
21067 <row>
21068 <entry><option>uucp_from_sender</option></entry>
21069 <entry>ditto</entry>
21070 </row>
21071 </tbody>
21072 </tgroup>
21073 </informaltable>
21074 </section>
21075 <section id="SECID110">
21076 <title>All incoming messages (SMTP and non-SMTP)</title>
21077 <informaltable frame="none">
21078 <tgroup cols="2" colsep="0" rowsep="0">
21079 <colspec colwidth="196pt" align="left"/>
21080 <colspec colwidth="254pt" align="left"/>
21081 <tbody>
21082 <row>
21083 <entry><option>header_maxsize</option></entry>
21084 <entry>total size of message header</entry>
21085 </row>
21086 <row>
21087 <entry><option>header_line_maxsize</option></entry>
21088 <entry>individual header line limit</entry>
21089 </row>
21090 <row>
21091 <entry><option>message_size_limit</option></entry>
21092 <entry>applies to all messages</entry>
21093 </row>
21094 <row>
21095 <entry><option>percent_hack_domains</option></entry>
21096 <entry>recognize %-hack for these domains</entry>
21097 </row>
21098 <row>
21099 <entry><option>received_header_text</option></entry>
21100 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21101 </row>
21102 <row>
21103 <entry><option>received_headers_max</option></entry>
21104 <entry>for mail loop detection</entry>
21105 </row>
21106 <row>
21107 <entry><option>recipients_max</option></entry>
21108 <entry>limit per message</entry>
21109 </row>
21110 <row>
21111 <entry><option>recipients_max_reject</option></entry>
21112 <entry>permanently reject excess recipients</entry>
21113 </row>
21114 </tbody>
21115 </tgroup>
21116 </informaltable>
21117 </section>
21118 <section id="SECID111">
21119 <title>Non-SMTP incoming messages</title>
21120 <informaltable frame="none">
21121 <tgroup cols="2" colsep="0" rowsep="0">
21122 <colspec colwidth="196pt" align="left"/>
21123 <colspec colwidth="254pt" align="left"/>
21124 <tbody>
21125 <row>
21126 <entry><option>receive_timeout</option></entry>
21127 <entry>for non-SMTP messages</entry>
21128 </row>
21129 </tbody>
21130 </tgroup>
21131 </informaltable>
21132 </section>
21133 <section id="SECID112">
21134 <title>Incoming SMTP messages</title>
21135 <para>
21136 See also the <emphasis>Policy controls</emphasis> section above.
21137 </para>
21138 <informaltable frame="none">
21139 <tgroup cols="2" colsep="0" rowsep="0">
21140 <colspec colwidth="196pt" align="left"/>
21141 <colspec colwidth="254pt" align="left"/>
21142 <tbody>
21143 <row>
21144 <entry><option>host_lookup</option></entry>
21145 <entry>host name looked up for these hosts</entry>
21146 </row>
21147 <row>
21148 <entry><option>host_lookup_order</option></entry>
21149 <entry>order of DNS and local name lookups</entry>
21150 </row>
21151 <row>
21152 <entry><option>recipient_unqualified_hosts</option></entry>
21153 <entry>may send unqualified recipients</entry>
21154 </row>
21155 <row>
21156 <entry><option>rfc1413_hosts</option></entry>
21157 <entry>make ident calls to these hosts</entry>
21158 </row>
21159 <row>
21160 <entry><option>rfc1413_query_timeout</option></entry>
21161 <entry>zero disables ident calls</entry>
21162 </row>
21163 <row>
21164 <entry><option>sender_unqualified_hosts</option></entry>
21165 <entry>may send unqualified senders</entry>
21166 </row>
21167 <row>
21168 <entry><option>smtp_accept_keepalive</option></entry>
21169 <entry>some TCP/IP magic</entry>
21170 </row>
21171 <row>
21172 <entry><option>smtp_accept_max</option></entry>
21173 <entry>simultaneous incoming connections</entry>
21174 </row>
21175 <row>
21176 <entry><option>smtp_accept_max_nonmail</option></entry>
21177 <entry>non-mail commands</entry>
21178 </row>
21179 <row>
21180 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21181 <entry>hosts to which the limit applies</entry>
21182 </row>
21183 <row>
21184 <entry><option>smtp_accept_max_per_connection</option></entry>
21185 <entry>messages per connection</entry>
21186 </row>
21187 <row>
21188 <entry><option>smtp_accept_max_per_host</option></entry>
21189 <entry>connections from one host</entry>
21190 </row>
21191 <row>
21192 <entry><option>smtp_accept_queue</option></entry>
21193 <entry>queue mail if more connections</entry>
21194 </row>
21195 <row>
21196 <entry><option>smtp_accept_queue_per_connection</option></entry>
21197 <entry>queue if more messages per connection</entry>
21198 </row>
21199 <row>
21200 <entry><option>smtp_accept_reserve</option></entry>
21201 <entry>only reserve hosts if more connections</entry>
21202 </row>
21203 <row>
21204 <entry><option>smtp_active_hostname</option></entry>
21205 <entry>host name to use in messages</entry>
21206 </row>
21207 <row>
21208 <entry><option>smtp_banner</option></entry>
21209 <entry>text for welcome banner</entry>
21210 </row>
21211 <row>
21212 <entry><option>smtp_check_spool_space</option></entry>
21213 <entry>from SIZE on MAIL command</entry>
21214 </row>
21215 <row>
21216 <entry><option>smtp_connect_backlog</option></entry>
21217 <entry>passed to TCP/IP stack</entry>
21218 </row>
21219 <row>
21220 <entry><option>smtp_enforce_sync</option></entry>
21221 <entry>of SMTP command/responses</entry>
21222 </row>
21223 <row>
21224 <entry><option>smtp_etrn_command</option></entry>
21225 <entry>what to run for ETRN</entry>
21226 </row>
21227 <row>
21228 <entry><option>smtp_etrn_serialize</option></entry>
21229 <entry>only one at once</entry>
21230 </row>
21231 <row>
21232 <entry><option>smtp_load_reserve</option></entry>
21233 <entry>only reserve hosts if this load</entry>
21234 </row>
21235 <row>
21236 <entry><option>smtp_max_unknown_commands</option></entry>
21237 <entry>before dropping connection</entry>
21238 </row>
21239 <row>
21240 <entry><option>smtp_ratelimit_hosts</option></entry>
21241 <entry>apply ratelimiting to these hosts</entry>
21242 </row>
21243 <row>
21244 <entry><option>smtp_ratelimit_mail</option></entry>
21245 <entry>ratelimit for MAIL commands</entry>
21246 </row>
21247 <row>
21248 <entry><option>smtp_ratelimit_rcpt</option></entry>
21249 <entry>ratelimit for RCPT commands</entry>
21250 </row>
21251 <row>
21252 <entry><option>smtp_receive_timeout</option></entry>
21253 <entry>per command or data line</entry>
21254 </row>
21255 <row>
21256 <entry><option>smtp_reserve_hosts</option></entry>
21257 <entry>these are the reserve hosts</entry>
21258 </row>
21259 <row>
21260 <entry><option>smtp_return_error_details</option></entry>
21261 <entry>give detail on rejections</entry>
21262 </row>
21263 </tbody>
21264 </tgroup>
21265 </informaltable>
21266 </section>
21267 <section id="SECID113">
21268 <title>SMTP extensions</title>
21269 <informaltable frame="none">
21270 <tgroup cols="2" colsep="0" rowsep="0">
21271 <colspec colwidth="196pt" align="left"/>
21272 <colspec colwidth="254pt" align="left"/>
21273 <tbody>
21274 <row>
21275 <entry><option>accept_8bitmime</option></entry>
21276 <entry>advertise 8BITMIME</entry>
21277 </row>
21278 <row>
21279 <entry><option>auth_advertise_hosts</option></entry>
21280 <entry>advertise AUTH to these hosts</entry>
21281 </row>
21282 <row>
21283 <entry><option>ignore_fromline_hosts</option></entry>
21284 <entry>allow <quote>From </quote> from these hosts</entry>
21285 </row>
21286 <row>
21287 <entry><option>ignore_fromline_local</option></entry>
21288 <entry>allow <quote>From </quote> from local SMTP</entry>
21289 </row>
21290 <row>
21291 <entry><option>pipelining_advertise_hosts</option></entry>
21292 <entry>advertise pipelining to these hosts</entry>
21293 </row>
21294 <row>
21295 <entry><option>prdr_enable</option></entry>
21296 <entry>advertise PRDR to all hosts</entry>
21297 </row>
21298 <row>
21299 <entry><option>tls_advertise_hosts</option></entry>
21300 <entry>advertise TLS to these hosts</entry>
21301 </row>
21302 </tbody>
21303 </tgroup>
21304 </informaltable>
21305 </section>
21306 <section id="SECID114">
21307 <title>Processing messages</title>
21308 <informaltable frame="none">
21309 <tgroup cols="2" colsep="0" rowsep="0">
21310 <colspec colwidth="196pt" align="left"/>
21311 <colspec colwidth="254pt" align="left"/>
21312 <tbody>
21313 <row>
21314 <entry><option>allow_domain_literals</option></entry>
21315 <entry>recognize domain literal syntax</entry>
21316 </row>
21317 <row>
21318 <entry><option>allow_mx_to_ip</option></entry>
21319 <entry>allow MX to point to IP address</entry>
21320 </row>
21321 <row>
21322 <entry><option>allow_utf8_domains</option></entry>
21323 <entry>in addresses</entry>
21324 </row>
21325 <row>
21326 <entry><option>check_rfc2047_length</option></entry>
21327 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21328 </row>
21329 <row>
21330 <entry><option>delivery_date_remove</option></entry>
21331 <entry>from incoming messages</entry>
21332 </row>
21333 <row>
21334 <entry><option>envelope_to_remove</option></entry>
21335 <entry>from incoming messages</entry>
21336 </row>
21337 <row>
21338 <entry><option>extract_addresses_remove_arguments</option></entry>
21339 <entry>affects <option>-t</option> processing</entry>
21340 </row>
21341 <row>
21342 <entry><option>headers_charset</option></entry>
21343 <entry>default for translations</entry>
21344 </row>
21345 <row>
21346 <entry><option>qualify_domain</option></entry>
21347 <entry>default for senders</entry>
21348 </row>
21349 <row>
21350 <entry><option>qualify_recipient</option></entry>
21351 <entry>default for recipients</entry>
21352 </row>
21353 <row>
21354 <entry><option>return_path_remove</option></entry>
21355 <entry>from incoming messages</entry>
21356 </row>
21357 <row>
21358 <entry><option>strip_excess_angle_brackets</option></entry>
21359 <entry>in addresses</entry>
21360 </row>
21361 <row>
21362 <entry><option>strip_trailing_dot</option></entry>
21363 <entry>at end of addresses</entry>
21364 </row>
21365 <row>
21366 <entry><option>untrusted_set_sender</option></entry>
21367 <entry>untrusted can set envelope sender</entry>
21368 </row>
21369 </tbody>
21370 </tgroup>
21371 </informaltable>
21372 </section>
21373 <section id="SECID115">
21374 <title>System filter</title>
21375 <informaltable frame="none">
21376 <tgroup cols="2" colsep="0" rowsep="0">
21377 <colspec colwidth="196pt" align="left"/>
21378 <colspec colwidth="254pt" align="left"/>
21379 <tbody>
21380 <row>
21381 <entry><option>system_filter</option></entry>
21382 <entry>locate system filter</entry>
21383 </row>
21384 <row>
21385 <entry><option>system_filter_directory_transport</option></entry>
21386 <entry>transport for delivery to a directory</entry>
21387 </row>
21388 <row>
21389 <entry><option>system_filter_file_transport</option></entry>
21390 <entry>transport for delivery to a file</entry>
21391 </row>
21392 <row>
21393 <entry><option>system_filter_group</option></entry>
21394 <entry>group for filter running</entry>
21395 </row>
21396 <row>
21397 <entry><option>system_filter_pipe_transport</option></entry>
21398 <entry>transport for delivery to a pipe</entry>
21399 </row>
21400 <row>
21401 <entry><option>system_filter_reply_transport</option></entry>
21402 <entry>transport for autoreply delivery</entry>
21403 </row>
21404 <row>
21405 <entry><option>system_filter_user</option></entry>
21406 <entry>user for filter running</entry>
21407 </row>
21408 </tbody>
21409 </tgroup>
21410 </informaltable>
21411 </section>
21412 <section id="SECID116">
21413 <title>Routing and delivery</title>
21414 <informaltable frame="none">
21415 <tgroup cols="2" colsep="0" rowsep="0">
21416 <colspec colwidth="196pt" align="left"/>
21417 <colspec colwidth="254pt" align="left"/>
21418 <tbody>
21419 <row>
21420 <entry><option>disable_ipv6</option></entry>
21421 <entry>do no IPv6 processing</entry>
21422 </row>
21423 <row>
21424 <entry><option>dns_again_means_nonexist</option></entry>
21425 <entry>for broken domains</entry>
21426 </row>
21427 <row>
21428 <entry><option>dns_check_names_pattern</option></entry>
21429 <entry>pre-DNS syntax check</entry>
21430 </row>
21431 <row>
21432 <entry><option>dns_dnssec_ok</option></entry>
21433 <entry>parameter for resolver</entry>
21434 </row>
21435 <row>
21436 <entry><option>dns_ipv4_lookup</option></entry>
21437 <entry>only v4 lookup for these domains</entry>
21438 </row>
21439 <row>
21440 <entry><option>dns_retrans</option></entry>
21441 <entry>parameter for resolver</entry>
21442 </row>
21443 <row>
21444 <entry><option>dns_retry</option></entry>
21445 <entry>parameter for resolver</entry>
21446 </row>
21447 <row>
21448 <entry><option>dns_use_edns0</option></entry>
21449 <entry>parameter for resolver</entry>
21450 </row>
21451 <row>
21452 <entry><option>hold_domains</option></entry>
21453 <entry>hold delivery for these domains</entry>
21454 </row>
21455 <row>
21456 <entry><option>local_interfaces</option></entry>
21457 <entry>for routing checks</entry>
21458 </row>
21459 <row>
21460 <entry><option>queue_domains</option></entry>
21461 <entry>no immediate delivery for these</entry>
21462 </row>
21463 <row>
21464 <entry><option>queue_only</option></entry>
21465 <entry>no immediate delivery at all</entry>
21466 </row>
21467 <row>
21468 <entry><option>queue_only_file</option></entry>
21469 <entry>no immediate delivery if file exists</entry>
21470 </row>
21471 <row>
21472 <entry><option>queue_only_load</option></entry>
21473 <entry>no immediate delivery if load is high</entry>
21474 </row>
21475 <row>
21476 <entry><option>queue_only_load_latch</option></entry>
21477 <entry>don&#x2019;t re-evaluate load for each message</entry>
21478 </row>
21479 <row>
21480 <entry><option>queue_only_override</option></entry>
21481 <entry>allow command line to override</entry>
21482 </row>
21483 <row>
21484 <entry><option>queue_run_in_order</option></entry>
21485 <entry>order of arrival</entry>
21486 </row>
21487 <row>
21488 <entry><option>queue_run_max</option></entry>
21489 <entry>of simultaneous queue runners</entry>
21490 </row>
21491 <row>
21492 <entry><option>queue_smtp_domains</option></entry>
21493 <entry>no immediate SMTP delivery for these</entry>
21494 </row>
21495 <row>
21496 <entry><option>remote_max_parallel</option></entry>
21497 <entry>parallel SMTP delivery per message</entry>
21498 </row>
21499 <row>
21500 <entry><option>remote_sort_domains</option></entry>
21501 <entry>order of remote deliveries</entry>
21502 </row>
21503 <row>
21504 <entry><option>retry_data_expire</option></entry>
21505 <entry>timeout for retry data</entry>
21506 </row>
21507 <row>
21508 <entry><option>retry_interval_max</option></entry>
21509 <entry>safety net for retry rules</entry>
21510 </row>
21511 </tbody>
21512 </tgroup>
21513 </informaltable>
21514 </section>
21515 <section id="SECID117">
21516 <title>Bounce and warning messages</title>
21517 <informaltable frame="none">
21518 <tgroup cols="2" colsep="0" rowsep="0">
21519 <colspec colwidth="196pt" align="left"/>
21520 <colspec colwidth="254pt" align="left"/>
21521 <tbody>
21522 <row>
21523 <entry><option>bounce_message_file</option></entry>
21524 <entry>content of bounce</entry>
21525 </row>
21526 <row>
21527 <entry><option>bounce_message_text</option></entry>
21528 <entry>content of bounce</entry>
21529 </row>
21530 <row>
21531 <entry><option>bounce_return_body</option></entry>
21532 <entry>include body if returning message</entry>
21533 </row>
21534 <row>
21535 <entry><option>bounce_return_message</option></entry>
21536 <entry>include original message in bounce</entry>
21537 </row>
21538 <row>
21539 <entry><option>bounce_return_size_limit</option></entry>
21540 <entry>limit on returned message</entry>
21541 </row>
21542 <row>
21543 <entry><option>bounce_sender_authentication</option></entry>
21544 <entry>send authenticated sender with bounce</entry>
21545 </row>
21546 <row>
21547 <entry><option>dsn_from</option></entry>
21548 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21549 </row>
21550 <row>
21551 <entry><option>errors_copy</option></entry>
21552 <entry>copy bounce messages</entry>
21553 </row>
21554 <row>
21555 <entry><option>errors_reply_to</option></entry>
21556 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21557 </row>
21558 <row>
21559 <entry><option>delay_warning</option></entry>
21560 <entry>time schedule</entry>
21561 </row>
21562 <row>
21563 <entry><option>delay_warning_condition</option></entry>
21564 <entry>condition for warning messages</entry>
21565 </row>
21566 <row>
21567 <entry><option>ignore_bounce_errors_after</option></entry>
21568 <entry>discard undeliverable bounces</entry>
21569 </row>
21570 <row>
21571 <entry><option>smtp_return_error_details</option></entry>
21572 <entry>give detail on rejections</entry>
21573 </row>
21574 <row>
21575 <entry><option>warn_message_file</option></entry>
21576 <entry>content of warning message</entry>
21577 </row>
21578 </tbody>
21579 </tgroup>
21580 </informaltable>
21581 </section>
21582 <section id="SECTalomo">
21583 <title>Alphabetical list of main options</title>
21584 <para>
21585 Those options that undergo string expansion before use are marked with
21586 &dagger;.
21587 </para>
21588 <para>
21589 <indexterm role="option">
21590 <primary><option>accept_8bitmime</option></primary>
21591 </indexterm>
21592 </para>
21593 <informaltable frame="all">
21594 <tgroup cols="4" colsep="0" rowsep="0">
21595 <colspec colwidth="8*" align="left"/>
21596 <colspec colwidth="6*" align="center"/>
21597 <colspec colwidth="6*" align="center"/>
21598 <colspec colwidth="6*" align="right"/>
21599 <tbody>
21600 <row>
21601 <entry><option>accept_8bitmime</option></entry>
21602 <entry>Use: <emphasis>main</emphasis></entry>
21603 <entry>Type: <emphasis>boolean</emphasis></entry>
21604 <entry>Default: <emphasis>true</emphasis></entry>
21605 </row>
21606 </tbody>
21607 </tgroup>
21608 </informaltable>
21609 <para>
21610 <indexterm role="concept">
21611 <primary>8BITMIME</primary>
21612 </indexterm>
21613 <indexterm role="concept">
21614 <primary>8-bit characters</primary>
21615 </indexterm>
21616 <indexterm role="concept">
21617 <primary>log</primary>
21618 <secondary>selectors</secondary>
21619 </indexterm>
21620 <indexterm role="concept">
21621 <primary>log</primary>
21622 <secondary>8BITMIME</secondary>
21623 </indexterm>
21624 This option causes Exim to send 8BITMIME in its response to an SMTP
21625 EHLO command, and to accept the BODY= parameter on MAIL commands.
21626 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21627 takes no steps to do anything special with messages received by this route.
21628 </para>
21629 <para>
21630 Historically Exim kept this option off by default, but the maintainers
21631 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21632 It now defaults to true.
21633 A more detailed analysis of the issues is provided by Dan Bernstein:
21634 </para>
21635 <literallayout>
21636 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21637 </literallayout>
21638 <para>
21639 To log received 8BITMIME status use
21640 </para>
21641 <literallayout class="monospaced">
21642 log_selector = +8bitmime
21643 </literallayout>
21644 <para>
21645 <indexterm role="option">
21646 <primary><option>acl_not_smtp</option></primary>
21647 </indexterm>
21648 </para>
21649 <informaltable frame="all">
21650 <tgroup cols="4" colsep="0" rowsep="0">
21651 <colspec colwidth="8*" align="left"/>
21652 <colspec colwidth="6*" align="center"/>
21653 <colspec colwidth="6*" align="center"/>
21654 <colspec colwidth="6*" align="right"/>
21655 <tbody>
21656 <row>
21657 <entry><option>acl_not_smtp</option></entry>
21658 <entry>Use: <emphasis>main</emphasis></entry>
21659 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21660 <entry>Default: <emphasis>unset</emphasis></entry>
21661 </row>
21662 </tbody>
21663 </tgroup>
21664 </informaltable>
21665 <para>
21666 <indexterm role="concept">
21667 <primary>access control lists (ACLs)</primary>
21668 <secondary>for non-SMTP messages</secondary>
21669 </indexterm>
21670 <indexterm role="concept">
21671 <primary>non-SMTP messages</primary>
21672 <secondary>ACLs for</secondary>
21673 </indexterm>
21674 This option defines the ACL that is run when a non-SMTP message has been
21675 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21676 further details.
21677 </para>
21678 <para>
21679 <indexterm role="option">
21680 <primary><option>acl_not_smtp_mime</option></primary>
21681 </indexterm>
21682 </para>
21683 <informaltable frame="all">
21684 <tgroup cols="4" colsep="0" rowsep="0">
21685 <colspec colwidth="8*" align="left"/>
21686 <colspec colwidth="6*" align="center"/>
21687 <colspec colwidth="6*" align="center"/>
21688 <colspec colwidth="6*" align="right"/>
21689 <tbody>
21690 <row>
21691 <entry><option>acl_not_smtp_mime</option></entry>
21692 <entry>Use: <emphasis>main</emphasis></entry>
21693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21694 <entry>Default: <emphasis>unset</emphasis></entry>
21695 </row>
21696 </tbody>
21697 </tgroup>
21698 </informaltable>
21699 <para>
21700 This option defines the ACL that is run for individual MIME parts of non-SMTP
21701 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21702 SMTP messages.
21703 </para>
21704 <para>
21705 <indexterm role="option">
21706 <primary><option>acl_not_smtp_start</option></primary>
21707 </indexterm>
21708 </para>
21709 <informaltable frame="all">
21710 <tgroup cols="4" colsep="0" rowsep="0">
21711 <colspec colwidth="8*" align="left"/>
21712 <colspec colwidth="6*" align="center"/>
21713 <colspec colwidth="6*" align="center"/>
21714 <colspec colwidth="6*" align="right"/>
21715 <tbody>
21716 <row>
21717 <entry><option>acl_not_smtp_start</option></entry>
21718 <entry>Use: <emphasis>main</emphasis></entry>
21719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21720 <entry>Default: <emphasis>unset</emphasis></entry>
21721 </row>
21722 </tbody>
21723 </tgroup>
21724 </informaltable>
21725 <para>
21726 <indexterm role="concept">
21727 <primary>access control lists (ACLs)</primary>
21728 <secondary>at start of non-SMTP message</secondary>
21729 </indexterm>
21730 <indexterm role="concept">
21731 <primary>non-SMTP messages</primary>
21732 <secondary>ACLs for</secondary>
21733 </indexterm>
21734 This option defines the ACL that is run before Exim starts reading a
21735 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21736 </para>
21737 <para>
21738 <indexterm role="option">
21739 <primary><option>acl_smtp_auth</option></primary>
21740 </indexterm>
21741 </para>
21742 <informaltable frame="all">
21743 <tgroup cols="4" colsep="0" rowsep="0">
21744 <colspec colwidth="8*" align="left"/>
21745 <colspec colwidth="6*" align="center"/>
21746 <colspec colwidth="6*" align="center"/>
21747 <colspec colwidth="6*" align="right"/>
21748 <tbody>
21749 <row>
21750 <entry><option>acl_smtp_auth</option></entry>
21751 <entry>Use: <emphasis>main</emphasis></entry>
21752 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21753 <entry>Default: <emphasis>unset</emphasis></entry>
21754 </row>
21755 </tbody>
21756 </tgroup>
21757 </informaltable>
21758 <para>
21759 <indexterm role="concept">
21760 <primary>access control lists (ACLs)</primary>
21761 <secondary>setting up for SMTP commands</secondary>
21762 </indexterm>
21763 <indexterm role="concept">
21764 <primary>AUTH</primary>
21765 <secondary>ACL for</secondary>
21766 </indexterm>
21767 This option defines the ACL that is run when an SMTP AUTH command is
21768 received. See chapter <xref linkend="CHAPACL"/> for further details.
21769 </para>
21770 <para>
21771 <indexterm role="option">
21772 <primary><option>acl_smtp_connect</option></primary>
21773 </indexterm>
21774 </para>
21775 <informaltable frame="all">
21776 <tgroup cols="4" colsep="0" rowsep="0">
21777 <colspec colwidth="8*" align="left"/>
21778 <colspec colwidth="6*" align="center"/>
21779 <colspec colwidth="6*" align="center"/>
21780 <colspec colwidth="6*" align="right"/>
21781 <tbody>
21782 <row>
21783 <entry><option>acl_smtp_connect</option></entry>
21784 <entry>Use: <emphasis>main</emphasis></entry>
21785 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21786 <entry>Default: <emphasis>unset</emphasis></entry>
21787 </row>
21788 </tbody>
21789 </tgroup>
21790 </informaltable>
21791 <para>
21792 <indexterm role="concept">
21793 <primary>access control lists (ACLs)</primary>
21794 <secondary>on SMTP connection</secondary>
21795 </indexterm>
21796 This option defines the ACL that is run when an SMTP connection is received.
21797 See chapter <xref linkend="CHAPACL"/> for further details.
21798 </para>
21799 <para>
21800 <indexterm role="option">
21801 <primary><option>acl_smtp_data</option></primary>
21802 </indexterm>
21803 </para>
21804 <informaltable frame="all">
21805 <tgroup cols="4" colsep="0" rowsep="0">
21806 <colspec colwidth="8*" align="left"/>
21807 <colspec colwidth="6*" align="center"/>
21808 <colspec colwidth="6*" align="center"/>
21809 <colspec colwidth="6*" align="right"/>
21810 <tbody>
21811 <row>
21812 <entry><option>acl_smtp_data</option></entry>
21813 <entry>Use: <emphasis>main</emphasis></entry>
21814 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21815 <entry>Default: <emphasis>unset</emphasis></entry>
21816 </row>
21817 </tbody>
21818 </tgroup>
21819 </informaltable>
21820 <para>
21821 <indexterm role="concept">
21822 <primary>DATA</primary>
21823 <secondary>ACL for</secondary>
21824 </indexterm>
21825 This option defines the ACL that is run after an SMTP DATA command has been
21826 processed and the message itself has been received, but before the final
21827 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21828 </para>
21829 <para>
21830 <indexterm role="option">
21831 <primary><option>acl_smtp_data_prdr</option></primary>
21832 </indexterm>
21833 </para>
21834 <informaltable frame="all">
21835 <tgroup cols="4" colsep="0" rowsep="0">
21836 <colspec colwidth="8*" align="left"/>
21837 <colspec colwidth="6*" align="center"/>
21838 <colspec colwidth="6*" align="center"/>
21839 <colspec colwidth="6*" align="right"/>
21840 <tbody>
21841 <row>
21842 <entry><option>acl_smtp_data_prdr</option></entry>
21843 <entry>Use: <emphasis>main</emphasis></entry>
21844 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21845 <entry>Default: <emphasis>unset</emphasis></entry>
21846 </row>
21847 </tbody>
21848 </tgroup>
21849 </informaltable>
21850 <para>
21851 <indexterm role="concept">
21852 <primary>DATA</primary>
21853 <secondary>ACL for</secondary>
21854 </indexterm>
21855 <indexterm role="concept">
21856 <primary>access control lists (ACLs)</primary>
21857 <secondary>PRDR-related</secondary>
21858 </indexterm>
21859 <indexterm role="concept">
21860 <primary>access control lists (ACLs)</primary>
21861 <secondary>per-user data processing</secondary>
21862 </indexterm>
21863 This option defines the ACL that,
21864 if the PRDR feature has been negotiated,
21865 is run for each recipient after an SMTP DATA command has been
21866 processed and the message itself has been received, but before the
21867 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21868 </para>
21869 <para>
21870 <indexterm role="option">
21871 <primary><option>acl_smtp_etrn</option></primary>
21872 </indexterm>
21873 </para>
21874 <informaltable frame="all">
21875 <tgroup cols="4" colsep="0" rowsep="0">
21876 <colspec colwidth="8*" align="left"/>
21877 <colspec colwidth="6*" align="center"/>
21878 <colspec colwidth="6*" align="center"/>
21879 <colspec colwidth="6*" align="right"/>
21880 <tbody>
21881 <row>
21882 <entry><option>acl_smtp_etrn</option></entry>
21883 <entry>Use: <emphasis>main</emphasis></entry>
21884 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21885 <entry>Default: <emphasis>unset</emphasis></entry>
21886 </row>
21887 </tbody>
21888 </tgroup>
21889 </informaltable>
21890 <para>
21891 <indexterm role="concept">
21892 <primary>ETRN</primary>
21893 <secondary>ACL for</secondary>
21894 </indexterm>
21895 This option defines the ACL that is run when an SMTP ETRN command is
21896 received. See chapter <xref linkend="CHAPACL"/> for further details.
21897 </para>
21898 <para>
21899 <indexterm role="option">
21900 <primary><option>acl_smtp_expn</option></primary>
21901 </indexterm>
21902 </para>
21903 <informaltable frame="all">
21904 <tgroup cols="4" colsep="0" rowsep="0">
21905 <colspec colwidth="8*" align="left"/>
21906 <colspec colwidth="6*" align="center"/>
21907 <colspec colwidth="6*" align="center"/>
21908 <colspec colwidth="6*" align="right"/>
21909 <tbody>
21910 <row>
21911 <entry><option>acl_smtp_expn</option></entry>
21912 <entry>Use: <emphasis>main</emphasis></entry>
21913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21914 <entry>Default: <emphasis>unset</emphasis></entry>
21915 </row>
21916 </tbody>
21917 </tgroup>
21918 </informaltable>
21919 <para>
21920 <indexterm role="concept">
21921 <primary>EXPN</primary>
21922 <secondary>ACL for</secondary>
21923 </indexterm>
21924 This option defines the ACL that is run when an SMTP EXPN command is
21925 received. See chapter <xref linkend="CHAPACL"/> for further details.
21926 </para>
21927 <para>
21928 <indexterm role="option">
21929 <primary><option>acl_smtp_helo</option></primary>
21930 </indexterm>
21931 </para>
21932 <informaltable frame="all">
21933 <tgroup cols="4" colsep="0" rowsep="0">
21934 <colspec colwidth="8*" align="left"/>
21935 <colspec colwidth="6*" align="center"/>
21936 <colspec colwidth="6*" align="center"/>
21937 <colspec colwidth="6*" align="right"/>
21938 <tbody>
21939 <row>
21940 <entry><option>acl_smtp_helo</option></entry>
21941 <entry>Use: <emphasis>main</emphasis></entry>
21942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21943 <entry>Default: <emphasis>unset</emphasis></entry>
21944 </row>
21945 </tbody>
21946 </tgroup>
21947 </informaltable>
21948 <para>
21949 <indexterm role="concept">
21950 <primary>EHLO</primary>
21951 <secondary>ACL for</secondary>
21952 </indexterm>
21953 <indexterm role="concept">
21954 <primary>HELO</primary>
21955 <secondary>ACL for</secondary>
21956 </indexterm>
21957 This option defines the ACL that is run when an SMTP EHLO or HELO
21958 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
21959 </para>
21960 <para>
21961 <indexterm role="option">
21962 <primary><option>acl_smtp_mail</option></primary>
21963 </indexterm>
21964 </para>
21965 <informaltable frame="all">
21966 <tgroup cols="4" colsep="0" rowsep="0">
21967 <colspec colwidth="8*" align="left"/>
21968 <colspec colwidth="6*" align="center"/>
21969 <colspec colwidth="6*" align="center"/>
21970 <colspec colwidth="6*" align="right"/>
21971 <tbody>
21972 <row>
21973 <entry><option>acl_smtp_mail</option></entry>
21974 <entry>Use: <emphasis>main</emphasis></entry>
21975 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21976 <entry>Default: <emphasis>unset</emphasis></entry>
21977 </row>
21978 </tbody>
21979 </tgroup>
21980 </informaltable>
21981 <para>
21982 <indexterm role="concept">
21983 <primary>MAIL</primary>
21984 <secondary>ACL for</secondary>
21985 </indexterm>
21986 This option defines the ACL that is run when an SMTP MAIL command is
21987 received. See chapter <xref linkend="CHAPACL"/> for further details.
21988 </para>
21989 <para>
21990 <indexterm role="option">
21991 <primary><option>acl_smtp_mailauth</option></primary>
21992 </indexterm>
21993 </para>
21994 <informaltable frame="all">
21995 <tgroup cols="4" colsep="0" rowsep="0">
21996 <colspec colwidth="8*" align="left"/>
21997 <colspec colwidth="6*" align="center"/>
21998 <colspec colwidth="6*" align="center"/>
21999 <colspec colwidth="6*" align="right"/>
22000 <tbody>
22001 <row>
22002 <entry><option>acl_smtp_mailauth</option></entry>
22003 <entry>Use: <emphasis>main</emphasis></entry>
22004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22005 <entry>Default: <emphasis>unset</emphasis></entry>
22006 </row>
22007 </tbody>
22008 </tgroup>
22009 </informaltable>
22010 <para>
22011 <indexterm role="concept">
22012 <primary>AUTH</primary>
22013 <secondary>on MAIL command</secondary>
22014 </indexterm>
22015 This option defines the ACL that is run when there is an AUTH parameter on
22016 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22017 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22018 </para>
22019 <para>
22020 <indexterm role="option">
22021 <primary><option>acl_smtp_mime</option></primary>
22022 </indexterm>
22023 </para>
22024 <informaltable frame="all">
22025 <tgroup cols="4" colsep="0" rowsep="0">
22026 <colspec colwidth="8*" align="left"/>
22027 <colspec colwidth="6*" align="center"/>
22028 <colspec colwidth="6*" align="center"/>
22029 <colspec colwidth="6*" align="right"/>
22030 <tbody>
22031 <row>
22032 <entry><option>acl_smtp_mime</option></entry>
22033 <entry>Use: <emphasis>main</emphasis></entry>
22034 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22035 <entry>Default: <emphasis>unset</emphasis></entry>
22036 </row>
22037 </tbody>
22038 </tgroup>
22039 </informaltable>
22040 <para>
22041 <indexterm role="concept">
22042 <primary>MIME content scanning</primary>
22043 <secondary>ACL for</secondary>
22044 </indexterm>
22045 This option is available when Exim is built with the content-scanning
22046 extension. It defines the ACL that is run for each MIME part in a message. See
22047 section <xref linkend="SECTscanmimepart"/> for details.
22048 </para>
22049 <para>
22050 <indexterm role="option">
22051 <primary><option>acl_smtp_predata</option></primary>
22052 </indexterm>
22053 </para>
22054 <informaltable frame="all">
22055 <tgroup cols="4" colsep="0" rowsep="0">
22056 <colspec colwidth="8*" align="left"/>
22057 <colspec colwidth="6*" align="center"/>
22058 <colspec colwidth="6*" align="center"/>
22059 <colspec colwidth="6*" align="right"/>
22060 <tbody>
22061 <row>
22062 <entry><option>acl_smtp_predata</option></entry>
22063 <entry>Use: <emphasis>main</emphasis></entry>
22064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22065 <entry>Default: <emphasis>unset</emphasis></entry>
22066 </row>
22067 </tbody>
22068 </tgroup>
22069 </informaltable>
22070 <para>
22071 This option defines the ACL that is run when an SMTP DATA command is
22072 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22073 further details.
22074 </para>
22075 <para>
22076 <indexterm role="option">
22077 <primary><option>acl_smtp_quit</option></primary>
22078 </indexterm>
22079 </para>
22080 <informaltable frame="all">
22081 <tgroup cols="4" colsep="0" rowsep="0">
22082 <colspec colwidth="8*" align="left"/>
22083 <colspec colwidth="6*" align="center"/>
22084 <colspec colwidth="6*" align="center"/>
22085 <colspec colwidth="6*" align="right"/>
22086 <tbody>
22087 <row>
22088 <entry><option>acl_smtp_quit</option></entry>
22089 <entry>Use: <emphasis>main</emphasis></entry>
22090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22091 <entry>Default: <emphasis>unset</emphasis></entry>
22092 </row>
22093 </tbody>
22094 </tgroup>
22095 </informaltable>
22096 <para>
22097 <indexterm role="concept">
22098 <primary>QUIT, ACL for</primary>
22099 </indexterm>
22100 This option defines the ACL that is run when an SMTP QUIT command is
22101 received. See chapter <xref linkend="CHAPACL"/> for further details.
22102 </para>
22103 <para>
22104 <indexterm role="option">
22105 <primary><option>acl_smtp_rcpt</option></primary>
22106 </indexterm>
22107 </para>
22108 <informaltable frame="all">
22109 <tgroup cols="4" colsep="0" rowsep="0">
22110 <colspec colwidth="8*" align="left"/>
22111 <colspec colwidth="6*" align="center"/>
22112 <colspec colwidth="6*" align="center"/>
22113 <colspec colwidth="6*" align="right"/>
22114 <tbody>
22115 <row>
22116 <entry><option>acl_smtp_rcpt</option></entry>
22117 <entry>Use: <emphasis>main</emphasis></entry>
22118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22119 <entry>Default: <emphasis>unset</emphasis></entry>
22120 </row>
22121 </tbody>
22122 </tgroup>
22123 </informaltable>
22124 <para>
22125 <indexterm role="concept">
22126 <primary>RCPT</primary>
22127 <secondary>ACL for</secondary>
22128 </indexterm>
22129 This option defines the ACL that is run when an SMTP RCPT command is
22130 received. See chapter <xref linkend="CHAPACL"/> for further details.
22131 </para>
22132 <para>
22133 <indexterm role="option">
22134 <primary><option>acl_smtp_starttls</option></primary>
22135 </indexterm>
22136 </para>
22137 <informaltable frame="all">
22138 <tgroup cols="4" colsep="0" rowsep="0">
22139 <colspec colwidth="8*" align="left"/>
22140 <colspec colwidth="6*" align="center"/>
22141 <colspec colwidth="6*" align="center"/>
22142 <colspec colwidth="6*" align="right"/>
22143 <tbody>
22144 <row>
22145 <entry><option>acl_smtp_starttls</option></entry>
22146 <entry>Use: <emphasis>main</emphasis></entry>
22147 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22148 <entry>Default: <emphasis>unset</emphasis></entry>
22149 </row>
22150 </tbody>
22151 </tgroup>
22152 </informaltable>
22153 <para>
22154 <indexterm role="concept">
22155 <primary>STARTTLS, ACL for</primary>
22156 </indexterm>
22157 This option defines the ACL that is run when an SMTP STARTTLS command is
22158 received. See chapter <xref linkend="CHAPACL"/> for further details.
22159 </para>
22160 <para>
22161 <indexterm role="option">
22162 <primary><option>acl_smtp_vrfy</option></primary>
22163 </indexterm>
22164 </para>
22165 <informaltable frame="all">
22166 <tgroup cols="4" colsep="0" rowsep="0">
22167 <colspec colwidth="8*" align="left"/>
22168 <colspec colwidth="6*" align="center"/>
22169 <colspec colwidth="6*" align="center"/>
22170 <colspec colwidth="6*" align="right"/>
22171 <tbody>
22172 <row>
22173 <entry><option>acl_smtp_vrfy</option></entry>
22174 <entry>Use: <emphasis>main</emphasis></entry>
22175 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22176 <entry>Default: <emphasis>unset</emphasis></entry>
22177 </row>
22178 </tbody>
22179 </tgroup>
22180 </informaltable>
22181 <para>
22182 <indexterm role="concept">
22183 <primary>VRFY</primary>
22184 <secondary>ACL for</secondary>
22185 </indexterm>
22186 This option defines the ACL that is run when an SMTP VRFY command is
22187 received. See chapter <xref linkend="CHAPACL"/> for further details.
22188 </para>
22189 <para>
22190 <indexterm role="option">
22191 <primary><option>admin_groups</option></primary>
22192 </indexterm>
22193 </para>
22194 <informaltable frame="all">
22195 <tgroup cols="4" colsep="0" rowsep="0">
22196 <colspec colwidth="8*" align="left"/>
22197 <colspec colwidth="6*" align="center"/>
22198 <colspec colwidth="6*" align="center"/>
22199 <colspec colwidth="6*" align="right"/>
22200 <tbody>
22201 <row>
22202 <entry><option>admin_groups</option></entry>
22203 <entry>Use: <emphasis>main</emphasis></entry>
22204 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22205 <entry>Default: <emphasis>unset</emphasis></entry>
22206 </row>
22207 </tbody>
22208 </tgroup>
22209 </informaltable>
22210 <para>
22211 <indexterm role="concept">
22212 <primary>admin user</primary>
22213 </indexterm>
22214 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
22215 current group or any of the supplementary groups of an Exim caller is in this
22216 colon-separated list, the caller has admin privileges. If all your system
22217 programmers are in a specific group, for example, you can give them all Exim
22218 admin privileges by putting that group in <option>admin_groups</option>. However, this does
22219 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
22220 To permit this, you have to add individuals to the Exim group.
22221 </para>
22222 <para>
22223 <indexterm role="option">
22224 <primary><option>allow_domain_literals</option></primary>
22225 </indexterm>
22226 </para>
22227 <informaltable frame="all">
22228 <tgroup cols="4" colsep="0" rowsep="0">
22229 <colspec colwidth="8*" align="left"/>
22230 <colspec colwidth="6*" align="center"/>
22231 <colspec colwidth="6*" align="center"/>
22232 <colspec colwidth="6*" align="right"/>
22233 <tbody>
22234 <row>
22235 <entry><option>allow_domain_literals</option></entry>
22236 <entry>Use: <emphasis>main</emphasis></entry>
22237 <entry>Type: <emphasis>boolean</emphasis></entry>
22238 <entry>Default: <emphasis>false</emphasis></entry>
22239 </row>
22240 </tbody>
22241 </tgroup>
22242 </informaltable>
22243 <para>
22244 <indexterm role="concept">
22245 <primary>domain literal</primary>
22246 </indexterm>
22247 If this option is set, the RFC 2822 domain literal format is permitted in
22248 email addresses. The option is not set by default, because the domain literal
22249 format is not normally required these days, and few people know about it. It
22250 has, however, been exploited by mail abusers.
22251 </para>
22252 <para>
22253 Unfortunately, it seems that some DNS black list maintainers are using this
22254 format to report black listing to postmasters. If you want to accept messages
22255 addressed to your hosts by IP address, you need to set
22256 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
22257 domains (defined in the named domain list <option>local_domains</option> in the default
22258 configuration). This <quote>magic string</quote> matches the domain literal form of all
22259 the local host&#x2019;s IP addresses.
22260 </para>
22261 <para>
22262 <indexterm role="option">
22263 <primary><option>allow_mx_to_ip</option></primary>
22264 </indexterm>
22265 </para>
22266 <informaltable frame="all">
22267 <tgroup cols="4" colsep="0" rowsep="0">
22268 <colspec colwidth="8*" align="left"/>
22269 <colspec colwidth="6*" align="center"/>
22270 <colspec colwidth="6*" align="center"/>
22271 <colspec colwidth="6*" align="right"/>
22272 <tbody>
22273 <row>
22274 <entry><option>allow_mx_to_ip</option></entry>
22275 <entry>Use: <emphasis>main</emphasis></entry>
22276 <entry>Type: <emphasis>boolean</emphasis></entry>
22277 <entry>Default: <emphasis>false</emphasis></entry>
22278 </row>
22279 </tbody>
22280 </tgroup>
22281 </informaltable>
22282 <para>
22283 <indexterm role="concept">
22284 <primary>MX record</primary>
22285 <secondary>pointing to IP address</secondary>
22286 </indexterm>
22287 It appears that more and more DNS zone administrators are breaking the rules
22288 and putting domain names that look like IP addresses on the right hand side of
22289 MX records. Exim follows the rules and rejects this, giving an error message
22290 that explains the mis-configuration. However, some other MTAs support this
22291 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
22292 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
22293 recommended, except when you have no other choice.
22294 </para>
22295 <para>
22296 <indexterm role="option">
22297 <primary><option>allow_utf8_domains</option></primary>
22298 </indexterm>
22299 </para>
22300 <informaltable frame="all">
22301 <tgroup cols="4" colsep="0" rowsep="0">
22302 <colspec colwidth="8*" align="left"/>
22303 <colspec colwidth="6*" align="center"/>
22304 <colspec colwidth="6*" align="center"/>
22305 <colspec colwidth="6*" align="right"/>
22306 <tbody>
22307 <row>
22308 <entry><option>allow_utf8_domains</option></entry>
22309 <entry>Use: <emphasis>main</emphasis></entry>
22310 <entry>Type: <emphasis>boolean</emphasis></entry>
22311 <entry>Default: <emphasis>false</emphasis></entry>
22312 </row>
22313 </tbody>
22314 </tgroup>
22315 </informaltable>
22316 <para>
22317 <indexterm role="concept">
22318 <primary>domain</primary>
22319 <secondary>UTF-8 characters in</secondary>
22320 </indexterm>
22321 <indexterm role="concept">
22322 <primary>UTF-8</primary>
22323 <secondary>in domain name</secondary>
22324 </indexterm>
22325 Lots of discussion is going on about internationalized domain names. One
22326 camp is strongly in favour of just using UTF-8 characters, and it seems
22327 that at least two other MTAs permit this. This option allows Exim users to
22328 experiment if they wish.
22329 </para>
22330 <para>
22331 If it is set true, Exim&#x2019;s domain parsing function allows valid
22332 UTF-8 multicharacters to appear in domain name components, in addition to
22333 letters, digits, and hyphens. However, just setting this option is not
22334 enough; if you want to look up these domain names in the DNS, you must also
22335 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
22336 suitable setting is:
22337 </para>
22338 <literallayout class="monospaced">
22339 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
22340   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
22341 </literallayout>
22342 <para>
22343 Alternatively, you can just disable this feature by setting
22344 </para>
22345 <literallayout class="monospaced">
22346 dns_check_names_pattern =
22347 </literallayout>
22348 <para>
22349 That is, set the option to an empty string so that no check is done.
22350 </para>
22351 <para>
22352 <indexterm role="option">
22353 <primary><option>auth_advertise_hosts</option></primary>
22354 </indexterm>
22355 </para>
22356 <informaltable frame="all">
22357 <tgroup cols="4" colsep="0" rowsep="0">
22358 <colspec colwidth="8*" align="left"/>
22359 <colspec colwidth="6*" align="center"/>
22360 <colspec colwidth="6*" align="center"/>
22361 <colspec colwidth="6*" align="right"/>
22362 <tbody>
22363 <row>
22364 <entry><option>auth_advertise_hosts</option></entry>
22365 <entry>Use: <emphasis>main</emphasis></entry>
22366 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22367 <entry>Default: <emphasis>*</emphasis></entry>
22368 </row>
22369 </tbody>
22370 </tgroup>
22371 </informaltable>
22372 <para>
22373 <indexterm role="concept">
22374 <primary>authentication</primary>
22375 <secondary>advertising</secondary>
22376 </indexterm>
22377 <indexterm role="concept">
22378 <primary>AUTH</primary>
22379 <secondary>advertising</secondary>
22380 </indexterm>
22381 If any server authentication mechanisms are configured, Exim advertises them in
22382 response to an EHLO command only if the calling host matches this list.
22383 Otherwise, Exim does not advertise AUTH.
22384 Exim does not accept AUTH commands from clients to which it has not
22385 advertised the availability of AUTH. The advertising of individual
22386 authentication mechanisms can be controlled by the use of the
22387 <option>server_advertise_condition</option> generic authenticator option on the individual
22388 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
22389 </para>
22390 <para>
22391 Certain mail clients (for example, Netscape) require the user to provide a name
22392 and password for authentication if AUTH is advertised, even though it may
22393 not be needed (the host may accept messages from hosts on its local LAN without
22394 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
22395 to make these clients more friendly by excluding them from the set of hosts to
22396 which Exim advertises AUTH.
22397 </para>
22398 <para>
22399 <indexterm role="concept">
22400 <primary>AUTH</primary>
22401 <secondary>advertising when encrypted</secondary>
22402 </indexterm>
22403 If you want to advertise the availability of AUTH only when the connection
22404 is encrypted using TLS, you can make use of the fact that the value of this
22405 option is expanded, with a setting like this:
22406 </para>
22407 <literallayout class="monospaced">
22408 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
22409 </literallayout>
22410 <para>
22411 <indexterm role="variable">
22412 <primary><varname>$tls_in_cipher</varname></primary>
22413 </indexterm>
22414 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
22415 the expansion is empty, thus matching no hosts. Otherwise, the result of the
22416 expansion is *, which matches all hosts.
22417 </para>
22418 <para>
22419 <indexterm role="option">
22420 <primary><option>auto_thaw</option></primary>
22421 </indexterm>
22422 </para>
22423 <informaltable frame="all">
22424 <tgroup cols="4" colsep="0" rowsep="0">
22425 <colspec colwidth="8*" align="left"/>
22426 <colspec colwidth="6*" align="center"/>
22427 <colspec colwidth="6*" align="center"/>
22428 <colspec colwidth="6*" align="right"/>
22429 <tbody>
22430 <row>
22431 <entry><option>auto_thaw</option></entry>
22432 <entry>Use: <emphasis>main</emphasis></entry>
22433 <entry>Type: <emphasis>time</emphasis></entry>
22434 <entry>Default: <emphasis>0s</emphasis></entry>
22435 </row>
22436 </tbody>
22437 </tgroup>
22438 </informaltable>
22439 <para>
22440 <indexterm role="concept">
22441 <primary>thawing messages</primary>
22442 </indexterm>
22443 <indexterm role="concept">
22444 <primary>unfreezing messages</primary>
22445 </indexterm>
22446 If this option is set to a time greater than zero, a queue runner will try a
22447 new delivery attempt on any frozen message, other than a bounce message, if
22448 this much time has passed since it was frozen. This may result in the message
22449 being re-frozen if nothing has changed since the last attempt. It is a way of
22450 saying <quote>keep on trying, even though there are big problems</quote>.
22451 </para>
22452 <para>
22453 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
22454 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
22455 thought to be very useful any more, and its use should probably be avoided.
22456 </para>
22457 <para>
22458 <indexterm role="option">
22459 <primary><option>av_scanner</option></primary>
22460 </indexterm>
22461 </para>
22462 <informaltable frame="all">
22463 <tgroup cols="4" colsep="0" rowsep="0">
22464 <colspec colwidth="8*" align="left"/>
22465 <colspec colwidth="6*" align="center"/>
22466 <colspec colwidth="6*" align="center"/>
22467 <colspec colwidth="6*" align="right"/>
22468 <tbody>
22469 <row>
22470 <entry><option>av_scanner</option></entry>
22471 <entry>Use: <emphasis>main</emphasis></entry>
22472 <entry>Type: <emphasis>string</emphasis></entry>
22473 <entry>Default: <emphasis>see below</emphasis></entry>
22474 </row>
22475 </tbody>
22476 </tgroup>
22477 </informaltable>
22478 <para>
22479 This option is available if Exim is built with the content-scanning extension.
22480 It specifies which anti-virus scanner to use. The default value is:
22481 </para>
22482 <literallayout class="monospaced">
22483 sophie:/var/run/sophie
22484 </literallayout>
22485 <para>
22486 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
22487 before use. See section <xref linkend="SECTscanvirus"/> for further details.
22488 </para>
22489 <para>
22490 <indexterm role="option">
22491 <primary><option>bi_command</option></primary>
22492 </indexterm>
22493 </para>
22494 <informaltable frame="all">
22495 <tgroup cols="4" colsep="0" rowsep="0">
22496 <colspec colwidth="8*" align="left"/>
22497 <colspec colwidth="6*" align="center"/>
22498 <colspec colwidth="6*" align="center"/>
22499 <colspec colwidth="6*" align="right"/>
22500 <tbody>
22501 <row>
22502 <entry><option>bi_command</option></entry>
22503 <entry>Use: <emphasis>main</emphasis></entry>
22504 <entry>Type: <emphasis>string</emphasis></entry>
22505 <entry>Default: <emphasis>unset</emphasis></entry>
22506 </row>
22507 </tbody>
22508 </tgroup>
22509 </informaltable>
22510 <para>
22511 <indexterm role="option">
22512 <primary><option>-bi</option></primary>
22513 </indexterm>
22514 This option supplies the name of a command that is run when Exim is called with
22515 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
22516 just the command name, it is not a complete command line. If an argument is
22517 required, it must come from the <option>-oA</option> command line option.
22518 </para>
22519 <para>
22520 <indexterm role="option">
22521 <primary><option>bounce_message_file</option></primary>
22522 </indexterm>
22523 </para>
22524 <informaltable frame="all">
22525 <tgroup cols="4" colsep="0" rowsep="0">
22526 <colspec colwidth="8*" align="left"/>
22527 <colspec colwidth="6*" align="center"/>
22528 <colspec colwidth="6*" align="center"/>
22529 <colspec colwidth="6*" align="right"/>
22530 <tbody>
22531 <row>
22532 <entry><option>bounce_message_file</option></entry>
22533 <entry>Use: <emphasis>main</emphasis></entry>
22534 <entry>Type: <emphasis>string</emphasis></entry>
22535 <entry>Default: <emphasis>unset</emphasis></entry>
22536 </row>
22537 </tbody>
22538 </tgroup>
22539 </informaltable>
22540 <para>
22541 <indexterm role="concept">
22542 <primary>bounce message</primary>
22543 <secondary>customizing</secondary>
22544 </indexterm>
22545 <indexterm role="concept">
22546 <primary>customizing</primary>
22547 <secondary>bounce message</secondary>
22548 </indexterm>
22549 This option defines a template file containing paragraphs of text to be used
22550 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22551 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22552 </para>
22553 <para>
22554 <indexterm role="option">
22555 <primary><option>bounce_message_text</option></primary>
22556 </indexterm>
22557 </para>
22558 <informaltable frame="all">
22559 <tgroup cols="4" colsep="0" rowsep="0">
22560 <colspec colwidth="8*" align="left"/>
22561 <colspec colwidth="6*" align="center"/>
22562 <colspec colwidth="6*" align="center"/>
22563 <colspec colwidth="6*" align="right"/>
22564 <tbody>
22565 <row>
22566 <entry><option>bounce_message_text</option></entry>
22567 <entry>Use: <emphasis>main</emphasis></entry>
22568 <entry>Type: <emphasis>string</emphasis></entry>
22569 <entry>Default: <emphasis>unset</emphasis></entry>
22570 </row>
22571 </tbody>
22572 </tgroup>
22573 </informaltable>
22574 <para>
22575 When this option is set, its contents are included in the default bounce
22576 message immediately after <quote>This message was created automatically by mail
22577 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22578 </para>
22579 <para>
22580 <indexterm role="option">
22581 <primary><option>bounce_return_body</option></primary>
22582 </indexterm>
22583 </para>
22584 <informaltable frame="all">
22585 <tgroup cols="4" colsep="0" rowsep="0">
22586 <colspec colwidth="8*" align="left"/>
22587 <colspec colwidth="6*" align="center"/>
22588 <colspec colwidth="6*" align="center"/>
22589 <colspec colwidth="6*" align="right"/>
22590 <tbody>
22591 <row>
22592 <entry><option>bounce_return_body</option></entry>
22593 <entry>Use: <emphasis>main</emphasis></entry>
22594 <entry>Type: <emphasis>boolean</emphasis></entry>
22595 <entry>Default: <emphasis>true</emphasis></entry>
22596 </row>
22597 </tbody>
22598 </tgroup>
22599 </informaltable>
22600 <para>
22601 <indexterm role="concept">
22602 <primary>bounce message</primary>
22603 <secondary>including body</secondary>
22604 </indexterm>
22605 This option controls whether the body of an incoming message is included in a
22606 bounce message when <option>bounce_return_message</option> is true. The default setting
22607 causes the entire message, both header and body, to be returned (subject to the
22608 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22609 message header is included. In the case of a non-SMTP message containing an
22610 error that is detected during reception, only those header lines preceding the
22611 point at which the error was detected are returned.
22612 <indexterm role="concept">
22613 <primary>bounce message</primary>
22614 <secondary>including original</secondary>
22615 </indexterm>
22616 </para>
22617 <para>
22618 <indexterm role="option">
22619 <primary><option>bounce_return_message</option></primary>
22620 </indexterm>
22621 </para>
22622 <informaltable frame="all">
22623 <tgroup cols="4" colsep="0" rowsep="0">
22624 <colspec colwidth="8*" align="left"/>
22625 <colspec colwidth="6*" align="center"/>
22626 <colspec colwidth="6*" align="center"/>
22627 <colspec colwidth="6*" align="right"/>
22628 <tbody>
22629 <row>
22630 <entry><option>bounce_return_message</option></entry>
22631 <entry>Use: <emphasis>main</emphasis></entry>
22632 <entry>Type: <emphasis>boolean</emphasis></entry>
22633 <entry>Default: <emphasis>true</emphasis></entry>
22634 </row>
22635 </tbody>
22636 </tgroup>
22637 </informaltable>
22638 <para>
22639 If this option is set false, none of the original message is included in
22640 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22641 <option>bounce_return_body</option>.
22642 </para>
22643 <para>
22644 <indexterm role="option">
22645 <primary><option>bounce_return_size_limit</option></primary>
22646 </indexterm>
22647 </para>
22648 <informaltable frame="all">
22649 <tgroup cols="4" colsep="0" rowsep="0">
22650 <colspec colwidth="8*" align="left"/>
22651 <colspec colwidth="6*" align="center"/>
22652 <colspec colwidth="6*" align="center"/>
22653 <colspec colwidth="6*" align="right"/>
22654 <tbody>
22655 <row>
22656 <entry><option>bounce_return_size_limit</option></entry>
22657 <entry>Use: <emphasis>main</emphasis></entry>
22658 <entry>Type: <emphasis>integer</emphasis></entry>
22659 <entry>Default: <emphasis>100K</emphasis></entry>
22660 </row>
22661 </tbody>
22662 </tgroup>
22663 </informaltable>
22664 <para>
22665 <indexterm role="concept">
22666 <primary>size</primary>
22667 <secondary>of bounce, limit</secondary>
22668 </indexterm>
22669 <indexterm role="concept">
22670 <primary>bounce message</primary>
22671 <secondary>size limit</secondary>
22672 </indexterm>
22673 <indexterm role="concept">
22674 <primary>limit</primary>
22675 <secondary>bounce message size</secondary>
22676 </indexterm>
22677 This option sets a limit in bytes on the size of messages that are returned to
22678 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22679 limit should be less than the value of the global <option>message_size_limit</option> and of
22680 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22681 that Exim generates. If this option is set to zero there is no limit.
22682 </para>
22683 <para>
22684 When the body of any message that is to be included in a bounce message is
22685 greater than the limit, it is truncated, and a comment pointing this out is
22686 added at the top. The actual cutoff may be greater than the value given, owing
22687 to the use of buffering for transferring the message in chunks (typically 8K in
22688 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22689 messages.
22690 </para>
22691 <para>
22692 <indexterm role="option">
22693 <primary><option>bounce_sender_authentication</option></primary>
22694 </indexterm>
22695 </para>
22696 <informaltable frame="all">
22697 <tgroup cols="4" colsep="0" rowsep="0">
22698 <colspec colwidth="8*" align="left"/>
22699 <colspec colwidth="6*" align="center"/>
22700 <colspec colwidth="6*" align="center"/>
22701 <colspec colwidth="6*" align="right"/>
22702 <tbody>
22703 <row>
22704 <entry><option>bounce_sender_authentication</option></entry>
22705 <entry>Use: <emphasis>main</emphasis></entry>
22706 <entry>Type: <emphasis>string</emphasis></entry>
22707 <entry>Default: <emphasis>unset</emphasis></entry>
22708 </row>
22709 </tbody>
22710 </tgroup>
22711 </informaltable>
22712 <para>
22713 <indexterm role="concept">
22714 <primary>bounce message</primary>
22715 <secondary>sender authentication</secondary>
22716 </indexterm>
22717 <indexterm role="concept">
22718 <primary>authentication</primary>
22719 <secondary>bounce message</secondary>
22720 </indexterm>
22721 <indexterm role="concept">
22722 <primary>AUTH</primary>
22723 <secondary>on bounce message</secondary>
22724 </indexterm>
22725 This option provides an authenticated sender address that is sent with any
22726 bounce messages generated by Exim that are sent over an authenticated SMTP
22727 connection. A typical setting might be:
22728 </para>
22729 <literallayout class="monospaced">
22730 bounce_sender_authentication = mailer-daemon@my.domain.example
22731 </literallayout>
22732 <para>
22733 which would cause bounce messages to be sent using the SMTP command:
22734 </para>
22735 <literallayout class="monospaced">
22736 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
22737 </literallayout>
22738 <para>
22739 The value of <option>bounce_sender_authentication</option> must always be a complete email
22740 address.
22741 </para>
22742 <para>
22743 <indexterm role="option">
22744 <primary><option>callout_domain_negative_expire</option></primary>
22745 </indexterm>
22746 </para>
22747 <informaltable frame="all">
22748 <tgroup cols="4" colsep="0" rowsep="0">
22749 <colspec colwidth="8*" align="left"/>
22750 <colspec colwidth="6*" align="center"/>
22751 <colspec colwidth="6*" align="center"/>
22752 <colspec colwidth="6*" align="right"/>
22753 <tbody>
22754 <row>
22755 <entry><option>callout_domain_negative_expire</option></entry>
22756 <entry>Use: <emphasis>main</emphasis></entry>
22757 <entry>Type: <emphasis>time</emphasis></entry>
22758 <entry>Default: <emphasis>3h</emphasis></entry>
22759 </row>
22760 </tbody>
22761 </tgroup>
22762 </informaltable>
22763 <para>
22764 <indexterm role="concept">
22765 <primary>caching</primary>
22766 <secondary>callout timeouts</secondary>
22767 </indexterm>
22768 <indexterm role="concept">
22769 <primary>callout</primary>
22770 <secondary>caching timeouts</secondary>
22771 </indexterm>
22772 This option specifies the expiry time for negative callout cache data for a
22773 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22774 section <xref linkend="SECTcallvercache"/> for details of the caching.
22775 </para>
22776 <para>
22777 <indexterm role="option">
22778 <primary><option>callout_domain_positive_expire</option></primary>
22779 </indexterm>
22780 </para>
22781 <informaltable frame="all">
22782 <tgroup cols="4" colsep="0" rowsep="0">
22783 <colspec colwidth="8*" align="left"/>
22784 <colspec colwidth="6*" align="center"/>
22785 <colspec colwidth="6*" align="center"/>
22786 <colspec colwidth="6*" align="right"/>
22787 <tbody>
22788 <row>
22789 <entry><option>callout_domain_positive_expire</option></entry>
22790 <entry>Use: <emphasis>main</emphasis></entry>
22791 <entry>Type: <emphasis>time</emphasis></entry>
22792 <entry>Default: <emphasis>7d</emphasis></entry>
22793 </row>
22794 </tbody>
22795 </tgroup>
22796 </informaltable>
22797 <para>
22798 This option specifies the expiry time for positive callout cache data for a
22799 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22800 section <xref linkend="SECTcallvercache"/> for details of the caching.
22801 </para>
22802 <para>
22803 <indexterm role="option">
22804 <primary><option>callout_negative_expire</option></primary>
22805 </indexterm>
22806 </para>
22807 <informaltable frame="all">
22808 <tgroup cols="4" colsep="0" rowsep="0">
22809 <colspec colwidth="8*" align="left"/>
22810 <colspec colwidth="6*" align="center"/>
22811 <colspec colwidth="6*" align="center"/>
22812 <colspec colwidth="6*" align="right"/>
22813 <tbody>
22814 <row>
22815 <entry><option>callout_negative_expire</option></entry>
22816 <entry>Use: <emphasis>main</emphasis></entry>
22817 <entry>Type: <emphasis>time</emphasis></entry>
22818 <entry>Default: <emphasis>2h</emphasis></entry>
22819 </row>
22820 </tbody>
22821 </tgroup>
22822 </informaltable>
22823 <para>
22824 This option specifies the expiry time for negative callout cache data for an
22825 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22826 section <xref linkend="SECTcallvercache"/> for details of the caching.
22827 </para>
22828 <para>
22829 <indexterm role="option">
22830 <primary><option>callout_positive_expire</option></primary>
22831 </indexterm>
22832 </para>
22833 <informaltable frame="all">
22834 <tgroup cols="4" colsep="0" rowsep="0">
22835 <colspec colwidth="8*" align="left"/>
22836 <colspec colwidth="6*" align="center"/>
22837 <colspec colwidth="6*" align="center"/>
22838 <colspec colwidth="6*" align="right"/>
22839 <tbody>
22840 <row>
22841 <entry><option>callout_positive_expire</option></entry>
22842 <entry>Use: <emphasis>main</emphasis></entry>
22843 <entry>Type: <emphasis>time</emphasis></entry>
22844 <entry>Default: <emphasis>24h</emphasis></entry>
22845 </row>
22846 </tbody>
22847 </tgroup>
22848 </informaltable>
22849 <para>
22850 This option specifies the expiry time for positive callout cache data for an
22851 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22852 section <xref linkend="SECTcallvercache"/> for details of the caching.
22853 </para>
22854 <para>
22855 <indexterm role="option">
22856 <primary><option>callout_random_local_part</option></primary>
22857 </indexterm>
22858 </para>
22859 <informaltable frame="all">
22860 <tgroup cols="4" colsep="0" rowsep="0">
22861 <colspec colwidth="8*" align="left"/>
22862 <colspec colwidth="6*" align="center"/>
22863 <colspec colwidth="6*" align="center"/>
22864 <colspec colwidth="6*" align="right"/>
22865 <tbody>
22866 <row>
22867 <entry><option>callout_random_local_part</option></entry>
22868 <entry>Use: <emphasis>main</emphasis></entry>
22869 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22870 <entry>Default: <emphasis>see below</emphasis></entry>
22871 </row>
22872 </tbody>
22873 </tgroup>
22874 </informaltable>
22875 <para>
22876 This option defines the <quote>random</quote> local part that can be used as part of
22877 callout verification. The default value is
22878 </para>
22879 <literallayout class="monospaced">
22880 $primary_hostname-$tod_epoch-testing
22881 </literallayout>
22882 <para>
22883 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
22884 </para>
22885 <para>
22886 <indexterm role="option">
22887 <primary><option>check_log_inodes</option></primary>
22888 </indexterm>
22889 </para>
22890 <informaltable frame="all">
22891 <tgroup cols="4" colsep="0" rowsep="0">
22892 <colspec colwidth="8*" align="left"/>
22893 <colspec colwidth="6*" align="center"/>
22894 <colspec colwidth="6*" align="center"/>
22895 <colspec colwidth="6*" align="right"/>
22896 <tbody>
22897 <row>
22898 <entry><option>check_log_inodes</option></entry>
22899 <entry>Use: <emphasis>main</emphasis></entry>
22900 <entry>Type: <emphasis>integer</emphasis></entry>
22901 <entry>Default: <emphasis>0</emphasis></entry>
22902 </row>
22903 </tbody>
22904 </tgroup>
22905 </informaltable>
22906 <para>
22907 See <option>check_spool_space</option> below.
22908 </para>
22909 <para>
22910 <indexterm role="option">
22911 <primary><option>check_log_space</option></primary>
22912 </indexterm>
22913 </para>
22914 <informaltable frame="all">
22915 <tgroup cols="4" colsep="0" rowsep="0">
22916 <colspec colwidth="8*" align="left"/>
22917 <colspec colwidth="6*" align="center"/>
22918 <colspec colwidth="6*" align="center"/>
22919 <colspec colwidth="6*" align="right"/>
22920 <tbody>
22921 <row>
22922 <entry><option>check_log_space</option></entry>
22923 <entry>Use: <emphasis>main</emphasis></entry>
22924 <entry>Type: <emphasis>integer</emphasis></entry>
22925 <entry>Default: <emphasis>0</emphasis></entry>
22926 </row>
22927 </tbody>
22928 </tgroup>
22929 </informaltable>
22930 <para>
22931 See <option>check_spool_space</option> below.
22932 </para>
22933 <para>
22934 <indexterm role="option">
22935 <primary><option>check_rfc2047_length</option></primary>
22936 </indexterm>
22937 <indexterm role="concept">
22938 <primary>RFC 2047</primary>
22939 <secondary>disabling length check</secondary>
22940 </indexterm>
22941 <indexterm role="option">
22942 <primary><option>check_rfc2047_length</option></primary>
22943 </indexterm>
22944 </para>
22945 <informaltable frame="all">
22946 <tgroup cols="4" colsep="0" rowsep="0">
22947 <colspec colwidth="8*" align="left"/>
22948 <colspec colwidth="6*" align="center"/>
22949 <colspec colwidth="6*" align="center"/>
22950 <colspec colwidth="6*" align="right"/>
22951 <tbody>
22952 <row>
22953 <entry><option>check_rfc2047_length</option></entry>
22954 <entry>Use: <emphasis>main</emphasis></entry>
22955 <entry>Type: <emphasis>boolean</emphasis></entry>
22956 <entry>Default: <emphasis>true</emphasis></entry>
22957 </row>
22958 </tbody>
22959 </tgroup>
22960 </informaltable>
22961 <para>
22962 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
22963 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
22964 word; strings to be encoded that exceed this length are supposed to use
22965 multiple encoded words. By default, Exim does not recognize encoded words that
22966 exceed the maximum length. However, it seems that some software, in violation
22967 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
22968 set false, Exim recognizes encoded words of any length.
22969 </para>
22970 <para>
22971 <indexterm role="option">
22972 <primary><option>check_spool_inodes</option></primary>
22973 </indexterm>
22974 </para>
22975 <informaltable frame="all">
22976 <tgroup cols="4" colsep="0" rowsep="0">
22977 <colspec colwidth="8*" align="left"/>
22978 <colspec colwidth="6*" align="center"/>
22979 <colspec colwidth="6*" align="center"/>
22980 <colspec colwidth="6*" align="right"/>
22981 <tbody>
22982 <row>
22983 <entry><option>check_spool_inodes</option></entry>
22984 <entry>Use: <emphasis>main</emphasis></entry>
22985 <entry>Type: <emphasis>integer</emphasis></entry>
22986 <entry>Default: <emphasis>0</emphasis></entry>
22987 </row>
22988 </tbody>
22989 </tgroup>
22990 </informaltable>
22991 <para>
22992 See <option>check_spool_space</option> below.
22993 </para>
22994 <para>
22995 <indexterm role="option">
22996 <primary><option>check_spool_space</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>check_spool_space</option></entry>
23008 <entry>Use: <emphasis>main</emphasis></entry>
23009 <entry>Type: <emphasis>integer</emphasis></entry>
23010 <entry>Default: <emphasis>0</emphasis></entry>
23011 </row>
23012 </tbody>
23013 </tgroup>
23014 </informaltable>
23015 <para>
23016 <indexterm role="concept">
23017 <primary>checking disk space</primary>
23018 </indexterm>
23019 <indexterm role="concept">
23020 <primary>disk space, checking</primary>
23021 </indexterm>
23022 <indexterm role="concept">
23023 <primary>spool directory</primary>
23024 <secondary>checking space</secondary>
23025 </indexterm>
23026 The four <option>check_...</option> options allow for checking of disk resources before a
23027 message is accepted.
23028 </para>
23029 <para>
23030 <indexterm role="variable">
23031 <primary><varname>$log_inodes</varname></primary>
23032 </indexterm>
23033 <indexterm role="variable">
23034 <primary><varname>$log_space</varname></primary>
23035 </indexterm>
23036 <indexterm role="variable">
23037 <primary><varname>$spool_inodes</varname></primary>
23038 </indexterm>
23039 <indexterm role="variable">
23040 <primary><varname>$spool_space</varname></primary>
23041 </indexterm>
23042 When any of these options are set, they apply to all incoming messages. If you
23043 want to apply different checks to different kinds of message, you can do so by
23044 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
23045 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
23046 </para>
23047 <para>
23048 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
23049 either value is greater than zero, for example:
23050 </para>
23051 <literallayout class="monospaced">
23052 check_spool_space = 10M
23053 check_spool_inodes = 100
23054 </literallayout>
23055 <para>
23056 The spool partition is the one that contains the directory defined by
23057 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
23058 transit.
23059 </para>
23060 <para>
23061 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
23062 files are written if either is greater than zero. These should be set only if
23063 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
23064 </para>
23065 <para>
23066 If there is less space or fewer inodes than requested, Exim refuses to accept
23067 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
23068 error response to the MAIL command. If ESMTP is in use and there was a
23069 SIZE parameter on the MAIL command, its value is added to the
23070 <option>check_spool_space</option> value, and the check is performed even if
23071 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
23072 </para>
23073 <para>
23074 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
23075 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
23076 </para>
23077 <para>
23078 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
23079 failure a message is written to stderr and Exim exits with a non-zero code, as
23080 it obviously cannot send an error message of any kind.
23081 </para>
23082 <para>
23083 <indexterm role="option">
23084 <primary><option>daemon_smtp_ports</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>daemon_smtp_ports</option></entry>
23096 <entry>Use: <emphasis>main</emphasis></entry>
23097 <entry>Type: <emphasis>string</emphasis></entry>
23098 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
23099 </row>
23100 </tbody>
23101 </tgroup>
23102 </informaltable>
23103 <para>
23104 <indexterm role="concept">
23105 <primary>port</primary>
23106 <secondary>for daemon</secondary>
23107 </indexterm>
23108 <indexterm role="concept">
23109 <primary>TCP/IP</primary>
23110 <secondary>setting listening ports</secondary>
23111 </indexterm>
23112 This option specifies one or more default SMTP ports on which the Exim daemon
23113 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
23114 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
23115 </para>
23116 <para>
23117 <indexterm role="option">
23118 <primary><option>daemon_startup_retries</option></primary>
23119 </indexterm>
23120 </para>
23121 <informaltable frame="all">
23122 <tgroup cols="4" colsep="0" rowsep="0">
23123 <colspec colwidth="8*" align="left"/>
23124 <colspec colwidth="6*" align="center"/>
23125 <colspec colwidth="6*" align="center"/>
23126 <colspec colwidth="6*" align="right"/>
23127 <tbody>
23128 <row>
23129 <entry><option>daemon_startup_retries</option></entry>
23130 <entry>Use: <emphasis>main</emphasis></entry>
23131 <entry>Type: <emphasis>integer</emphasis></entry>
23132 <entry>Default: <emphasis>9</emphasis></entry>
23133 </row>
23134 </tbody>
23135 </tgroup>
23136 </informaltable>
23137 <para>
23138 <indexterm role="concept">
23139 <primary>daemon startup, retrying</primary>
23140 </indexterm>
23141 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
23142 the daemon at startup when it cannot immediately bind a listening socket
23143 (typically because the socket is already in use): <option>daemon_startup_retries</option>
23144 defines the number of retries after the first failure, and
23145 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
23146 </para>
23147 <para>
23148 <indexterm role="option">
23149 <primary><option>daemon_startup_sleep</option></primary>
23150 </indexterm>
23151 </para>
23152 <informaltable frame="all">
23153 <tgroup cols="4" colsep="0" rowsep="0">
23154 <colspec colwidth="8*" align="left"/>
23155 <colspec colwidth="6*" align="center"/>
23156 <colspec colwidth="6*" align="center"/>
23157 <colspec colwidth="6*" align="right"/>
23158 <tbody>
23159 <row>
23160 <entry><option>daemon_startup_sleep</option></entry>
23161 <entry>Use: <emphasis>main</emphasis></entry>
23162 <entry>Type: <emphasis>time</emphasis></entry>
23163 <entry>Default: <emphasis>30s</emphasis></entry>
23164 </row>
23165 </tbody>
23166 </tgroup>
23167 </informaltable>
23168 <para>
23169 See <option>daemon_startup_retries</option>.
23170 </para>
23171 <para>
23172 <indexterm role="option">
23173 <primary><option>delay_warning</option></primary>
23174 </indexterm>
23175 </para>
23176 <informaltable frame="all">
23177 <tgroup cols="4" colsep="0" rowsep="0">
23178 <colspec colwidth="8*" align="left"/>
23179 <colspec colwidth="6*" align="center"/>
23180 <colspec colwidth="6*" align="center"/>
23181 <colspec colwidth="6*" align="right"/>
23182 <tbody>
23183 <row>
23184 <entry><option>delay_warning</option></entry>
23185 <entry>Use: <emphasis>main</emphasis></entry>
23186 <entry>Type: <emphasis>time list</emphasis></entry>
23187 <entry>Default: <emphasis>24h</emphasis></entry>
23188 </row>
23189 </tbody>
23190 </tgroup>
23191 </informaltable>
23192 <para>
23193 <indexterm role="concept">
23194 <primary>warning of delay</primary>
23195 </indexterm>
23196 <indexterm role="concept">
23197 <primary>delay warning, specifying</primary>
23198 </indexterm>
23199 When a message is delayed, Exim sends a warning message to the sender at
23200 intervals specified by this option. The data is a colon-separated list of times
23201 after which to send warning messages. If the value of the option is an empty
23202 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
23203 message has been on the queue for longer than the last time, the last interval
23204 between the times is used to compute subsequent warning times. For example,
23205 with
23206 </para>
23207 <literallayout class="monospaced">
23208 delay_warning = 4h:8h:24h
23209 </literallayout>
23210 <para>
23211 the first message is sent after 4 hours, the second after 8 hours, and
23212 the third one after 24 hours. After that, messages are sent every 16 hours,
23213 because that is the interval between the last two times on the list. If you set
23214 just one time, it specifies the repeat interval. For example, with:
23215 </para>
23216 <literallayout class="monospaced">
23217 delay_warning = 6h
23218 </literallayout>
23219 <para>
23220 messages are repeated every six hours. To stop warnings after a given time, set
23221 a very large time at the end of the list. For example:
23222 </para>
23223 <literallayout class="monospaced">
23224 delay_warning = 2h:12h:99d
23225 </literallayout>
23226 <para>
23227 Note that the option is only evaluated at the time a delivery attempt fails,
23228 which depends on retry and queue-runner configuration.
23229 Typically retries will be configured more frequently than warning messages.
23230 </para>
23231 <para>
23232 <indexterm role="option">
23233 <primary><option>delay_warning_condition</option></primary>
23234 </indexterm>
23235 </para>
23236 <informaltable frame="all">
23237 <tgroup cols="4" colsep="0" rowsep="0">
23238 <colspec colwidth="8*" align="left"/>
23239 <colspec colwidth="6*" align="center"/>
23240 <colspec colwidth="6*" align="center"/>
23241 <colspec colwidth="6*" align="right"/>
23242 <tbody>
23243 <row>
23244 <entry><option>delay_warning_condition</option></entry>
23245 <entry>Use: <emphasis>main</emphasis></entry>
23246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23247 <entry>Default: <emphasis>see below</emphasis></entry>
23248 </row>
23249 </tbody>
23250 </tgroup>
23251 </informaltable>
23252 <para>
23253 <indexterm role="variable">
23254 <primary><varname>$domain</varname></primary>
23255 </indexterm>
23256 The string is expanded at the time a warning message might be sent. If all the
23257 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
23258 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
23259 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
23260 <quote>false</quote> (the comparison being done caselessly) then the warning message is
23261 not sent. The default is:
23262 </para>
23263 <literallayout class="monospaced">
23264 delay_warning_condition = ${if or {\
23265   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
23266   { match{$h_precedence:}{(?i)bulk|list|junk} }\
23267   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
23268   } {no}{yes}}
23269 </literallayout>
23270 <para>
23271 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
23272 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
23273 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
23274 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
23275 </para>
23276 <para>
23277 <indexterm role="option">
23278 <primary><option>deliver_drop_privilege</option></primary>
23279 </indexterm>
23280 </para>
23281 <informaltable frame="all">
23282 <tgroup cols="4" colsep="0" rowsep="0">
23283 <colspec colwidth="8*" align="left"/>
23284 <colspec colwidth="6*" align="center"/>
23285 <colspec colwidth="6*" align="center"/>
23286 <colspec colwidth="6*" align="right"/>
23287 <tbody>
23288 <row>
23289 <entry><option>deliver_drop_privilege</option></entry>
23290 <entry>Use: <emphasis>main</emphasis></entry>
23291 <entry>Type: <emphasis>boolean</emphasis></entry>
23292 <entry>Default: <emphasis>false</emphasis></entry>
23293 </row>
23294 </tbody>
23295 </tgroup>
23296 </informaltable>
23297 <para>
23298 <indexterm role="concept">
23299 <primary>unprivileged delivery</primary>
23300 </indexterm>
23301 <indexterm role="concept">
23302 <primary>delivery</primary>
23303 <secondary>unprivileged</secondary>
23304 </indexterm>
23305 If this option is set true, Exim drops its root privilege at the start of a
23306 delivery process, and runs as the Exim user throughout. This severely restricts
23307 the kinds of local delivery that are possible, but is viable in certain types
23308 of configuration. There is a discussion about the use of root privilege in
23309 chapter <xref linkend="CHAPsecurity"/>.
23310 </para>
23311 <para>
23312 <indexterm role="option">
23313 <primary><option>deliver_queue_load_max</option></primary>
23314 </indexterm>
23315 </para>
23316 <informaltable frame="all">
23317 <tgroup cols="4" colsep="0" rowsep="0">
23318 <colspec colwidth="8*" align="left"/>
23319 <colspec colwidth="6*" align="center"/>
23320 <colspec colwidth="6*" align="center"/>
23321 <colspec colwidth="6*" align="right"/>
23322 <tbody>
23323 <row>
23324 <entry><option>deliver_queue_load_max</option></entry>
23325 <entry>Use: <emphasis>main</emphasis></entry>
23326 <entry>Type: <emphasis>fixed-point</emphasis></entry>
23327 <entry>Default: <emphasis>unset</emphasis></entry>
23328 </row>
23329 </tbody>
23330 </tgroup>
23331 </informaltable>
23332 <para>
23333 <indexterm role="concept">
23334 <primary>load average</primary>
23335 </indexterm>
23336 <indexterm role="concept">
23337 <primary>queue runner</primary>
23338 <secondary>abandoning</secondary>
23339 </indexterm>
23340 When this option is set, a queue run is abandoned if the system load average
23341 becomes greater than the value of the option. The option has no effect on
23342 ancient operating systems on which Exim cannot determine the load average.
23343 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
23344 </para>
23345 <para>
23346 <indexterm role="option">
23347 <primary><option>delivery_date_remove</option></primary>
23348 </indexterm>
23349 </para>
23350 <informaltable frame="all">
23351 <tgroup cols="4" colsep="0" rowsep="0">
23352 <colspec colwidth="8*" align="left"/>
23353 <colspec colwidth="6*" align="center"/>
23354 <colspec colwidth="6*" align="center"/>
23355 <colspec colwidth="6*" align="right"/>
23356 <tbody>
23357 <row>
23358 <entry><option>delivery_date_remove</option></entry>
23359 <entry>Use: <emphasis>main</emphasis></entry>
23360 <entry>Type: <emphasis>boolean</emphasis></entry>
23361 <entry>Default: <emphasis>true</emphasis></entry>
23362 </row>
23363 </tbody>
23364 </tgroup>
23365 </informaltable>
23366 <para>
23367 <indexterm role="concept">
23368 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
23369 </indexterm>
23370 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
23371 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23372 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
23373 should not be present in incoming messages, and this option causes them to be
23374 removed at the time the message is received, to avoid any problems that might
23375 occur when a delivered message is subsequently sent on to some other recipient.
23376 </para>
23377 <para>
23378 <indexterm role="option">
23379 <primary><option>disable_fsync</option></primary>
23380 </indexterm>
23381 </para>
23382 <informaltable frame="all">
23383 <tgroup cols="4" colsep="0" rowsep="0">
23384 <colspec colwidth="8*" align="left"/>
23385 <colspec colwidth="6*" align="center"/>
23386 <colspec colwidth="6*" align="center"/>
23387 <colspec colwidth="6*" align="right"/>
23388 <tbody>
23389 <row>
23390 <entry><option>disable_fsync</option></entry>
23391 <entry>Use: <emphasis>main</emphasis></entry>
23392 <entry>Type: <emphasis>boolean</emphasis></entry>
23393 <entry>Default: <emphasis>false</emphasis></entry>
23394 </row>
23395 </tbody>
23396 </tgroup>
23397 </informaltable>
23398 <para>
23399 <indexterm role="concept">
23400 <primary><function>fsync()</function>, disabling</primary>
23401 </indexterm>
23402 This option is available only if Exim was built with the compile-time option
23403 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
23404 a runtime configuration generates an <quote>unknown option</quote> error. You should not
23405 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
23406 really, really, really understand what you are doing. <emphasis>No pre-compiled
23407 distributions of Exim should ever make this option available.</emphasis>
23408 </para>
23409 <para>
23410 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
23411 updated files&#x2019; data to be written to disc before continuing. Unexpected events
23412 such as crashes and power outages may cause data to be lost or scrambled.
23413 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
23414 </para>
23415 <para>
23416 <indexterm role="option">
23417 <primary><option>disable_ipv6</option></primary>
23418 </indexterm>
23419 </para>
23420 <informaltable frame="all">
23421 <tgroup cols="4" colsep="0" rowsep="0">
23422 <colspec colwidth="8*" align="left"/>
23423 <colspec colwidth="6*" align="center"/>
23424 <colspec colwidth="6*" align="center"/>
23425 <colspec colwidth="6*" align="right"/>
23426 <tbody>
23427 <row>
23428 <entry><option>disable_ipv6</option></entry>
23429 <entry>Use: <emphasis>main</emphasis></entry>
23430 <entry>Type: <emphasis>boolean</emphasis></entry>
23431 <entry>Default: <emphasis>false</emphasis></entry>
23432 </row>
23433 </tbody>
23434 </tgroup>
23435 </informaltable>
23436 <para>
23437 <indexterm role="concept">
23438 <primary>IPv6</primary>
23439 <secondary>disabling</secondary>
23440 </indexterm>
23441 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
23442 activities take place. AAAA records are never looked up, and any IPv6 addresses
23443 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
23444 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23445 to handle IPv6 literal addresses.
23446 </para>
23447 <para>
23448 <indexterm role="option">
23449 <primary><option>dns_again_means_nonexist</option></primary>
23450 </indexterm>
23451 </para>
23452 <informaltable frame="all">
23453 <tgroup cols="4" colsep="0" rowsep="0">
23454 <colspec colwidth="8*" align="left"/>
23455 <colspec colwidth="6*" align="center"/>
23456 <colspec colwidth="6*" align="center"/>
23457 <colspec colwidth="6*" align="right"/>
23458 <tbody>
23459 <row>
23460 <entry><option>dns_again_means_nonexist</option></entry>
23461 <entry>Use: <emphasis>main</emphasis></entry>
23462 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23463 <entry>Default: <emphasis>unset</emphasis></entry>
23464 </row>
23465 </tbody>
23466 </tgroup>
23467 </informaltable>
23468 <para>
23469 <indexterm role="concept">
23470 <primary>DNS</primary>
23471 <secondary><quote>try again</quote> response; overriding</secondary>
23472 </indexterm>
23473 DNS lookups give a <quote>try again</quote> response for the DNS errors
23474 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
23475 keep trying to deliver a message, or to give repeated temporary errors to
23476 incoming mail. Sometimes the effect is caused by a badly set up name server and
23477 may persist for a long time. If a domain which exhibits this problem matches
23478 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
23479 This option should be used with care. You can make it apply to reverse lookups
23480 by a setting such as this:
23481 </para>
23482 <literallayout class="monospaced">
23483 dns_again_means_nonexist = *.in-addr.arpa
23484 </literallayout>
23485 <para>
23486 This option applies to all DNS lookups that Exim does. It also applies when the
23487 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
23488 since these are most likely to be caused by DNS lookup problems. The
23489 <command>dnslookup</command> router has some options of its own for controlling what happens
23490 when lookups for MX or SRV records give temporary errors. These more specific
23491 options are applied after this global option.
23492 </para>
23493 <para>
23494 <indexterm role="option">
23495 <primary><option>dns_check_names_pattern</option></primary>
23496 </indexterm>
23497 </para>
23498 <informaltable frame="all">
23499 <tgroup cols="4" colsep="0" rowsep="0">
23500 <colspec colwidth="8*" align="left"/>
23501 <colspec colwidth="6*" align="center"/>
23502 <colspec colwidth="6*" align="center"/>
23503 <colspec colwidth="6*" align="right"/>
23504 <tbody>
23505 <row>
23506 <entry><option>dns_check_names_pattern</option></entry>
23507 <entry>Use: <emphasis>main</emphasis></entry>
23508 <entry>Type: <emphasis>string</emphasis></entry>
23509 <entry>Default: <emphasis>see below</emphasis></entry>
23510 </row>
23511 </tbody>
23512 </tgroup>
23513 </informaltable>
23514 <para>
23515 <indexterm role="concept">
23516 <primary>DNS</primary>
23517 <secondary>pre-check of name syntax</secondary>
23518 </indexterm>
23519 When this option is set to a non-empty string, it causes Exim to check domain
23520 names for characters that are not allowed in host names before handing them to
23521 the DNS resolver, because some resolvers give temporary errors for names that
23522 contain unusual characters. If a domain name contains any unwanted characters,
23523 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
23524 done by matching the domain name against a regular expression, which is the
23525 value of this option. The default pattern is
23526 </para>
23527 <literallayout class="monospaced">
23528 dns_check_names_pattern = \
23529   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
23530 </literallayout>
23531 <para>
23532 which permits only letters, digits, slashes, and hyphens in components, but
23533 they must start and end with a letter or digit. Slashes are not, in fact,
23534 permitted in host names, but they are found in certain NS records (which can be
23535 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
23536 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
23537 empty string.
23538 </para>
23539 <para>
23540 <indexterm role="option">
23541 <primary><option>dns_csa_search_limit</option></primary>
23542 </indexterm>
23543 </para>
23544 <informaltable frame="all">
23545 <tgroup cols="4" colsep="0" rowsep="0">
23546 <colspec colwidth="8*" align="left"/>
23547 <colspec colwidth="6*" align="center"/>
23548 <colspec colwidth="6*" align="center"/>
23549 <colspec colwidth="6*" align="right"/>
23550 <tbody>
23551 <row>
23552 <entry><option>dns_csa_search_limit</option></entry>
23553 <entry>Use: <emphasis>main</emphasis></entry>
23554 <entry>Type: <emphasis>integer</emphasis></entry>
23555 <entry>Default: <emphasis>5</emphasis></entry>
23556 </row>
23557 </tbody>
23558 </tgroup>
23559 </informaltable>
23560 <para>
23561 This option controls the depth of parental searching for CSA SRV records in the
23562 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23563 </para>
23564 <para>
23565 <indexterm role="option">
23566 <primary><option>dns_csa_use_reverse</option></primary>
23567 </indexterm>
23568 </para>
23569 <informaltable frame="all">
23570 <tgroup cols="4" colsep="0" rowsep="0">
23571 <colspec colwidth="8*" align="left"/>
23572 <colspec colwidth="6*" align="center"/>
23573 <colspec colwidth="6*" align="center"/>
23574 <colspec colwidth="6*" align="right"/>
23575 <tbody>
23576 <row>
23577 <entry><option>dns_csa_use_reverse</option></entry>
23578 <entry>Use: <emphasis>main</emphasis></entry>
23579 <entry>Type: <emphasis>boolean</emphasis></entry>
23580 <entry>Default: <emphasis>true</emphasis></entry>
23581 </row>
23582 </tbody>
23583 </tgroup>
23584 </informaltable>
23585 <para>
23586 This option controls whether or not an IP address, given as a CSA domain, is
23587 reversed and looked up in the reverse DNS, as described in more detail in
23588 section <xref linkend="SECTverifyCSA"/>.
23589 </para>
23590 <para>
23591 <indexterm role="option">
23592 <primary><option>dns_dnssec_ok</option></primary>
23593 </indexterm>
23594 </para>
23595 <informaltable frame="all">
23596 <tgroup cols="4" colsep="0" rowsep="0">
23597 <colspec colwidth="8*" align="left"/>
23598 <colspec colwidth="6*" align="center"/>
23599 <colspec colwidth="6*" align="center"/>
23600 <colspec colwidth="6*" align="right"/>
23601 <tbody>
23602 <row>
23603 <entry><option>dns_dnssec_ok</option></entry>
23604 <entry>Use: <emphasis>main</emphasis></entry>
23605 <entry>Type: <emphasis>integer</emphasis></entry>
23606 <entry>Default: <emphasis>-1</emphasis></entry>
23607 </row>
23608 </tbody>
23609 </tgroup>
23610 </informaltable>
23611 <para>
23612 <indexterm role="concept">
23613 <primary>DNS</primary>
23614 <secondary>resolver options</secondary>
23615 </indexterm>
23616 <indexterm role="concept">
23617 <primary>DNS</primary>
23618 <secondary>DNSSEC</secondary>
23619 </indexterm>
23620 If this option is set to a non-negative number then Exim will initialise the
23621 DNS resolver library to either use or not use DNSSEC, overriding the system
23622 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23623 </para>
23624 <para>
23625 If the resolver library does not support DNSSEC then this option has no effect.
23626 </para>
23627 <para>
23628 <indexterm role="option">
23629 <primary><option>dns_ipv4_lookup</option></primary>
23630 </indexterm>
23631 </para>
23632 <informaltable frame="all">
23633 <tgroup cols="4" colsep="0" rowsep="0">
23634 <colspec colwidth="8*" align="left"/>
23635 <colspec colwidth="6*" align="center"/>
23636 <colspec colwidth="6*" align="center"/>
23637 <colspec colwidth="6*" align="right"/>
23638 <tbody>
23639 <row>
23640 <entry><option>dns_ipv4_lookup</option></entry>
23641 <entry>Use: <emphasis>main</emphasis></entry>
23642 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23643 <entry>Default: <emphasis>unset</emphasis></entry>
23644 </row>
23645 </tbody>
23646 </tgroup>
23647 </informaltable>
23648 <para>
23649 <indexterm role="concept">
23650 <primary>IPv6</primary>
23651 <secondary>DNS lookup for AAAA records</secondary>
23652 </indexterm>
23653 <indexterm role="concept">
23654 <primary>DNS</primary>
23655 <secondary>IPv6 lookup for AAAA records</secondary>
23656 </indexterm>
23657 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23658 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23659 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23660 domain matches this list.
23661 </para>
23662 <para>
23663 This is a fudge to help with name servers that give big delays or otherwise do
23664 not work for the AAAA record type. In due course, when the world&#x2019;s name
23665 servers have all been upgraded, there should be no need for this option.
23666 </para>
23667 <para>
23668 <indexterm role="option">
23669 <primary><option>dns_retrans</option></primary>
23670 </indexterm>
23671 </para>
23672 <informaltable frame="all">
23673 <tgroup cols="4" colsep="0" rowsep="0">
23674 <colspec colwidth="8*" align="left"/>
23675 <colspec colwidth="6*" align="center"/>
23676 <colspec colwidth="6*" align="center"/>
23677 <colspec colwidth="6*" align="right"/>
23678 <tbody>
23679 <row>
23680 <entry><option>dns_retrans</option></entry>
23681 <entry>Use: <emphasis>main</emphasis></entry>
23682 <entry>Type: <emphasis>time</emphasis></entry>
23683 <entry>Default: <emphasis>0s</emphasis></entry>
23684 </row>
23685 </tbody>
23686 </tgroup>
23687 </informaltable>
23688 <para>
23689 <indexterm role="concept">
23690 <primary>DNS</primary>
23691 <secondary>resolver options</secondary>
23692 </indexterm>
23693 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
23694 retransmission and retry parameters for DNS lookups. Values of zero (the
23695 defaults) leave the system default settings unchanged. The first value is the
23696 time between retries, and the second is the number of retries. It isn&#x2019;t
23697 totally clear exactly how these settings affect the total time a DNS lookup may
23698 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
23699 parameter values are available in the external resolver interface structure,
23700 but nowhere does it seem to describe how they are used or what you might want
23701 to set in them.
23702 </para>
23703 <para>
23704 <indexterm role="option">
23705 <primary><option>dns_retry</option></primary>
23706 </indexterm>
23707 </para>
23708 <informaltable frame="all">
23709 <tgroup cols="4" colsep="0" rowsep="0">
23710 <colspec colwidth="8*" align="left"/>
23711 <colspec colwidth="6*" align="center"/>
23712 <colspec colwidth="6*" align="center"/>
23713 <colspec colwidth="6*" align="right"/>
23714 <tbody>
23715 <row>
23716 <entry><option>dns_retry</option></entry>
23717 <entry>Use: <emphasis>main</emphasis></entry>
23718 <entry>Type: <emphasis>integer</emphasis></entry>
23719 <entry>Default: <emphasis>0</emphasis></entry>
23720 </row>
23721 </tbody>
23722 </tgroup>
23723 </informaltable>
23724 <para>
23725 See <option>dns_retrans</option> above.
23726 </para>
23727 <para>
23728 <indexterm role="option">
23729 <primary><option>dns_use_edns0</option></primary>
23730 </indexterm>
23731 </para>
23732 <informaltable frame="all">
23733 <tgroup cols="4" colsep="0" rowsep="0">
23734 <colspec colwidth="8*" align="left"/>
23735 <colspec colwidth="6*" align="center"/>
23736 <colspec colwidth="6*" align="center"/>
23737 <colspec colwidth="6*" align="right"/>
23738 <tbody>
23739 <row>
23740 <entry><option>dns_use_edns0</option></entry>
23741 <entry>Use: <emphasis>main</emphasis></entry>
23742 <entry>Type: <emphasis>integer</emphasis></entry>
23743 <entry>Default: <emphasis>-1</emphasis></entry>
23744 </row>
23745 </tbody>
23746 </tgroup>
23747 </informaltable>
23748 <para>
23749 <indexterm role="concept">
23750 <primary>DNS</primary>
23751 <secondary>resolver options</secondary>
23752 </indexterm>
23753 <indexterm role="concept">
23754 <primary>DNS</primary>
23755 <secondary>EDNS0</secondary>
23756 </indexterm>
23757 If this option is set to a non-negative number then Exim will initialise the
23758 DNS resolver library to either use or not use EDNS0 extensions, overriding
23759 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
23760 on.
23761 </para>
23762 <para>
23763 If the resolver library does not support EDNS0 then this option has no effect.
23764 </para>
23765 <para>
23766 <indexterm role="option">
23767 <primary><option>drop_cr</option></primary>
23768 </indexterm>
23769 </para>
23770 <informaltable frame="all">
23771 <tgroup cols="4" colsep="0" rowsep="0">
23772 <colspec colwidth="8*" align="left"/>
23773 <colspec colwidth="6*" align="center"/>
23774 <colspec colwidth="6*" align="center"/>
23775 <colspec colwidth="6*" align="right"/>
23776 <tbody>
23777 <row>
23778 <entry><option>drop_cr</option></entry>
23779 <entry>Use: <emphasis>main</emphasis></entry>
23780 <entry>Type: <emphasis>boolean</emphasis></entry>
23781 <entry>Default: <emphasis>false</emphasis></entry>
23782 </row>
23783 </tbody>
23784 </tgroup>
23785 </informaltable>
23786 <para>
23787 This is an obsolete option that is now a no-op. It used to affect the way Exim
23788 handled CR and LF characters in incoming messages. What happens now is
23789 described in section <xref linkend="SECTlineendings"/>.
23790 </para>
23791 <para>
23792 <indexterm role="option">
23793 <primary><option>dsn_from</option></primary>
23794 </indexterm>
23795 </para>
23796 <informaltable frame="all">
23797 <tgroup cols="4" colsep="0" rowsep="0">
23798 <colspec colwidth="8*" align="left"/>
23799 <colspec colwidth="6*" align="center"/>
23800 <colspec colwidth="6*" align="center"/>
23801 <colspec colwidth="6*" align="right"/>
23802 <tbody>
23803 <row>
23804 <entry><option>dsn_from</option></entry>
23805 <entry>Use: <emphasis>main</emphasis></entry>
23806 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23807 <entry>Default: <emphasis>see below</emphasis></entry>
23808 </row>
23809 </tbody>
23810 </tgroup>
23811 </informaltable>
23812 <para>
23813 <indexterm role="concept">
23814 <primary><emphasis>From:</emphasis> header line</primary>
23815 <secondary>in bounces</secondary>
23816 </indexterm>
23817 <indexterm role="concept">
23818 <primary>bounce messages</primary>
23819 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
23820 </indexterm>
23821 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
23822 bounces and other automatically generated messages (<quote>Delivery Status
23823 Notifications</quote> &ndash; hence the name of the option). The default setting is:
23824 </para>
23825 <literallayout class="monospaced">
23826 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
23827 </literallayout>
23828 <para>
23829 The value is expanded every time it is needed. If the expansion fails, a
23830 panic is logged, and the default value is used.
23831 </para>
23832 <para>
23833 <indexterm role="option">
23834 <primary><option>envelope_to_remove</option></primary>
23835 </indexterm>
23836 </para>
23837 <informaltable frame="all">
23838 <tgroup cols="4" colsep="0" rowsep="0">
23839 <colspec colwidth="8*" align="left"/>
23840 <colspec colwidth="6*" align="center"/>
23841 <colspec colwidth="6*" align="center"/>
23842 <colspec colwidth="6*" align="right"/>
23843 <tbody>
23844 <row>
23845 <entry><option>envelope_to_remove</option></entry>
23846 <entry>Use: <emphasis>main</emphasis></entry>
23847 <entry>Type: <emphasis>boolean</emphasis></entry>
23848 <entry>Default: <emphasis>true</emphasis></entry>
23849 </row>
23850 </tbody>
23851 </tgroup>
23852 </informaltable>
23853 <para>
23854 <indexterm role="concept">
23855 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
23856 </indexterm>
23857 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
23858 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23859 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
23860 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
23861 be present in incoming messages, and this option causes them to be removed at
23862 the time the message is received, to avoid any problems that might occur when a
23863 delivered message is subsequently sent on to some other recipient.
23864 </para>
23865 <para>
23866 <indexterm role="option">
23867 <primary><option>errors_copy</option></primary>
23868 </indexterm>
23869 </para>
23870 <informaltable frame="all">
23871 <tgroup cols="4" colsep="0" rowsep="0">
23872 <colspec colwidth="8*" align="left"/>
23873 <colspec colwidth="6*" align="center"/>
23874 <colspec colwidth="6*" align="center"/>
23875 <colspec colwidth="6*" align="right"/>
23876 <tbody>
23877 <row>
23878 <entry><option>errors_copy</option></entry>
23879 <entry>Use: <emphasis>main</emphasis></entry>
23880 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23881 <entry>Default: <emphasis>unset</emphasis></entry>
23882 </row>
23883 </tbody>
23884 </tgroup>
23885 </informaltable>
23886 <para>
23887 <indexterm role="concept">
23888 <primary>bounce message</primary>
23889 <secondary>copy to other address</secondary>
23890 </indexterm>
23891 <indexterm role="concept">
23892 <primary>copy of bounce message</primary>
23893 </indexterm>
23894 Setting this option causes Exim to send bcc copies of bounce messages that it
23895 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
23896 coming from elsewhere. The value of the option is a colon-separated list of
23897 items. Each item consists of a pattern, terminated by white space, followed by
23898 a comma-separated list of email addresses. If a pattern contains spaces, it
23899 must be enclosed in double quotes.
23900 </para>
23901 <para>
23902 Each pattern is processed in the same way as a single item in an address list
23903 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
23904 the bounce message, the message is copied to the addresses on the list. The
23905 items are scanned in order, and once a matching one is found, no further items
23906 are examined. For example:
23907 </para>
23908 <literallayout class="monospaced">
23909 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
23910               rqps@mydomain   hostmaster@mydomain.example,\
23911                               postmaster@mydomain.example
23912 </literallayout>
23913 <para>
23914 <indexterm role="variable">
23915 <primary><varname>$domain</varname></primary>
23916 </indexterm>
23917 <indexterm role="variable">
23918 <primary><varname>$local_part</varname></primary>
23919 </indexterm>
23920 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
23921 and <varname>$domain</varname> are set from the original recipient of the error message, and if
23922 there was any wildcard matching in the pattern, the expansion
23923 <indexterm role="concept">
23924 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23925 <secondary>in <option>errors_copy</option></secondary>
23926 </indexterm>
23927 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
23928 </para>
23929 <para>
23930 <indexterm role="option">
23931 <primary><option>errors_reply_to</option></primary>
23932 </indexterm>
23933 </para>
23934 <informaltable frame="all">
23935 <tgroup cols="4" colsep="0" rowsep="0">
23936 <colspec colwidth="8*" align="left"/>
23937 <colspec colwidth="6*" align="center"/>
23938 <colspec colwidth="6*" align="center"/>
23939 <colspec colwidth="6*" align="right"/>
23940 <tbody>
23941 <row>
23942 <entry><option>errors_reply_to</option></entry>
23943 <entry>Use: <emphasis>main</emphasis></entry>
23944 <entry>Type: <emphasis>string</emphasis></entry>
23945 <entry>Default: <emphasis>unset</emphasis></entry>
23946 </row>
23947 </tbody>
23948 </tgroup>
23949 </informaltable>
23950 <para>
23951 <indexterm role="concept">
23952 <primary>bounce message</primary>
23953 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
23954 </indexterm>
23955 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
23956 </para>
23957 <literallayout>
23958 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
23959 </literallayout>
23960 <para>
23961 <indexterm role="option">
23962 <primary><option>quota_warn_message</option></primary>
23963 </indexterm>
23964 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
23965 A warning message that is generated by the <option>quota_warn_message</option> option in an
23966 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
23967 overrides the default.
23968 </para>
23969 <para>
23970 Experience shows that people reply to bounce messages. If the
23971 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
23972 and warning messages. For example:
23973 </para>
23974 <literallayout class="monospaced">
23975 errors_reply_to = postmaster@my.domain.example
23976 </literallayout>
23977 <para>
23978 The value of the option is not expanded. It must specify a valid RFC 2822
23979 address. However, if a warning message that is generated by the
23980 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
23981 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
23982 not used.
23983 </para>
23984 <para>
23985 <indexterm role="option">
23986 <primary><option>exim_group</option></primary>
23987 </indexterm>
23988 </para>
23989 <informaltable frame="all">
23990 <tgroup cols="4" colsep="0" rowsep="0">
23991 <colspec colwidth="8*" align="left"/>
23992 <colspec colwidth="6*" align="center"/>
23993 <colspec colwidth="6*" align="center"/>
23994 <colspec colwidth="6*" align="right"/>
23995 <tbody>
23996 <row>
23997 <entry><option>exim_group</option></entry>
23998 <entry>Use: <emphasis>main</emphasis></entry>
23999 <entry>Type: <emphasis>string</emphasis></entry>
24000 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24001 </row>
24002 </tbody>
24003 </tgroup>
24004 </informaltable>
24005 <para>
24006 <indexterm role="concept">
24007 <primary>gid (group id)</primary>
24008 <secondary>Exim&#x2019;s own</secondary>
24009 </indexterm>
24010 <indexterm role="concept">
24011 <primary>Exim group</primary>
24012 </indexterm>
24013 This option changes the gid under which Exim runs when it gives up root
24014 privilege. The default value is compiled into the binary. The value of this
24015 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
24016 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
24017 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
24018 security issues.
24019 </para>
24020 <para>
24021 <indexterm role="option">
24022 <primary><option>exim_path</option></primary>
24023 </indexterm>
24024 </para>
24025 <informaltable frame="all">
24026 <tgroup cols="4" colsep="0" rowsep="0">
24027 <colspec colwidth="8*" align="left"/>
24028 <colspec colwidth="6*" align="center"/>
24029 <colspec colwidth="6*" align="center"/>
24030 <colspec colwidth="6*" align="right"/>
24031 <tbody>
24032 <row>
24033 <entry><option>exim_path</option></entry>
24034 <entry>Use: <emphasis>main</emphasis></entry>
24035 <entry>Type: <emphasis>string</emphasis></entry>
24036 <entry>Default: <emphasis>see below</emphasis></entry>
24037 </row>
24038 </tbody>
24039 </tgroup>
24040 </informaltable>
24041 <para>
24042 <indexterm role="concept">
24043 <primary>Exim binary, path name</primary>
24044 </indexterm>
24045 This option specifies the path name of the Exim binary, which is used when Exim
24046 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
24047 the directory configured at compile time by the BIN_DIRECTORY setting. It
24048 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
24049 other place.
24050 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
24051 you will break those Exim utilities that scan the configuration file to find
24052 where the binary is. (They then use the <option>-bP</option> option to extract option
24053 settings such as the value of <option>spool_directory</option>.)
24054 </para>
24055 <para>
24056 <indexterm role="option">
24057 <primary><option>exim_user</option></primary>
24058 </indexterm>
24059 </para>
24060 <informaltable frame="all">
24061 <tgroup cols="4" colsep="0" rowsep="0">
24062 <colspec colwidth="8*" align="left"/>
24063 <colspec colwidth="6*" align="center"/>
24064 <colspec colwidth="6*" align="center"/>
24065 <colspec colwidth="6*" align="right"/>
24066 <tbody>
24067 <row>
24068 <entry><option>exim_user</option></entry>
24069 <entry>Use: <emphasis>main</emphasis></entry>
24070 <entry>Type: <emphasis>string</emphasis></entry>
24071 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
24072 </row>
24073 </tbody>
24074 </tgroup>
24075 </informaltable>
24076 <para>
24077 <indexterm role="concept">
24078 <primary>uid (user id)</primary>
24079 <secondary>Exim&#x2019;s own</secondary>
24080 </indexterm>
24081 <indexterm role="concept">
24082 <primary>Exim user</primary>
24083 </indexterm>
24084 This option changes the uid under which Exim runs when it gives up root
24085 privilege. The default value is compiled into the binary. Ownership of the run
24086 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
24087 options is checked against the values in the binary, not what is set here.
24088 </para>
24089 <para>
24090 Unless it consists entirely of digits, the string is looked up using
24091 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
24092 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
24093 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
24094 </para>
24095 <para>
24096 <indexterm role="option">
24097 <primary><option>extra_local_interfaces</option></primary>
24098 </indexterm>
24099 </para>
24100 <informaltable frame="all">
24101 <tgroup cols="4" colsep="0" rowsep="0">
24102 <colspec colwidth="8*" align="left"/>
24103 <colspec colwidth="6*" align="center"/>
24104 <colspec colwidth="6*" align="center"/>
24105 <colspec colwidth="6*" align="right"/>
24106 <tbody>
24107 <row>
24108 <entry><option>extra_local_interfaces</option></entry>
24109 <entry>Use: <emphasis>main</emphasis></entry>
24110 <entry>Type: <emphasis>string list</emphasis></entry>
24111 <entry>Default: <emphasis>unset</emphasis></entry>
24112 </row>
24113 </tbody>
24114 </tgroup>
24115 </informaltable>
24116 <para>
24117 This option defines network interfaces that are to be considered local when
24118 routing, but which are not used for listening by the daemon. See section
24119 <xref linkend="SECTreclocipadd"/> for details.
24120 </para>
24121 <para>
24122 <indexterm role="option">
24123 <primary><option>extract_addresses_remove_arguments</option></primary>
24124 </indexterm>
24125 </para>
24126 <informaltable frame="all">
24127 <tgroup cols="4" colsep="0" rowsep="0">
24128 <colspec colwidth="8*" align="left"/>
24129 <colspec colwidth="6*" align="center"/>
24130 <colspec colwidth="6*" align="center"/>
24131 <colspec colwidth="6*" align="right"/>
24132 <tbody>
24133 <row>
24134 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
24135 <entry>Use: <emphasis>main</emphasis></entry>
24136 <entry>Type: <emphasis>boolean</emphasis></entry>
24137 <entry>Default: <emphasis>true</emphasis></entry>
24138 </row>
24139 </tbody>
24140 </tgroup>
24141 </informaltable>
24142 <para>
24143 <indexterm role="option">
24144 <primary><option>-t</option></primary>
24145 </indexterm>
24146 <indexterm role="concept">
24147 <primary>command line</primary>
24148 <secondary>addresses with <option>-t</option></secondary>
24149 </indexterm>
24150 <indexterm role="concept">
24151 <primary>Sendmail compatibility</primary>
24152 <secondary><option>-t</option> option</secondary>
24153 </indexterm>
24154 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
24155 are present on the command line when the <option>-t</option> option is used to build an
24156 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
24157 line addresses are removed from the recipients list. This is also how Smail
24158 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
24159 command line addresses are added to those obtained from the header lines. When
24160 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
24161 argument headers. If it is set false, Exim adds rather than removes argument
24162 addresses.
24163 </para>
24164 <para>
24165 <indexterm role="option">
24166 <primary><option>finduser_retries</option></primary>
24167 </indexterm>
24168 </para>
24169 <informaltable frame="all">
24170 <tgroup cols="4" colsep="0" rowsep="0">
24171 <colspec colwidth="8*" align="left"/>
24172 <colspec colwidth="6*" align="center"/>
24173 <colspec colwidth="6*" align="center"/>
24174 <colspec colwidth="6*" align="right"/>
24175 <tbody>
24176 <row>
24177 <entry><option>finduser_retries</option></entry>
24178 <entry>Use: <emphasis>main</emphasis></entry>
24179 <entry>Type: <emphasis>integer</emphasis></entry>
24180 <entry>Default: <emphasis>0</emphasis></entry>
24181 </row>
24182 </tbody>
24183 </tgroup>
24184 </informaltable>
24185 <para>
24186 <indexterm role="concept">
24187 <primary>NIS, retrying user lookups</primary>
24188 </indexterm>
24189 On systems running NIS or other schemes in which user and group information is
24190 distributed from a remote system, there can be times when <function>getpwnam()</function> and
24191 related functions fail, even when given valid data, because things time out.
24192 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
24193 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
24194 many extra times to find a user or a group, waiting for one second between
24195 retries.
24196 </para>
24197 <para>
24198 <indexterm role="concept">
24199 <primary><filename>/etc/passwd</filename></primary>
24200 <secondary>multiple reading of</secondary>
24201 </indexterm>
24202 You should not set this option greater than zero if your user information is in
24203 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
24204 search the file multiple times for non-existent users, and also cause delay.
24205 </para>
24206 <para>
24207 <indexterm role="option">
24208 <primary><option>freeze_tell</option></primary>
24209 </indexterm>
24210 </para>
24211 <informaltable frame="all">
24212 <tgroup cols="4" colsep="0" rowsep="0">
24213 <colspec colwidth="8*" align="left"/>
24214 <colspec colwidth="6*" align="center"/>
24215 <colspec colwidth="6*" align="center"/>
24216 <colspec colwidth="6*" align="right"/>
24217 <tbody>
24218 <row>
24219 <entry><option>freeze_tell</option></entry>
24220 <entry>Use: <emphasis>main</emphasis></entry>
24221 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
24222 <entry>Default: <emphasis>unset</emphasis></entry>
24223 </row>
24224 </tbody>
24225 </tgroup>
24226 </informaltable>
24227 <para>
24228 <indexterm role="concept">
24229 <primary>freezing messages</primary>
24230 <secondary>sending a message when freezing</secondary>
24231 </indexterm>
24232 On encountering certain errors, or when configured to do so in a system filter,
24233 ACL, or special router, Exim freezes a message. This means that no further
24234 delivery attempts take place until an administrator thaws the message, or the
24235 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
24236 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
24237 warning message whenever it freezes something, unless the message it is
24238 freezing is a locally-generated bounce message. (Without this exception there
24239 is the possibility of looping.) The warning message is sent to the addresses
24240 supplied as the comma-separated value of this option. If several of the
24241 message&#x2019;s addresses cause freezing, only a single message is sent. If the
24242 freezing was automatic, the reason(s) for freezing can be found in the message
24243 log. If you configure freezing in a filter or ACL, you must arrange for any
24244 logging that you require.
24245 </para>
24246 <para>
24247 <indexterm role="option">
24248 <primary><option>gecos_name</option></primary>
24249 </indexterm>
24250 </para>
24251 <informaltable frame="all">
24252 <tgroup cols="4" colsep="0" rowsep="0">
24253 <colspec colwidth="8*" align="left"/>
24254 <colspec colwidth="6*" align="center"/>
24255 <colspec colwidth="6*" align="center"/>
24256 <colspec colwidth="6*" align="right"/>
24257 <tbody>
24258 <row>
24259 <entry><option>gecos_name</option></entry>
24260 <entry>Use: <emphasis>main</emphasis></entry>
24261 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24262 <entry>Default: <emphasis>unset</emphasis></entry>
24263 </row>
24264 </tbody>
24265 </tgroup>
24266 </informaltable>
24267 <para>
24268 <indexterm role="concept">
24269 <primary>HP-UX</primary>
24270 </indexterm>
24271 <indexterm role="concept">
24272 <primary><quote>gecos</quote> field, parsing</primary>
24273 </indexterm>
24274 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
24275 password file to hold other information in addition to users&#x2019; real names. Exim
24276 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
24277 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
24278 of the field are used unchanged, except that, if an ampersand is encountered,
24279 it is replaced by the user&#x2019;s login name with the first character forced to
24280 upper case, since this is a convention that is observed on many systems.
24281 </para>
24282 <para>
24283 When these options are set, <option>gecos_pattern</option> is treated as a regular
24284 expression that is to be applied to the field (again with &amp; replaced by the
24285 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
24286 user&#x2019;s name.
24287 </para>
24288 <para>
24289 <indexterm role="concept">
24290 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
24291 <secondary>in <option>gecos_name</option></secondary>
24292 </indexterm>
24293 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
24294 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
24295 name terminates at the first comma, the following can be used:
24296 </para>
24297 <literallayout class="monospaced">
24298 gecos_pattern = ([^,]*)
24299 gecos_name = $1
24300 </literallayout>
24301 <para>
24302 <indexterm role="option">
24303 <primary><option>gecos_pattern</option></primary>
24304 </indexterm>
24305 </para>
24306 <informaltable frame="all">
24307 <tgroup cols="4" colsep="0" rowsep="0">
24308 <colspec colwidth="8*" align="left"/>
24309 <colspec colwidth="6*" align="center"/>
24310 <colspec colwidth="6*" align="center"/>
24311 <colspec colwidth="6*" align="right"/>
24312 <tbody>
24313 <row>
24314 <entry><option>gecos_pattern</option></entry>
24315 <entry>Use: <emphasis>main</emphasis></entry>
24316 <entry>Type: <emphasis>string</emphasis></entry>
24317 <entry>Default: <emphasis>unset</emphasis></entry>
24318 </row>
24319 </tbody>
24320 </tgroup>
24321 </informaltable>
24322 <para>
24323 See <option>gecos_name</option> above.
24324 </para>
24325 <para>
24326 <indexterm role="option">
24327 <primary><option>gnutls_compat_mode</option></primary>
24328 </indexterm>
24329 </para>
24330 <informaltable frame="all">
24331 <tgroup cols="4" colsep="0" rowsep="0">
24332 <colspec colwidth="8*" align="left"/>
24333 <colspec colwidth="6*" align="center"/>
24334 <colspec colwidth="6*" align="center"/>
24335 <colspec colwidth="6*" align="right"/>
24336 <tbody>
24337 <row>
24338 <entry><option>gnutls_compat_mode</option></entry>
24339 <entry>Use: <emphasis>main</emphasis></entry>
24340 <entry>Type: <emphasis>boolean</emphasis></entry>
24341 <entry>Default: <emphasis>unset</emphasis></entry>
24342 </row>
24343 </tbody>
24344 </tgroup>
24345 </informaltable>
24346 <para>
24347 This option controls whether GnuTLS is used in compatibility mode in an Exim
24348 server. This reduces security slightly, but improves interworking with older
24349 implementations of TLS.
24350 </para>
24351 <para>
24352 option gnutls_allow_auto_pkcs11 main boolean unset
24353 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
24354 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
24355 </para>
24356 <para>
24357 See
24358 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs">http://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs</ulink></emphasis>
24359 for documentation.
24360 </para>
24361 <para>
24362 <indexterm role="option">
24363 <primary><option>headers_charset</option></primary>
24364 </indexterm>
24365 </para>
24366 <informaltable frame="all">
24367 <tgroup cols="4" colsep="0" rowsep="0">
24368 <colspec colwidth="8*" align="left"/>
24369 <colspec colwidth="6*" align="center"/>
24370 <colspec colwidth="6*" align="center"/>
24371 <colspec colwidth="6*" align="right"/>
24372 <tbody>
24373 <row>
24374 <entry><option>headers_charset</option></entry>
24375 <entry>Use: <emphasis>main</emphasis></entry>
24376 <entry>Type: <emphasis>string</emphasis></entry>
24377 <entry>Default: <emphasis>see below</emphasis></entry>
24378 </row>
24379 </tbody>
24380 </tgroup>
24381 </informaltable>
24382 <para>
24383 This option sets a default character set for translating from encoded MIME
24384 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
24385 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
24386 ultimate default is ISO-8859-1. For more details see the description of header
24387 insertions in section <xref linkend="SECTexpansionitems"/>.
24388 </para>
24389 <para>
24390 <indexterm role="option">
24391 <primary><option>header_maxsize</option></primary>
24392 </indexterm>
24393 </para>
24394 <informaltable frame="all">
24395 <tgroup cols="4" colsep="0" rowsep="0">
24396 <colspec colwidth="8*" align="left"/>
24397 <colspec colwidth="6*" align="center"/>
24398 <colspec colwidth="6*" align="center"/>
24399 <colspec colwidth="6*" align="right"/>
24400 <tbody>
24401 <row>
24402 <entry><option>header_maxsize</option></entry>
24403 <entry>Use: <emphasis>main</emphasis></entry>
24404 <entry>Type: <emphasis>integer</emphasis></entry>
24405 <entry>Default: <emphasis>see below</emphasis></entry>
24406 </row>
24407 </tbody>
24408 </tgroup>
24409 </informaltable>
24410 <para>
24411 <indexterm role="concept">
24412 <primary>header section</primary>
24413 <secondary>maximum size of</secondary>
24414 </indexterm>
24415 <indexterm role="concept">
24416 <primary>limit</primary>
24417 <secondary>size of message header section</secondary>
24418 </indexterm>
24419 This option controls the overall maximum size of a message&#x2019;s header
24420 section. The default is the value of HEADER_MAXSIZE in
24421 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
24422 sections are rejected.
24423 </para>
24424 <para>
24425 <indexterm role="option">
24426 <primary><option>header_line_maxsize</option></primary>
24427 </indexterm>
24428 </para>
24429 <informaltable frame="all">
24430 <tgroup cols="4" colsep="0" rowsep="0">
24431 <colspec colwidth="8*" align="left"/>
24432 <colspec colwidth="6*" align="center"/>
24433 <colspec colwidth="6*" align="center"/>
24434 <colspec colwidth="6*" align="right"/>
24435 <tbody>
24436 <row>
24437 <entry><option>header_line_maxsize</option></entry>
24438 <entry>Use: <emphasis>main</emphasis></entry>
24439 <entry>Type: <emphasis>integer</emphasis></entry>
24440 <entry>Default: <emphasis>0</emphasis></entry>
24441 </row>
24442 </tbody>
24443 </tgroup>
24444 </informaltable>
24445 <para>
24446 <indexterm role="concept">
24447 <primary>header lines</primary>
24448 <secondary>maximum size of</secondary>
24449 </indexterm>
24450 <indexterm role="concept">
24451 <primary>limit</primary>
24452 <secondary>size of one header line</secondary>
24453 </indexterm>
24454 This option limits the length of any individual header line in a message, after
24455 all the continuations have been joined together. Messages with individual
24456 header lines that are longer than the limit are rejected. The default value of
24457 zero means <quote>no limit</quote>.
24458 </para>
24459 <para>
24460 <indexterm role="option">
24461 <primary><option>helo_accept_junk_hosts</option></primary>
24462 </indexterm>
24463 </para>
24464 <informaltable frame="all">
24465 <tgroup cols="4" colsep="0" rowsep="0">
24466 <colspec colwidth="8*" align="left"/>
24467 <colspec colwidth="6*" align="center"/>
24468 <colspec colwidth="6*" align="center"/>
24469 <colspec colwidth="6*" align="right"/>
24470 <tbody>
24471 <row>
24472 <entry><option>helo_accept_junk_hosts</option></entry>
24473 <entry>Use: <emphasis>main</emphasis></entry>
24474 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24475 <entry>Default: <emphasis>unset</emphasis></entry>
24476 </row>
24477 </tbody>
24478 </tgroup>
24479 </informaltable>
24480 <para>
24481 <indexterm role="concept">
24482 <primary>HELO</primary>
24483 <secondary>accepting junk data</secondary>
24484 </indexterm>
24485 <indexterm role="concept">
24486 <primary>EHLO</primary>
24487 <secondary>accepting junk data</secondary>
24488 </indexterm>
24489 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
24490 mail, and gives an error response for invalid data. Unfortunately, there are
24491 some SMTP clients that send syntactic junk. They can be accommodated by setting
24492 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
24493 if you want to do semantic checking.
24494 See also <option>helo_allow_chars</option> for a way of extending the permitted character
24495 set.
24496 </para>
24497 <para>
24498 <indexterm role="option">
24499 <primary><option>helo_allow_chars</option></primary>
24500 </indexterm>
24501 </para>
24502 <informaltable frame="all">
24503 <tgroup cols="4" colsep="0" rowsep="0">
24504 <colspec colwidth="8*" align="left"/>
24505 <colspec colwidth="6*" align="center"/>
24506 <colspec colwidth="6*" align="center"/>
24507 <colspec colwidth="6*" align="right"/>
24508 <tbody>
24509 <row>
24510 <entry><option>helo_allow_chars</option></entry>
24511 <entry>Use: <emphasis>main</emphasis></entry>
24512 <entry>Type: <emphasis>string</emphasis></entry>
24513 <entry>Default: <emphasis>unset</emphasis></entry>
24514 </row>
24515 </tbody>
24516 </tgroup>
24517 </informaltable>
24518 <para>
24519 <indexterm role="concept">
24520 <primary>HELO</primary>
24521 <secondary>underscores in</secondary>
24522 </indexterm>
24523 <indexterm role="concept">
24524 <primary>EHLO</primary>
24525 <secondary>underscores in</secondary>
24526 </indexterm>
24527 <indexterm role="concept">
24528 <primary>underscore in EHLO/HELO</primary>
24529 </indexterm>
24530 This option can be set to a string of rogue characters that are permitted in
24531 all EHLO and HELO names in addition to the standard letters, digits,
24532 hyphens, and dots. If you really must allow underscores, you can set
24533 </para>
24534 <literallayout class="monospaced">
24535 helo_allow_chars = _
24536 </literallayout>
24537 <para>
24538 Note that the value is one string, not a list.
24539 </para>
24540 <para>
24541 <indexterm role="option">
24542 <primary><option>helo_lookup_domains</option></primary>
24543 </indexterm>
24544 </para>
24545 <informaltable frame="all">
24546 <tgroup cols="4" colsep="0" rowsep="0">
24547 <colspec colwidth="8*" align="left"/>
24548 <colspec colwidth="6*" align="center"/>
24549 <colspec colwidth="6*" align="center"/>
24550 <colspec colwidth="6*" align="right"/>
24551 <tbody>
24552 <row>
24553 <entry><option>helo_lookup_domains</option></entry>
24554 <entry>Use: <emphasis>main</emphasis></entry>
24555 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24556 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24557 </row>
24558 </tbody>
24559 </tgroup>
24560 </informaltable>
24561 <para>
24562 <indexterm role="concept">
24563 <primary>HELO</primary>
24564 <secondary>forcing reverse lookup</secondary>
24565 </indexterm>
24566 <indexterm role="concept">
24567 <primary>EHLO</primary>
24568 <secondary>forcing reverse lookup</secondary>
24569 </indexterm>
24570 If the domain given by a client in a HELO or EHLO command matches this
24571 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
24572 default forces a lookup if the client host gives the server&#x2019;s name or any of
24573 its IP addresses (in brackets), something that broken clients have been seen to
24574 do.
24575 </para>
24576 <para>
24577 <indexterm role="option">
24578 <primary><option>helo_try_verify_hosts</option></primary>
24579 </indexterm>
24580 </para>
24581 <informaltable frame="all">
24582 <tgroup cols="4" colsep="0" rowsep="0">
24583 <colspec colwidth="8*" align="left"/>
24584 <colspec colwidth="6*" align="center"/>
24585 <colspec colwidth="6*" align="center"/>
24586 <colspec colwidth="6*" align="right"/>
24587 <tbody>
24588 <row>
24589 <entry><option>helo_try_verify_hosts</option></entry>
24590 <entry>Use: <emphasis>main</emphasis></entry>
24591 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24592 <entry>Default: <emphasis>unset</emphasis></entry>
24593 </row>
24594 </tbody>
24595 </tgroup>
24596 </informaltable>
24597 <para>
24598 <indexterm role="concept">
24599 <primary>HELO verifying</primary>
24600 <secondary>optional</secondary>
24601 </indexterm>
24602 <indexterm role="concept">
24603 <primary>EHLO</primary>
24604 <secondary>verifying, optional</secondary>
24605 </indexterm>
24606 By default, Exim just checks the syntax of HELO and EHLO commands (see
24607 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
24608 to do more extensive checking of the data supplied by these commands. The ACL
24609 condition <literal>verify = helo</literal> is provided to make this possible.
24610 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
24611 to force the check to occur. From release 4.53 onwards, this is no longer
24612 necessary. If the check has not been done before <literal>verify = helo</literal> is
24613 encountered, it is done at that time. Consequently, this option is obsolete.
24614 Its specification is retained here for backwards compatibility.
24615 </para>
24616 <para>
24617 When an EHLO or HELO command is received, if the calling host matches
24618 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
24619 EHLO command either:
24620 </para>
24621 <itemizedlist>
24622 <listitem>
24623 <para>
24624 is an IP literal matching the calling address of the host, or
24625 </para>
24626 </listitem>
24627 <listitem>
24628 <para>
24629 <indexterm role="concept">
24630 <primary>DNS</primary>
24631 <secondary>reverse lookup</secondary>
24632 </indexterm>
24633 <indexterm role="concept">
24634 <primary>reverse DNS lookup</primary>
24635 </indexterm>
24636 matches the host name that Exim obtains by doing a reverse lookup of the
24637 calling host address, or
24638 </para>
24639 </listitem>
24640 <listitem>
24641 <para>
24642 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
24643 available) yields the calling host address.
24644 </para>
24645 </listitem>
24646 </itemizedlist>
24647 <para>
24648 However, the EHLO or HELO command is not rejected if any of the checks
24649 fail. Processing continues, but the result of the check is remembered, and can
24650 be detected later in an ACL by the <literal>verify = helo</literal> condition.
24651 </para>
24652 <para>
24653 <indexterm role="option">
24654 <primary><option>helo_verify_hosts</option></primary>
24655 </indexterm>
24656 </para>
24657 <informaltable frame="all">
24658 <tgroup cols="4" colsep="0" rowsep="0">
24659 <colspec colwidth="8*" align="left"/>
24660 <colspec colwidth="6*" align="center"/>
24661 <colspec colwidth="6*" align="center"/>
24662 <colspec colwidth="6*" align="right"/>
24663 <tbody>
24664 <row>
24665 <entry><option>helo_verify_hosts</option></entry>
24666 <entry>Use: <emphasis>main</emphasis></entry>
24667 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24668 <entry>Default: <emphasis>unset</emphasis></entry>
24669 </row>
24670 </tbody>
24671 </tgroup>
24672 </informaltable>
24673 <para>
24674 <indexterm role="concept">
24675 <primary>HELO verifying</primary>
24676 <secondary>mandatory</secondary>
24677 </indexterm>
24678 <indexterm role="concept">
24679 <primary>EHLO</primary>
24680 <secondary>verifying, mandatory</secondary>
24681 </indexterm>
24682 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
24683 backwards compatibility. For hosts that match this option, Exim checks the host
24684 name given in the HELO or EHLO in the same way as for
24685 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
24686 rejected with a 550 error, and entries are written to the main and reject logs.
24687 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
24688 error.
24689 </para>
24690 <para>
24691 <indexterm role="option">
24692 <primary><option>hold_domains</option></primary>
24693 </indexterm>
24694 </para>
24695 <informaltable frame="all">
24696 <tgroup cols="4" colsep="0" rowsep="0">
24697 <colspec colwidth="8*" align="left"/>
24698 <colspec colwidth="6*" align="center"/>
24699 <colspec colwidth="6*" align="center"/>
24700 <colspec colwidth="6*" align="right"/>
24701 <tbody>
24702 <row>
24703 <entry><option>hold_domains</option></entry>
24704 <entry>Use: <emphasis>main</emphasis></entry>
24705 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24706 <entry>Default: <emphasis>unset</emphasis></entry>
24707 </row>
24708 </tbody>
24709 </tgroup>
24710 </informaltable>
24711 <para>
24712 <indexterm role="concept">
24713 <primary>domain</primary>
24714 <secondary>delaying delivery</secondary>
24715 </indexterm>
24716 <indexterm role="concept">
24717 <primary>delivery</primary>
24718 <secondary>delaying certain domains</secondary>
24719 </indexterm>
24720 This option allows mail for particular domains to be held on the queue
24721 manually. The option is overridden if a message delivery is forced with the
24722 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
24723 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
24724 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
24725 it is deferred every time the message is looked at.
24726 </para>
24727 <para>
24728 This option is intended as a temporary operational measure for delaying the
24729 delivery of mail while some problem is being sorted out, or some new
24730 configuration tested. If you just want to delay the processing of some
24731 domains until a queue run occurs, you should use <option>queue_domains</option> or
24732 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
24733 </para>
24734 <para>
24735 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
24736 messages from the queue if they have been there longer than the longest retry
24737 time in any retry rule. If you want to hold messages for longer than the normal
24738 retry times, insert a dummy retry rule with a long retry time.
24739 </para>
24740 <para>
24741 <indexterm role="option">
24742 <primary><option>host_lookup</option></primary>
24743 </indexterm>
24744 </para>
24745 <informaltable frame="all">
24746 <tgroup cols="4" colsep="0" rowsep="0">
24747 <colspec colwidth="8*" align="left"/>
24748 <colspec colwidth="6*" align="center"/>
24749 <colspec colwidth="6*" align="center"/>
24750 <colspec colwidth="6*" align="right"/>
24751 <tbody>
24752 <row>
24753 <entry><option>host_lookup</option></entry>
24754 <entry>Use: <emphasis>main</emphasis></entry>
24755 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24756 <entry>Default: <emphasis>unset</emphasis></entry>
24757 </row>
24758 </tbody>
24759 </tgroup>
24760 </informaltable>
24761 <para>
24762 <indexterm role="concept">
24763 <primary>host name</primary>
24764 <secondary>lookup, forcing</secondary>
24765 </indexterm>
24766 Exim does not look up the name of a calling host from its IP address unless it
24767 is required to compare against some host list, or the host matches
24768 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
24769 option (which normally contains IP addresses rather than host names). The
24770 default configuration file contains
24771 </para>
24772 <literallayout class="monospaced">
24773 host_lookup = *
24774 </literallayout>
24775 <para>
24776 which causes a lookup to happen for all hosts. If the expense of these lookups
24777 is felt to be too great, the setting can be changed or removed.
24778 </para>
24779 <para>
24780 After a successful reverse lookup, Exim does a forward lookup on the name it
24781 has obtained, to verify that it yields the IP address that it started with. If
24782 this check fails, Exim behaves as if the name lookup failed.
24783 </para>
24784 <para>
24785 <indexterm role="variable">
24786 <primary><varname>$host_lookup_failed</varname></primary>
24787 </indexterm>
24788 <indexterm role="variable">
24789 <primary><varname>$sender_host_name</varname></primary>
24790 </indexterm>
24791 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
24792 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
24793 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
24794 <literal>verify = reverse_host_lookup</literal> in ACLs.
24795 </para>
24796 <para>
24797 <indexterm role="option">
24798 <primary><option>host_lookup_order</option></primary>
24799 </indexterm>
24800 </para>
24801 <informaltable frame="all">
24802 <tgroup cols="4" colsep="0" rowsep="0">
24803 <colspec colwidth="8*" align="left"/>
24804 <colspec colwidth="6*" align="center"/>
24805 <colspec colwidth="6*" align="center"/>
24806 <colspec colwidth="6*" align="right"/>
24807 <tbody>
24808 <row>
24809 <entry><option>host_lookup_order</option></entry>
24810 <entry>Use: <emphasis>main</emphasis></entry>
24811 <entry>Type: <emphasis>string list</emphasis></entry>
24812 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
24813 </row>
24814 </tbody>
24815 </tgroup>
24816 </informaltable>
24817 <para>
24818 This option specifies the order of different lookup methods when Exim is trying
24819 to find a host name from an IP address. The default is to do a DNS lookup
24820 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
24821 if that fails. You can change the order of these lookups, or omit one entirely,
24822 if you want.
24823 </para>
24824 <para>
24825 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
24826 multiple PTR records in the DNS and the IP address is not listed in
24827 <filename>/etc/hosts</filename>. Different operating systems give different results in this
24828 case. That is why the default tries a DNS lookup first.
24829 </para>
24830 <para>
24831 <indexterm role="option">
24832 <primary><option>host_reject_connection</option></primary>
24833 </indexterm>
24834 </para>
24835 <informaltable frame="all">
24836 <tgroup cols="4" colsep="0" rowsep="0">
24837 <colspec colwidth="8*" align="left"/>
24838 <colspec colwidth="6*" align="center"/>
24839 <colspec colwidth="6*" align="center"/>
24840 <colspec colwidth="6*" align="right"/>
24841 <tbody>
24842 <row>
24843 <entry><option>host_reject_connection</option></entry>
24844 <entry>Use: <emphasis>main</emphasis></entry>
24845 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24846 <entry>Default: <emphasis>unset</emphasis></entry>
24847 </row>
24848 </tbody>
24849 </tgroup>
24850 </informaltable>
24851 <para>
24852 <indexterm role="concept">
24853 <primary>host</primary>
24854 <secondary>rejecting connections from</secondary>
24855 </indexterm>
24856 If this option is set, incoming SMTP calls from the hosts listed are rejected
24857 as soon as the connection is made.
24858 This option is obsolete, and retained only for backward compatibility, because
24859 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
24860 connections immediately.
24861 </para>
24862 <para>
24863 The ability to give an immediate rejection (either by this option or using an
24864 ACL) is provided for use in unusual cases. Many hosts will just try again,
24865 sometimes without much delay. Normally, it is better to use an ACL to reject
24866 incoming messages at a later stage, such as after RCPT commands. See
24867 chapter <xref linkend="CHAPACL"/>.
24868 </para>
24869 <para>
24870 <indexterm role="option">
24871 <primary><option>hosts_connection_nolog</option></primary>
24872 </indexterm>
24873 </para>
24874 <informaltable frame="all">
24875 <tgroup cols="4" colsep="0" rowsep="0">
24876 <colspec colwidth="8*" align="left"/>
24877 <colspec colwidth="6*" align="center"/>
24878 <colspec colwidth="6*" align="center"/>
24879 <colspec colwidth="6*" align="right"/>
24880 <tbody>
24881 <row>
24882 <entry><option>hosts_connection_nolog</option></entry>
24883 <entry>Use: <emphasis>main</emphasis></entry>
24884 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24885 <entry>Default: <emphasis>unset</emphasis></entry>
24886 </row>
24887 </tbody>
24888 </tgroup>
24889 </informaltable>
24890 <para>
24891 <indexterm role="concept">
24892 <primary>host</primary>
24893 <secondary>not logging connections from</secondary>
24894 </indexterm>
24895 This option defines a list of hosts for which connection logging does not
24896 happen, even though the <option>smtp_connection</option> log selector is set. For example,
24897 you might want not to log SMTP connections from local processes, or from
24898 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
24899 the daemon; you should therefore strive to restrict its value to a short inline
24900 list of IP addresses and networks. To disable logging SMTP connections from
24901 local processes, you must create a host list with an empty item. For example:
24902 </para>
24903 <literallayout class="monospaced">
24904 hosts_connection_nolog = :
24905 </literallayout>
24906 <para>
24907 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
24908 </para>
24909 <para>
24910 <indexterm role="option">
24911 <primary><option>hosts_treat_as_local</option></primary>
24912 </indexterm>
24913 </para>
24914 <informaltable frame="all">
24915 <tgroup cols="4" colsep="0" rowsep="0">
24916 <colspec colwidth="8*" align="left"/>
24917 <colspec colwidth="6*" align="center"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="right"/>
24920 <tbody>
24921 <row>
24922 <entry><option>hosts_treat_as_local</option></entry>
24923 <entry>Use: <emphasis>main</emphasis></entry>
24924 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24925 <entry>Default: <emphasis>unset</emphasis></entry>
24926 </row>
24927 </tbody>
24928 </tgroup>
24929 </informaltable>
24930 <para>
24931 <indexterm role="concept">
24932 <primary>local host</primary>
24933 <secondary>domains treated as</secondary>
24934 </indexterm>
24935 <indexterm role="concept">
24936 <primary>host</primary>
24937 <secondary>treated as local</secondary>
24938 </indexterm>
24939 If this option is set, any host names that match the domain list are treated as
24940 if they were the local host when Exim is scanning host lists obtained from MX
24941 records
24942 or other sources. Note that the value of this option is a domain list, not a
24943 host list, because it is always used to check host names, not IP addresses.
24944 </para>
24945 <para>
24946 This option also applies when Exim is matching the special items
24947 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
24948 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
24949 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
24950 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
24951 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
24952 interfaces and recognizing the local host.
24953 </para>
24954 <para>
24955 <indexterm role="option">
24956 <primary><option>ibase_servers</option></primary>
24957 </indexterm>
24958 </para>
24959 <informaltable frame="all">
24960 <tgroup cols="4" colsep="0" rowsep="0">
24961 <colspec colwidth="8*" align="left"/>
24962 <colspec colwidth="6*" align="center"/>
24963 <colspec colwidth="6*" align="center"/>
24964 <colspec colwidth="6*" align="right"/>
24965 <tbody>
24966 <row>
24967 <entry><option>ibase_servers</option></entry>
24968 <entry>Use: <emphasis>main</emphasis></entry>
24969 <entry>Type: <emphasis>string list</emphasis></entry>
24970 <entry>Default: <emphasis>unset</emphasis></entry>
24971 </row>
24972 </tbody>
24973 </tgroup>
24974 </informaltable>
24975 <para>
24976 <indexterm role="concept">
24977 <primary>InterBase</primary>
24978 <secondary>server list</secondary>
24979 </indexterm>
24980 This option provides a list of InterBase servers and associated connection data,
24981 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
24982 The option is available only if Exim has been built with InterBase support.
24983 </para>
24984 <para>
24985 <indexterm role="option">
24986 <primary><option>ignore_bounce_errors_after</option></primary>
24987 </indexterm>
24988 </para>
24989 <informaltable frame="all">
24990 <tgroup cols="4" colsep="0" rowsep="0">
24991 <colspec colwidth="8*" align="left"/>
24992 <colspec colwidth="6*" align="center"/>
24993 <colspec colwidth="6*" align="center"/>
24994 <colspec colwidth="6*" align="right"/>
24995 <tbody>
24996 <row>
24997 <entry><option>ignore_bounce_errors_after</option></entry>
24998 <entry>Use: <emphasis>main</emphasis></entry>
24999 <entry>Type: <emphasis>time</emphasis></entry>
25000 <entry>Default: <emphasis>10w</emphasis></entry>
25001 </row>
25002 </tbody>
25003 </tgroup>
25004 </informaltable>
25005 <para>
25006 <indexterm role="concept">
25007 <primary>bounce message</primary>
25008 <secondary>discarding</secondary>
25009 </indexterm>
25010 <indexterm role="concept">
25011 <primary>discarding bounce message</primary>
25012 </indexterm>
25013 This option affects the processing of bounce messages that cannot be delivered,
25014 that is, those that suffer a permanent delivery failure. (Bounce messages that
25015 suffer temporary delivery failures are of course retried in the usual way.)
25016 </para>
25017 <para>
25018 After a permanent delivery failure, bounce messages are frozen,
25019 because there is no sender to whom they can be returned. When a frozen bounce
25020 message has been on the queue for more than the given time, it is unfrozen at
25021 the next queue run, and a further delivery is attempted. If delivery fails
25022 again, the bounce message is discarded. This makes it possible to keep failed
25023 bounce messages around for a shorter time than the normal maximum retry time
25024 for frozen messages. For example,
25025 </para>
25026 <literallayout class="monospaced">
25027 ignore_bounce_errors_after = 12h
25028 </literallayout>
25029 <para>
25030 retries failed bounce message deliveries after 12 hours, discarding any further
25031 failures. If the value of this option is set to a zero time period, bounce
25032 failures are discarded immediately. Setting a very long time (as in the default
25033 value) has the effect of disabling this option. For ways of automatically
25034 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
25035 <option>timeout_frozen_after</option>.
25036 </para>
25037 <para>
25038 <indexterm role="option">
25039 <primary><option>ignore_fromline_hosts</option></primary>
25040 </indexterm>
25041 </para>
25042 <informaltable frame="all">
25043 <tgroup cols="4" colsep="0" rowsep="0">
25044 <colspec colwidth="8*" align="left"/>
25045 <colspec colwidth="6*" align="center"/>
25046 <colspec colwidth="6*" align="center"/>
25047 <colspec colwidth="6*" align="right"/>
25048 <tbody>
25049 <row>
25050 <entry><option>ignore_fromline_hosts</option></entry>
25051 <entry>Use: <emphasis>main</emphasis></entry>
25052 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25053 <entry>Default: <emphasis>unset</emphasis></entry>
25054 </row>
25055 </tbody>
25056 </tgroup>
25057 </informaltable>
25058 <para>
25059 <indexterm role="concept">
25060 <primary><quote>From</quote> line</primary>
25061 </indexterm>
25062 <indexterm role="concept">
25063 <primary>UUCP</primary>
25064 <secondary><quote>From</quote> line</secondary>
25065 </indexterm>
25066 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
25067 the headers of a message. By default this is treated as the start of the
25068 message&#x2019;s body, which means that any following headers are not recognized as
25069 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
25070 match those hosts that insist on sending it. If the sender is actually a local
25071 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
25072 <option>ignore_fromline_local</option> must be set to achieve this effect.
25073 </para>
25074 <para>
25075 <indexterm role="option">
25076 <primary><option>ignore_fromline_local</option></primary>
25077 </indexterm>
25078 </para>
25079 <informaltable frame="all">
25080 <tgroup cols="4" colsep="0" rowsep="0">
25081 <colspec colwidth="8*" align="left"/>
25082 <colspec colwidth="6*" align="center"/>
25083 <colspec colwidth="6*" align="center"/>
25084 <colspec colwidth="6*" align="right"/>
25085 <tbody>
25086 <row>
25087 <entry><option>ignore_fromline_local</option></entry>
25088 <entry>Use: <emphasis>main</emphasis></entry>
25089 <entry>Type: <emphasis>boolean</emphasis></entry>
25090 <entry>Default: <emphasis>false</emphasis></entry>
25091 </row>
25092 </tbody>
25093 </tgroup>
25094 </informaltable>
25095 <para>
25096 See <option>ignore_fromline_hosts</option> above.
25097 </para>
25098 <para>
25099 <indexterm role="option">
25100 <primary><option>keep_malformed</option></primary>
25101 </indexterm>
25102 </para>
25103 <informaltable frame="all">
25104 <tgroup cols="4" colsep="0" rowsep="0">
25105 <colspec colwidth="8*" align="left"/>
25106 <colspec colwidth="6*" align="center"/>
25107 <colspec colwidth="6*" align="center"/>
25108 <colspec colwidth="6*" align="right"/>
25109 <tbody>
25110 <row>
25111 <entry><option>keep_malformed</option></entry>
25112 <entry>Use: <emphasis>main</emphasis></entry>
25113 <entry>Type: <emphasis>time</emphasis></entry>
25114 <entry>Default: <emphasis>4d</emphasis></entry>
25115 </row>
25116 </tbody>
25117 </tgroup>
25118 </informaltable>
25119 <para>
25120 This option specifies the length of time to keep messages whose spool files
25121 have been corrupted in some way. This should, of course, never happen. At the
25122 next attempt to deliver such a message, it gets removed. The incident is
25123 logged.
25124 </para>
25125 <para>
25126 <indexterm role="option">
25127 <primary><option>ldap_ca_cert_dir</option></primary>
25128 </indexterm>
25129 </para>
25130 <informaltable frame="all">
25131 <tgroup cols="4" colsep="0" rowsep="0">
25132 <colspec colwidth="8*" align="left"/>
25133 <colspec colwidth="6*" align="center"/>
25134 <colspec colwidth="6*" align="center"/>
25135 <colspec colwidth="6*" align="right"/>
25136 <tbody>
25137 <row>
25138 <entry><option>ldap_ca_cert_dir</option></entry>
25139 <entry>Use: <emphasis>main</emphasis></entry>
25140 <entry>Type: <emphasis>string</emphasis></entry>
25141 <entry>Default: <emphasis>unset</emphasis></entry>
25142 </row>
25143 </tbody>
25144 </tgroup>
25145 </informaltable>
25146 <para>
25147 <indexterm role="concept">
25148 <primary>LDAP</primary>
25149 <secondary>,</secondary>
25150 </indexterm>
25151 This option indicates which directory contains CA certificates for verifying
25152 a TLS certificate presented by an LDAP server.
25153 While Exim does not provide a default value, your SSL library may.
25154 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25155 and constrained to be a directory.
25156 </para>
25157 <para>
25158 <indexterm role="option">
25159 <primary><option>ldap_ca_cert_file</option></primary>
25160 </indexterm>
25161 </para>
25162 <informaltable frame="all">
25163 <tgroup cols="4" colsep="0" rowsep="0">
25164 <colspec colwidth="8*" align="left"/>
25165 <colspec colwidth="6*" align="center"/>
25166 <colspec colwidth="6*" align="center"/>
25167 <colspec colwidth="6*" align="right"/>
25168 <tbody>
25169 <row>
25170 <entry><option>ldap_ca_cert_file</option></entry>
25171 <entry>Use: <emphasis>main</emphasis></entry>
25172 <entry>Type: <emphasis>string</emphasis></entry>
25173 <entry>Default: <emphasis>unset</emphasis></entry>
25174 </row>
25175 </tbody>
25176 </tgroup>
25177 </informaltable>
25178 <para>
25179 <indexterm role="concept">
25180 <primary>LDAP</primary>
25181 <secondary>,</secondary>
25182 </indexterm>
25183 This option indicates which file contains CA certificates for verifying
25184 a TLS certificate presented by an LDAP server.
25185 While Exim does not provide a default value, your SSL library may.
25186 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
25187 and constrained to be a file.
25188 </para>
25189 <para>
25190 <indexterm role="option">
25191 <primary><option>ldap_cert_file</option></primary>
25192 </indexterm>
25193 </para>
25194 <informaltable frame="all">
25195 <tgroup cols="4" colsep="0" rowsep="0">
25196 <colspec colwidth="8*" align="left"/>
25197 <colspec colwidth="6*" align="center"/>
25198 <colspec colwidth="6*" align="center"/>
25199 <colspec colwidth="6*" align="right"/>
25200 <tbody>
25201 <row>
25202 <entry><option>ldap_cert_file</option></entry>
25203 <entry>Use: <emphasis>main</emphasis></entry>
25204 <entry>Type: <emphasis>string</emphasis></entry>
25205 <entry>Default: <emphasis>unset</emphasis></entry>
25206 </row>
25207 </tbody>
25208 </tgroup>
25209 </informaltable>
25210 <para>
25211 <indexterm role="concept">
25212 <primary>LDAP</primary>
25213 <secondary>TLS client certificate file</secondary>
25214 </indexterm>
25215 This option indicates which file contains an TLS client certificate which
25216 Exim should present to the LDAP server during TLS negotiation.
25217 Should be used together with <option>ldap_cert_key</option>.
25218 </para>
25219 <para>
25220 <indexterm role="option">
25221 <primary><option>ldap_cert_key</option></primary>
25222 </indexterm>
25223 </para>
25224 <informaltable frame="all">
25225 <tgroup cols="4" colsep="0" rowsep="0">
25226 <colspec colwidth="8*" align="left"/>
25227 <colspec colwidth="6*" align="center"/>
25228 <colspec colwidth="6*" align="center"/>
25229 <colspec colwidth="6*" align="right"/>
25230 <tbody>
25231 <row>
25232 <entry><option>ldap_cert_key</option></entry>
25233 <entry>Use: <emphasis>main</emphasis></entry>
25234 <entry>Type: <emphasis>string</emphasis></entry>
25235 <entry>Default: <emphasis>unset</emphasis></entry>
25236 </row>
25237 </tbody>
25238 </tgroup>
25239 </informaltable>
25240 <para>
25241 <indexterm role="concept">
25242 <primary>LDAP</primary>
25243 <secondary>TLS client key file</secondary>
25244 </indexterm>
25245 This option indicates which file contains the secret/private key to use
25246 to prove identity to the LDAP server during TLS negotiation.
25247 Should be used together with <option>ldap_cert_file</option>, which contains the
25248 identity to be proven.
25249 </para>
25250 <para>
25251 <indexterm role="option">
25252 <primary><option>ldap_cipher_suite</option></primary>
25253 </indexterm>
25254 </para>
25255 <informaltable frame="all">
25256 <tgroup cols="4" colsep="0" rowsep="0">
25257 <colspec colwidth="8*" align="left"/>
25258 <colspec colwidth="6*" align="center"/>
25259 <colspec colwidth="6*" align="center"/>
25260 <colspec colwidth="6*" align="right"/>
25261 <tbody>
25262 <row>
25263 <entry><option>ldap_cipher_suite</option></entry>
25264 <entry>Use: <emphasis>main</emphasis></entry>
25265 <entry>Type: <emphasis>string</emphasis></entry>
25266 <entry>Default: <emphasis>unset</emphasis></entry>
25267 </row>
25268 </tbody>
25269 </tgroup>
25270 </informaltable>
25271 <para>
25272 <indexterm role="concept">
25273 <primary>LDAP</primary>
25274 <secondary>TLS cipher suite</secondary>
25275 </indexterm>
25276 This controls the TLS cipher-suite negotiation during TLS negotiation with
25277 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
25278 cipher-suite options with OpenSSL (as used by LDAP client libraries).
25279 </para>
25280 <para>
25281 <indexterm role="option">
25282 <primary><option>ldap_default_servers</option></primary>
25283 </indexterm>
25284 </para>
25285 <informaltable frame="all">
25286 <tgroup cols="4" colsep="0" rowsep="0">
25287 <colspec colwidth="8*" align="left"/>
25288 <colspec colwidth="6*" align="center"/>
25289 <colspec colwidth="6*" align="center"/>
25290 <colspec colwidth="6*" align="right"/>
25291 <tbody>
25292 <row>
25293 <entry><option>ldap_default_servers</option></entry>
25294 <entry>Use: <emphasis>main</emphasis></entry>
25295 <entry>Type: <emphasis>string list</emphasis></entry>
25296 <entry>Default: <emphasis>unset</emphasis></entry>
25297 </row>
25298 </tbody>
25299 </tgroup>
25300 </informaltable>
25301 <para>
25302 <indexterm role="concept">
25303 <primary>LDAP</primary>
25304 <secondary>default servers</secondary>
25305 </indexterm>
25306 This option provides a list of LDAP servers which are tried in turn when an
25307 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
25308 details of LDAP queries. This option is available only when Exim has been built
25309 with LDAP support.
25310 </para>
25311 <para>
25312 <indexterm role="option">
25313 <primary><option>ldap_require_cert</option></primary>
25314 </indexterm>
25315 </para>
25316 <informaltable frame="all">
25317 <tgroup cols="4" colsep="0" rowsep="0">
25318 <colspec colwidth="8*" align="left"/>
25319 <colspec colwidth="6*" align="center"/>
25320 <colspec colwidth="6*" align="center"/>
25321 <colspec colwidth="6*" align="right"/>
25322 <tbody>
25323 <row>
25324 <entry><option>ldap_require_cert</option></entry>
25325 <entry>Use: <emphasis>main</emphasis></entry>
25326 <entry>Type: <emphasis>string</emphasis></entry>
25327 <entry>Default: <emphasis>unset.</emphasis></entry>
25328 </row>
25329 </tbody>
25330 </tgroup>
25331 </informaltable>
25332 <para>
25333 <indexterm role="concept">
25334 <primary>LDAP</primary>
25335 <secondary>policy for LDAP server TLS cert presentation</secondary>
25336 </indexterm>
25337 This should be one of the values "hard", "demand", "allow", "try" or "never".
25338 A value other than one of these is interpreted as "never".
25339 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
25340 Although Exim does not set a default, the LDAP library probably defaults
25341 to hard/demand.
25342 </para>
25343 <para>
25344 <indexterm role="option">
25345 <primary><option>ldap_start_tls</option></primary>
25346 </indexterm>
25347 </para>
25348 <informaltable frame="all">
25349 <tgroup cols="4" colsep="0" rowsep="0">
25350 <colspec colwidth="8*" align="left"/>
25351 <colspec colwidth="6*" align="center"/>
25352 <colspec colwidth="6*" align="center"/>
25353 <colspec colwidth="6*" align="right"/>
25354 <tbody>
25355 <row>
25356 <entry><option>ldap_start_tls</option></entry>
25357 <entry>Use: <emphasis>main</emphasis></entry>
25358 <entry>Type: <emphasis>boolean</emphasis></entry>
25359 <entry>Default: <emphasis>false</emphasis></entry>
25360 </row>
25361 </tbody>
25362 </tgroup>
25363 </informaltable>
25364 <para>
25365 <indexterm role="concept">
25366 <primary>LDAP</primary>
25367 <secondary>whether or not to negotiate TLS</secondary>
25368 </indexterm>
25369 If set, Exim will attempt to negotiate TLS with the LDAP server when
25370 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
25371 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
25372 of SSL-on-connect.
25373 In the event of failure to negotiate TLS, the action taken is controlled
25374 by <option>ldap_require_cert</option>.
25375 </para>
25376 <para>
25377 <indexterm role="option">
25378 <primary><option>ldap_version</option></primary>
25379 </indexterm>
25380 </para>
25381 <informaltable frame="all">
25382 <tgroup cols="4" colsep="0" rowsep="0">
25383 <colspec colwidth="8*" align="left"/>
25384 <colspec colwidth="6*" align="center"/>
25385 <colspec colwidth="6*" align="center"/>
25386 <colspec colwidth="6*" align="right"/>
25387 <tbody>
25388 <row>
25389 <entry><option>ldap_version</option></entry>
25390 <entry>Use: <emphasis>main</emphasis></entry>
25391 <entry>Type: <emphasis>integer</emphasis></entry>
25392 <entry>Default: <emphasis>unset</emphasis></entry>
25393 </row>
25394 </tbody>
25395 </tgroup>
25396 </informaltable>
25397 <para>
25398 <indexterm role="concept">
25399 <primary>LDAP</primary>
25400 <secondary>protocol version, forcing</secondary>
25401 </indexterm>
25402 This option can be used to force Exim to set a specific protocol version for
25403 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
25404 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
25405 the LDAP headers; otherwise it is 2. This option is available only when Exim
25406 has been built with LDAP support.
25407 </para>
25408 <para>
25409 <indexterm role="option">
25410 <primary><option>local_from_check</option></primary>
25411 </indexterm>
25412 </para>
25413 <informaltable frame="all">
25414 <tgroup cols="4" colsep="0" rowsep="0">
25415 <colspec colwidth="8*" align="left"/>
25416 <colspec colwidth="6*" align="center"/>
25417 <colspec colwidth="6*" align="center"/>
25418 <colspec colwidth="6*" align="right"/>
25419 <tbody>
25420 <row>
25421 <entry><option>local_from_check</option></entry>
25422 <entry>Use: <emphasis>main</emphasis></entry>
25423 <entry>Type: <emphasis>boolean</emphasis></entry>
25424 <entry>Default: <emphasis>true</emphasis></entry>
25425 </row>
25426 </tbody>
25427 </tgroup>
25428 </informaltable>
25429 <para>
25430 <indexterm role="concept">
25431 <primary><emphasis>Sender:</emphasis> header line</primary>
25432 <secondary>disabling addition of</secondary>
25433 </indexterm>
25434 <indexterm role="concept">
25435 <primary><emphasis>From:</emphasis> header line</primary>
25436 <secondary>disabling checking of</secondary>
25437 </indexterm>
25438 When a message is submitted locally (that is, not over a TCP/IP connection) by
25439 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
25440 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
25441 the domain specified by <option>qualify_domain</option>.
25442 </para>
25443 <para>
25444 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
25445 locally submitted message is automatically qualified by Exim, unless the
25446 <option>-bnq</option> command line option is used.
25447 </para>
25448 <para>
25449 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
25450 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
25451 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
25452 and the default qualify domain.
25453 </para>
25454 <para>
25455 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
25456 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
25457 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
25458 <option>local_sender_retain</option> to be true.
25459 </para>
25460 <para>
25461 <indexterm role="concept">
25462 <primary>envelope sender</primary>
25463 </indexterm>
25464 These options affect only the header lines in the message. The envelope sender
25465 is still forced to be the login id at the qualify domain unless
25466 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
25467 </para>
25468 <para>
25469 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
25470 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
25471 has more details about <emphasis>Sender:</emphasis> processing.
25472 </para>
25473 <para>
25474 <indexterm role="option">
25475 <primary><option>local_from_prefix</option></primary>
25476 </indexterm>
25477 </para>
25478 <informaltable frame="all">
25479 <tgroup cols="4" colsep="0" rowsep="0">
25480 <colspec colwidth="8*" align="left"/>
25481 <colspec colwidth="6*" align="center"/>
25482 <colspec colwidth="6*" align="center"/>
25483 <colspec colwidth="6*" align="right"/>
25484 <tbody>
25485 <row>
25486 <entry><option>local_from_prefix</option></entry>
25487 <entry>Use: <emphasis>main</emphasis></entry>
25488 <entry>Type: <emphasis>string</emphasis></entry>
25489 <entry>Default: <emphasis>unset</emphasis></entry>
25490 </row>
25491 </tbody>
25492 </tgroup>
25493 </informaltable>
25494 <para>
25495 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
25496 matching the login id (see <option>local_from_check</option> above), it can be configured to
25497 ignore certain prefixes and suffixes in the local part of the address. This is
25498 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
25499 appropriate lists, in the same form as the <option>local_part_prefix</option> and
25500 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
25501 example, if
25502 </para>
25503 <literallayout class="monospaced">
25504 local_from_prefix = *-
25505 </literallayout>
25506 <para>
25507 is set, a <emphasis>From:</emphasis> line containing
25508 </para>
25509 <literallayout class="monospaced">
25510 From: anything-user@your.domain.example
25511 </literallayout>
25512 <para>
25513 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
25514 matches the actual sender address that is constructed from the login name and
25515 qualify domain.
25516 </para>
25517 <para>
25518 <indexterm role="option">
25519 <primary><option>local_from_suffix</option></primary>
25520 </indexterm>
25521 </para>
25522 <informaltable frame="all">
25523 <tgroup cols="4" colsep="0" rowsep="0">
25524 <colspec colwidth="8*" align="left"/>
25525 <colspec colwidth="6*" align="center"/>
25526 <colspec colwidth="6*" align="center"/>
25527 <colspec colwidth="6*" align="right"/>
25528 <tbody>
25529 <row>
25530 <entry><option>local_from_suffix</option></entry>
25531 <entry>Use: <emphasis>main</emphasis></entry>
25532 <entry>Type: <emphasis>string</emphasis></entry>
25533 <entry>Default: <emphasis>unset</emphasis></entry>
25534 </row>
25535 </tbody>
25536 </tgroup>
25537 </informaltable>
25538 <para>
25539 See <option>local_from_prefix</option> above.
25540 </para>
25541 <para>
25542 <indexterm role="option">
25543 <primary><option>local_interfaces</option></primary>
25544 </indexterm>
25545 </para>
25546 <informaltable frame="all">
25547 <tgroup cols="4" colsep="0" rowsep="0">
25548 <colspec colwidth="8*" align="left"/>
25549 <colspec colwidth="6*" align="center"/>
25550 <colspec colwidth="6*" align="center"/>
25551 <colspec colwidth="6*" align="right"/>
25552 <tbody>
25553 <row>
25554 <entry><option>local_interfaces</option></entry>
25555 <entry>Use: <emphasis>main</emphasis></entry>
25556 <entry>Type: <emphasis>string list</emphasis></entry>
25557 <entry>Default: <emphasis>see below</emphasis></entry>
25558 </row>
25559 </tbody>
25560 </tgroup>
25561 </informaltable>
25562 <para>
25563 This option controls which network interfaces are used by the daemon for
25564 listening; they are also used to identify the local host when routing. Chapter
25565 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
25566 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
25567 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
25568 <option>local_interfaces</option> is
25569 </para>
25570 <literallayout class="monospaced">
25571 local_interfaces = 0.0.0.0
25572 </literallayout>
25573 <para>
25574 when Exim is built without IPv6 support; otherwise it is
25575 </para>
25576 <literallayout class="monospaced">
25577 local_interfaces = &lt;; ::0 ; 0.0.0.0
25578 </literallayout>
25579 <para>
25580 <indexterm role="option">
25581 <primary><option>local_scan_timeout</option></primary>
25582 </indexterm>
25583 </para>
25584 <informaltable frame="all">
25585 <tgroup cols="4" colsep="0" rowsep="0">
25586 <colspec colwidth="8*" align="left"/>
25587 <colspec colwidth="6*" align="center"/>
25588 <colspec colwidth="6*" align="center"/>
25589 <colspec colwidth="6*" align="right"/>
25590 <tbody>
25591 <row>
25592 <entry><option>local_scan_timeout</option></entry>
25593 <entry>Use: <emphasis>main</emphasis></entry>
25594 <entry>Type: <emphasis>time</emphasis></entry>
25595 <entry>Default: <emphasis>5m</emphasis></entry>
25596 </row>
25597 </tbody>
25598 </tgroup>
25599 </informaltable>
25600 <para>
25601 <indexterm role="concept">
25602 <primary>timeout</primary>
25603 <secondary>for <function>local_scan()</function> function</secondary>
25604 </indexterm>
25605 <indexterm role="concept">
25606 <primary><function>local_scan()</function> function</primary>
25607 <secondary>timeout</secondary>
25608 </indexterm>
25609 This timeout applies to the <function>local_scan()</function> function (see chapter
25610 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
25611 the incoming message is rejected with a temporary error if it is an SMTP
25612 message. For a non-SMTP message, the message is dropped and Exim ends with a
25613 non-zero code. The incident is logged on the main and reject logs.
25614 </para>
25615 <para>
25616 <indexterm role="option">
25617 <primary><option>local_sender_retain</option></primary>
25618 </indexterm>
25619 </para>
25620 <informaltable frame="all">
25621 <tgroup cols="4" colsep="0" rowsep="0">
25622 <colspec colwidth="8*" align="left"/>
25623 <colspec colwidth="6*" align="center"/>
25624 <colspec colwidth="6*" align="center"/>
25625 <colspec colwidth="6*" align="right"/>
25626 <tbody>
25627 <row>
25628 <entry><option>local_sender_retain</option></entry>
25629 <entry>Use: <emphasis>main</emphasis></entry>
25630 <entry>Type: <emphasis>boolean</emphasis></entry>
25631 <entry>Default: <emphasis>false</emphasis></entry>
25632 </row>
25633 </tbody>
25634 </tgroup>
25635 </informaltable>
25636 <para>
25637 <indexterm role="concept">
25638 <primary><emphasis>Sender:</emphasis> header line</primary>
25639 <secondary>retaining from local submission</secondary>
25640 </indexterm>
25641 When a message is submitted locally (that is, not over a TCP/IP connection) by
25642 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
25643 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
25644 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
25645 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
25646 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
25647 </para>
25648 <para>
25649 <indexterm role="option">
25650 <primary><option>localhost_number</option></primary>
25651 </indexterm>
25652 </para>
25653 <informaltable frame="all">
25654 <tgroup cols="4" colsep="0" rowsep="0">
25655 <colspec colwidth="8*" align="left"/>
25656 <colspec colwidth="6*" align="center"/>
25657 <colspec colwidth="6*" align="center"/>
25658 <colspec colwidth="6*" align="right"/>
25659 <tbody>
25660 <row>
25661 <entry><option>localhost_number</option></entry>
25662 <entry>Use: <emphasis>main</emphasis></entry>
25663 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25664 <entry>Default: <emphasis>unset</emphasis></entry>
25665 </row>
25666 </tbody>
25667 </tgroup>
25668 </informaltable>
25669 <para>
25670 <indexterm role="concept">
25671 <primary>host</primary>
25672 <secondary>locally unique number for</secondary>
25673 </indexterm>
25674 <indexterm role="concept">
25675 <primary>message ids</primary>
25676 <secondary>with multiple hosts</secondary>
25677 </indexterm>
25678 <indexterm role="variable">
25679 <primary><varname>$localhost_number</varname></primary>
25680 </indexterm>
25681 Exim&#x2019;s message ids are normally unique only within the local host. If
25682 uniqueness among a set of hosts is required, each host must set a different
25683 value for the <option>localhost_number</option> option. The string is expanded immediately
25684 after reading the configuration file (so that a number can be computed from the
25685 host name, for example) and the result of the expansion must be a number in the
25686 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
25687 systems). This is available in subsequent string expansions via the variable
25688 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
25689 characters of the message id, instead of just being a fractional part of the
25690 time, are computed from the time and the local host number as described in
25691 section <xref linkend="SECTmessiden"/>.
25692 </para>
25693 <para>
25694 <indexterm role="option">
25695 <primary><option>log_file_path</option></primary>
25696 </indexterm>
25697 </para>
25698 <informaltable frame="all">
25699 <tgroup cols="4" colsep="0" rowsep="0">
25700 <colspec colwidth="8*" align="left"/>
25701 <colspec colwidth="6*" align="center"/>
25702 <colspec colwidth="6*" align="center"/>
25703 <colspec colwidth="6*" align="right"/>
25704 <tbody>
25705 <row>
25706 <entry><option>log_file_path</option></entry>
25707 <entry>Use: <emphasis>main</emphasis></entry>
25708 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25709 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25710 </row>
25711 </tbody>
25712 </tgroup>
25713 </informaltable>
25714 <para>
25715 <indexterm role="concept">
25716 <primary>log</primary>
25717 <secondary>file path for</secondary>
25718 </indexterm>
25719 This option sets the path which is used to determine the names of Exim&#x2019;s log
25720 files, or indicates that logging is to be to syslog, or both. It is expanded
25721 when Exim is entered, so it can, for example, contain a reference to the host
25722 name. If no specific path is set for the log files at compile or run time, they
25723 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
25724 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
25725 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
25726 used. If this string is fixed at your installation (contains no expansion
25727 variables) it is recommended that you do not set this option in the
25728 configuration file, but instead supply the path using LOG_FILE_PATH in
25729 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
25730 early on &ndash; in particular, failure to read the configuration file.
25731 </para>
25732 <para>
25733 <indexterm role="option">
25734 <primary><option>log_selector</option></primary>
25735 </indexterm>
25736 </para>
25737 <informaltable frame="all">
25738 <tgroup cols="4" colsep="0" rowsep="0">
25739 <colspec colwidth="8*" align="left"/>
25740 <colspec colwidth="6*" align="center"/>
25741 <colspec colwidth="6*" align="center"/>
25742 <colspec colwidth="6*" align="right"/>
25743 <tbody>
25744 <row>
25745 <entry><option>log_selector</option></entry>
25746 <entry>Use: <emphasis>main</emphasis></entry>
25747 <entry>Type: <emphasis>string</emphasis></entry>
25748 <entry>Default: <emphasis>unset</emphasis></entry>
25749 </row>
25750 </tbody>
25751 </tgroup>
25752 </informaltable>
25753 <para>
25754 <indexterm role="concept">
25755 <primary>log</primary>
25756 <secondary>selectors</secondary>
25757 </indexterm>
25758 This option can be used to reduce or increase the number of things that Exim
25759 writes to its log files. Its argument is made up of names preceded by plus or
25760 minus characters. For example:
25761 </para>
25762 <literallayout class="monospaced">
25763 log_selector = +arguments -retry_defer
25764 </literallayout>
25765 <para>
25766 A list of possible names and what they control is given in the chapter on
25767 logging, in section <xref linkend="SECTlogselector"/>.
25768 </para>
25769 <para>
25770 <indexterm role="option">
25771 <primary><option>log_timezone</option></primary>
25772 </indexterm>
25773 </para>
25774 <informaltable frame="all">
25775 <tgroup cols="4" colsep="0" rowsep="0">
25776 <colspec colwidth="8*" align="left"/>
25777 <colspec colwidth="6*" align="center"/>
25778 <colspec colwidth="6*" align="center"/>
25779 <colspec colwidth="6*" align="right"/>
25780 <tbody>
25781 <row>
25782 <entry><option>log_timezone</option></entry>
25783 <entry>Use: <emphasis>main</emphasis></entry>
25784 <entry>Type: <emphasis>boolean</emphasis></entry>
25785 <entry>Default: <emphasis>false</emphasis></entry>
25786 </row>
25787 </tbody>
25788 </tgroup>
25789 </informaltable>
25790 <para>
25791 <indexterm role="concept">
25792 <primary>log</primary>
25793 <secondary>timezone for entries</secondary>
25794 </indexterm>
25795 <indexterm role="variable">
25796 <primary><varname>$tod_log</varname></primary>
25797 </indexterm>
25798 <indexterm role="variable">
25799 <primary><varname>$tod_zone</varname></primary>
25800 </indexterm>
25801 By default, the timestamps on log lines are in local time without the
25802 timezone. This means that if your timezone changes twice a year, the timestamps
25803 in log lines are ambiguous for an hour when the clocks go back. One way of
25804 avoiding this problem is to set the timezone to UTC. An alternative is to set
25805 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
25806 timestamps in log lines. Turning on this option can add quite a lot to the size
25807 of log files because each line is extended by 6 characters. Note that the
25808 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
25809 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
25810 </para>
25811 <para>
25812 <indexterm role="option">
25813 <primary><option>lookup_open_max</option></primary>
25814 </indexterm>
25815 </para>
25816 <informaltable frame="all">
25817 <tgroup cols="4" colsep="0" rowsep="0">
25818 <colspec colwidth="8*" align="left"/>
25819 <colspec colwidth="6*" align="center"/>
25820 <colspec colwidth="6*" align="center"/>
25821 <colspec colwidth="6*" align="right"/>
25822 <tbody>
25823 <row>
25824 <entry><option>lookup_open_max</option></entry>
25825 <entry>Use: <emphasis>main</emphasis></entry>
25826 <entry>Type: <emphasis>integer</emphasis></entry>
25827 <entry>Default: <emphasis>25</emphasis></entry>
25828 </row>
25829 </tbody>
25830 </tgroup>
25831 </informaltable>
25832 <para>
25833 <indexterm role="concept">
25834 <primary>too many open files</primary>
25835 </indexterm>
25836 <indexterm role="concept">
25837 <primary>open files, too many</primary>
25838 </indexterm>
25839 <indexterm role="concept">
25840 <primary>file</primary>
25841 <secondary>too many open</secondary>
25842 </indexterm>
25843 <indexterm role="concept">
25844 <primary>lookup</primary>
25845 <secondary>maximum open files</secondary>
25846 </indexterm>
25847 <indexterm role="concept">
25848 <primary>limit</primary>
25849 <secondary>open files for lookups</secondary>
25850 </indexterm>
25851 This option limits the number of simultaneously open files for single-key
25852 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
25853 Exim normally keeps these files open during routing, because often the same
25854 file is required several times. If the limit is reached, Exim closes the least
25855 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
25856 actually opens two files for each logical DBM database, though it still counts
25857 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
25858 open files</quote> errors with NDBM, you need to reduce the value of
25859 <option>lookup_open_max</option>.
25860 </para>
25861 <para>
25862 <indexterm role="option">
25863 <primary><option>max_username_length</option></primary>
25864 </indexterm>
25865 </para>
25866 <informaltable frame="all">
25867 <tgroup cols="4" colsep="0" rowsep="0">
25868 <colspec colwidth="8*" align="left"/>
25869 <colspec colwidth="6*" align="center"/>
25870 <colspec colwidth="6*" align="center"/>
25871 <colspec colwidth="6*" align="right"/>
25872 <tbody>
25873 <row>
25874 <entry><option>max_username_length</option></entry>
25875 <entry>Use: <emphasis>main</emphasis></entry>
25876 <entry>Type: <emphasis>integer</emphasis></entry>
25877 <entry>Default: <emphasis>0</emphasis></entry>
25878 </row>
25879 </tbody>
25880 </tgroup>
25881 </informaltable>
25882 <para>
25883 <indexterm role="concept">
25884 <primary>length of login name</primary>
25885 </indexterm>
25886 <indexterm role="concept">
25887 <primary>user name</primary>
25888 <secondary>maximum length</secondary>
25889 </indexterm>
25890 <indexterm role="concept">
25891 <primary>limit</primary>
25892 <secondary>user name length</secondary>
25893 </indexterm>
25894 Some operating systems are broken in that they truncate long arguments to
25895 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
25896 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
25897 an argument that is longer behaves as if <function>getpwnam()</function> failed.
25898 </para>
25899 <para>
25900 <indexterm role="option">
25901 <primary><option>message_body_newlines</option></primary>
25902 </indexterm>
25903 </para>
25904 <informaltable frame="all">
25905 <tgroup cols="4" colsep="0" rowsep="0">
25906 <colspec colwidth="8*" align="left"/>
25907 <colspec colwidth="6*" align="center"/>
25908 <colspec colwidth="6*" align="center"/>
25909 <colspec colwidth="6*" align="right"/>
25910 <tbody>
25911 <row>
25912 <entry><option>message_body_newlines</option></entry>
25913 <entry>Use: <emphasis>main</emphasis></entry>
25914 <entry>Type: <emphasis>bool</emphasis></entry>
25915 <entry>Default: <emphasis>false</emphasis></entry>
25916 </row>
25917 </tbody>
25918 </tgroup>
25919 </informaltable>
25920 <para>
25921 <indexterm role="concept">
25922 <primary>message body</primary>
25923 <secondary>newlines in variables</secondary>
25924 </indexterm>
25925 <indexterm role="concept">
25926 <primary>newline</primary>
25927 <secondary>in message body variables</secondary>
25928 </indexterm>
25929 <indexterm role="variable">
25930 <primary><varname>$message_body</varname></primary>
25931 </indexterm>
25932 <indexterm role="variable">
25933 <primary><varname>$message_body_end</varname></primary>
25934 </indexterm>
25935 By default, newlines in the message body are replaced by spaces when setting
25936 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
25937 option is set true, this no longer happens.
25938 </para>
25939 <para>
25940 <indexterm role="option">
25941 <primary><option>message_body_visible</option></primary>
25942 </indexterm>
25943 </para>
25944 <informaltable frame="all">
25945 <tgroup cols="4" colsep="0" rowsep="0">
25946 <colspec colwidth="8*" align="left"/>
25947 <colspec colwidth="6*" align="center"/>
25948 <colspec colwidth="6*" align="center"/>
25949 <colspec colwidth="6*" align="right"/>
25950 <tbody>
25951 <row>
25952 <entry><option>message_body_visible</option></entry>
25953 <entry>Use: <emphasis>main</emphasis></entry>
25954 <entry>Type: <emphasis>integer</emphasis></entry>
25955 <entry>Default: <emphasis>500</emphasis></entry>
25956 </row>
25957 </tbody>
25958 </tgroup>
25959 </informaltable>
25960 <para>
25961 <indexterm role="concept">
25962 <primary>body of message</primary>
25963 <secondary>visible size</secondary>
25964 </indexterm>
25965 <indexterm role="concept">
25966 <primary>message body</primary>
25967 <secondary>visible size</secondary>
25968 </indexterm>
25969 <indexterm role="variable">
25970 <primary><varname>$message_body</varname></primary>
25971 </indexterm>
25972 <indexterm role="variable">
25973 <primary><varname>$message_body_end</varname></primary>
25974 </indexterm>
25975 This option specifies how much of a message&#x2019;s body is to be included in the
25976 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
25977 </para>
25978 <para>
25979 <indexterm role="option">
25980 <primary><option>message_id_header_domain</option></primary>
25981 </indexterm>
25982 </para>
25983 <informaltable frame="all">
25984 <tgroup cols="4" colsep="0" rowsep="0">
25985 <colspec colwidth="8*" align="left"/>
25986 <colspec colwidth="6*" align="center"/>
25987 <colspec colwidth="6*" align="center"/>
25988 <colspec colwidth="6*" align="right"/>
25989 <tbody>
25990 <row>
25991 <entry><option>message_id_header_domain</option></entry>
25992 <entry>Use: <emphasis>main</emphasis></entry>
25993 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25994 <entry>Default: <emphasis>unset</emphasis></entry>
25995 </row>
25996 </tbody>
25997 </tgroup>
25998 </informaltable>
25999 <para>
26000 <indexterm role="concept">
26001 <primary><emphasis>Message-ID:</emphasis> header line</primary>
26002 </indexterm>
26003 If this option is set, the string is expanded and used as the right hand side
26004 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
26005 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
26006 means <quote>not received over TCP/IP.</quote>
26007 Otherwise, the primary host name is used.
26008 Only letters, digits, dot and hyphen are accepted; any other characters are
26009 replaced by hyphens. If the expansion is forced to fail, or if the result is an
26010 empty string, the option is ignored.
26011 </para>
26012 <para>
26013 <indexterm role="option">
26014 <primary><option>message_id_header_text</option></primary>
26015 </indexterm>
26016 </para>
26017 <informaltable frame="all">
26018 <tgroup cols="4" colsep="0" rowsep="0">
26019 <colspec colwidth="8*" align="left"/>
26020 <colspec colwidth="6*" align="center"/>
26021 <colspec colwidth="6*" align="center"/>
26022 <colspec colwidth="6*" align="right"/>
26023 <tbody>
26024 <row>
26025 <entry><option>message_id_header_text</option></entry>
26026 <entry>Use: <emphasis>main</emphasis></entry>
26027 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26028 <entry>Default: <emphasis>unset</emphasis></entry>
26029 </row>
26030 </tbody>
26031 </tgroup>
26032 </informaltable>
26033 <para>
26034 If this variable is set, the string is expanded and used to augment the text of
26035 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
26036 message does not have one. The text of this header is required by RFC 2822 to
26037 take the form of an address. By default, Exim uses its internal message id as
26038 the local part, and the primary host name as the domain. If this option is set,
26039 it is expanded, and provided the expansion is not forced to fail, and does not
26040 yield an empty string, the result is inserted into the header immediately
26041 before the @, separated from the internal message id by a dot. Any characters
26042 that are illegal in an address are automatically converted into hyphens. This
26043 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
26044 colons will become hyphens.
26045 </para>
26046 <para>
26047 <indexterm role="option">
26048 <primary><option>message_logs</option></primary>
26049 </indexterm>
26050 </para>
26051 <informaltable frame="all">
26052 <tgroup cols="4" colsep="0" rowsep="0">
26053 <colspec colwidth="8*" align="left"/>
26054 <colspec colwidth="6*" align="center"/>
26055 <colspec colwidth="6*" align="center"/>
26056 <colspec colwidth="6*" align="right"/>
26057 <tbody>
26058 <row>
26059 <entry><option>message_logs</option></entry>
26060 <entry>Use: <emphasis>main</emphasis></entry>
26061 <entry>Type: <emphasis>boolean</emphasis></entry>
26062 <entry>Default: <emphasis>true</emphasis></entry>
26063 </row>
26064 </tbody>
26065 </tgroup>
26066 </informaltable>
26067 <para>
26068 <indexterm role="concept">
26069 <primary>message logs</primary>
26070 <secondary>disabling</secondary>
26071 </indexterm>
26072 <indexterm role="concept">
26073 <primary>log</primary>
26074 <secondary>message log; disabling</secondary>
26075 </indexterm>
26076 If this option is turned off, per-message log files are not created in the
26077 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
26078 Exim, by reducing the number of files involved in handling a message from a
26079 minimum of four (header spool file, body spool file, delivery journal, and
26080 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
26081 which is not affected by this option.
26082 </para>
26083 <para>
26084 <indexterm role="option">
26085 <primary><option>message_size_limit</option></primary>
26086 </indexterm>
26087 </para>
26088 <informaltable frame="all">
26089 <tgroup cols="4" colsep="0" rowsep="0">
26090 <colspec colwidth="8*" align="left"/>
26091 <colspec colwidth="6*" align="center"/>
26092 <colspec colwidth="6*" align="center"/>
26093 <colspec colwidth="6*" align="right"/>
26094 <tbody>
26095 <row>
26096 <entry><option>message_size_limit</option></entry>
26097 <entry>Use: <emphasis>main</emphasis></entry>
26098 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26099 <entry>Default: <emphasis>50M</emphasis></entry>
26100 </row>
26101 </tbody>
26102 </tgroup>
26103 </informaltable>
26104 <para>
26105 <indexterm role="concept">
26106 <primary>message</primary>
26107 <secondary>size limit</secondary>
26108 </indexterm>
26109 <indexterm role="concept">
26110 <primary>limit</primary>
26111 <secondary>message size</secondary>
26112 </indexterm>
26113 <indexterm role="concept">
26114 <primary>size</primary>
26115 <secondary>of message, limit</secondary>
26116 </indexterm>
26117 This option limits the maximum size of message that Exim will process. The
26118 value is expanded for each incoming connection so, for example, it can be made
26119 to depend on the IP address of the remote host for messages arriving via
26120 TCP/IP. After expansion, the value must be a sequence of decimal digits,
26121 optionally followed by K or M.
26122 </para>
26123 <para>
26124 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
26125 other properties of an individual message, because it has to be advertised in
26126 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
26127 error. A value of zero means no limit, but its use is not recommended. See also
26128 <option>bounce_return_size_limit</option>.
26129 </para>
26130 <para>
26131 Incoming SMTP messages are failed with a 552 error if the limit is
26132 exceeded; locally-generated messages either get a stderr message or a delivery
26133 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
26134 an oversized message is logged in both the main and the reject logs. See also
26135 the generic transport option <option>message_size_limit</option>, which limits the size of
26136 message that an individual transport can process.
26137 </para>
26138 <para>
26139 If you use a virus-scanner and set this option to to a value larger than the
26140 maximum size that your virus-scanner is configured to support, you may get
26141 failures triggered by large mails.  The right size to configure for the
26142 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
26143 probably safest to just set it to a little larger than this value.  Eg, with a
26144 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
26145 some problems may result.
26146 </para>
26147 <para>
26148 A value of 0 will disable size limit checking; Exim will still advertise the
26149 SIZE extension in an EHLO response, but without a limit, so as to permit
26150 SMTP clients to still indicate the message size along with the MAIL verb.
26151 </para>
26152 <para>
26153 <indexterm role="option">
26154 <primary><option>move_frozen_messages</option></primary>
26155 </indexterm>
26156 </para>
26157 <informaltable frame="all">
26158 <tgroup cols="4" colsep="0" rowsep="0">
26159 <colspec colwidth="8*" align="left"/>
26160 <colspec colwidth="6*" align="center"/>
26161 <colspec colwidth="6*" align="center"/>
26162 <colspec colwidth="6*" align="right"/>
26163 <tbody>
26164 <row>
26165 <entry><option>move_frozen_messages</option></entry>
26166 <entry>Use: <emphasis>main</emphasis></entry>
26167 <entry>Type: <emphasis>boolean</emphasis></entry>
26168 <entry>Default: <emphasis>false</emphasis></entry>
26169 </row>
26170 </tbody>
26171 </tgroup>
26172 </informaltable>
26173 <para>
26174 <indexterm role="concept">
26175 <primary>frozen messages</primary>
26176 <secondary>moving</secondary>
26177 </indexterm>
26178 This option, which is available only if Exim has been built with the setting
26179 </para>
26180 <literallayout class="monospaced">
26181 SUPPORT_MOVE_FROZEN_MESSAGES=yes
26182 </literallayout>
26183 <para>
26184 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
26185 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
26186 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
26187 standard utilities for handling such moved messages, and they do not show up in
26188 lists generated by <option>-bp</option> or by the Exim monitor.
26189 </para>
26190 <para>
26191 <indexterm role="option">
26192 <primary><option>mua_wrapper</option></primary>
26193 </indexterm>
26194 </para>
26195 <informaltable frame="all">
26196 <tgroup cols="4" colsep="0" rowsep="0">
26197 <colspec colwidth="8*" align="left"/>
26198 <colspec colwidth="6*" align="center"/>
26199 <colspec colwidth="6*" align="center"/>
26200 <colspec colwidth="6*" align="right"/>
26201 <tbody>
26202 <row>
26203 <entry><option>mua_wrapper</option></entry>
26204 <entry>Use: <emphasis>main</emphasis></entry>
26205 <entry>Type: <emphasis>boolean</emphasis></entry>
26206 <entry>Default: <emphasis>false</emphasis></entry>
26207 </row>
26208 </tbody>
26209 </tgroup>
26210 </informaltable>
26211 <para>
26212 Setting this option true causes Exim to run in a very restrictive mode in which
26213 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
26214 contains a full description of this facility.
26215 </para>
26216 <para>
26217 <indexterm role="option">
26218 <primary><option>mysql_servers</option></primary>
26219 </indexterm>
26220 </para>
26221 <informaltable frame="all">
26222 <tgroup cols="4" colsep="0" rowsep="0">
26223 <colspec colwidth="8*" align="left"/>
26224 <colspec colwidth="6*" align="center"/>
26225 <colspec colwidth="6*" align="center"/>
26226 <colspec colwidth="6*" align="right"/>
26227 <tbody>
26228 <row>
26229 <entry><option>mysql_servers</option></entry>
26230 <entry>Use: <emphasis>main</emphasis></entry>
26231 <entry>Type: <emphasis>string list</emphasis></entry>
26232 <entry>Default: <emphasis>unset</emphasis></entry>
26233 </row>
26234 </tbody>
26235 </tgroup>
26236 </informaltable>
26237 <para>
26238 <indexterm role="concept">
26239 <primary>MySQL</primary>
26240 <secondary>server list</secondary>
26241 </indexterm>
26242 This option provides a list of MySQL servers and associated connection data, to
26243 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
26244 option is available only if Exim has been built with MySQL support.
26245 </para>
26246 <para>
26247 <indexterm role="option">
26248 <primary><option>never_users</option></primary>
26249 </indexterm>
26250 </para>
26251 <informaltable frame="all">
26252 <tgroup cols="4" colsep="0" rowsep="0">
26253 <colspec colwidth="8*" align="left"/>
26254 <colspec colwidth="6*" align="center"/>
26255 <colspec colwidth="6*" align="center"/>
26256 <colspec colwidth="6*" align="right"/>
26257 <tbody>
26258 <row>
26259 <entry><option>never_users</option></entry>
26260 <entry>Use: <emphasis>main</emphasis></entry>
26261 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26262 <entry>Default: <emphasis>unset</emphasis></entry>
26263 </row>
26264 </tbody>
26265 </tgroup>
26266 </informaltable>
26267 <para>
26268 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
26269 message deliveries are normally run in processes that are setuid to the
26270 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
26271 It is usually desirable to prevent any deliveries from running as root, as a
26272 safety precaution.
26273 </para>
26274 <para>
26275 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
26276 list of users that must not be used for local deliveries. This list is fixed in
26277 the binary and cannot be overridden by the configuration file. By default, it
26278 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
26279 can be used to add more users to the fixed list.
26280 </para>
26281 <para>
26282 If a message is to be delivered as one of the users on the fixed list or the
26283 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
26284 example is
26285 </para>
26286 <literallayout class="monospaced">
26287 never_users = root:daemon:bin
26288 </literallayout>
26289 <para>
26290 Including root is redundant if it is also on the fixed list, but it does no
26291 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
26292 transport driver.
26293 </para>
26294 <para>
26295 <indexterm role="option">
26296 <primary><option>openssl_options</option></primary>
26297 </indexterm>
26298 </para>
26299 <informaltable frame="all">
26300 <tgroup cols="4" colsep="0" rowsep="0">
26301 <colspec colwidth="8*" align="left"/>
26302 <colspec colwidth="6*" align="center"/>
26303 <colspec colwidth="6*" align="center"/>
26304 <colspec colwidth="6*" align="right"/>
26305 <tbody>
26306 <row>
26307 <entry><option>openssl_options</option></entry>
26308 <entry>Use: <emphasis>main</emphasis></entry>
26309 <entry>Type: <emphasis>string list</emphasis></entry>
26310 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
26311 </row>
26312 </tbody>
26313 </tgroup>
26314 </informaltable>
26315 <para>
26316 <indexterm role="concept">
26317 <primary>OpenSSL </primary>
26318 <secondary>compatibility</secondary>
26319 </indexterm>
26320 This option allows an administrator to adjust the SSL options applied
26321 by OpenSSL to connections.  It is given as a space-separated list of items,
26322 each one to be +added or -subtracted from the current value.
26323 </para>
26324 <para>
26325 This option is only available if Exim is built against OpenSSL.  The values
26326 available for this option vary according to the age of your OpenSSL install.
26327 The <quote>all</quote> value controls a subset of flags which are available, typically
26328 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
26329 list the values known on your system and Exim should support all the
26330 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
26331 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
26332 </para>
26333 <para>
26334 Note that adjusting the options can have severe impact upon the security of
26335 SSL as used by Exim.  It is possible to disable safety checks and shoot
26336 yourself in the foot in various unpleasant ways.  This option should not be
26337 adjusted lightly.  An unrecognised item will be detected at startup, by
26338 invoking Exim with the <option>-bV</option> flag.
26339 </para>
26340 <para>
26341 The option affects Exim operating both as a server and as a client.
26342 </para>
26343 <para>
26344 Historical note: prior to release 4.80, Exim defaulted this value to
26345 "+dont_insert_empty_fragments", which may still be needed for compatibility
26346 with some clients, but which lowers security by increasing exposure to
26347 some now infamous attacks.
26348 </para>
26349 <para>
26350 Examples:
26351 </para>
26352 <literallayout class="monospaced">
26353 # Make both old MS and old Eudora happy:
26354 openssl_options = -all +microsoft_big_sslv3_buffer \
26355                        +dont_insert_empty_fragments
26356
26357 # Disable older protocol versions:
26358 openssl_options = +no_sslv2 +no_sslv3
26359 </literallayout>
26360 <para>
26361 Possible options may include:
26362 </para>
26363 <itemizedlist>
26364 <listitem>
26365 <para>
26366 <literal>all</literal>
26367 </para>
26368 </listitem>
26369 <listitem>
26370 <para>
26371 <literal>allow_unsafe_legacy_renegotiation</literal>
26372 </para>
26373 </listitem>
26374 <listitem>
26375 <para>
26376 <literal>cipher_server_preference</literal>
26377 </para>
26378 </listitem>
26379 <listitem>
26380 <para>
26381 <literal>dont_insert_empty_fragments</literal>
26382 </para>
26383 </listitem>
26384 <listitem>
26385 <para>
26386 <literal>ephemeral_rsa</literal>
26387 </para>
26388 </listitem>
26389 <listitem>
26390 <para>
26391 <literal>legacy_server_connect</literal>
26392 </para>
26393 </listitem>
26394 <listitem>
26395 <para>
26396 <literal>microsoft_big_sslv3_buffer</literal>
26397 </para>
26398 </listitem>
26399 <listitem>
26400 <para>
26401 <literal>microsoft_sess_id_bug</literal>
26402 </para>
26403 </listitem>
26404 <listitem>
26405 <para>
26406 <literal>msie_sslv2_rsa_padding</literal>
26407 </para>
26408 </listitem>
26409 <listitem>
26410 <para>
26411 <literal>netscape_challenge_bug</literal>
26412 </para>
26413 </listitem>
26414 <listitem>
26415 <para>
26416 <literal>netscape_reuse_cipher_change_bug</literal>
26417 </para>
26418 </listitem>
26419 <listitem>
26420 <para>
26421 <literal>no_compression</literal>
26422 </para>
26423 </listitem>
26424 <listitem>
26425 <para>
26426 <literal>no_session_resumption_on_renegotiation</literal>
26427 </para>
26428 </listitem>
26429 <listitem>
26430 <para>
26431 <literal>no_sslv2</literal>
26432 </para>
26433 </listitem>
26434 <listitem>
26435 <para>
26436 <literal>no_sslv3</literal>
26437 </para>
26438 </listitem>
26439 <listitem>
26440 <para>
26441 <literal>no_ticket</literal>
26442 </para>
26443 </listitem>
26444 <listitem>
26445 <para>
26446 <literal>no_tlsv1</literal>
26447 </para>
26448 </listitem>
26449 <listitem>
26450 <para>
26451 <literal>no_tlsv1_1</literal>
26452 </para>
26453 </listitem>
26454 <listitem>
26455 <para>
26456 <literal>no_tlsv1_2</literal>
26457 </para>
26458 </listitem>
26459 <listitem>
26460 <para>
26461 <literal>safari_ecdhe_ecdsa_bug</literal>
26462 </para>
26463 </listitem>
26464 <listitem>
26465 <para>
26466 <literal>single_dh_use</literal>
26467 </para>
26468 </listitem>
26469 <listitem>
26470 <para>
26471 <literal>single_ecdh_use</literal>
26472 </para>
26473 </listitem>
26474 <listitem>
26475 <para>
26476 <literal>ssleay_080_client_dh_bug</literal>
26477 </para>
26478 </listitem>
26479 <listitem>
26480 <para>
26481 <literal>sslref2_reuse_cert_type_bug</literal>
26482 </para>
26483 </listitem>
26484 <listitem>
26485 <para>
26486 <literal>tls_block_padding_bug</literal>
26487 </para>
26488 </listitem>
26489 <listitem>
26490 <para>
26491 <literal>tls_d5_bug</literal>
26492 </para>
26493 </listitem>
26494 <listitem>
26495 <para>
26496 <literal>tls_rollback_bug</literal>
26497 </para>
26498 </listitem>
26499 </itemizedlist>
26500 <para>
26501 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
26502 all clients connecting using the MacOS SecureTransport TLS facility prior
26503 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
26504 to negotiate TLS then this option value might help, provided that your OpenSSL
26505 release is new enough to contain this work-around.  This may be a situation
26506 where you have to upgrade OpenSSL to get buggy clients working.
26507 </para>
26508 <para>
26509 <indexterm role="option">
26510 <primary><option>oracle_servers</option></primary>
26511 </indexterm>
26512 </para>
26513 <informaltable frame="all">
26514 <tgroup cols="4" colsep="0" rowsep="0">
26515 <colspec colwidth="8*" align="left"/>
26516 <colspec colwidth="6*" align="center"/>
26517 <colspec colwidth="6*" align="center"/>
26518 <colspec colwidth="6*" align="right"/>
26519 <tbody>
26520 <row>
26521 <entry><option>oracle_servers</option></entry>
26522 <entry>Use: <emphasis>main</emphasis></entry>
26523 <entry>Type: <emphasis>string list</emphasis></entry>
26524 <entry>Default: <emphasis>unset</emphasis></entry>
26525 </row>
26526 </tbody>
26527 </tgroup>
26528 </informaltable>
26529 <para>
26530 <indexterm role="concept">
26531 <primary>Oracle</primary>
26532 <secondary>server list</secondary>
26533 </indexterm>
26534 This option provides a list of Oracle servers and associated connection data,
26535 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
26536 The option is available only if Exim has been built with Oracle support.
26537 </para>
26538 <para>
26539 <indexterm role="option">
26540 <primary><option>percent_hack_domains</option></primary>
26541 </indexterm>
26542 </para>
26543 <informaltable frame="all">
26544 <tgroup cols="4" colsep="0" rowsep="0">
26545 <colspec colwidth="8*" align="left"/>
26546 <colspec colwidth="6*" align="center"/>
26547 <colspec colwidth="6*" align="center"/>
26548 <colspec colwidth="6*" align="right"/>
26549 <tbody>
26550 <row>
26551 <entry><option>percent_hack_domains</option></entry>
26552 <entry>Use: <emphasis>main</emphasis></entry>
26553 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26554 <entry>Default: <emphasis>unset</emphasis></entry>
26555 </row>
26556 </tbody>
26557 </tgroup>
26558 </informaltable>
26559 <para>
26560 <indexterm role="concept">
26561 <primary><quote>percent hack</quote></primary>
26562 </indexterm>
26563 <indexterm role="concept">
26564 <primary>source routing</primary>
26565 <secondary>in email address</secondary>
26566 </indexterm>
26567 <indexterm role="concept">
26568 <primary>address</primary>
26569 <secondary>source-routed</secondary>
26570 </indexterm>
26571 The <quote>percent hack</quote> is the convention whereby a local part containing a
26572 percent sign is re-interpreted as a new email address, with the percent
26573 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
26574 also applied to RFC 2822 addresses that begin with an @ character. If this
26575 option is set, Exim implements the percent facility for those domains listed,
26576 but no others. This happens before an incoming SMTP address is tested against
26577 an ACL.
26578 </para>
26579 <para>
26580 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
26581 trying to get round relaying restrictions. For this reason, it is best avoided
26582 if at all possible. Unfortunately, a number of less security-conscious MTAs
26583 implement it unconditionally. If you are running Exim on a gateway host, and
26584 routing mail through to internal MTAs without processing the local parts, it is
26585 a good idea to reject recipient addresses with percent characters in their
26586 local parts. Exim&#x2019;s default configuration does this.
26587 </para>
26588 <para>
26589 <indexterm role="option">
26590 <primary><option>perl_at_start</option></primary>
26591 </indexterm>
26592 </para>
26593 <informaltable frame="all">
26594 <tgroup cols="4" colsep="0" rowsep="0">
26595 <colspec colwidth="8*" align="left"/>
26596 <colspec colwidth="6*" align="center"/>
26597 <colspec colwidth="6*" align="center"/>
26598 <colspec colwidth="6*" align="right"/>
26599 <tbody>
26600 <row>
26601 <entry><option>perl_at_start</option></entry>
26602 <entry>Use: <emphasis>main</emphasis></entry>
26603 <entry>Type: <emphasis>boolean</emphasis></entry>
26604 <entry>Default: <emphasis>false</emphasis></entry>
26605 </row>
26606 </tbody>
26607 </tgroup>
26608 </informaltable>
26609 <para>
26610 This option is available only when Exim is built with an embedded Perl
26611 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26612 </para>
26613 <para>
26614 <indexterm role="option">
26615 <primary><option>perl_startup</option></primary>
26616 </indexterm>
26617 </para>
26618 <informaltable frame="all">
26619 <tgroup cols="4" colsep="0" rowsep="0">
26620 <colspec colwidth="8*" align="left"/>
26621 <colspec colwidth="6*" align="center"/>
26622 <colspec colwidth="6*" align="center"/>
26623 <colspec colwidth="6*" align="right"/>
26624 <tbody>
26625 <row>
26626 <entry><option>perl_startup</option></entry>
26627 <entry>Use: <emphasis>main</emphasis></entry>
26628 <entry>Type: <emphasis>string</emphasis></entry>
26629 <entry>Default: <emphasis>unset</emphasis></entry>
26630 </row>
26631 </tbody>
26632 </tgroup>
26633 </informaltable>
26634 <para>
26635 This option is available only when Exim is built with an embedded Perl
26636 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26637 </para>
26638 <para>
26639 <indexterm role="option">
26640 <primary><option>pgsql_servers</option></primary>
26641 </indexterm>
26642 </para>
26643 <informaltable frame="all">
26644 <tgroup cols="4" colsep="0" rowsep="0">
26645 <colspec colwidth="8*" align="left"/>
26646 <colspec colwidth="6*" align="center"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="right"/>
26649 <tbody>
26650 <row>
26651 <entry><option>pgsql_servers</option></entry>
26652 <entry>Use: <emphasis>main</emphasis></entry>
26653 <entry>Type: <emphasis>string list</emphasis></entry>
26654 <entry>Default: <emphasis>unset</emphasis></entry>
26655 </row>
26656 </tbody>
26657 </tgroup>
26658 </informaltable>
26659 <para>
26660 <indexterm role="concept">
26661 <primary>PostgreSQL lookup type</primary>
26662 <secondary>server list</secondary>
26663 </indexterm>
26664 This option provides a list of PostgreSQL servers and associated connection
26665 data, to be used in conjunction with <command>pgsql</command> lookups (see section
26666 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
26667 PostgreSQL support.
26668 </para>
26669 <para>
26670 <indexterm role="option">
26671 <primary><option>pid_file_path</option></primary>
26672 </indexterm>
26673 </para>
26674 <informaltable frame="all">
26675 <tgroup cols="4" colsep="0" rowsep="0">
26676 <colspec colwidth="8*" align="left"/>
26677 <colspec colwidth="6*" align="center"/>
26678 <colspec colwidth="6*" align="center"/>
26679 <colspec colwidth="6*" align="right"/>
26680 <tbody>
26681 <row>
26682 <entry><option>pid_file_path</option></entry>
26683 <entry>Use: <emphasis>main</emphasis></entry>
26684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26685 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26686 </row>
26687 </tbody>
26688 </tgroup>
26689 </informaltable>
26690 <para>
26691 <indexterm role="concept">
26692 <primary>daemon</primary>
26693 <secondary>pid file path</secondary>
26694 </indexterm>
26695 <indexterm role="concept">
26696 <primary>pid file, path for</primary>
26697 </indexterm>
26698 This option sets the name of the file to which the Exim daemon writes its
26699 process id. The string is expanded, so it can contain, for example, references
26700 to the host name:
26701 </para>
26702 <literallayout class="monospaced">
26703 pid_file_path = /var/log/$primary_hostname/exim.pid
26704 </literallayout>
26705 <para>
26706 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
26707 spool directory.
26708 The value set by the option can be overridden by the <option>-oP</option> command line
26709 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
26710 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
26711 </para>
26712 <para>
26713 <indexterm role="option">
26714 <primary><option>pipelining_advertise_hosts</option></primary>
26715 </indexterm>
26716 </para>
26717 <informaltable frame="all">
26718 <tgroup cols="4" colsep="0" rowsep="0">
26719 <colspec colwidth="8*" align="left"/>
26720 <colspec colwidth="6*" align="center"/>
26721 <colspec colwidth="6*" align="center"/>
26722 <colspec colwidth="6*" align="right"/>
26723 <tbody>
26724 <row>
26725 <entry><option>pipelining_advertise_hosts</option></entry>
26726 <entry>Use: <emphasis>main</emphasis></entry>
26727 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26728 <entry>Default: <emphasis>*</emphasis></entry>
26729 </row>
26730 </tbody>
26731 </tgroup>
26732 </informaltable>
26733 <para>
26734 <indexterm role="concept">
26735 <primary>PIPELINING</primary>
26736 <secondary>suppressing advertising</secondary>
26737 </indexterm>
26738 This option can be used to suppress the advertisement of the SMTP
26739 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
26740 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
26741 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
26742 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
26743 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
26744 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
26745 </para>
26746 <para>
26747 <indexterm role="option">
26748 <primary><option>prdr_enable</option></primary>
26749 </indexterm>
26750 </para>
26751 <informaltable frame="all">
26752 <tgroup cols="4" colsep="0" rowsep="0">
26753 <colspec colwidth="8*" align="left"/>
26754 <colspec colwidth="6*" align="center"/>
26755 <colspec colwidth="6*" align="center"/>
26756 <colspec colwidth="6*" align="right"/>
26757 <tbody>
26758 <row>
26759 <entry><option>prdr_enable</option></entry>
26760 <entry>Use: <emphasis>main</emphasis></entry>
26761 <entry>Type: <emphasis>boolean</emphasis></entry>
26762 <entry>Default: <emphasis>false</emphasis></entry>
26763 </row>
26764 </tbody>
26765 </tgroup>
26766 </informaltable>
26767 <para>
26768 <indexterm role="concept">
26769 <primary>PRDR</primary>
26770 <secondary>enabling on server</secondary>
26771 </indexterm>
26772 This option can be used to enable the Per-Recipient Data Response extension
26773 to SMTP, defined by Eric Hall.
26774 If the option is set, PRDR is advertised by Exim when operating as a server.
26775 If the client requests PRDR, and more than one recipient, for a message 
26776 an additional ACL is called for each recipient after the message content
26777 is recieved.  See section <xref linkend="SECTPRDRACL"/>.
26778 </para>
26779 <para>
26780 <indexterm role="option">
26781 <primary><option>preserve_message_logs</option></primary>
26782 </indexterm>
26783 </para>
26784 <informaltable frame="all">
26785 <tgroup cols="4" colsep="0" rowsep="0">
26786 <colspec colwidth="8*" align="left"/>
26787 <colspec colwidth="6*" align="center"/>
26788 <colspec colwidth="6*" align="center"/>
26789 <colspec colwidth="6*" align="right"/>
26790 <tbody>
26791 <row>
26792 <entry><option>preserve_message_logs</option></entry>
26793 <entry>Use: <emphasis>main</emphasis></entry>
26794 <entry>Type: <emphasis>boolean</emphasis></entry>
26795 <entry>Default: <emphasis>false</emphasis></entry>
26796 </row>
26797 </tbody>
26798 </tgroup>
26799 </informaltable>
26800 <para>
26801 <indexterm role="concept">
26802 <primary>message logs</primary>
26803 <secondary>preserving</secondary>
26804 </indexterm>
26805 If this option is set, message log files are not deleted when messages are
26806 completed. Instead, they are moved to a sub-directory of the spool directory
26807 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
26808 purposes. This is a dangerous option to set on systems with any appreciable
26809 volume of mail. Use with care!
26810 </para>
26811 <para>
26812 <indexterm role="option">
26813 <primary><option>primary_hostname</option></primary>
26814 </indexterm>
26815 </para>
26816 <informaltable frame="all">
26817 <tgroup cols="4" colsep="0" rowsep="0">
26818 <colspec colwidth="8*" align="left"/>
26819 <colspec colwidth="6*" align="center"/>
26820 <colspec colwidth="6*" align="center"/>
26821 <colspec colwidth="6*" align="right"/>
26822 <tbody>
26823 <row>
26824 <entry><option>primary_hostname</option></entry>
26825 <entry>Use: <emphasis>main</emphasis></entry>
26826 <entry>Type: <emphasis>string</emphasis></entry>
26827 <entry>Default: <emphasis>see below</emphasis></entry>
26828 </row>
26829 </tbody>
26830 </tgroup>
26831 </informaltable>
26832 <para>
26833 <indexterm role="concept">
26834 <primary>name</primary>
26835 <secondary>of local host</secondary>
26836 </indexterm>
26837 <indexterm role="concept">
26838 <primary>host</primary>
26839 <secondary>name of local</secondary>
26840 </indexterm>
26841 <indexterm role="concept">
26842 <primary>local host</primary>
26843 <secondary>name of</secondary>
26844 </indexterm>
26845 <indexterm role="variable">
26846 <primary><varname>$primary_hostname</varname></primary>
26847 </indexterm>
26848 This specifies the name of the current host. It is used in the default EHLO or
26849 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
26850 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
26851 The value is also used by default in some SMTP response messages from an Exim
26852 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
26853 </para>
26854 <para>
26855 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
26856 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
26857 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
26858 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
26859 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
26860 explicitly by this option, or defaulted.
26861 </para>
26862 <para>
26863 <indexterm role="option">
26864 <primary><option>print_topbitchars</option></primary>
26865 </indexterm>
26866 </para>
26867 <informaltable frame="all">
26868 <tgroup cols="4" colsep="0" rowsep="0">
26869 <colspec colwidth="8*" align="left"/>
26870 <colspec colwidth="6*" align="center"/>
26871 <colspec colwidth="6*" align="center"/>
26872 <colspec colwidth="6*" align="right"/>
26873 <tbody>
26874 <row>
26875 <entry><option>print_topbitchars</option></entry>
26876 <entry>Use: <emphasis>main</emphasis></entry>
26877 <entry>Type: <emphasis>boolean</emphasis></entry>
26878 <entry>Default: <emphasis>false</emphasis></entry>
26879 </row>
26880 </tbody>
26881 </tgroup>
26882 </informaltable>
26883 <para>
26884 <indexterm role="concept">
26885 <primary>printing characters</primary>
26886 </indexterm>
26887 <indexterm role="concept">
26888 <primary>8-bit characters</primary>
26889 </indexterm>
26890 By default, Exim considers only those characters whose codes lie in the range
26891 32&ndash;126 to be printing characters. In a number of circumstances (for example,
26892 when writing log entries) non-printing characters are converted into escape
26893 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
26894 is set, code values of 128 and above are also considered to be printing
26895 characters.
26896 </para>
26897 <para>
26898 This option also affects the header syntax checks performed by the
26899 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
26900 the user&#x2019;s full name when constructing From: and Sender: addresses (as
26901 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
26902 Exim to generate eight bit message headers that do not conform to the
26903 standards.
26904 </para>
26905 <para>
26906 <indexterm role="option">
26907 <primary><option>process_log_path</option></primary>
26908 </indexterm>
26909 </para>
26910 <informaltable frame="all">
26911 <tgroup cols="4" colsep="0" rowsep="0">
26912 <colspec colwidth="8*" align="left"/>
26913 <colspec colwidth="6*" align="center"/>
26914 <colspec colwidth="6*" align="center"/>
26915 <colspec colwidth="6*" align="right"/>
26916 <tbody>
26917 <row>
26918 <entry><option>process_log_path</option></entry>
26919 <entry>Use: <emphasis>main</emphasis></entry>
26920 <entry>Type: <emphasis>string</emphasis></entry>
26921 <entry>Default: <emphasis>unset</emphasis></entry>
26922 </row>
26923 </tbody>
26924 </tgroup>
26925 </informaltable>
26926 <para>
26927 <indexterm role="concept">
26928 <primary>process log path</primary>
26929 </indexterm>
26930 <indexterm role="concept">
26931 <primary>log</primary>
26932 <secondary>process log</secondary>
26933 </indexterm>
26934 <indexterm role="concept">
26935 <primary><emphasis>exiwhat</emphasis></primary>
26936 </indexterm>
26937 This option sets the name of the file to which an Exim process writes its
26938 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
26939 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
26940 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
26941 can be useful in environments where two different Exims are running, using
26942 different spool directories.
26943 </para>
26944 <para>
26945 <indexterm role="option">
26946 <primary><option>prod_requires_admin</option></primary>
26947 </indexterm>
26948 </para>
26949 <informaltable frame="all">
26950 <tgroup cols="4" colsep="0" rowsep="0">
26951 <colspec colwidth="8*" align="left"/>
26952 <colspec colwidth="6*" align="center"/>
26953 <colspec colwidth="6*" align="center"/>
26954 <colspec colwidth="6*" align="right"/>
26955 <tbody>
26956 <row>
26957 <entry><option>prod_requires_admin</option></entry>
26958 <entry>Use: <emphasis>main</emphasis></entry>
26959 <entry>Type: <emphasis>boolean</emphasis></entry>
26960 <entry>Default: <emphasis>true</emphasis></entry>
26961 </row>
26962 </tbody>
26963 </tgroup>
26964 </informaltable>
26965 <para>
26966 <indexterm role="option">
26967 <primary><option>-M</option></primary>
26968 </indexterm>
26969 <indexterm role="option">
26970 <primary><option>-R</option></primary>
26971 </indexterm>
26972 <indexterm role="option">
26973 <primary><option>-q</option></primary>
26974 </indexterm>
26975 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
26976 admin user unless <option>prod_requires_admin</option> is set false. See also
26977 <option>queue_list_requires_admin</option>.
26978 </para>
26979 <para>
26980 <indexterm role="option">
26981 <primary><option>qualify_domain</option></primary>
26982 </indexterm>
26983 </para>
26984 <informaltable frame="all">
26985 <tgroup cols="4" colsep="0" rowsep="0">
26986 <colspec colwidth="8*" align="left"/>
26987 <colspec colwidth="6*" align="center"/>
26988 <colspec colwidth="6*" align="center"/>
26989 <colspec colwidth="6*" align="right"/>
26990 <tbody>
26991 <row>
26992 <entry><option>qualify_domain</option></entry>
26993 <entry>Use: <emphasis>main</emphasis></entry>
26994 <entry>Type: <emphasis>string</emphasis></entry>
26995 <entry>Default: <emphasis>see below</emphasis></entry>
26996 </row>
26997 </tbody>
26998 </tgroup>
26999 </informaltable>
27000 <para>
27001 <indexterm role="concept">
27002 <primary>domain</primary>
27003 <secondary>for qualifying addresses</secondary>
27004 </indexterm>
27005 <indexterm role="concept">
27006 <primary>address</primary>
27007 <secondary>qualification</secondary>
27008 </indexterm>
27009 This option specifies the domain name that is added to any envelope sender
27010 addresses that do not have a domain qualification. It also applies to
27011 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
27012 are accepted by default only for locally-generated messages. Qualification is
27013 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
27014 locally-generated messages, unless the <option>-bnq</option> command line option is used.
27015 </para>
27016 <para>
27017 Messages from external sources must always contain fully qualified addresses,
27018 unless the sending host matches <option>sender_unqualified_hosts</option> or
27019 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
27020 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
27021 necessary. Internally, Exim always works with fully qualified envelope
27022 addresses. If <option>qualify_domain</option> is not set, it defaults to the
27023 <option>primary_hostname</option> value.
27024 </para>
27025 <para>
27026 <indexterm role="option">
27027 <primary><option>qualify_recipient</option></primary>
27028 </indexterm>
27029 </para>
27030 <informaltable frame="all">
27031 <tgroup cols="4" colsep="0" rowsep="0">
27032 <colspec colwidth="8*" align="left"/>
27033 <colspec colwidth="6*" align="center"/>
27034 <colspec colwidth="6*" align="center"/>
27035 <colspec colwidth="6*" align="right"/>
27036 <tbody>
27037 <row>
27038 <entry><option>qualify_recipient</option></entry>
27039 <entry>Use: <emphasis>main</emphasis></entry>
27040 <entry>Type: <emphasis>string</emphasis></entry>
27041 <entry>Default: <emphasis>see below</emphasis></entry>
27042 </row>
27043 </tbody>
27044 </tgroup>
27045 </informaltable>
27046 <para>
27047 This option allows you to specify a different domain for qualifying recipient
27048 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
27049 </para>
27050 <para>
27051 <indexterm role="option">
27052 <primary><option>queue_domains</option></primary>
27053 </indexterm>
27054 </para>
27055 <informaltable frame="all">
27056 <tgroup cols="4" colsep="0" rowsep="0">
27057 <colspec colwidth="8*" align="left"/>
27058 <colspec colwidth="6*" align="center"/>
27059 <colspec colwidth="6*" align="center"/>
27060 <colspec colwidth="6*" align="right"/>
27061 <tbody>
27062 <row>
27063 <entry><option>queue_domains</option></entry>
27064 <entry>Use: <emphasis>main</emphasis></entry>
27065 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27066 <entry>Default: <emphasis>unset</emphasis></entry>
27067 </row>
27068 </tbody>
27069 </tgroup>
27070 </informaltable>
27071 <para>
27072 <indexterm role="concept">
27073 <primary>domain</primary>
27074 <secondary>specifying non-immediate delivery</secondary>
27075 </indexterm>
27076 <indexterm role="concept">
27077 <primary>queueing incoming messages</primary>
27078 </indexterm>
27079 <indexterm role="concept">
27080 <primary>message</primary>
27081 <secondary>queueing certain domains</secondary>
27082 </indexterm>
27083 This option lists domains for which immediate delivery is not required.
27084 A delivery process is started whenever a message is received, but only those
27085 domains that do not match are processed. All other deliveries wait until the
27086 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
27087 </para>
27088 <para>
27089 <indexterm role="option">
27090 <primary><option>queue_list_requires_admin</option></primary>
27091 </indexterm>
27092 </para>
27093 <informaltable frame="all">
27094 <tgroup cols="4" colsep="0" rowsep="0">
27095 <colspec colwidth="8*" align="left"/>
27096 <colspec colwidth="6*" align="center"/>
27097 <colspec colwidth="6*" align="center"/>
27098 <colspec colwidth="6*" align="right"/>
27099 <tbody>
27100 <row>
27101 <entry><option>queue_list_requires_admin</option></entry>
27102 <entry>Use: <emphasis>main</emphasis></entry>
27103 <entry>Type: <emphasis>boolean</emphasis></entry>
27104 <entry>Default: <emphasis>true</emphasis></entry>
27105 </row>
27106 </tbody>
27107 </tgroup>
27108 </informaltable>
27109 <para>
27110 <indexterm role="option">
27111 <primary><option>-bp</option></primary>
27112 </indexterm>
27113 The <option>-bp</option> command-line option, which lists the messages that are on the
27114 queue, requires the caller to be an admin user unless
27115 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
27116 </para>
27117 <para>
27118 <indexterm role="option">
27119 <primary><option>queue_only</option></primary>
27120 </indexterm>
27121 </para>
27122 <informaltable frame="all">
27123 <tgroup cols="4" colsep="0" rowsep="0">
27124 <colspec colwidth="8*" align="left"/>
27125 <colspec colwidth="6*" align="center"/>
27126 <colspec colwidth="6*" align="center"/>
27127 <colspec colwidth="6*" align="right"/>
27128 <tbody>
27129 <row>
27130 <entry><option>queue_only</option></entry>
27131 <entry>Use: <emphasis>main</emphasis></entry>
27132 <entry>Type: <emphasis>boolean</emphasis></entry>
27133 <entry>Default: <emphasis>false</emphasis></entry>
27134 </row>
27135 </tbody>
27136 </tgroup>
27137 </informaltable>
27138 <para>
27139 <indexterm role="concept">
27140 <primary>queueing incoming messages</primary>
27141 </indexterm>
27142 <indexterm role="concept">
27143 <primary>message</primary>
27144 <secondary>queueing unconditionally</secondary>
27145 </indexterm>
27146 If <option>queue_only</option> is set, a delivery process is not automatically started
27147 whenever a message is received. Instead, the message waits on the queue for the
27148 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
27149 delivered immediately when certain conditions (such as heavy load) occur.
27150 </para>
27151 <para>
27152 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
27153 and <option>-odi</option> command line options override <option>queue_only</option> unless
27154 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
27155 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
27156 </para>
27157 <para>
27158 <indexterm role="option">
27159 <primary><option>queue_only_file</option></primary>
27160 </indexterm>
27161 </para>
27162 <informaltable frame="all">
27163 <tgroup cols="4" colsep="0" rowsep="0">
27164 <colspec colwidth="8*" align="left"/>
27165 <colspec colwidth="6*" align="center"/>
27166 <colspec colwidth="6*" align="center"/>
27167 <colspec colwidth="6*" align="right"/>
27168 <tbody>
27169 <row>
27170 <entry><option>queue_only_file</option></entry>
27171 <entry>Use: <emphasis>main</emphasis></entry>
27172 <entry>Type: <emphasis>string</emphasis></entry>
27173 <entry>Default: <emphasis>unset</emphasis></entry>
27174 </row>
27175 </tbody>
27176 </tgroup>
27177 </informaltable>
27178 <para>
27179 <indexterm role="concept">
27180 <primary>queueing incoming messages</primary>
27181 </indexterm>
27182 <indexterm role="concept">
27183 <primary>message</primary>
27184 <secondary>queueing by file existence</secondary>
27185 </indexterm>
27186 This option can be set to a colon-separated list of absolute path names, each
27187 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
27188 it tests for the existence of each listed path using a call to <function>stat()</function>. For
27189 each path that exists, the corresponding queueing option is set.
27190 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
27191 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
27192 </para>
27193 <literallayout class="monospaced">
27194 queue_only_file = smtp/some/file
27195 </literallayout>
27196 <para>
27197 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
27198 <filename>/some/file</filename> exists.
27199 </para>
27200 <para>
27201 <indexterm role="option">
27202 <primary><option>queue_only_load</option></primary>
27203 </indexterm>
27204 </para>
27205 <informaltable frame="all">
27206 <tgroup cols="4" colsep="0" rowsep="0">
27207 <colspec colwidth="8*" align="left"/>
27208 <colspec colwidth="6*" align="center"/>
27209 <colspec colwidth="6*" align="center"/>
27210 <colspec colwidth="6*" align="right"/>
27211 <tbody>
27212 <row>
27213 <entry><option>queue_only_load</option></entry>
27214 <entry>Use: <emphasis>main</emphasis></entry>
27215 <entry>Type: <emphasis>fixed-point</emphasis></entry>
27216 <entry>Default: <emphasis>unset</emphasis></entry>
27217 </row>
27218 </tbody>
27219 </tgroup>
27220 </informaltable>
27221 <para>
27222 <indexterm role="concept">
27223 <primary>load average</primary>
27224 </indexterm>
27225 <indexterm role="concept">
27226 <primary>queueing incoming messages</primary>
27227 </indexterm>
27228 <indexterm role="concept">
27229 <primary>message</primary>
27230 <secondary>queueing by load</secondary>
27231 </indexterm>
27232 If the system load average is higher than this value, incoming messages from
27233 all sources are queued, and no automatic deliveries are started. If this
27234 happens during local or remote SMTP input, all subsequent messages received on
27235 the same SMTP connection are queued by default, whatever happens to the load in
27236 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
27237 false.
27238 </para>
27239 <para>
27240 Deliveries will subsequently be performed by queue runner processes. This
27241 option has no effect on ancient operating systems on which Exim cannot
27242 determine the load average. See also <option>deliver_queue_load_max</option> and
27243 <option>smtp_load_reserve</option>.
27244 </para>
27245 <para>
27246 <indexterm role="option">
27247 <primary><option>queue_only_load_latch</option></primary>
27248 </indexterm>
27249 </para>
27250 <informaltable frame="all">
27251 <tgroup cols="4" colsep="0" rowsep="0">
27252 <colspec colwidth="8*" align="left"/>
27253 <colspec colwidth="6*" align="center"/>
27254 <colspec colwidth="6*" align="center"/>
27255 <colspec colwidth="6*" align="right"/>
27256 <tbody>
27257 <row>
27258 <entry><option>queue_only_load_latch</option></entry>
27259 <entry>Use: <emphasis>main</emphasis></entry>
27260 <entry>Type: <emphasis>boolean</emphasis></entry>
27261 <entry>Default: <emphasis>true</emphasis></entry>
27262 </row>
27263 </tbody>
27264 </tgroup>
27265 </informaltable>
27266 <para>
27267 <indexterm role="concept">
27268 <primary>load average</primary>
27269 <secondary>re-evaluating per message</secondary>
27270 </indexterm>
27271 When this option is true (the default), once one message has been queued
27272 because the load average is higher than the value set by <option>queue_only_load</option>,
27273 all subsequent messages received on the same SMTP connection are also queued.
27274 This is a deliberate choice; even though the load average may fall below the
27275 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
27276 connection when not delivering earlier ones. However, there are special
27277 circumstances such as very long-lived connections from scanning appliances
27278 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
27279 should be set false. This causes the value of the load average to be
27280 re-evaluated for each message.
27281 </para>
27282 <para>
27283 <indexterm role="option">
27284 <primary><option>queue_only_override</option></primary>
27285 </indexterm>
27286 </para>
27287 <informaltable frame="all">
27288 <tgroup cols="4" colsep="0" rowsep="0">
27289 <colspec colwidth="8*" align="left"/>
27290 <colspec colwidth="6*" align="center"/>
27291 <colspec colwidth="6*" align="center"/>
27292 <colspec colwidth="6*" align="right"/>
27293 <tbody>
27294 <row>
27295 <entry><option>queue_only_override</option></entry>
27296 <entry>Use: <emphasis>main</emphasis></entry>
27297 <entry>Type: <emphasis>boolean</emphasis></entry>
27298 <entry>Default: <emphasis>true</emphasis></entry>
27299 </row>
27300 </tbody>
27301 </tgroup>
27302 </informaltable>
27303 <para>
27304 <indexterm role="concept">
27305 <primary>queueing incoming messages</primary>
27306 </indexterm>
27307 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
27308 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
27309 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
27310 to override; they are accepted, but ignored.
27311 </para>
27312 <para>
27313 <indexterm role="option">
27314 <primary><option>queue_run_in_order</option></primary>
27315 </indexterm>
27316 </para>
27317 <informaltable frame="all">
27318 <tgroup cols="4" colsep="0" rowsep="0">
27319 <colspec colwidth="8*" align="left"/>
27320 <colspec colwidth="6*" align="center"/>
27321 <colspec colwidth="6*" align="center"/>
27322 <colspec colwidth="6*" align="right"/>
27323 <tbody>
27324 <row>
27325 <entry><option>queue_run_in_order</option></entry>
27326 <entry>Use: <emphasis>main</emphasis></entry>
27327 <entry>Type: <emphasis>boolean</emphasis></entry>
27328 <entry>Default: <emphasis>false</emphasis></entry>
27329 </row>
27330 </tbody>
27331 </tgroup>
27332 </informaltable>
27333 <para>
27334 <indexterm role="concept">
27335 <primary>queue runner</primary>
27336 <secondary>processing messages in order</secondary>
27337 </indexterm>
27338 If this option is set, queue runs happen in order of message arrival instead of
27339 in an arbitrary order. For this to happen, a complete list of the entire queue
27340 must be set up before the deliveries start. When the queue is all held in a
27341 single directory (the default), a single list is created for both the ordered
27342 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
27343 single list is not created when <option>queue_run_in_order</option> is false. In this case,
27344 the sub-directories are processed one at a time (in a random order), and this
27345 avoids setting up one huge list for the whole queue. Thus, setting
27346 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
27347 when the queue is large, because of the extra work in setting up the single,
27348 large list. In most situations, <option>queue_run_in_order</option> should not be set.
27349 </para>
27350 <para>
27351 <indexterm role="option">
27352 <primary><option>queue_run_max</option></primary>
27353 </indexterm>
27354 </para>
27355 <informaltable frame="all">
27356 <tgroup cols="4" colsep="0" rowsep="0">
27357 <colspec colwidth="8*" align="left"/>
27358 <colspec colwidth="6*" align="center"/>
27359 <colspec colwidth="6*" align="center"/>
27360 <colspec colwidth="6*" align="right"/>
27361 <tbody>
27362 <row>
27363 <entry><option>queue_run_max</option></entry>
27364 <entry>Use: <emphasis>main</emphasis></entry>
27365 <entry>Type: <emphasis>integer</emphasis></entry>
27366 <entry>Default: <emphasis>5</emphasis></entry>
27367 </row>
27368 </tbody>
27369 </tgroup>
27370 </informaltable>
27371 <para>
27372 <indexterm role="concept">
27373 <primary>queue runner</primary>
27374 <secondary>maximum number of</secondary>
27375 </indexterm>
27376 This controls the maximum number of queue runner processes that an Exim daemon
27377 can run simultaneously. This does not mean that it starts them all at once,
27378 but rather that if the maximum number are still running when the time comes to
27379 start another one, it refrains from starting another one. This can happen with
27380 very large queues and/or very sluggish deliveries. This option does not,
27381 however, interlock with other processes, so additional queue runners can be
27382 started by other means, or by killing and restarting the daemon.
27383 </para>
27384 <para>
27385 Setting this option to zero does not suppress queue runs; rather, it disables
27386 the limit, allowing any number of simultaneous queue runner processes to be
27387 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
27388 the daemon&#x2019;s command line.
27389 </para>
27390 <para>
27391 <indexterm role="option">
27392 <primary><option>queue_smtp_domains</option></primary>
27393 </indexterm>
27394 </para>
27395 <informaltable frame="all">
27396 <tgroup cols="4" colsep="0" rowsep="0">
27397 <colspec colwidth="8*" align="left"/>
27398 <colspec colwidth="6*" align="center"/>
27399 <colspec colwidth="6*" align="center"/>
27400 <colspec colwidth="6*" align="right"/>
27401 <tbody>
27402 <row>
27403 <entry><option>queue_smtp_domains</option></entry>
27404 <entry>Use: <emphasis>main</emphasis></entry>
27405 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27406 <entry>Default: <emphasis>unset</emphasis></entry>
27407 </row>
27408 </tbody>
27409 </tgroup>
27410 </informaltable>
27411 <para>
27412 <indexterm role="concept">
27413 <primary>queueing incoming messages</primary>
27414 </indexterm>
27415 <indexterm role="concept">
27416 <primary>message</primary>
27417 <secondary>queueing remote deliveries</secondary>
27418 </indexterm>
27419 When this option is set, a delivery process is started whenever a message is
27420 received, routing is performed, and local deliveries take place.
27421 However, if any SMTP deliveries are required for domains that match
27422 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
27423 message waits on the queue for the next queue run. Since routing of the message
27424 has taken place, Exim knows to which remote hosts it must be delivered, and so
27425 when the queue run happens, multiple messages for the same host are delivered
27426 over a single SMTP connection. The <option>-odqs</option> command line option causes all
27427 SMTP deliveries to be queued in this way, and is equivalent to setting
27428 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
27429 <option>queue_domains</option>.
27430 </para>
27431 <para>
27432 <indexterm role="option">
27433 <primary><option>receive_timeout</option></primary>
27434 </indexterm>
27435 </para>
27436 <informaltable frame="all">
27437 <tgroup cols="4" colsep="0" rowsep="0">
27438 <colspec colwidth="8*" align="left"/>
27439 <colspec colwidth="6*" align="center"/>
27440 <colspec colwidth="6*" align="center"/>
27441 <colspec colwidth="6*" align="right"/>
27442 <tbody>
27443 <row>
27444 <entry><option>receive_timeout</option></entry>
27445 <entry>Use: <emphasis>main</emphasis></entry>
27446 <entry>Type: <emphasis>time</emphasis></entry>
27447 <entry>Default: <emphasis>0s</emphasis></entry>
27448 </row>
27449 </tbody>
27450 </tgroup>
27451 </informaltable>
27452 <para>
27453 <indexterm role="concept">
27454 <primary>timeout</primary>
27455 <secondary>for non-SMTP input</secondary>
27456 </indexterm>
27457 This option sets the timeout for accepting a non-SMTP message, that is, the
27458 maximum time that Exim waits when reading a message on the standard input. If
27459 the value is zero, it will wait for ever. This setting is overridden by the
27460 <option>-or</option> command line option. The timeout for incoming SMTP messages is
27461 controlled by <option>smtp_receive_timeout</option>.
27462 </para>
27463 <para>
27464 <indexterm role="option">
27465 <primary><option>received_header_text</option></primary>
27466 </indexterm>
27467 </para>
27468 <informaltable frame="all">
27469 <tgroup cols="4" colsep="0" rowsep="0">
27470 <colspec colwidth="8*" align="left"/>
27471 <colspec colwidth="6*" align="center"/>
27472 <colspec colwidth="6*" align="center"/>
27473 <colspec colwidth="6*" align="right"/>
27474 <tbody>
27475 <row>
27476 <entry><option>received_header_text</option></entry>
27477 <entry>Use: <emphasis>main</emphasis></entry>
27478 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27479 <entry>Default: <emphasis>see below</emphasis></entry>
27480 </row>
27481 </tbody>
27482 </tgroup>
27483 </informaltable>
27484 <para>
27485 <indexterm role="concept">
27486 <primary>customizing</primary>
27487 <secondary><emphasis>Received:</emphasis> header</secondary>
27488 </indexterm>
27489 <indexterm role="concept">
27490 <primary><emphasis>Received:</emphasis> header line</primary>
27491 <secondary>customizing</secondary>
27492 </indexterm>
27493 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
27494 added to each message, except for the timestamp, which is automatically added
27495 on at the end (preceded by a semicolon). The string is expanded each time it is
27496 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
27497 added to the message. Otherwise, the string should start with the text
27498 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
27499 header lines. The default setting is:
27500 </para>
27501 <literallayout class="monospaced">
27502 received_header_text = Received: \
27503   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
27504   {${if def:sender_ident \
27505   {from ${quote_local_part:$sender_ident} }}\
27506   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
27507   by $primary_hostname \
27508   ${if def:received_protocol {with $received_protocol}} \
27509   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
27510   (Exim $version_number)\n\t\
27511   ${if def:sender_address \
27512   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
27513   id $message_exim_id\
27514   ${if def:received_for {\n\tfor $received_for}}
27515 </literallayout>
27516 <para>
27517 The reference to the TLS cipher is omitted when Exim is built without TLS
27518 support. The use of conditional expansions ensures that this works for both
27519 locally generated messages and messages received from remote hosts, giving
27520 header lines such as the following:
27521 </para>
27522 <literallayout class="monospaced">
27523 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
27524 by marley.carol.example with esmtp (Exim 4.00)
27525 (envelope-from &lt;bob@carol.example&gt;)
27526 id 16IOWa-00019l-00
27527 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
27528 Received: by scrooge.carol.example with local (Exim 4.00)
27529 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
27530 </literallayout>
27531 <para>
27532 Until the body of the message has been received, the timestamp is the time when
27533 the message started to be received. Once the body has arrived, and all policy
27534 checks have taken place, the timestamp is updated to the time at which the
27535 message was accepted.
27536 </para>
27537 <para>
27538 <indexterm role="option">
27539 <primary><option>received_headers_max</option></primary>
27540 </indexterm>
27541 </para>
27542 <informaltable frame="all">
27543 <tgroup cols="4" colsep="0" rowsep="0">
27544 <colspec colwidth="8*" align="left"/>
27545 <colspec colwidth="6*" align="center"/>
27546 <colspec colwidth="6*" align="center"/>
27547 <colspec colwidth="6*" align="right"/>
27548 <tbody>
27549 <row>
27550 <entry><option>received_headers_max</option></entry>
27551 <entry>Use: <emphasis>main</emphasis></entry>
27552 <entry>Type: <emphasis>integer</emphasis></entry>
27553 <entry>Default: <emphasis>30</emphasis></entry>
27554 </row>
27555 </tbody>
27556 </tgroup>
27557 </informaltable>
27558 <para>
27559 <indexterm role="concept">
27560 <primary>loop</primary>
27561 <secondary>prevention</secondary>
27562 </indexterm>
27563 <indexterm role="concept">
27564 <primary>mail loop prevention</primary>
27565 </indexterm>
27566 <indexterm role="concept">
27567 <primary><emphasis>Received:</emphasis> header line</primary>
27568 <secondary>counting</secondary>
27569 </indexterm>
27570 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
27571 counted, and if it is greater than this parameter, a mail loop is assumed to
27572 have occurred, the delivery is abandoned, and an error message is generated.
27573 This applies to both local and remote deliveries.
27574 </para>
27575 <para>
27576 <indexterm role="option">
27577 <primary><option>recipient_unqualified_hosts</option></primary>
27578 </indexterm>
27579 </para>
27580 <informaltable frame="all">
27581 <tgroup cols="4" colsep="0" rowsep="0">
27582 <colspec colwidth="8*" align="left"/>
27583 <colspec colwidth="6*" align="center"/>
27584 <colspec colwidth="6*" align="center"/>
27585 <colspec colwidth="6*" align="right"/>
27586 <tbody>
27587 <row>
27588 <entry><option>recipient_unqualified_hosts</option></entry>
27589 <entry>Use: <emphasis>main</emphasis></entry>
27590 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27591 <entry>Default: <emphasis>unset</emphasis></entry>
27592 </row>
27593 </tbody>
27594 </tgroup>
27595 </informaltable>
27596 <para>
27597 <indexterm role="concept">
27598 <primary>unqualified addresses</primary>
27599 </indexterm>
27600 <indexterm role="concept">
27601 <primary>host</primary>
27602 <secondary>unqualified addresses from</secondary>
27603 </indexterm>
27604 This option lists those hosts from which Exim is prepared to accept unqualified
27605 recipient addresses in message envelopes. The addresses are made fully
27606 qualified by the addition of the <option>qualify_recipient</option> value. This option also
27607 affects message header lines. Exim does not reject unqualified recipient
27608 addresses in headers, but it qualifies them only if the message came from a
27609 host that matches <option>recipient_unqualified_hosts</option>,
27610 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
27611 option was not set.
27612 </para>
27613 <para>
27614 <indexterm role="option">
27615 <primary><option>recipients_max</option></primary>
27616 </indexterm>
27617 </para>
27618 <informaltable frame="all">
27619 <tgroup cols="4" colsep="0" rowsep="0">
27620 <colspec colwidth="8*" align="left"/>
27621 <colspec colwidth="6*" align="center"/>
27622 <colspec colwidth="6*" align="center"/>
27623 <colspec colwidth="6*" align="right"/>
27624 <tbody>
27625 <row>
27626 <entry><option>recipients_max</option></entry>
27627 <entry>Use: <emphasis>main</emphasis></entry>
27628 <entry>Type: <emphasis>integer</emphasis></entry>
27629 <entry>Default: <emphasis>0</emphasis></entry>
27630 </row>
27631 </tbody>
27632 </tgroup>
27633 </informaltable>
27634 <para>
27635 <indexterm role="concept">
27636 <primary>limit</primary>
27637 <secondary>number of recipients</secondary>
27638 </indexterm>
27639 <indexterm role="concept">
27640 <primary>recipient</primary>
27641 <secondary>maximum number</secondary>
27642 </indexterm>
27643 If this option is set greater than zero, it specifies the maximum number of
27644 original recipients for any message. Additional recipients that are generated
27645 by aliasing or forwarding do not count. SMTP messages get a 452 response for
27646 all recipients over the limit; earlier recipients are delivered as normal.
27647 Non-SMTP messages with too many recipients are failed, and no deliveries are
27648 done.
27649 </para>
27650 <para>
27651 <indexterm role="concept">
27652 <primary>RCPT</primary>
27653 <secondary>maximum number of incoming</secondary>
27654 </indexterm>
27655 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
27656 RCPT commands in a single message.
27657 </para>
27658 <para>
27659 <indexterm role="option">
27660 <primary><option>recipients_max_reject</option></primary>
27661 </indexterm>
27662 </para>
27663 <informaltable frame="all">
27664 <tgroup cols="4" colsep="0" rowsep="0">
27665 <colspec colwidth="8*" align="left"/>
27666 <colspec colwidth="6*" align="center"/>
27667 <colspec colwidth="6*" align="center"/>
27668 <colspec colwidth="6*" align="right"/>
27669 <tbody>
27670 <row>
27671 <entry><option>recipients_max_reject</option></entry>
27672 <entry>Use: <emphasis>main</emphasis></entry>
27673 <entry>Type: <emphasis>boolean</emphasis></entry>
27674 <entry>Default: <emphasis>false</emphasis></entry>
27675 </row>
27676 </tbody>
27677 </tgroup>
27678 </informaltable>
27679 <para>
27680 If this option is set true, Exim rejects SMTP messages containing too many
27681 recipients by giving 552 errors to the surplus RCPT commands, and a 554
27682 error to the eventual DATA command. Otherwise (the default) it gives a 452
27683 error to the surplus RCPT commands and accepts the message on behalf of the
27684 initial set of recipients. The remote server should then re-send the message
27685 for the remaining recipients at a later time.
27686 </para>
27687 <para>
27688 <indexterm role="option">
27689 <primary><option>remote_max_parallel</option></primary>
27690 </indexterm>
27691 </para>
27692 <informaltable frame="all">
27693 <tgroup cols="4" colsep="0" rowsep="0">
27694 <colspec colwidth="8*" align="left"/>
27695 <colspec colwidth="6*" align="center"/>
27696 <colspec colwidth="6*" align="center"/>
27697 <colspec colwidth="6*" align="right"/>
27698 <tbody>
27699 <row>
27700 <entry><option>remote_max_parallel</option></entry>
27701 <entry>Use: <emphasis>main</emphasis></entry>
27702 <entry>Type: <emphasis>integer</emphasis></entry>
27703 <entry>Default: <emphasis>2</emphasis></entry>
27704 </row>
27705 </tbody>
27706 </tgroup>
27707 </informaltable>
27708 <para>
27709 <indexterm role="concept">
27710 <primary>delivery</primary>
27711 <secondary>parallelism for remote</secondary>
27712 </indexterm>
27713 This option controls parallel delivery of one message to a number of remote
27714 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
27715 does all the remote deliveries for a message one by one. Otherwise, if a single
27716 message has to be delivered to more than one remote host, or if several copies
27717 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
27718 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
27719 deliveries are required, the maximum number of processes are started, and as
27720 each one finishes, another is begun. The order of starting processes is the
27721 same as if sequential delivery were being done, and can be controlled by the
27722 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
27723 with debugging turned on, the debugging output from each delivery process is
27724 tagged with its process id.
27725 </para>
27726 <para>
27727 This option controls only the maximum number of parallel deliveries for one
27728 message in one Exim delivery process. Because Exim has no central queue
27729 manager, there is no way of controlling the total number of simultaneous
27730 deliveries if the configuration allows a delivery attempt as soon as a message
27731 is received.
27732 </para>
27733 <para>
27734 <indexterm role="concept">
27735 <primary>number of deliveries</primary>
27736 </indexterm>
27737 <indexterm role="concept">
27738 <primary>delivery</primary>
27739 <secondary>maximum number of</secondary>
27740 </indexterm>
27741 If you want to control the total number of deliveries on the system, you
27742 need to set the <option>queue_only</option> option. This ensures that all incoming messages
27743 are added to the queue without starting a delivery process. Then set up an Exim
27744 daemon to start queue runner processes at appropriate intervals (probably
27745 fairly often, for example, every minute), and limit the total number of queue
27746 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
27747 delivers only one message at a time, the maximum number of deliveries that can
27748 then take place at once is <option>queue_run_max</option> multiplied by
27749 <option>remote_max_parallel</option>.
27750 </para>
27751 <para>
27752 If it is purely remote deliveries you want to control, use
27753 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
27754 doing the SMTP routing before queueing, so that several messages for the same
27755 host will eventually get delivered down the same connection.
27756 </para>
27757 <para>
27758 <indexterm role="option">
27759 <primary><option>remote_sort_domains</option></primary>
27760 </indexterm>
27761 </para>
27762 <informaltable frame="all">
27763 <tgroup cols="4" colsep="0" rowsep="0">
27764 <colspec colwidth="8*" align="left"/>
27765 <colspec colwidth="6*" align="center"/>
27766 <colspec colwidth="6*" align="center"/>
27767 <colspec colwidth="6*" align="right"/>
27768 <tbody>
27769 <row>
27770 <entry><option>remote_sort_domains</option></entry>
27771 <entry>Use: <emphasis>main</emphasis></entry>
27772 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27773 <entry>Default: <emphasis>unset</emphasis></entry>
27774 </row>
27775 </tbody>
27776 </tgroup>
27777 </informaltable>
27778 <para>
27779 <indexterm role="concept">
27780 <primary>sorting remote deliveries</primary>
27781 </indexterm>
27782 <indexterm role="concept">
27783 <primary>delivery</primary>
27784 <secondary>sorting remote</secondary>
27785 </indexterm>
27786 When there are a number of remote deliveries for a message, they are sorted by
27787 domain into the order given by this list. For example,
27788 </para>
27789 <literallayout class="monospaced">
27790 remote_sort_domains = *.cam.ac.uk:*.uk
27791 </literallayout>
27792 <para>
27793 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
27794 then to those in the <option>uk</option> domain, then to any others.
27795 </para>
27796 <para>
27797 <indexterm role="option">
27798 <primary><option>retry_data_expire</option></primary>
27799 </indexterm>
27800 </para>
27801 <informaltable frame="all">
27802 <tgroup cols="4" colsep="0" rowsep="0">
27803 <colspec colwidth="8*" align="left"/>
27804 <colspec colwidth="6*" align="center"/>
27805 <colspec colwidth="6*" align="center"/>
27806 <colspec colwidth="6*" align="right"/>
27807 <tbody>
27808 <row>
27809 <entry><option>retry_data_expire</option></entry>
27810 <entry>Use: <emphasis>main</emphasis></entry>
27811 <entry>Type: <emphasis>time</emphasis></entry>
27812 <entry>Default: <emphasis>7d</emphasis></entry>
27813 </row>
27814 </tbody>
27815 </tgroup>
27816 </informaltable>
27817 <para>
27818 <indexterm role="concept">
27819 <primary>hints database</primary>
27820 <secondary>data expiry</secondary>
27821 </indexterm>
27822 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
27823 database. Any older retry data is ignored. This means that, for example, once a
27824 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
27825 past failures.
27826 </para>
27827 <para>
27828 <indexterm role="option">
27829 <primary><option>retry_interval_max</option></primary>
27830 </indexterm>
27831 </para>
27832 <informaltable frame="all">
27833 <tgroup cols="4" colsep="0" rowsep="0">
27834 <colspec colwidth="8*" align="left"/>
27835 <colspec colwidth="6*" align="center"/>
27836 <colspec colwidth="6*" align="center"/>
27837 <colspec colwidth="6*" align="right"/>
27838 <tbody>
27839 <row>
27840 <entry><option>retry_interval_max</option></entry>
27841 <entry>Use: <emphasis>main</emphasis></entry>
27842 <entry>Type: <emphasis>time</emphasis></entry>
27843 <entry>Default: <emphasis>24h</emphasis></entry>
27844 </row>
27845 </tbody>
27846 </tgroup>
27847 </informaltable>
27848 <para>
27849 <indexterm role="concept">
27850 <primary>retry</primary>
27851 <secondary>limit on interval</secondary>
27852 </indexterm>
27853 <indexterm role="concept">
27854 <primary>limit</primary>
27855 <secondary>on retry interval</secondary>
27856 </indexterm>
27857 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
27858 intervals between delivery attempts for messages that cannot be delivered
27859 straight away. This option sets an overall limit to the length of time between
27860 retries. It cannot be set greater than 24 hours; any attempt to do so forces
27861 the default value.
27862 </para>
27863 <para>
27864 <indexterm role="option">
27865 <primary><option>return_path_remove</option></primary>
27866 </indexterm>
27867 </para>
27868 <informaltable frame="all">
27869 <tgroup cols="4" colsep="0" rowsep="0">
27870 <colspec colwidth="8*" align="left"/>
27871 <colspec colwidth="6*" align="center"/>
27872 <colspec colwidth="6*" align="center"/>
27873 <colspec colwidth="6*" align="right"/>
27874 <tbody>
27875 <row>
27876 <entry><option>return_path_remove</option></entry>
27877 <entry>Use: <emphasis>main</emphasis></entry>
27878 <entry>Type: <emphasis>boolean</emphasis></entry>
27879 <entry>Default: <emphasis>true</emphasis></entry>
27880 </row>
27881 </tbody>
27882 </tgroup>
27883 </informaltable>
27884 <para>
27885 <indexterm role="concept">
27886 <primary><emphasis>Return-path:</emphasis> header line</primary>
27887 <secondary>removing</secondary>
27888 </indexterm>
27889 RFC 2821, section 4.4, states that an SMTP server must insert a
27890 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
27891 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
27892 MAIL command. This description implies that this header should not be present
27893 in an incoming message. If <option>return_path_remove</option> is true, any existing
27894 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
27895 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
27896 the time of delivery. They are normally used only for final local deliveries.
27897 </para>
27898 <para>
27899 <indexterm role="option">
27900 <primary><option>return_size_limit</option></primary>
27901 </indexterm>
27902 </para>
27903 <informaltable frame="all">
27904 <tgroup cols="4" colsep="0" rowsep="0">
27905 <colspec colwidth="8*" align="left"/>
27906 <colspec colwidth="6*" align="center"/>
27907 <colspec colwidth="6*" align="center"/>
27908 <colspec colwidth="6*" align="right"/>
27909 <tbody>
27910 <row>
27911 <entry><option>return_size_limit</option></entry>
27912 <entry>Use: <emphasis>main</emphasis></entry>
27913 <entry>Type: <emphasis>integer</emphasis></entry>
27914 <entry>Default: <emphasis>100K</emphasis></entry>
27915 </row>
27916 </tbody>
27917 </tgroup>
27918 </informaltable>
27919 <para>
27920 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
27921 </para>
27922 <para>
27923 <indexterm role="option">
27924 <primary><option>rfc1413_hosts</option></primary>
27925 </indexterm>
27926 </para>
27927 <informaltable frame="all">
27928 <tgroup cols="4" colsep="0" rowsep="0">
27929 <colspec colwidth="8*" align="left"/>
27930 <colspec colwidth="6*" align="center"/>
27931 <colspec colwidth="6*" align="center"/>
27932 <colspec colwidth="6*" align="right"/>
27933 <tbody>
27934 <row>
27935 <entry><option>rfc1413_hosts</option></entry>
27936 <entry>Use: <emphasis>main</emphasis></entry>
27937 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27938 <entry>Default: <emphasis>*</emphasis></entry>
27939 </row>
27940 </tbody>
27941 </tgroup>
27942 </informaltable>
27943 <para>
27944 <indexterm role="concept">
27945 <primary>RFC 1413</primary>
27946 </indexterm>
27947 <indexterm role="concept">
27948 <primary>host</primary>
27949 <secondary>for RFC 1413 calls</secondary>
27950 </indexterm>
27951 RFC 1413 identification calls are made to any client host which matches an item
27952 in the list.
27953 </para>
27954 <para>
27955 <indexterm role="option">
27956 <primary><option>rfc1413_query_timeout</option></primary>
27957 </indexterm>
27958 </para>
27959 <informaltable frame="all">
27960 <tgroup cols="4" colsep="0" rowsep="0">
27961 <colspec colwidth="8*" align="left"/>
27962 <colspec colwidth="6*" align="center"/>
27963 <colspec colwidth="6*" align="center"/>
27964 <colspec colwidth="6*" align="right"/>
27965 <tbody>
27966 <row>
27967 <entry><option>rfc1413_query_timeout</option></entry>
27968 <entry>Use: <emphasis>main</emphasis></entry>
27969 <entry>Type: <emphasis>time</emphasis></entry>
27970 <entry>Default: <emphasis>5s</emphasis></entry>
27971 </row>
27972 </tbody>
27973 </tgroup>
27974 </informaltable>
27975 <para>
27976 <indexterm role="concept">
27977 <primary>RFC 1413</primary>
27978 <secondary>query timeout</secondary>
27979 </indexterm>
27980 <indexterm role="concept">
27981 <primary>timeout</primary>
27982 <secondary>for RFC 1413 call</secondary>
27983 </indexterm>
27984 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
27985 no RFC 1413 calls are ever made.
27986 </para>
27987 <para>
27988 <indexterm role="option">
27989 <primary><option>sender_unqualified_hosts</option></primary>
27990 </indexterm>
27991 </para>
27992 <informaltable frame="all">
27993 <tgroup cols="4" colsep="0" rowsep="0">
27994 <colspec colwidth="8*" align="left"/>
27995 <colspec colwidth="6*" align="center"/>
27996 <colspec colwidth="6*" align="center"/>
27997 <colspec colwidth="6*" align="right"/>
27998 <tbody>
27999 <row>
28000 <entry><option>sender_unqualified_hosts</option></entry>
28001 <entry>Use: <emphasis>main</emphasis></entry>
28002 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28003 <entry>Default: <emphasis>unset</emphasis></entry>
28004 </row>
28005 </tbody>
28006 </tgroup>
28007 </informaltable>
28008 <para>
28009 <indexterm role="concept">
28010 <primary>unqualified addresses</primary>
28011 </indexterm>
28012 <indexterm role="concept">
28013 <primary>host</primary>
28014 <secondary>unqualified addresses from</secondary>
28015 </indexterm>
28016 This option lists those hosts from which Exim is prepared to accept unqualified
28017 sender addresses. The addresses are made fully qualified by the addition of
28018 <option>qualify_domain</option>. This option also affects message header lines. Exim does
28019 not reject unqualified addresses in headers that contain sender addresses, but
28020 it qualifies them only if the message came from a host that matches
28021 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
28022 using TCP/IP), and the <option>-bnq</option> option was not set.
28023 </para>
28024 <para>
28025 <indexterm role="option">
28026 <primary><option>smtp_accept_keepalive</option></primary>
28027 </indexterm>
28028 </para>
28029 <informaltable frame="all">
28030 <tgroup cols="4" colsep="0" rowsep="0">
28031 <colspec colwidth="8*" align="left"/>
28032 <colspec colwidth="6*" align="center"/>
28033 <colspec colwidth="6*" align="center"/>
28034 <colspec colwidth="6*" align="right"/>
28035 <tbody>
28036 <row>
28037 <entry><option>smtp_accept_keepalive</option></entry>
28038 <entry>Use: <emphasis>main</emphasis></entry>
28039 <entry>Type: <emphasis>boolean</emphasis></entry>
28040 <entry>Default: <emphasis>true</emphasis></entry>
28041 </row>
28042 </tbody>
28043 </tgroup>
28044 </informaltable>
28045 <para>
28046 <indexterm role="concept">
28047 <primary>keepalive</primary>
28048 <secondary>on incoming connection</secondary>
28049 </indexterm>
28050 This option controls the setting of the SO_KEEPALIVE option on incoming
28051 TCP/IP socket connections. When set, it causes the kernel to probe idle
28052 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
28053 other end of the connection should send an acknowledgment if the connection is
28054 still okay or a reset if the connection has been aborted. The reason for doing
28055 this is that it has the beneficial effect of freeing up certain types of
28056 connection that can get stuck when the remote host is disconnected without
28057 tidying up the TCP/IP call properly. The keepalive mechanism takes several
28058 hours to detect unreachable hosts.
28059 </para>
28060 <para>
28061 <indexterm role="option">
28062 <primary><option>smtp_accept_max</option></primary>
28063 </indexterm>
28064 </para>
28065 <informaltable frame="all">
28066 <tgroup cols="4" colsep="0" rowsep="0">
28067 <colspec colwidth="8*" align="left"/>
28068 <colspec colwidth="6*" align="center"/>
28069 <colspec colwidth="6*" align="center"/>
28070 <colspec colwidth="6*" align="right"/>
28071 <tbody>
28072 <row>
28073 <entry><option>smtp_accept_max</option></entry>
28074 <entry>Use: <emphasis>main</emphasis></entry>
28075 <entry>Type: <emphasis>integer</emphasis></entry>
28076 <entry>Default: <emphasis>20</emphasis></entry>
28077 </row>
28078 </tbody>
28079 </tgroup>
28080 </informaltable>
28081 <para>
28082 <indexterm role="concept">
28083 <primary>limit</primary>
28084 <secondary>incoming SMTP connections</secondary>
28085 </indexterm>
28086 <indexterm role="concept">
28087 <primary>SMTP</primary>
28088 <secondary>incoming connection count</secondary>
28089 </indexterm>
28090 <indexterm role="concept">
28091 <primary>inetd</primary>
28092 </indexterm>
28093 This option specifies the maximum number of simultaneous incoming SMTP calls
28094 that Exim will accept. It applies only to the listening daemon; there is no
28095 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
28096 value is set to zero, no limit is applied. However, it is required to be
28097 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
28098 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
28099 </para>
28100 <para>
28101 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
28102 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
28103 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
28104 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
28105 </para>
28106 <para>
28107 <indexterm role="option">
28108 <primary><option>smtp_accept_max_nonmail</option></primary>
28109 </indexterm>
28110 </para>
28111 <informaltable frame="all">
28112 <tgroup cols="4" colsep="0" rowsep="0">
28113 <colspec colwidth="8*" align="left"/>
28114 <colspec colwidth="6*" align="center"/>
28115 <colspec colwidth="6*" align="center"/>
28116 <colspec colwidth="6*" align="right"/>
28117 <tbody>
28118 <row>
28119 <entry><option>smtp_accept_max_nonmail</option></entry>
28120 <entry>Use: <emphasis>main</emphasis></entry>
28121 <entry>Type: <emphasis>integer</emphasis></entry>
28122 <entry>Default: <emphasis>10</emphasis></entry>
28123 </row>
28124 </tbody>
28125 </tgroup>
28126 </informaltable>
28127 <para>
28128 <indexterm role="concept">
28129 <primary>limit</primary>
28130 <secondary>non-mail SMTP commands</secondary>
28131 </indexterm>
28132 <indexterm role="concept">
28133 <primary>SMTP</primary>
28134 <secondary>limiting non-mail commands</secondary>
28135 </indexterm>
28136 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
28137 the connection if there are too many. This option defines <quote>too many</quote>. The
28138 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
28139 client looping sending EHLO, for example. The check is applied only if the
28140 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
28141 </para>
28142 <para>
28143 When a new message is expected, one occurrence of RSET is not counted. This
28144 allows a client to send one RSET between messages (this is not necessary,
28145 but some clients do it). Exim also allows one uncounted occurrence of HELO
28146 or EHLO, and one occurrence of STARTTLS between messages. After
28147 starting up a TLS session, another EHLO is expected, and so it too is not
28148 counted. The first occurrence of AUTH in a connection, or immediately
28149 following STARTTLS is not counted. Otherwise, all commands other than
28150 MAIL, RCPT, DATA, and QUIT are counted.
28151 </para>
28152 <para>
28153 <indexterm role="option">
28154 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
28155 </indexterm>
28156 </para>
28157 <informaltable frame="all">
28158 <tgroup cols="4" colsep="0" rowsep="0">
28159 <colspec colwidth="8*" align="left"/>
28160 <colspec colwidth="6*" align="center"/>
28161 <colspec colwidth="6*" align="center"/>
28162 <colspec colwidth="6*" align="right"/>
28163 <tbody>
28164 <row>
28165 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
28166 <entry>Use: <emphasis>main</emphasis></entry>
28167 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28168 <entry>Default: <emphasis>*</emphasis></entry>
28169 </row>
28170 </tbody>
28171 </tgroup>
28172 </informaltable>
28173 <para>
28174 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
28175 check by setting this option. The default value makes it apply to all hosts. By
28176 changing the value, you can exclude any badly-behaved hosts that you have to
28177 live with.
28178 </para>
28179 <para>
28180 <indexterm role="option">
28181 <primary><option>smtp_accept_max_per_connection</option></primary>
28182 </indexterm>
28183 </para>
28184 <informaltable frame="all">
28185 <tgroup cols="4" colsep="0" rowsep="0">
28186 <colspec colwidth="8*" align="left"/>
28187 <colspec colwidth="6*" align="center"/>
28188 <colspec colwidth="6*" align="center"/>
28189 <colspec colwidth="6*" align="right"/>
28190 <tbody>
28191 <row>
28192 <entry><option>smtp_accept_max_per_connection</option></entry>
28193 <entry>Use: <emphasis>main</emphasis></entry>
28194 <entry>Type: <emphasis>integer</emphasis></entry>
28195 <entry>Default: <emphasis>1000</emphasis></entry>
28196 </row>
28197 </tbody>
28198 </tgroup>
28199 </informaltable>
28200 <para>
28201 <indexterm role="concept">
28202 <primary>SMTP</primary>
28203 <secondary>limiting incoming message count</secondary>
28204 </indexterm>
28205 <indexterm role="concept">
28206 <primary>limit</primary>
28207 <secondary>messages per SMTP connection</secondary>
28208 </indexterm>
28209 The value of this option limits the number of MAIL commands that Exim is
28210 prepared to accept over a single SMTP connection, whether or not each command
28211 results in the transfer of a message. After the limit is reached, a 421
28212 response is given to subsequent MAIL commands. This limit is a safety
28213 precaution against a client that goes mad (incidents of this type have been
28214 seen).
28215 </para>
28216 <para>
28217 <indexterm role="option">
28218 <primary><option>smtp_accept_max_per_host</option></primary>
28219 </indexterm>
28220 </para>
28221 <informaltable frame="all">
28222 <tgroup cols="4" colsep="0" rowsep="0">
28223 <colspec colwidth="8*" align="left"/>
28224 <colspec colwidth="6*" align="center"/>
28225 <colspec colwidth="6*" align="center"/>
28226 <colspec colwidth="6*" align="right"/>
28227 <tbody>
28228 <row>
28229 <entry><option>smtp_accept_max_per_host</option></entry>
28230 <entry>Use: <emphasis>main</emphasis></entry>
28231 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28232 <entry>Default: <emphasis>unset</emphasis></entry>
28233 </row>
28234 </tbody>
28235 </tgroup>
28236 </informaltable>
28237 <para>
28238 <indexterm role="concept">
28239 <primary>limit</primary>
28240 <secondary>SMTP connections from one host</secondary>
28241 </indexterm>
28242 <indexterm role="concept">
28243 <primary>host</primary>
28244 <secondary>limiting SMTP connections from</secondary>
28245 </indexterm>
28246 This option restricts the number of simultaneous IP connections from a single
28247 host (strictly, from a single IP address) to the Exim daemon. The option is
28248 expanded, to enable different limits to be applied to different hosts by
28249 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
28250 connection attempts from the same host are rejected with error code 421. This
28251 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
28252 of zero imposes no limit. If this option is set greater than zero, it is
28253 required that <option>smtp_accept_max</option> be non-zero.
28254 </para>
28255 <para>
28256 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
28257 constructions that take an appreciable amount of time. The expansion and test
28258 happen in the main daemon loop, in order to reject additional connections
28259 without forking additional processes (otherwise a denial-of-service attack
28260 could cause a vast number or processes to be created). While the daemon is
28261 doing this processing, it cannot accept any other incoming connections.
28262 </para>
28263 <para>
28264 <indexterm role="option">
28265 <primary><option>smtp_accept_queue</option></primary>
28266 </indexterm>
28267 </para>
28268 <informaltable frame="all">
28269 <tgroup cols="4" colsep="0" rowsep="0">
28270 <colspec colwidth="8*" align="left"/>
28271 <colspec colwidth="6*" align="center"/>
28272 <colspec colwidth="6*" align="center"/>
28273 <colspec colwidth="6*" align="right"/>
28274 <tbody>
28275 <row>
28276 <entry><option>smtp_accept_queue</option></entry>
28277 <entry>Use: <emphasis>main</emphasis></entry>
28278 <entry>Type: <emphasis>integer</emphasis></entry>
28279 <entry>Default: <emphasis>0</emphasis></entry>
28280 </row>
28281 </tbody>
28282 </tgroup>
28283 </informaltable>
28284 <para>
28285 <indexterm role="concept">
28286 <primary>SMTP</primary>
28287 <secondary>incoming connection count</secondary>
28288 </indexterm>
28289 <indexterm role="concept">
28290 <primary>queueing incoming messages</primary>
28291 </indexterm>
28292 <indexterm role="concept">
28293 <primary>message</primary>
28294 <secondary>queueing by SMTP connection count</secondary>
28295 </indexterm>
28296 If the number of simultaneous incoming SMTP connections being handled via the
28297 listening daemon exceeds this value, messages received by SMTP are just placed
28298 on the queue; no delivery processes are started automatically. The count is
28299 fixed at the start of an SMTP connection. It cannot be updated in the
28300 subprocess that receives messages, and so the queueing or not queueing applies
28301 to all messages received in the same connection.
28302 </para>
28303 <para>
28304 A value of zero implies no limit, and clearly any non-zero value is useful only
28305 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
28306 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
28307 various <option>-od</option><emphasis>x</emphasis> command line options.
28308 </para>
28309 <para>
28310 <indexterm role="option">
28311 <primary><option>smtp_accept_queue_per_connection</option></primary>
28312 </indexterm>
28313 </para>
28314 <informaltable frame="all">
28315 <tgroup cols="4" colsep="0" rowsep="0">
28316 <colspec colwidth="8*" align="left"/>
28317 <colspec colwidth="6*" align="center"/>
28318 <colspec colwidth="6*" align="center"/>
28319 <colspec colwidth="6*" align="right"/>
28320 <tbody>
28321 <row>
28322 <entry><option>smtp_accept_queue_per_connection</option></entry>
28323 <entry>Use: <emphasis>main</emphasis></entry>
28324 <entry>Type: <emphasis>integer</emphasis></entry>
28325 <entry>Default: <emphasis>10</emphasis></entry>
28326 </row>
28327 </tbody>
28328 </tgroup>
28329 </informaltable>
28330 <para>
28331 <indexterm role="concept">
28332 <primary>queueing incoming messages</primary>
28333 </indexterm>
28334 <indexterm role="concept">
28335 <primary>message</primary>
28336 <secondary>queueing by message count</secondary>
28337 </indexterm>
28338 This option limits the number of delivery processes that Exim starts
28339 automatically when receiving messages via SMTP, whether via the daemon or by
28340 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
28341 and the number of messages received in a single SMTP session exceeds this
28342 number, subsequent messages are placed on the queue, but no delivery processes
28343 are started. This helps to limit the number of Exim processes when a server
28344 restarts after downtime and there is a lot of mail waiting for it on other
28345 systems. On large systems, the default should probably be increased, and on
28346 dial-in client systems it should probably be set to zero (that is, disabled).
28347 </para>
28348 <para>
28349 <indexterm role="option">
28350 <primary><option>smtp_accept_reserve</option></primary>
28351 </indexterm>
28352 </para>
28353 <informaltable frame="all">
28354 <tgroup cols="4" colsep="0" rowsep="0">
28355 <colspec colwidth="8*" align="left"/>
28356 <colspec colwidth="6*" align="center"/>
28357 <colspec colwidth="6*" align="center"/>
28358 <colspec colwidth="6*" align="right"/>
28359 <tbody>
28360 <row>
28361 <entry><option>smtp_accept_reserve</option></entry>
28362 <entry>Use: <emphasis>main</emphasis></entry>
28363 <entry>Type: <emphasis>integer</emphasis></entry>
28364 <entry>Default: <emphasis>0</emphasis></entry>
28365 </row>
28366 </tbody>
28367 </tgroup>
28368 </informaltable>
28369 <para>
28370 <indexterm role="concept">
28371 <primary>SMTP</primary>
28372 <secondary>incoming call count</secondary>
28373 </indexterm>
28374 <indexterm role="concept">
28375 <primary>host</primary>
28376 <secondary>reserved</secondary>
28377 </indexterm>
28378 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
28379 number of SMTP connections that are reserved for connections from the hosts
28380 that are specified in <option>smtp_reserve_hosts</option>. The value set in
28381 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
28382 restricted to this number of connections; the option specifies a minimum number
28383 of connection slots for them, not a maximum. It is a guarantee that this group
28384 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
28385 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
28386 individual host.
28387 </para>
28388 <para>
28389 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
28390 set to 5, once there are 45 active connections (from any hosts), new
28391 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
28392 provided the other criteria for acceptance are met.
28393 </para>
28394 <para>
28395 <indexterm role="option">
28396 <primary><option>smtp_active_hostname</option></primary>
28397 </indexterm>
28398 </para>
28399 <informaltable frame="all">
28400 <tgroup cols="4" colsep="0" rowsep="0">
28401 <colspec colwidth="8*" align="left"/>
28402 <colspec colwidth="6*" align="center"/>
28403 <colspec colwidth="6*" align="center"/>
28404 <colspec colwidth="6*" align="right"/>
28405 <tbody>
28406 <row>
28407 <entry><option>smtp_active_hostname</option></entry>
28408 <entry>Use: <emphasis>main</emphasis></entry>
28409 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28410 <entry>Default: <emphasis>unset</emphasis></entry>
28411 </row>
28412 </tbody>
28413 </tgroup>
28414 </informaltable>
28415 <para>
28416 <indexterm role="concept">
28417 <primary>host</primary>
28418 <secondary>name in SMTP responses</secondary>
28419 </indexterm>
28420 <indexterm role="concept">
28421 <primary>SMTP</primary>
28422 <secondary>host name in responses</secondary>
28423 </indexterm>
28424 <indexterm role="variable">
28425 <primary><varname>$primary_hostname</varname></primary>
28426 </indexterm>
28427 This option is provided for multi-homed servers that want to masquerade as
28428 several different hosts. At the start of an incoming SMTP connection, its value
28429 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
28430 responses. For example, it is used as domain name in the response to an
28431 incoming HELO or EHLO command.
28432 </para>
28433 <para>
28434 <indexterm role="variable">
28435 <primary><varname>$smtp_active_hostname</varname></primary>
28436 </indexterm>
28437 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
28438 is saved with any messages that are received. It is therefore available for use
28439 in routers and transports when the message is later delivered.
28440 </para>
28441 <para>
28442 If this option is unset, or if its expansion is forced to fail, or if the
28443 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
28444 used. Other expansion failures cause a message to be written to the main and
28445 panic logs, and the SMTP command receives a temporary error. Typically, the
28446 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
28447 For example:
28448 </para>
28449 <literallayout class="monospaced">
28450 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
28451   {cox.mydomain}{box.mydomain}}
28452 </literallayout>
28453 <para>
28454 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
28455 messages, it is also used as the default for HELO commands in callout
28456 verification if there is no remote transport from which to obtain a
28457 <option>helo_data</option> value.
28458 </para>
28459 <para>
28460 <indexterm role="option">
28461 <primary><option>smtp_banner</option></primary>
28462 </indexterm>
28463 </para>
28464 <informaltable frame="all">
28465 <tgroup cols="4" colsep="0" rowsep="0">
28466 <colspec colwidth="8*" align="left"/>
28467 <colspec colwidth="6*" align="center"/>
28468 <colspec colwidth="6*" align="center"/>
28469 <colspec colwidth="6*" align="right"/>
28470 <tbody>
28471 <row>
28472 <entry><option>smtp_banner</option></entry>
28473 <entry>Use: <emphasis>main</emphasis></entry>
28474 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28475 <entry>Default: <emphasis>see below</emphasis></entry>
28476 </row>
28477 </tbody>
28478 </tgroup>
28479 </informaltable>
28480 <para>
28481 <indexterm role="concept">
28482 <primary>SMTP</primary>
28483 <secondary>welcome banner</secondary>
28484 </indexterm>
28485 <indexterm role="concept">
28486 <primary>banner for SMTP</primary>
28487 </indexterm>
28488 <indexterm role="concept">
28489 <primary>welcome banner for SMTP</primary>
28490 </indexterm>
28491 <indexterm role="concept">
28492 <primary>customizing</primary>
28493 <secondary>SMTP banner</secondary>
28494 </indexterm>
28495 This string, which is expanded every time it is used, is output as the initial
28496 positive response to an SMTP connection. The default setting is:
28497 </para>
28498 <literallayout class="monospaced">
28499 smtp_banner = $smtp_active_hostname ESMTP Exim \
28500   $version_number $tod_full
28501 </literallayout>
28502 <para>
28503 Failure to expand the string causes a panic error. If you want to create a
28504 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
28505 appropriate points, but not at the end. Note that the 220 code is not included
28506 in this string. Exim adds it automatically (several times in the case of a
28507 multiline response).
28508 </para>
28509 <para>
28510 <indexterm role="option">
28511 <primary><option>smtp_check_spool_space</option></primary>
28512 </indexterm>
28513 </para>
28514 <informaltable frame="all">
28515 <tgroup cols="4" colsep="0" rowsep="0">
28516 <colspec colwidth="8*" align="left"/>
28517 <colspec colwidth="6*" align="center"/>
28518 <colspec colwidth="6*" align="center"/>
28519 <colspec colwidth="6*" align="right"/>
28520 <tbody>
28521 <row>
28522 <entry><option>smtp_check_spool_space</option></entry>
28523 <entry>Use: <emphasis>main</emphasis></entry>
28524 <entry>Type: <emphasis>boolean</emphasis></entry>
28525 <entry>Default: <emphasis>true</emphasis></entry>
28526 </row>
28527 </tbody>
28528 </tgroup>
28529 </informaltable>
28530 <para>
28531 <indexterm role="concept">
28532 <primary>checking disk space</primary>
28533 </indexterm>
28534 <indexterm role="concept">
28535 <primary>disk space, checking</primary>
28536 </indexterm>
28537 <indexterm role="concept">
28538 <primary>spool directory</primary>
28539 <secondary>checking space</secondary>
28540 </indexterm>
28541 When this option is set, if an incoming SMTP session encounters the SIZE
28542 option on a MAIL command, it checks that there is enough space in the
28543 spool directory&#x2019;s partition to accept a message of that size, while still
28544 leaving free the amount specified by <option>check_spool_space</option> (even if that value
28545 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
28546 </para>
28547 <para>
28548 <indexterm role="option">
28549 <primary><option>smtp_connect_backlog</option></primary>
28550 </indexterm>
28551 </para>
28552 <informaltable frame="all">
28553 <tgroup cols="4" colsep="0" rowsep="0">
28554 <colspec colwidth="8*" align="left"/>
28555 <colspec colwidth="6*" align="center"/>
28556 <colspec colwidth="6*" align="center"/>
28557 <colspec colwidth="6*" align="right"/>
28558 <tbody>
28559 <row>
28560 <entry><option>smtp_connect_backlog</option></entry>
28561 <entry>Use: <emphasis>main</emphasis></entry>
28562 <entry>Type: <emphasis>integer</emphasis></entry>
28563 <entry>Default: <emphasis>20</emphasis></entry>
28564 </row>
28565 </tbody>
28566 </tgroup>
28567 </informaltable>
28568 <para>
28569 <indexterm role="concept">
28570 <primary>connection backlog</primary>
28571 </indexterm>
28572 <indexterm role="concept">
28573 <primary>SMTP</primary>
28574 <secondary>connection backlog</secondary>
28575 </indexterm>
28576 <indexterm role="concept">
28577 <primary>backlog of connections</primary>
28578 </indexterm>
28579 This option specifies a maximum number of waiting SMTP connections. Exim passes
28580 this value to the TCP/IP system when it sets up its listener. Once this number
28581 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
28582 attempts are refused at the TCP/IP level. At least, that is what the manuals
28583 say; in some circumstances such connection attempts have been observed to time
28584 out instead. For large systems it is probably a good idea to increase the
28585 value (to 50, say). It also gives some protection against denial-of-service
28586 attacks by SYN flooding.
28587 </para>
28588 <para>
28589 <indexterm role="option">
28590 <primary><option>smtp_enforce_sync</option></primary>
28591 </indexterm>
28592 </para>
28593 <informaltable frame="all">
28594 <tgroup cols="4" colsep="0" rowsep="0">
28595 <colspec colwidth="8*" align="left"/>
28596 <colspec colwidth="6*" align="center"/>
28597 <colspec colwidth="6*" align="center"/>
28598 <colspec colwidth="6*" align="right"/>
28599 <tbody>
28600 <row>
28601 <entry><option>smtp_enforce_sync</option></entry>
28602 <entry>Use: <emphasis>main</emphasis></entry>
28603 <entry>Type: <emphasis>boolean</emphasis></entry>
28604 <entry>Default: <emphasis>true</emphasis></entry>
28605 </row>
28606 </tbody>
28607 </tgroup>
28608 </informaltable>
28609 <para>
28610 <indexterm role="concept">
28611 <primary>SMTP</primary>
28612 <secondary>synchronization checking</secondary>
28613 </indexterm>
28614 <indexterm role="concept">
28615 <primary>synchronization checking in SMTP</primary>
28616 </indexterm>
28617 The SMTP protocol specification requires the client to wait for a response from
28618 the server at certain points in the dialogue. Without PIPELINING these
28619 synchronization points are after every command; with PIPELINING they are
28620 fewer, but they still exist.
28621 </para>
28622 <para>
28623 Some spamming sites send out a complete set of SMTP commands without waiting
28624 for any response. Exim protects against this by rejecting a message if the
28625 client has sent further input when it should not have. The error response <quote>554
28626 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
28627 for this error cannot be perfect because of transmission delays (unexpected
28628 input may be on its way but not yet received when Exim checks). However, it
28629 does detect many instances.
28630 </para>
28631 <para>
28632 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
28633 If you want to disable the check selectively (for example, only for certain
28634 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
28635 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
28636 </para>
28637 <para>
28638 <indexterm role="option">
28639 <primary><option>smtp_etrn_command</option></primary>
28640 </indexterm>
28641 </para>
28642 <informaltable frame="all">
28643 <tgroup cols="4" colsep="0" rowsep="0">
28644 <colspec colwidth="8*" align="left"/>
28645 <colspec colwidth="6*" align="center"/>
28646 <colspec colwidth="6*" align="center"/>
28647 <colspec colwidth="6*" align="right"/>
28648 <tbody>
28649 <row>
28650 <entry><option>smtp_etrn_command</option></entry>
28651 <entry>Use: <emphasis>main</emphasis></entry>
28652 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28653 <entry>Default: <emphasis>unset</emphasis></entry>
28654 </row>
28655 </tbody>
28656 </tgroup>
28657 </informaltable>
28658 <para>
28659 <indexterm role="concept">
28660 <primary>ETRN</primary>
28661 <secondary>command to be run</secondary>
28662 </indexterm>
28663 <indexterm role="variable">
28664 <primary><varname>$domain</varname></primary>
28665 </indexterm>
28666 If this option is set, the given command is run whenever an SMTP ETRN
28667 command is received from a host that is permitted to issue such commands (see
28668 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
28669 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
28670 argument of the ETRN command, and no syntax checking is done on it. For
28671 example:
28672 </para>
28673 <literallayout class="monospaced">
28674 smtp_etrn_command = /etc/etrn_command $domain \
28675                     $sender_host_address
28676 </literallayout>
28677 <para>
28678 A new process is created to run the command, but Exim does not wait for it to
28679 complete. Consequently, its status cannot be checked. If the command cannot be
28680 run, a line is written to the panic log, but the ETRN caller still receives
28681 a 250 success response. Exim is normally running under its own uid when
28682 receiving SMTP, so it is not possible for it to change the uid before running
28683 the command.
28684 </para>
28685 <para>
28686 <indexterm role="option">
28687 <primary><option>smtp_etrn_serialize</option></primary>
28688 </indexterm>
28689 </para>
28690 <informaltable frame="all">
28691 <tgroup cols="4" colsep="0" rowsep="0">
28692 <colspec colwidth="8*" align="left"/>
28693 <colspec colwidth="6*" align="center"/>
28694 <colspec colwidth="6*" align="center"/>
28695 <colspec colwidth="6*" align="right"/>
28696 <tbody>
28697 <row>
28698 <entry><option>smtp_etrn_serialize</option></entry>
28699 <entry>Use: <emphasis>main</emphasis></entry>
28700 <entry>Type: <emphasis>boolean</emphasis></entry>
28701 <entry>Default: <emphasis>true</emphasis></entry>
28702 </row>
28703 </tbody>
28704 </tgroup>
28705 </informaltable>
28706 <para>
28707 <indexterm role="concept">
28708 <primary>ETRN</primary>
28709 <secondary>serializing</secondary>
28710 </indexterm>
28711 When this option is set, it prevents the simultaneous execution of more than
28712 one identical command as a result of ETRN in an SMTP connection. See
28713 section <xref linkend="SECTETRN"/> for details.
28714 </para>
28715 <para>
28716 <indexterm role="option">
28717 <primary><option>smtp_load_reserve</option></primary>
28718 </indexterm>
28719 </para>
28720 <informaltable frame="all">
28721 <tgroup cols="4" colsep="0" rowsep="0">
28722 <colspec colwidth="8*" align="left"/>
28723 <colspec colwidth="6*" align="center"/>
28724 <colspec colwidth="6*" align="center"/>
28725 <colspec colwidth="6*" align="right"/>
28726 <tbody>
28727 <row>
28728 <entry><option>smtp_load_reserve</option></entry>
28729 <entry>Use: <emphasis>main</emphasis></entry>
28730 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28731 <entry>Default: <emphasis>unset</emphasis></entry>
28732 </row>
28733 </tbody>
28734 </tgroup>
28735 </informaltable>
28736 <para>
28737 <indexterm role="concept">
28738 <primary>load average</primary>
28739 </indexterm>
28740 If the system load average ever gets higher than this, incoming SMTP calls are
28741 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
28742 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
28743 the load is over the limit. The option has no effect on ancient operating
28744 systems on which Exim cannot determine the load average. See also
28745 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
28746 </para>
28747 <para>
28748 <indexterm role="option">
28749 <primary><option>smtp_max_synprot_errors</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>smtp_max_synprot_errors</option></entry>
28761 <entry>Use: <emphasis>main</emphasis></entry>
28762 <entry>Type: <emphasis>integer</emphasis></entry>
28763 <entry>Default: <emphasis>3</emphasis></entry>
28764 </row>
28765 </tbody>
28766 </tgroup>
28767 </informaltable>
28768 <para>
28769 <indexterm role="concept">
28770 <primary>SMTP</primary>
28771 <secondary>limiting syntax and protocol errors</secondary>
28772 </indexterm>
28773 <indexterm role="concept">
28774 <primary>limit</primary>
28775 <secondary>SMTP syntax and protocol errors</secondary>
28776 </indexterm>
28777 Exim rejects SMTP commands that contain syntax or protocol errors. In
28778 particular, a syntactically invalid email address, as in this command:
28779 </para>
28780 <literallayout class="monospaced">
28781 RCPT TO:&lt;abc xyz@a.b.c&gt;
28782 </literallayout>
28783 <para>
28784 causes immediate rejection of the command, before any other tests are done.
28785 (The ACL cannot be run if there is no valid address to set up for it.) An
28786 example of a protocol error is receiving RCPT before MAIL. If there are
28787 too many syntax or protocol errors in one SMTP session, the connection is
28788 dropped. The limit is set by this option.
28789 </para>
28790 <para>
28791 <indexterm role="concept">
28792 <primary>PIPELINING</primary>
28793 <secondary>expected errors</secondary>
28794 </indexterm>
28795 When the PIPELINING extension to SMTP is in use, some protocol errors are
28796 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
28797 Exim assumes that PIPELINING will be used if it advertises it (see
28798 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
28799 not count towards the limit.
28800 </para>
28801 <para>
28802 <indexterm role="option">
28803 <primary><option>smtp_max_unknown_commands</option></primary>
28804 </indexterm>
28805 </para>
28806 <informaltable frame="all">
28807 <tgroup cols="4" colsep="0" rowsep="0">
28808 <colspec colwidth="8*" align="left"/>
28809 <colspec colwidth="6*" align="center"/>
28810 <colspec colwidth="6*" align="center"/>
28811 <colspec colwidth="6*" align="right"/>
28812 <tbody>
28813 <row>
28814 <entry><option>smtp_max_unknown_commands</option></entry>
28815 <entry>Use: <emphasis>main</emphasis></entry>
28816 <entry>Type: <emphasis>integer</emphasis></entry>
28817 <entry>Default: <emphasis>3</emphasis></entry>
28818 </row>
28819 </tbody>
28820 </tgroup>
28821 </informaltable>
28822 <para>
28823 <indexterm role="concept">
28824 <primary>SMTP</primary>
28825 <secondary>limiting unknown commands</secondary>
28826 </indexterm>
28827 <indexterm role="concept">
28828 <primary>limit</primary>
28829 <secondary>unknown SMTP commands</secondary>
28830 </indexterm>
28831 If there are too many unrecognized commands in an incoming SMTP session, an
28832 Exim server drops the connection. This is a defence against some kinds of abuse
28833 that subvert web
28834 clients
28835 into making connections to SMTP ports; in these circumstances, a number of
28836 non-SMTP command lines are sent first.
28837 </para>
28838 <para>
28839 <indexterm role="option">
28840 <primary><option>smtp_ratelimit_hosts</option></primary>
28841 </indexterm>
28842 </para>
28843 <informaltable frame="all">
28844 <tgroup cols="4" colsep="0" rowsep="0">
28845 <colspec colwidth="8*" align="left"/>
28846 <colspec colwidth="6*" align="center"/>
28847 <colspec colwidth="6*" align="center"/>
28848 <colspec colwidth="6*" align="right"/>
28849 <tbody>
28850 <row>
28851 <entry><option>smtp_ratelimit_hosts</option></entry>
28852 <entry>Use: <emphasis>main</emphasis></entry>
28853 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28854 <entry>Default: <emphasis>unset</emphasis></entry>
28855 </row>
28856 </tbody>
28857 </tgroup>
28858 </informaltable>
28859 <para>
28860 <indexterm role="concept">
28861 <primary>SMTP</primary>
28862 <secondary>rate limiting</secondary>
28863 </indexterm>
28864 <indexterm role="concept">
28865 <primary>limit</primary>
28866 <secondary>rate of message arrival</secondary>
28867 </indexterm>
28868 <indexterm role="concept">
28869 <primary>RCPT</primary>
28870 <secondary>rate limiting</secondary>
28871 </indexterm>
28872 Some sites find it helpful to be able to limit the rate at which certain hosts
28873 can send them messages, and the rate at which an individual message can specify
28874 recipients.
28875 </para>
28876 <para>
28877 Exim has two rate-limiting facilities. This section describes the older
28878 facility, which can limit rates within a single connection. The newer
28879 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
28880 <xref linkend="SECTratelimiting"/> for details of the newer facility.
28881 </para>
28882 <para>
28883 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
28884 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
28885 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
28886 respectively. Each option, if set, must contain a set of four comma-separated
28887 values:
28888 </para>
28889 <itemizedlist>
28890 <listitem>
28891 <para>
28892 A threshold, before which there is no rate limiting.
28893 </para>
28894 </listitem>
28895 <listitem>
28896 <para>
28897 An initial time delay. Unlike other times in Exim, numbers with decimal
28898 fractional parts are allowed here.
28899 </para>
28900 </listitem>
28901 <listitem>
28902 <para>
28903 A factor by which to increase the delay each time.
28904 </para>
28905 </listitem>
28906 <listitem>
28907 <para>
28908 A maximum value for the delay. This should normally be less than 5 minutes,
28909 because after that time, the client is liable to timeout the SMTP command.
28910 </para>
28911 </listitem>
28912 </itemizedlist>
28913 <para>
28914 For example, these settings have been used successfully at the site which
28915 first suggested this feature, for controlling mail from their customers:
28916 </para>
28917 <literallayout class="monospaced">
28918 smtp_ratelimit_mail = 2,0.5s,1.05,4m
28919 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
28920 </literallayout>
28921 <para>
28922 The first setting specifies delays that are applied to MAIL commands after
28923 two have been received over a single connection. The initial delay is 0.5
28924 seconds, increasing by a factor of 1.05 each time. The second setting applies
28925 delays to RCPT commands when more than four occur in a single message.
28926 </para>
28927 <para>
28928 <indexterm role="option">
28929 <primary><option>smtp_ratelimit_mail</option></primary>
28930 </indexterm>
28931 </para>
28932 <informaltable frame="all">
28933 <tgroup cols="4" colsep="0" rowsep="0">
28934 <colspec colwidth="8*" align="left"/>
28935 <colspec colwidth="6*" align="center"/>
28936 <colspec colwidth="6*" align="center"/>
28937 <colspec colwidth="6*" align="right"/>
28938 <tbody>
28939 <row>
28940 <entry><option>smtp_ratelimit_mail</option></entry>
28941 <entry>Use: <emphasis>main</emphasis></entry>
28942 <entry>Type: <emphasis>string</emphasis></entry>
28943 <entry>Default: <emphasis>unset</emphasis></entry>
28944 </row>
28945 </tbody>
28946 </tgroup>
28947 </informaltable>
28948 <para>
28949 See <option>smtp_ratelimit_hosts</option> above.
28950 </para>
28951 <para>
28952 <indexterm role="option">
28953 <primary><option>smtp_ratelimit_rcpt</option></primary>
28954 </indexterm>
28955 </para>
28956 <informaltable frame="all">
28957 <tgroup cols="4" colsep="0" rowsep="0">
28958 <colspec colwidth="8*" align="left"/>
28959 <colspec colwidth="6*" align="center"/>
28960 <colspec colwidth="6*" align="center"/>
28961 <colspec colwidth="6*" align="right"/>
28962 <tbody>
28963 <row>
28964 <entry><option>smtp_ratelimit_rcpt</option></entry>
28965 <entry>Use: <emphasis>main</emphasis></entry>
28966 <entry>Type: <emphasis>string</emphasis></entry>
28967 <entry>Default: <emphasis>unset</emphasis></entry>
28968 </row>
28969 </tbody>
28970 </tgroup>
28971 </informaltable>
28972 <para>
28973 See <option>smtp_ratelimit_hosts</option> above.
28974 </para>
28975 <para>
28976 <indexterm role="option">
28977 <primary><option>smtp_receive_timeout</option></primary>
28978 </indexterm>
28979 </para>
28980 <informaltable frame="all">
28981 <tgroup cols="4" colsep="0" rowsep="0">
28982 <colspec colwidth="8*" align="left"/>
28983 <colspec colwidth="6*" align="center"/>
28984 <colspec colwidth="6*" align="center"/>
28985 <colspec colwidth="6*" align="right"/>
28986 <tbody>
28987 <row>
28988 <entry><option>smtp_receive_timeout</option></entry>
28989 <entry>Use: <emphasis>main</emphasis></entry>
28990 <entry>Type: <emphasis>time</emphasis></entry>
28991 <entry>Default: <emphasis>5m</emphasis></entry>
28992 </row>
28993 </tbody>
28994 </tgroup>
28995 </informaltable>
28996 <para>
28997 <indexterm role="concept">
28998 <primary>timeout</primary>
28999 <secondary>for SMTP input</secondary>
29000 </indexterm>
29001 <indexterm role="concept">
29002 <primary>SMTP</primary>
29003 <secondary>input timeout</secondary>
29004 </indexterm>
29005 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
29006 input, including batch SMTP. If a line of input (either an SMTP command or a
29007 data line) is not received within this time, the SMTP connection is dropped and
29008 the message is abandoned.
29009 A line is written to the log containing one of the following messages:
29010 </para>
29011 <literallayout class="monospaced">
29012 SMTP command timeout on connection from...
29013 SMTP data timeout on connection from...
29014 </literallayout>
29015 <para>
29016 The former means that Exim was expecting to read an SMTP command; the latter
29017 means that it was in the DATA phase, reading the contents of a message.
29018 </para>
29019 <para>
29020 <indexterm role="option">
29021 <primary><option>-os</option></primary>
29022 </indexterm>
29023 The value set by this option can be overridden by the
29024 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
29025 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
29026 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
29027 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
29028 </para>
29029 <para>
29030 <indexterm role="option">
29031 <primary><option>smtp_reserve_hosts</option></primary>
29032 </indexterm>
29033 </para>
29034 <informaltable frame="all">
29035 <tgroup cols="4" colsep="0" rowsep="0">
29036 <colspec colwidth="8*" align="left"/>
29037 <colspec colwidth="6*" align="center"/>
29038 <colspec colwidth="6*" align="center"/>
29039 <colspec colwidth="6*" align="right"/>
29040 <tbody>
29041 <row>
29042 <entry><option>smtp_reserve_hosts</option></entry>
29043 <entry>Use: <emphasis>main</emphasis></entry>
29044 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29045 <entry>Default: <emphasis>unset</emphasis></entry>
29046 </row>
29047 </tbody>
29048 </tgroup>
29049 </informaltable>
29050 <para>
29051 This option defines hosts for which SMTP connections are reserved; see
29052 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
29053 </para>
29054 <para>
29055 <indexterm role="option">
29056 <primary><option>smtp_return_error_details</option></primary>
29057 </indexterm>
29058 </para>
29059 <informaltable frame="all">
29060 <tgroup cols="4" colsep="0" rowsep="0">
29061 <colspec colwidth="8*" align="left"/>
29062 <colspec colwidth="6*" align="center"/>
29063 <colspec colwidth="6*" align="center"/>
29064 <colspec colwidth="6*" align="right"/>
29065 <tbody>
29066 <row>
29067 <entry><option>smtp_return_error_details</option></entry>
29068 <entry>Use: <emphasis>main</emphasis></entry>
29069 <entry>Type: <emphasis>boolean</emphasis></entry>
29070 <entry>Default: <emphasis>false</emphasis></entry>
29071 </row>
29072 </tbody>
29073 </tgroup>
29074 </informaltable>
29075 <para>
29076 <indexterm role="concept">
29077 <primary>SMTP</primary>
29078 <secondary>details policy failures</secondary>
29079 </indexterm>
29080 <indexterm role="concept">
29081 <primary>policy control</primary>
29082 <secondary>rejection, returning details</secondary>
29083 </indexterm>
29084 In the default state, Exim uses bland messages such as
29085 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
29086 reasons. Many sysadmins like this because it gives away little information
29087 to spammers. However, some other sysadmins who are applying strict checking
29088 policies want to give out much fuller information about failures. Setting
29089 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
29090 example, instead of <quote>Administrative prohibition</quote>, it might give:
29091 </para>
29092 <literallayout class="monospaced">
29093 550-Rejected after DATA: '&gt;' missing at end of address:
29094 550 failing address in "From" header is: &lt;user@dom.ain
29095 </literallayout>
29096 <para>
29097 <indexterm role="option">
29098 <primary><option>spamd_address</option></primary>
29099 </indexterm>
29100 </para>
29101 <informaltable frame="all">
29102 <tgroup cols="4" colsep="0" rowsep="0">
29103 <colspec colwidth="8*" align="left"/>
29104 <colspec colwidth="6*" align="center"/>
29105 <colspec colwidth="6*" align="center"/>
29106 <colspec colwidth="6*" align="right"/>
29107 <tbody>
29108 <row>
29109 <entry><option>spamd_address</option></entry>
29110 <entry>Use: <emphasis>main</emphasis></entry>
29111 <entry>Type: <emphasis>string</emphasis></entry>
29112 <entry>Default: <emphasis>see below</emphasis></entry>
29113 </row>
29114 </tbody>
29115 </tgroup>
29116 </informaltable>
29117 <para>
29118 This option is available when Exim is compiled with the content-scanning
29119 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
29120 The default value is
29121 </para>
29122 <literallayout class="monospaced">
29123 127.0.0.1 783
29124 </literallayout>
29125 <para>
29126 See section <xref linkend="SECTscanspamass"/> for more details.
29127 </para>
29128 <para>
29129 <indexterm role="option">
29130 <primary><option>split_spool_directory</option></primary>
29131 </indexterm>
29132 </para>
29133 <informaltable frame="all">
29134 <tgroup cols="4" colsep="0" rowsep="0">
29135 <colspec colwidth="8*" align="left"/>
29136 <colspec colwidth="6*" align="center"/>
29137 <colspec colwidth="6*" align="center"/>
29138 <colspec colwidth="6*" align="right"/>
29139 <tbody>
29140 <row>
29141 <entry><option>split_spool_directory</option></entry>
29142 <entry>Use: <emphasis>main</emphasis></entry>
29143 <entry>Type: <emphasis>boolean</emphasis></entry>
29144 <entry>Default: <emphasis>false</emphasis></entry>
29145 </row>
29146 </tbody>
29147 </tgroup>
29148 </informaltable>
29149 <para>
29150 <indexterm role="concept">
29151 <primary>multiple spool directories</primary>
29152 </indexterm>
29153 <indexterm role="concept">
29154 <primary>spool directory</primary>
29155 <secondary>split</secondary>
29156 </indexterm>
29157 <indexterm role="concept">
29158 <primary>directories, multiple</primary>
29159 </indexterm>
29160 If this option is set, it causes Exim to split its input directory into 62
29161 subdirectories, each with a single alphanumeric character as its name. The
29162 sixth character of the message id is used to allocate messages to
29163 subdirectories; this is the least significant base-62 digit of the time of
29164 arrival of the message.
29165 </para>
29166 <para>
29167 Splitting up the spool in this way may provide better performance on systems
29168 where there are long mail queues, by reducing the number of files in any one
29169 directory. The msglog directory is also split up in a similar way to the input
29170 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
29171 are still placed in the single directory <filename>msglog.OLD</filename>.
29172 </para>
29173 <para>
29174 It is not necessary to take any special action for existing messages when
29175 changing <option>split_spool_directory</option>. Exim notices messages that are in the
29176 <quote>wrong</quote> place, and continues to process them. If the option is turned off
29177 after a period of being on, the subdirectories will eventually empty and be
29178 automatically deleted.
29179 </para>
29180 <para>
29181 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
29182 changes. Instead of creating a list of all messages in the queue, and then
29183 trying to deliver each one in turn, it constructs a list of those in one
29184 sub-directory and tries to deliver them, before moving on to the next
29185 sub-directory. The sub-directories are processed in a random order. This
29186 spreads out the scanning of the input directories, and uses less memory. It is
29187 particularly beneficial when there are lots of messages on the queue. However,
29188 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
29189 entire queue has to be scanned and sorted before any deliveries can start.
29190 </para>
29191 <para>
29192 <indexterm role="option">
29193 <primary><option>spool_directory</option></primary>
29194 </indexterm>
29195 </para>
29196 <informaltable frame="all">
29197 <tgroup cols="4" colsep="0" rowsep="0">
29198 <colspec colwidth="8*" align="left"/>
29199 <colspec colwidth="6*" align="center"/>
29200 <colspec colwidth="6*" align="center"/>
29201 <colspec colwidth="6*" align="right"/>
29202 <tbody>
29203 <row>
29204 <entry><option>spool_directory</option></entry>
29205 <entry>Use: <emphasis>main</emphasis></entry>
29206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29207 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29208 </row>
29209 </tbody>
29210 </tgroup>
29211 </informaltable>
29212 <para>
29213 <indexterm role="concept">
29214 <primary>spool directory</primary>
29215 <secondary>path to</secondary>
29216 </indexterm>
29217 This defines the directory in which Exim keeps its spool, that is, the messages
29218 it is waiting to deliver. The default value is taken from the compile-time
29219 configuration setting, if there is one. If not, this option must be set. The
29220 string is expanded, so it can contain, for example, a reference to
29221 <varname>$primary_hostname</varname>.
29222 </para>
29223 <para>
29224 If the spool directory name is fixed on your installation, it is recommended
29225 that you set it at build time rather than from this option, particularly if the
29226 log files are being written to the spool directory (see <option>log_file_path</option>).
29227 Otherwise log files cannot be used for errors that are detected early on, such
29228 as failures in the configuration file.
29229 </para>
29230 <para>
29231 By using this option to override the compiled-in path, it is possible to run
29232 tests of Exim without using the standard spool.
29233 </para>
29234 <para>
29235 <indexterm role="option">
29236 <primary><option>sqlite_lock_timeout</option></primary>
29237 </indexterm>
29238 </para>
29239 <informaltable frame="all">
29240 <tgroup cols="4" colsep="0" rowsep="0">
29241 <colspec colwidth="8*" align="left"/>
29242 <colspec colwidth="6*" align="center"/>
29243 <colspec colwidth="6*" align="center"/>
29244 <colspec colwidth="6*" align="right"/>
29245 <tbody>
29246 <row>
29247 <entry><option>sqlite_lock_timeout</option></entry>
29248 <entry>Use: <emphasis>main</emphasis></entry>
29249 <entry>Type: <emphasis>time</emphasis></entry>
29250 <entry>Default: <emphasis>5s</emphasis></entry>
29251 </row>
29252 </tbody>
29253 </tgroup>
29254 </informaltable>
29255 <para>
29256 <indexterm role="concept">
29257 <primary>sqlite lookup type</primary>
29258 <secondary>lock timeout</secondary>
29259 </indexterm>
29260 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
29261 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
29262 </para>
29263 <para>
29264 <indexterm role="option">
29265 <primary><option>strict_acl_vars</option></primary>
29266 </indexterm>
29267 </para>
29268 <informaltable frame="all">
29269 <tgroup cols="4" colsep="0" rowsep="0">
29270 <colspec colwidth="8*" align="left"/>
29271 <colspec colwidth="6*" align="center"/>
29272 <colspec colwidth="6*" align="center"/>
29273 <colspec colwidth="6*" align="right"/>
29274 <tbody>
29275 <row>
29276 <entry><option>strict_acl_vars</option></entry>
29277 <entry>Use: <emphasis>main</emphasis></entry>
29278 <entry>Type: <emphasis>boolean</emphasis></entry>
29279 <entry>Default: <emphasis>false</emphasis></entry>
29280 </row>
29281 </tbody>
29282 </tgroup>
29283 </informaltable>
29284 <para>
29285 <indexterm role="concept">
29286 <primary>access control lists (ACLs)</primary>
29287 <secondary>variables, handling unset</secondary>
29288 </indexterm>
29289 This option controls what happens if a syntactically valid but undefined ACL
29290 variable is referenced. If it is false (the default), an empty string
29291 is substituted; if it is true, an error is generated. See section
29292 <xref linkend="SECTaclvariables"/> for details of ACL variables.
29293 </para>
29294 <para>
29295 <indexterm role="option">
29296 <primary><option>strip_excess_angle_brackets</option></primary>
29297 </indexterm>
29298 </para>
29299 <informaltable frame="all">
29300 <tgroup cols="4" colsep="0" rowsep="0">
29301 <colspec colwidth="8*" align="left"/>
29302 <colspec colwidth="6*" align="center"/>
29303 <colspec colwidth="6*" align="center"/>
29304 <colspec colwidth="6*" align="right"/>
29305 <tbody>
29306 <row>
29307 <entry><option>strip_excess_angle_brackets</option></entry>
29308 <entry>Use: <emphasis>main</emphasis></entry>
29309 <entry>Type: <emphasis>boolean</emphasis></entry>
29310 <entry>Default: <emphasis>false</emphasis></entry>
29311 </row>
29312 </tbody>
29313 </tgroup>
29314 </informaltable>
29315 <para>
29316 <indexterm role="concept">
29317 <primary>angle brackets, excess</primary>
29318 </indexterm>
29319 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
29320 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
29321 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
29322 passed on to another MTA, the excess angle brackets are not passed on. If this
29323 option is not set, multiple pairs of angle brackets cause a syntax error.
29324 </para>
29325 <para>
29326 <indexterm role="option">
29327 <primary><option>strip_trailing_dot</option></primary>
29328 </indexterm>
29329 </para>
29330 <informaltable frame="all">
29331 <tgroup cols="4" colsep="0" rowsep="0">
29332 <colspec colwidth="8*" align="left"/>
29333 <colspec colwidth="6*" align="center"/>
29334 <colspec colwidth="6*" align="center"/>
29335 <colspec colwidth="6*" align="right"/>
29336 <tbody>
29337 <row>
29338 <entry><option>strip_trailing_dot</option></entry>
29339 <entry>Use: <emphasis>main</emphasis></entry>
29340 <entry>Type: <emphasis>boolean</emphasis></entry>
29341 <entry>Default: <emphasis>false</emphasis></entry>
29342 </row>
29343 </tbody>
29344 </tgroup>
29345 </informaltable>
29346 <para>
29347 <indexterm role="concept">
29348 <primary>trailing dot on domain</primary>
29349 </indexterm>
29350 <indexterm role="concept">
29351 <primary>dot</primary>
29352 <secondary>trailing on domain</secondary>
29353 </indexterm>
29354 If this option is set, a trailing dot at the end of a domain in an address is
29355 ignored. If this is in the envelope and the message is passed on to another
29356 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
29357 domain causes a syntax error.
29358 However, addresses in header lines are checked only when an ACL requests header
29359 syntax checking.
29360 </para>
29361 <para>
29362 <indexterm role="option">
29363 <primary><option>syslog_duplication</option></primary>
29364 </indexterm>
29365 </para>
29366 <informaltable frame="all">
29367 <tgroup cols="4" colsep="0" rowsep="0">
29368 <colspec colwidth="8*" align="left"/>
29369 <colspec colwidth="6*" align="center"/>
29370 <colspec colwidth="6*" align="center"/>
29371 <colspec colwidth="6*" align="right"/>
29372 <tbody>
29373 <row>
29374 <entry><option>syslog_duplication</option></entry>
29375 <entry>Use: <emphasis>main</emphasis></entry>
29376 <entry>Type: <emphasis>boolean</emphasis></entry>
29377 <entry>Default: <emphasis>true</emphasis></entry>
29378 </row>
29379 </tbody>
29380 </tgroup>
29381 </informaltable>
29382 <para>
29383 <indexterm role="concept">
29384 <primary>syslog</primary>
29385 <secondary>duplicate log lines; suppressing</secondary>
29386 </indexterm>
29387 When Exim is logging to syslog, it writes the log lines for its three
29388 separate logs at different syslog priorities so that they can in principle
29389 be separated on the logging hosts. Some installations do not require this
29390 separation, and in those cases, the duplication of certain log lines is a
29391 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
29392 particular log line is written to syslog. For lines that normally go to
29393 both the main log and the reject log, the reject log version (possibly
29394 containing message header lines) is written, at LOG_NOTICE priority.
29395 Lines that normally go to both the main and the panic log are written at
29396 the LOG_ALERT priority.
29397 </para>
29398 <para>
29399 <indexterm role="option">
29400 <primary><option>syslog_facility</option></primary>
29401 </indexterm>
29402 </para>
29403 <informaltable frame="all">
29404 <tgroup cols="4" colsep="0" rowsep="0">
29405 <colspec colwidth="8*" align="left"/>
29406 <colspec colwidth="6*" align="center"/>
29407 <colspec colwidth="6*" align="center"/>
29408 <colspec colwidth="6*" align="right"/>
29409 <tbody>
29410 <row>
29411 <entry><option>syslog_facility</option></entry>
29412 <entry>Use: <emphasis>main</emphasis></entry>
29413 <entry>Type: <emphasis>string</emphasis></entry>
29414 <entry>Default: <emphasis>unset</emphasis></entry>
29415 </row>
29416 </tbody>
29417 </tgroup>
29418 </informaltable>
29419 <para>
29420 <indexterm role="concept">
29421 <primary>syslog</primary>
29422 <secondary>facility; setting</secondary>
29423 </indexterm>
29424 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
29425 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
29426 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
29427 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
29428 details of Exim&#x2019;s logging.
29429 </para>
29430 <para>
29431 <indexterm role="option">
29432 <primary><option>syslog_processname</option></primary>
29433 </indexterm>
29434 </para>
29435 <informaltable frame="all">
29436 <tgroup cols="4" colsep="0" rowsep="0">
29437 <colspec colwidth="8*" align="left"/>
29438 <colspec colwidth="6*" align="center"/>
29439 <colspec colwidth="6*" align="center"/>
29440 <colspec colwidth="6*" align="right"/>
29441 <tbody>
29442 <row>
29443 <entry><option>syslog_processname</option></entry>
29444 <entry>Use: <emphasis>main</emphasis></entry>
29445 <entry>Type: <emphasis>string</emphasis></entry>
29446 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
29447 </row>
29448 </tbody>
29449 </tgroup>
29450 </informaltable>
29451 <para>
29452 <indexterm role="concept">
29453 <primary>syslog</primary>
29454 <secondary>process name; setting</secondary>
29455 </indexterm>
29456 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
29457 syslog. The value must be no longer than 32 characters. See chapter
29458 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
29459 </para>
29460 <para>
29461 <indexterm role="option">
29462 <primary><option>syslog_timestamp</option></primary>
29463 </indexterm>
29464 </para>
29465 <informaltable frame="all">
29466 <tgroup cols="4" colsep="0" rowsep="0">
29467 <colspec colwidth="8*" align="left"/>
29468 <colspec colwidth="6*" align="center"/>
29469 <colspec colwidth="6*" align="center"/>
29470 <colspec colwidth="6*" align="right"/>
29471 <tbody>
29472 <row>
29473 <entry><option>syslog_timestamp</option></entry>
29474 <entry>Use: <emphasis>main</emphasis></entry>
29475 <entry>Type: <emphasis>boolean</emphasis></entry>
29476 <entry>Default: <emphasis>true</emphasis></entry>
29477 </row>
29478 </tbody>
29479 </tgroup>
29480 </informaltable>
29481 <para>
29482 <indexterm role="concept">
29483 <primary>syslog</primary>
29484 <secondary>timestamps</secondary>
29485 </indexterm>
29486 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
29487 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
29488 details of Exim&#x2019;s logging.
29489 </para>
29490 <para>
29491 <indexterm role="option">
29492 <primary><option>system_filter</option></primary>
29493 </indexterm>
29494 </para>
29495 <informaltable frame="all">
29496 <tgroup cols="4" colsep="0" rowsep="0">
29497 <colspec colwidth="8*" align="left"/>
29498 <colspec colwidth="6*" align="center"/>
29499 <colspec colwidth="6*" align="center"/>
29500 <colspec colwidth="6*" align="right"/>
29501 <tbody>
29502 <row>
29503 <entry><option>system_filter</option></entry>
29504 <entry>Use: <emphasis>main</emphasis></entry>
29505 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29506 <entry>Default: <emphasis>unset</emphasis></entry>
29507 </row>
29508 </tbody>
29509 </tgroup>
29510 </informaltable>
29511 <para>
29512 <indexterm role="concept">
29513 <primary>filter</primary>
29514 <secondary>system filter</secondary>
29515 </indexterm>
29516 <indexterm role="concept">
29517 <primary>system filter</primary>
29518 <secondary>specifying</secondary>
29519 </indexterm>
29520 <indexterm role="concept">
29521 <primary>Sieve filter</primary>
29522 <secondary>not available for system filter</secondary>
29523 </indexterm>
29524 This option specifies an Exim filter file that is applied to all messages at
29525 the start of each delivery attempt, before any routing is done. System filters
29526 must be Exim filters; they cannot be Sieve filters. If the system filter
29527 generates any deliveries to files or pipes, or any new mail messages, the
29528 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
29529 which transports are to be used. Details of this facility are given in chapter
29530 <xref linkend="CHAPsystemfilter"/>.
29531 </para>
29532 <para>
29533 <indexterm role="option">
29534 <primary><option>system_filter_directory_transport</option></primary>
29535 </indexterm>
29536 </para>
29537 <informaltable frame="all">
29538 <tgroup cols="4" colsep="0" rowsep="0">
29539 <colspec colwidth="8*" align="left"/>
29540 <colspec colwidth="6*" align="center"/>
29541 <colspec colwidth="6*" align="center"/>
29542 <colspec colwidth="6*" align="right"/>
29543 <tbody>
29544 <row>
29545 <entry><option>system_filter_directory_transport</option></entry>
29546 <entry>Use: <emphasis>main</emphasis></entry>
29547 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29548 <entry>Default: <emphasis>unset</emphasis></entry>
29549 </row>
29550 </tbody>
29551 </tgroup>
29552 </informaltable>
29553 <para>
29554 <indexterm role="variable">
29555 <primary><varname>$address_file</varname></primary>
29556 </indexterm>
29557 This sets the name of the transport driver that is to be used when the
29558 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
29559 implying delivery of each message into a separate file in some directory.
29560 During the delivery, the variable <varname>$address_file</varname> contains the path name.
29561 </para>
29562 <para>
29563 <indexterm role="option">
29564 <primary><option>system_filter_file_transport</option></primary>
29565 </indexterm>
29566 </para>
29567 <informaltable frame="all">
29568 <tgroup cols="4" colsep="0" rowsep="0">
29569 <colspec colwidth="8*" align="left"/>
29570 <colspec colwidth="6*" align="center"/>
29571 <colspec colwidth="6*" align="center"/>
29572 <colspec colwidth="6*" align="right"/>
29573 <tbody>
29574 <row>
29575 <entry><option>system_filter_file_transport</option></entry>
29576 <entry>Use: <emphasis>main</emphasis></entry>
29577 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29578 <entry>Default: <emphasis>unset</emphasis></entry>
29579 </row>
29580 </tbody>
29581 </tgroup>
29582 </informaltable>
29583 <para>
29584 <indexterm role="concept">
29585 <primary>file</primary>
29586 <secondary>transport for system filter</secondary>
29587 </indexterm>
29588 This sets the name of the transport driver that is to be used when the <option>save</option>
29589 command in a system message filter specifies a path not ending in <quote>/</quote>. During
29590 the delivery, the variable <varname>$address_file</varname> contains the path name.
29591 </para>
29592 <para>
29593 <indexterm role="option">
29594 <primary><option>system_filter_group</option></primary>
29595 </indexterm>
29596 </para>
29597 <informaltable frame="all">
29598 <tgroup cols="4" colsep="0" rowsep="0">
29599 <colspec colwidth="8*" align="left"/>
29600 <colspec colwidth="6*" align="center"/>
29601 <colspec colwidth="6*" align="center"/>
29602 <colspec colwidth="6*" align="right"/>
29603 <tbody>
29604 <row>
29605 <entry><option>system_filter_group</option></entry>
29606 <entry>Use: <emphasis>main</emphasis></entry>
29607 <entry>Type: <emphasis>string</emphasis></entry>
29608 <entry>Default: <emphasis>unset</emphasis></entry>
29609 </row>
29610 </tbody>
29611 </tgroup>
29612 </informaltable>
29613 <para>
29614 <indexterm role="concept">
29615 <primary>gid (group id)</primary>
29616 <secondary>system filter</secondary>
29617 </indexterm>
29618 This option is used only when <option>system_filter_user</option> is also set. It sets the
29619 gid under which the system filter is run, overriding any gid that is associated
29620 with the user. The value may be numerical or symbolic.
29621 </para>
29622 <para>
29623 <indexterm role="option">
29624 <primary><option>system_filter_pipe_transport</option></primary>
29625 </indexterm>
29626 </para>
29627 <informaltable frame="all">
29628 <tgroup cols="4" colsep="0" rowsep="0">
29629 <colspec colwidth="8*" align="left"/>
29630 <colspec colwidth="6*" align="center"/>
29631 <colspec colwidth="6*" align="center"/>
29632 <colspec colwidth="6*" align="right"/>
29633 <tbody>
29634 <row>
29635 <entry><option>system_filter_pipe_transport</option></entry>
29636 <entry>Use: <emphasis>main</emphasis></entry>
29637 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29638 <entry>Default: <emphasis>unset</emphasis></entry>
29639 </row>
29640 </tbody>
29641 </tgroup>
29642 </informaltable>
29643 <para>
29644 <indexterm role="concept">
29645 <primary><command>pipe</command> transport</primary>
29646 <secondary>for system filter</secondary>
29647 </indexterm>
29648 <indexterm role="variable">
29649 <primary><varname>$address_pipe</varname></primary>
29650 </indexterm>
29651 This specifies the transport driver that is to be used when a <option>pipe</option> command
29652 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
29653 contains the pipe command.
29654 </para>
29655 <para>
29656 <indexterm role="option">
29657 <primary><option>system_filter_reply_transport</option></primary>
29658 </indexterm>
29659 </para>
29660 <informaltable frame="all">
29661 <tgroup cols="4" colsep="0" rowsep="0">
29662 <colspec colwidth="8*" align="left"/>
29663 <colspec colwidth="6*" align="center"/>
29664 <colspec colwidth="6*" align="center"/>
29665 <colspec colwidth="6*" align="right"/>
29666 <tbody>
29667 <row>
29668 <entry><option>system_filter_reply_transport</option></entry>
29669 <entry>Use: <emphasis>main</emphasis></entry>
29670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29671 <entry>Default: <emphasis>unset</emphasis></entry>
29672 </row>
29673 </tbody>
29674 </tgroup>
29675 </informaltable>
29676 <para>
29677 <indexterm role="concept">
29678 <primary><command>autoreply</command> transport</primary>
29679 <secondary>for system filter</secondary>
29680 </indexterm>
29681 This specifies the transport driver that is to be used when a <option>mail</option> command
29682 is used in a system filter.
29683 </para>
29684 <para>
29685 <indexterm role="option">
29686 <primary><option>system_filter_user</option></primary>
29687 </indexterm>
29688 </para>
29689 <informaltable frame="all">
29690 <tgroup cols="4" colsep="0" rowsep="0">
29691 <colspec colwidth="8*" align="left"/>
29692 <colspec colwidth="6*" align="center"/>
29693 <colspec colwidth="6*" align="center"/>
29694 <colspec colwidth="6*" align="right"/>
29695 <tbody>
29696 <row>
29697 <entry><option>system_filter_user</option></entry>
29698 <entry>Use: <emphasis>main</emphasis></entry>
29699 <entry>Type: <emphasis>string</emphasis></entry>
29700 <entry>Default: <emphasis>unset</emphasis></entry>
29701 </row>
29702 </tbody>
29703 </tgroup>
29704 </informaltable>
29705 <para>
29706 <indexterm role="concept">
29707 <primary>uid (user id)</primary>
29708 <secondary>system filter</secondary>
29709 </indexterm>
29710 If this option is set to root, the system filter is run in the main Exim
29711 delivery process, as root.  Otherwise, the system filter runs in a separate
29712 process, as the given user, defaulting to the Exim run-time user.
29713 Unless the string consists entirely of digits, it
29714 is looked up in the password data. Failure to find the named user causes a
29715 configuration error. The gid is either taken from the password data, or
29716 specified by <option>system_filter_group</option>. When the uid is specified numerically,
29717 <option>system_filter_group</option> is required to be set.
29718 </para>
29719 <para>
29720 If the system filter generates any pipe, file, or reply deliveries, the uid
29721 under which the filter is run is used when transporting them, unless a
29722 transport option overrides.
29723 </para>
29724 <para>
29725 <indexterm role="option">
29726 <primary><option>tcp_nodelay</option></primary>
29727 </indexterm>
29728 </para>
29729 <informaltable frame="all">
29730 <tgroup cols="4" colsep="0" rowsep="0">
29731 <colspec colwidth="8*" align="left"/>
29732 <colspec colwidth="6*" align="center"/>
29733 <colspec colwidth="6*" align="center"/>
29734 <colspec colwidth="6*" align="right"/>
29735 <tbody>
29736 <row>
29737 <entry><option>tcp_nodelay</option></entry>
29738 <entry>Use: <emphasis>main</emphasis></entry>
29739 <entry>Type: <emphasis>boolean</emphasis></entry>
29740 <entry>Default: <emphasis>true</emphasis></entry>
29741 </row>
29742 </tbody>
29743 </tgroup>
29744 </informaltable>
29745 <para>
29746 <indexterm role="concept">
29747 <primary>daemon</primary>
29748 <secondary>TCP_NODELAY on sockets</secondary>
29749 </indexterm>
29750 <indexterm role="concept">
29751 <primary>Nagle algorithm</primary>
29752 </indexterm>
29753 <indexterm role="concept">
29754 <primary>TCP_NODELAY on listening sockets</primary>
29755 </indexterm>
29756 If this option is set false, it stops the Exim daemon setting the
29757 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
29758 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
29759 performance in interactive (character-by-character) situations. Turning it off
29760 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
29761 However, it appears that some broken clients cannot cope, and time out. Hence
29762 this option. It affects only those sockets that are set up for listening by the
29763 daemon. Sockets created by the smtp transport for delivering mail always set
29764 TCP_NODELAY.
29765 </para>
29766 <para>
29767 <indexterm role="option">
29768 <primary><option>timeout_frozen_after</option></primary>
29769 </indexterm>
29770 </para>
29771 <informaltable frame="all">
29772 <tgroup cols="4" colsep="0" rowsep="0">
29773 <colspec colwidth="8*" align="left"/>
29774 <colspec colwidth="6*" align="center"/>
29775 <colspec colwidth="6*" align="center"/>
29776 <colspec colwidth="6*" align="right"/>
29777 <tbody>
29778 <row>
29779 <entry><option>timeout_frozen_after</option></entry>
29780 <entry>Use: <emphasis>main</emphasis></entry>
29781 <entry>Type: <emphasis>time</emphasis></entry>
29782 <entry>Default: <emphasis>0s</emphasis></entry>
29783 </row>
29784 </tbody>
29785 </tgroup>
29786 </informaltable>
29787 <para>
29788 <indexterm role="concept">
29789 <primary>frozen messages</primary>
29790 <secondary>timing out</secondary>
29791 </indexterm>
29792 <indexterm role="concept">
29793 <primary>timeout</primary>
29794 <secondary>frozen messages</secondary>
29795 </indexterm>
29796 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
29797 message of any kind that has been on the queue for longer than the given time
29798 is automatically cancelled at the next queue run. If the frozen message is a
29799 bounce message, it is just discarded; otherwise, a bounce is sent to the
29800 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
29801 If you want to timeout frozen bounce messages earlier than other kinds of
29802 frozen message, see <option>ignore_bounce_errors_after</option>.
29803 </para>
29804 <para>
29805 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
29806 frozen messages remain on the queue forever (except for any frozen bounce
29807 messages that are released by <option>ignore_bounce_errors_after</option>).
29808 </para>
29809 <para>
29810 <indexterm role="option">
29811 <primary><option>timezone</option></primary>
29812 </indexterm>
29813 </para>
29814 <informaltable frame="all">
29815 <tgroup cols="4" colsep="0" rowsep="0">
29816 <colspec colwidth="8*" align="left"/>
29817 <colspec colwidth="6*" align="center"/>
29818 <colspec colwidth="6*" align="center"/>
29819 <colspec colwidth="6*" align="right"/>
29820 <tbody>
29821 <row>
29822 <entry><option>timezone</option></entry>
29823 <entry>Use: <emphasis>main</emphasis></entry>
29824 <entry>Type: <emphasis>string</emphasis></entry>
29825 <entry>Default: <emphasis>unset</emphasis></entry>
29826 </row>
29827 </tbody>
29828 </tgroup>
29829 </informaltable>
29830 <para>
29831 <indexterm role="concept">
29832 <primary>timezone, setting</primary>
29833 </indexterm>
29834 The value of <option>timezone</option> is used to set the environment variable TZ while
29835 running Exim (if it is different on entry). This ensures that all timestamps
29836 created by Exim are in the required timezone. If you want all your timestamps
29837 to be in UTC (aka GMT) you should set
29838 </para>
29839 <literallayout class="monospaced">
29840 timezone = UTC
29841 </literallayout>
29842 <para>
29843 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
29844 or, if that is not set, from the value of the TZ environment variable when Exim
29845 is built. If <option>timezone</option> is set to the empty string, either at build or run
29846 time, any existing TZ variable is removed from the environment when Exim
29847 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
29848 unfortunately not all, operating systems.
29849 </para>
29850 <para>
29851 <indexterm role="option">
29852 <primary><option>tls_advertise_hosts</option></primary>
29853 </indexterm>
29854 </para>
29855 <informaltable frame="all">
29856 <tgroup cols="4" colsep="0" rowsep="0">
29857 <colspec colwidth="8*" align="left"/>
29858 <colspec colwidth="6*" align="center"/>
29859 <colspec colwidth="6*" align="center"/>
29860 <colspec colwidth="6*" align="right"/>
29861 <tbody>
29862 <row>
29863 <entry><option>tls_advertise_hosts</option></entry>
29864 <entry>Use: <emphasis>main</emphasis></entry>
29865 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29866 <entry>Default: <emphasis>unset</emphasis></entry>
29867 </row>
29868 </tbody>
29869 </tgroup>
29870 </informaltable>
29871 <para>
29872 <indexterm role="concept">
29873 <primary>TLS</primary>
29874 <secondary>advertising</secondary>
29875 </indexterm>
29876 <indexterm role="concept">
29877 <primary>encryption</primary>
29878 <secondary>on SMTP connection</secondary>
29879 </indexterm>
29880 <indexterm role="concept">
29881 <primary>SMTP</primary>
29882 <secondary>encrypted connection</secondary>
29883 </indexterm>
29884 When Exim is built with support for TLS encrypted connections, the availability
29885 of the STARTTLS command to set up an encrypted session is advertised in
29886 response to EHLO only to those client hosts that match this option. See
29887 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
29888 </para>
29889 <para>
29890 <indexterm role="option">
29891 <primary><option>tls_certificate</option></primary>
29892 </indexterm>
29893 </para>
29894 <informaltable frame="all">
29895 <tgroup cols="4" colsep="0" rowsep="0">
29896 <colspec colwidth="8*" align="left"/>
29897 <colspec colwidth="6*" align="center"/>
29898 <colspec colwidth="6*" align="center"/>
29899 <colspec colwidth="6*" align="right"/>
29900 <tbody>
29901 <row>
29902 <entry><option>tls_certificate</option></entry>
29903 <entry>Use: <emphasis>main</emphasis></entry>
29904 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29905 <entry>Default: <emphasis>unset</emphasis></entry>
29906 </row>
29907 </tbody>
29908 </tgroup>
29909 </informaltable>
29910 <para>
29911 <indexterm role="concept">
29912 <primary>TLS</primary>
29913 <secondary>server certificate; location of</secondary>
29914 </indexterm>
29915 <indexterm role="concept">
29916 <primary>certificate</primary>
29917 <secondary>server, location of</secondary>
29918 </indexterm>
29919 The value of this option is expanded, and must then be the absolute path to a
29920 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
29921 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
29922 <xref linkend="CHAPTLS"/> for further details.
29923 </para>
29924 <para>
29925 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
29926 receiving incoming messages as a server. If you want to supply certificates for
29927 use when sending messages as a client, you must set the <option>tls_certificate</option>
29928 option in the relevant <command>smtp</command> transport.
29929 </para>
29930 <para>
29931 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
29932 if the OpenSSL build supports TLS extensions and the TLS client sends the
29933 Server Name Indication extension, then this option and others documented in
29934 <xref linkend="SECTtlssni"/> will be re-expanded.
29935 </para>
29936 <para>
29937 <indexterm role="option">
29938 <primary><option>tls_crl</option></primary>
29939 </indexterm>
29940 </para>
29941 <informaltable frame="all">
29942 <tgroup cols="4" colsep="0" rowsep="0">
29943 <colspec colwidth="8*" align="left"/>
29944 <colspec colwidth="6*" align="center"/>
29945 <colspec colwidth="6*" align="center"/>
29946 <colspec colwidth="6*" align="right"/>
29947 <tbody>
29948 <row>
29949 <entry><option>tls_crl</option></entry>
29950 <entry>Use: <emphasis>main</emphasis></entry>
29951 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29952 <entry>Default: <emphasis>unset</emphasis></entry>
29953 </row>
29954 </tbody>
29955 </tgroup>
29956 </informaltable>
29957 <para>
29958 <indexterm role="concept">
29959 <primary>TLS</primary>
29960 <secondary>server certificate revocation list</secondary>
29961 </indexterm>
29962 <indexterm role="concept">
29963 <primary>certificate</primary>
29964 <secondary>revocation list for server</secondary>
29965 </indexterm>
29966 This option specifies a certificate revocation list. The expanded value must
29967 be the name of a file that contains a CRL in PEM format.
29968 </para>
29969 <para>
29970 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29971 </para>
29972 <para>
29973 <indexterm role="option">
29974 <primary><option>tls_dh_max_bits</option></primary>
29975 </indexterm>
29976 </para>
29977 <informaltable frame="all">
29978 <tgroup cols="4" colsep="0" rowsep="0">
29979 <colspec colwidth="8*" align="left"/>
29980 <colspec colwidth="6*" align="center"/>
29981 <colspec colwidth="6*" align="center"/>
29982 <colspec colwidth="6*" align="right"/>
29983 <tbody>
29984 <row>
29985 <entry><option>tls_dh_max_bits</option></entry>
29986 <entry>Use: <emphasis>main</emphasis></entry>
29987 <entry>Type: <emphasis>integer</emphasis></entry>
29988 <entry>Default: <emphasis>2236</emphasis></entry>
29989 </row>
29990 </tbody>
29991 </tgroup>
29992 </informaltable>
29993 <para>
29994 <indexterm role="concept">
29995 <primary>TLS</primary>
29996 <secondary>D-H bit count</secondary>
29997 </indexterm>
29998 The number of bits used for Diffie-Hellman key-exchange may be suggested by
29999 the chosen TLS library.  That value might prove to be too high for
30000 interoperability.  This option provides a maximum clamp on the value
30001 suggested, trading off security for interoperability.
30002 </para>
30003 <para>
30004 The value must be at least 1024.
30005 </para>
30006 <para>
30007 The value 2236 was chosen because, at time of adding the option, it was the
30008 hard-coded maximum value supported by the NSS cryptographic library, as used
30009 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
30010 </para>
30011 <para>
30012 If you prefer more security and are willing to break some clients, raise this
30013 number.
30014 </para>
30015 <para>
30016 Note that the value passed to GnuTLS for *generating* a new prime may be a
30017 little less than this figure, because GnuTLS is inexact and may produce a
30018 larger prime than requested.
30019 </para>
30020 <para>
30021 <indexterm role="option">
30022 <primary><option>tls_dhparam</option></primary>
30023 </indexterm>
30024 </para>
30025 <informaltable frame="all">
30026 <tgroup cols="4" colsep="0" rowsep="0">
30027 <colspec colwidth="8*" align="left"/>
30028 <colspec colwidth="6*" align="center"/>
30029 <colspec colwidth="6*" align="center"/>
30030 <colspec colwidth="6*" align="right"/>
30031 <tbody>
30032 <row>
30033 <entry><option>tls_dhparam</option></entry>
30034 <entry>Use: <emphasis>main</emphasis></entry>
30035 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30036 <entry>Default: <emphasis>unset</emphasis></entry>
30037 </row>
30038 </tbody>
30039 </tgroup>
30040 </informaltable>
30041 <para>
30042 <indexterm role="concept">
30043 <primary>TLS</primary>
30044 <secondary>D-H parameters for server</secondary>
30045 </indexterm>
30046 The value of this option is expanded and indicates the source of DH parameters
30047 to be used by Exim.
30048 </para>
30049 <para>
30050 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
30051 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
30052 PKCS#3 representation of the DH prime.  If the file does not exist, for
30053 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
30054 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
30055 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
30056 and treated as though the <option>tls_dhparam</option> were set to "none".
30057 </para>
30058 <para>
30059 If this option expands to the string "none", then no DH parameters will be
30060 loaded by Exim.
30061 </para>
30062 <para>
30063 If this option expands to the string "historic" and Exim is using GnuTLS, then
30064 Exim will attempt to load a file from inside the spool directory.  If the file
30065 does not exist, Exim will attempt to create it.
30066 See section <xref linkend="SECTgnutlsparam"/> for further details.
30067 </para>
30068 <para>
30069 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
30070 a default DH prime; the default is the 2048 bit prime described in section
30071 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
30072 in IKE is assigned number 23.
30073 </para>
30074 <para>
30075 Otherwise, the option must expand to the name used by Exim for any of a number
30076 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
30077 "ike" followed by the number used by IKE, of "default" which corresponds to
30078 "ike23".
30079 </para>
30080 <para>
30081 The available primes are:
30082 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
30083 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
30084 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
30085 </para>
30086 <para>
30087 Some of these will be too small to be accepted by clients.
30088 Some may be too large to be accepted by clients.
30089 </para>
30090 <para>
30091 The TLS protocol does not negotiate an acceptable size for this; clients tend
30092 to hard-drop connections if what is offered by the server is unacceptable,
30093 whether too large or too small, and there&#x2019;s no provision for the client to
30094 tell the server what these constraints are.  Thus, as a server operator, you
30095 need to make an educated guess as to what is most likely to work for your
30096 userbase.
30097 </para>
30098 <para>
30099 Some known size constraints suggest that a bit-size in the range 2048 to 2236
30100 is most likely to maximise interoperability.  The upper bound comes from
30101 applications using the Mozilla Network Security Services (NSS) library, which
30102 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
30103 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
30104 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
30105 acceptable bound from 1024 to 2048.
30106 </para>
30107 <para>
30108 <indexterm role="option">
30109 <primary><option>tls_ocsp_file</option></primary>
30110 </indexterm>
30111 </para>
30112 <informaltable frame="all">
30113 <tgroup cols="4" colsep="0" rowsep="0">
30114 <colspec colwidth="8*" align="left"/>
30115 <colspec colwidth="6*" align="center"/>
30116 <colspec colwidth="6*" align="center"/>
30117 <colspec colwidth="6*" align="right"/>
30118 <tbody>
30119 <row>
30120 <entry><option>tls_ocsp_file</option></entry>
30121 <entry>Use: <emphasis>main</emphasis></entry>
30122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30123 <entry>Default: <emphasis>unset</emphasis></entry>
30124 </row>
30125 </tbody>
30126 </tgroup>
30127 </informaltable>
30128 <para>
30129 This option
30130 must if set expand to the absolute path to a file which contains a current
30131 status proof for the server&#x2019;s certificate, as obtained from the
30132 Certificate Authority.
30133 </para>
30134 <para>
30135 <indexterm role="option">
30136 <primary><option>tls_on_connect_ports</option></primary>
30137 </indexterm>
30138 </para>
30139 <informaltable frame="all">
30140 <tgroup cols="4" colsep="0" rowsep="0">
30141 <colspec colwidth="8*" align="left"/>
30142 <colspec colwidth="6*" align="center"/>
30143 <colspec colwidth="6*" align="center"/>
30144 <colspec colwidth="6*" align="right"/>
30145 <tbody>
30146 <row>
30147 <entry><option>tls_on_connect_ports</option></entry>
30148 <entry>Use: <emphasis>main</emphasis></entry>
30149 <entry>Type: <emphasis>string list</emphasis></entry>
30150 <entry>Default: <emphasis>unset</emphasis></entry>
30151 </row>
30152 </tbody>
30153 </tgroup>
30154 </informaltable>
30155 <para>
30156 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
30157 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
30158 set up without waiting for the client to issue a STARTTLS command. For
30159 further details, see section <xref linkend="SECTsupobssmt"/>.
30160 </para>
30161 <para>
30162 <indexterm role="option">
30163 <primary><option>tls_privatekey</option></primary>
30164 </indexterm>
30165 </para>
30166 <informaltable frame="all">
30167 <tgroup cols="4" colsep="0" rowsep="0">
30168 <colspec colwidth="8*" align="left"/>
30169 <colspec colwidth="6*" align="center"/>
30170 <colspec colwidth="6*" align="center"/>
30171 <colspec colwidth="6*" align="right"/>
30172 <tbody>
30173 <row>
30174 <entry><option>tls_privatekey</option></entry>
30175 <entry>Use: <emphasis>main</emphasis></entry>
30176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30177 <entry>Default: <emphasis>unset</emphasis></entry>
30178 </row>
30179 </tbody>
30180 </tgroup>
30181 </informaltable>
30182 <para>
30183 <indexterm role="concept">
30184 <primary>TLS</primary>
30185 <secondary>server private key; location of</secondary>
30186 </indexterm>
30187 The value of this option is expanded, and must then be the absolute path to a
30188 file which contains the server&#x2019;s private key. If this option is unset, or if
30189 the expansion is forced to fail, or the result is an empty string, the private
30190 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
30191 <xref linkend="CHAPTLS"/> for further details.
30192 </para>
30193 <para>
30194 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30195 </para>
30196 <para>
30197 <indexterm role="option">
30198 <primary><option>tls_remember_esmtp</option></primary>
30199 </indexterm>
30200 </para>
30201 <informaltable frame="all">
30202 <tgroup cols="4" colsep="0" rowsep="0">
30203 <colspec colwidth="8*" align="left"/>
30204 <colspec colwidth="6*" align="center"/>
30205 <colspec colwidth="6*" align="center"/>
30206 <colspec colwidth="6*" align="right"/>
30207 <tbody>
30208 <row>
30209 <entry><option>tls_remember_esmtp</option></entry>
30210 <entry>Use: <emphasis>main</emphasis></entry>
30211 <entry>Type: <emphasis>boolean</emphasis></entry>
30212 <entry>Default: <emphasis>false</emphasis></entry>
30213 </row>
30214 </tbody>
30215 </tgroup>
30216 </informaltable>
30217 <para>
30218 <indexterm role="concept">
30219 <primary>TLS</primary>
30220 <secondary>esmtp state; remembering</secondary>
30221 </indexterm>
30222 <indexterm role="concept">
30223 <primary>TLS</primary>
30224 <secondary>broken clients</secondary>
30225 </indexterm>
30226 If this option is set true, Exim violates the RFCs by remembering that it is in
30227 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
30228 support for broken clients that fail to send a new EHLO after starting a
30229 TLS session.
30230 </para>
30231 <para>
30232 <indexterm role="option">
30233 <primary><option>tls_require_ciphers</option></primary>
30234 </indexterm>
30235 </para>
30236 <informaltable frame="all">
30237 <tgroup cols="4" colsep="0" rowsep="0">
30238 <colspec colwidth="8*" align="left"/>
30239 <colspec colwidth="6*" align="center"/>
30240 <colspec colwidth="6*" align="center"/>
30241 <colspec colwidth="6*" align="right"/>
30242 <tbody>
30243 <row>
30244 <entry><option>tls_require_ciphers</option></entry>
30245 <entry>Use: <emphasis>main</emphasis></entry>
30246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30247 <entry>Default: <emphasis>unset</emphasis></entry>
30248 </row>
30249 </tbody>
30250 </tgroup>
30251 </informaltable>
30252 <para>
30253 <indexterm role="concept">
30254 <primary>TLS</primary>
30255 <secondary>requiring specific ciphers</secondary>
30256 </indexterm>
30257 <indexterm role="concept">
30258 <primary>cipher</primary>
30259 <secondary>requiring specific</secondary>
30260 </indexterm>
30261 This option controls which ciphers can be used for incoming TLS connections.
30262 The <command>smtp</command> transport has an option of the same name for controlling outgoing
30263 connections. This option is expanded for each connection, so can be varied for
30264 different clients if required. The value of this option must be a list of
30265 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
30266 in somewhat different ways. If GnuTLS is being used, the client controls the
30267 preference order of the available ciphers. Details are given in sections
30268 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
30269 </para>
30270 <para>
30271 <indexterm role="option">
30272 <primary><option>tls_try_verify_hosts</option></primary>
30273 </indexterm>
30274 </para>
30275 <informaltable frame="all">
30276 <tgroup cols="4" colsep="0" rowsep="0">
30277 <colspec colwidth="8*" align="left"/>
30278 <colspec colwidth="6*" align="center"/>
30279 <colspec colwidth="6*" align="center"/>
30280 <colspec colwidth="6*" align="right"/>
30281 <tbody>
30282 <row>
30283 <entry><option>tls_try_verify_hosts</option></entry>
30284 <entry>Use: <emphasis>main</emphasis></entry>
30285 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30286 <entry>Default: <emphasis>unset</emphasis></entry>
30287 </row>
30288 </tbody>
30289 </tgroup>
30290 </informaltable>
30291 <para>
30292 <indexterm role="concept">
30293 <primary>TLS</primary>
30294 <secondary>client certificate verification</secondary>
30295 </indexterm>
30296 <indexterm role="concept">
30297 <primary>certificate</primary>
30298 <secondary>verification of client</secondary>
30299 </indexterm>
30300 See <option>tls_verify_hosts</option> below.
30301 </para>
30302 <para>
30303 <indexterm role="option">
30304 <primary><option>tls_verify_certificates</option></primary>
30305 </indexterm>
30306 </para>
30307 <informaltable frame="all">
30308 <tgroup cols="4" colsep="0" rowsep="0">
30309 <colspec colwidth="8*" align="left"/>
30310 <colspec colwidth="6*" align="center"/>
30311 <colspec colwidth="6*" align="center"/>
30312 <colspec colwidth="6*" align="right"/>
30313 <tbody>
30314 <row>
30315 <entry><option>tls_verify_certificates</option></entry>
30316 <entry>Use: <emphasis>main</emphasis></entry>
30317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30318 <entry>Default: <emphasis>unset</emphasis></entry>
30319 </row>
30320 </tbody>
30321 </tgroup>
30322 </informaltable>
30323 <para>
30324 <indexterm role="concept">
30325 <primary>TLS</primary>
30326 <secondary>client certificate verification</secondary>
30327 </indexterm>
30328 <indexterm role="concept">
30329 <primary>certificate</primary>
30330 <secondary>verification of client</secondary>
30331 </indexterm>
30332 The value of this option is expanded, and must then be the absolute path to
30333 a file containing permitted certificates for clients that
30334 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
30335 are using either GnuTLS version 3.3.6 (or later) or OpenSSL,
30336 you can set <option>tls_verify_certificates</option> to the name of a
30337 directory containing certificate files.
30338 For earlier versions of GnuTLS
30339 the option must be set to the name of a single file.
30340 </para>
30341 <para>
30342 With OpenSSL the certificates specified
30343 explicitly
30344 either by file or directory
30345 are added to those given by the system default location.
30346 </para>
30347 <para>
30348 These certificates should be for the certificate authorities trusted, rather
30349 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
30350 the value is a file then the certificates are sent by Exim as a server to
30351 connecting clients, defining the list of accepted certificate authorities.
30352 Thus the values defined should be considered public data.  To avoid this,
30353 use the explicit directory version.
30354 </para>
30355 <para>
30356 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
30357 </para>
30358 <para>
30359 A forced expansion failure or setting to an empty string is equivalent to
30360 being unset.
30361 </para>
30362 <para>
30363 <indexterm role="option">
30364 <primary><option>tls_verify_hosts</option></primary>
30365 </indexterm>
30366 </para>
30367 <informaltable frame="all">
30368 <tgroup cols="4" colsep="0" rowsep="0">
30369 <colspec colwidth="8*" align="left"/>
30370 <colspec colwidth="6*" align="center"/>
30371 <colspec colwidth="6*" align="center"/>
30372 <colspec colwidth="6*" align="right"/>
30373 <tbody>
30374 <row>
30375 <entry><option>tls_verify_hosts</option></entry>
30376 <entry>Use: <emphasis>main</emphasis></entry>
30377 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30378 <entry>Default: <emphasis>unset</emphasis></entry>
30379 </row>
30380 </tbody>
30381 </tgroup>
30382 </informaltable>
30383 <para>
30384 <indexterm role="concept">
30385 <primary>TLS</primary>
30386 <secondary>client certificate verification</secondary>
30387 </indexterm>
30388 <indexterm role="concept">
30389 <primary>certificate</primary>
30390 <secondary>verification of client</secondary>
30391 </indexterm>
30392 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
30393 certificates from clients. The expected certificates are defined by
30394 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
30395 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
30396 <option>tls_verify_certificates</option> is not set.
30397 </para>
30398 <para>
30399 Any client that matches <option>tls_verify_hosts</option> is constrained by
30400 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
30401 present one of the listed certificates. If it does not, the connection is
30402 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
30403 the host to use TLS. It can still send SMTP commands through unencrypted
30404 connections. Forcing a client to use TLS has to be done separately using an
30405 ACL to reject inappropriate commands when the connection is not encrypted.
30406 </para>
30407 <para>
30408 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
30409 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
30410 certificate and checks it against <option>tls_verify_certificates</option>, but does not
30411 abort the connection if there is no certificate or if it does not match. This
30412 state can be detected in an ACL, which makes it possible to implement policies
30413 such as <quote>accept for relay only if a verified certificate has been received,
30414 but accept for local delivery if encrypted, even without a verified
30415 certificate</quote>.
30416 </para>
30417 <para>
30418 Client hosts that match neither of these lists are not asked to present
30419 certificates.
30420 </para>
30421 <para>
30422 <indexterm role="option">
30423 <primary><option>trusted_groups</option></primary>
30424 </indexterm>
30425 </para>
30426 <informaltable frame="all">
30427 <tgroup cols="4" colsep="0" rowsep="0">
30428 <colspec colwidth="8*" align="left"/>
30429 <colspec colwidth="6*" align="center"/>
30430 <colspec colwidth="6*" align="center"/>
30431 <colspec colwidth="6*" align="right"/>
30432 <tbody>
30433 <row>
30434 <entry><option>trusted_groups</option></entry>
30435 <entry>Use: <emphasis>main</emphasis></entry>
30436 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30437 <entry>Default: <emphasis>unset</emphasis></entry>
30438 </row>
30439 </tbody>
30440 </tgroup>
30441 </informaltable>
30442 <para>
30443 <indexterm role="concept">
30444 <primary>trusted groups</primary>
30445 </indexterm>
30446 <indexterm role="concept">
30447 <primary>groups</primary>
30448 <secondary>trusted</secondary>
30449 </indexterm>
30450 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30451 option is set, any process that is running in one of the listed groups, or
30452 which has one of them as a supplementary group, is trusted. The groups can be
30453 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
30454 details of what trusted callers are permitted to do. If neither
30455 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
30456 are trusted.
30457 </para>
30458 <para>
30459 <indexterm role="option">
30460 <primary><option>trusted_users</option></primary>
30461 </indexterm>
30462 </para>
30463 <informaltable frame="all">
30464 <tgroup cols="4" colsep="0" rowsep="0">
30465 <colspec colwidth="8*" align="left"/>
30466 <colspec colwidth="6*" align="center"/>
30467 <colspec colwidth="6*" align="center"/>
30468 <colspec colwidth="6*" align="right"/>
30469 <tbody>
30470 <row>
30471 <entry><option>trusted_users</option></entry>
30472 <entry>Use: <emphasis>main</emphasis></entry>
30473 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30474 <entry>Default: <emphasis>unset</emphasis></entry>
30475 </row>
30476 </tbody>
30477 </tgroup>
30478 </informaltable>
30479 <para>
30480 <indexterm role="concept">
30481 <primary>trusted users</primary>
30482 </indexterm>
30483 <indexterm role="concept">
30484 <primary>user</primary>
30485 <secondary>trusted</secondary>
30486 </indexterm>
30487 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
30488 option is set, any process that is running as one of the listed users is
30489 trusted. The users can be specified numerically or by name. See section
30490 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
30491 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
30492 Exim user are trusted.
30493 </para>
30494 <para>
30495 <indexterm role="option">
30496 <primary><option>unknown_login</option></primary>
30497 </indexterm>
30498 </para>
30499 <informaltable frame="all">
30500 <tgroup cols="4" colsep="0" rowsep="0">
30501 <colspec colwidth="8*" align="left"/>
30502 <colspec colwidth="6*" align="center"/>
30503 <colspec colwidth="6*" align="center"/>
30504 <colspec colwidth="6*" align="right"/>
30505 <tbody>
30506 <row>
30507 <entry><option>unknown_login</option></entry>
30508 <entry>Use: <emphasis>main</emphasis></entry>
30509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30510 <entry>Default: <emphasis>unset</emphasis></entry>
30511 </row>
30512 </tbody>
30513 </tgroup>
30514 </informaltable>
30515 <para>
30516 <indexterm role="concept">
30517 <primary>uid (user id)</primary>
30518 <secondary>unknown caller</secondary>
30519 </indexterm>
30520 <indexterm role="variable">
30521 <primary><varname>$caller_uid</varname></primary>
30522 </indexterm>
30523 This is a specialized feature for use in unusual configurations. By default, if
30524 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
30525 gives up. The <option>unknown_login</option> option can be used to set a login name to be
30526 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
30527 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
30528 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
30529 <option>-F</option> option.
30530 </para>
30531 <para>
30532 <indexterm role="option">
30533 <primary><option>unknown_username</option></primary>
30534 </indexterm>
30535 </para>
30536 <informaltable frame="all">
30537 <tgroup cols="4" colsep="0" rowsep="0">
30538 <colspec colwidth="8*" align="left"/>
30539 <colspec colwidth="6*" align="center"/>
30540 <colspec colwidth="6*" align="center"/>
30541 <colspec colwidth="6*" align="right"/>
30542 <tbody>
30543 <row>
30544 <entry><option>unknown_username</option></entry>
30545 <entry>Use: <emphasis>main</emphasis></entry>
30546 <entry>Type: <emphasis>string</emphasis></entry>
30547 <entry>Default: <emphasis>unset</emphasis></entry>
30548 </row>
30549 </tbody>
30550 </tgroup>
30551 </informaltable>
30552 <para>
30553 See <option>unknown_login</option>.
30554 </para>
30555 <para>
30556 <indexterm role="option">
30557 <primary><option>untrusted_set_sender</option></primary>
30558 </indexterm>
30559 </para>
30560 <informaltable frame="all">
30561 <tgroup cols="4" colsep="0" rowsep="0">
30562 <colspec colwidth="8*" align="left"/>
30563 <colspec colwidth="6*" align="center"/>
30564 <colspec colwidth="6*" align="center"/>
30565 <colspec colwidth="6*" align="right"/>
30566 <tbody>
30567 <row>
30568 <entry><option>untrusted_set_sender</option></entry>
30569 <entry>Use: <emphasis>main</emphasis></entry>
30570 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
30571 <entry>Default: <emphasis>unset</emphasis></entry>
30572 </row>
30573 </tbody>
30574 </tgroup>
30575 </informaltable>
30576 <para>
30577 <indexterm role="concept">
30578 <primary>trusted users</primary>
30579 </indexterm>
30580 <indexterm role="concept">
30581 <primary>sender</primary>
30582 <secondary>setting by untrusted user</secondary>
30583 </indexterm>
30584 <indexterm role="concept">
30585 <primary>untrusted user setting sender</primary>
30586 </indexterm>
30587 <indexterm role="concept">
30588 <primary>user</primary>
30589 <secondary>untrusted setting sender</secondary>
30590 </indexterm>
30591 <indexterm role="concept">
30592 <primary>envelope sender</primary>
30593 </indexterm>
30594 When an untrusted user submits a message to Exim using the standard input, Exim
30595 normally creates an envelope sender address from the user&#x2019;s login and the
30596 default qualification domain. Data from the <option>-f</option> option (for setting envelope
30597 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
30598 is used) is ignored.
30599 </para>
30600 <para>
30601 However, untrusted users are permitted to set an empty envelope sender address,
30602 to declare that a message should never generate any bounces. For example:
30603 </para>
30604 <literallayout class="monospaced">
30605 exim -f '&lt;&gt;' user@domain.example
30606 </literallayout>
30607 <para>
30608 <indexterm role="variable">
30609 <primary><varname>$sender_ident</varname></primary>
30610 </indexterm>
30611 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
30612 other envelope sender addresses in a controlled way. When it is set, untrusted
30613 users are allowed to set envelope sender addresses that match any of the
30614 patterns in the list. Like all address lists, the string is expanded. The
30615 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
30616 users to setting senders that start with their login ids
30617 followed by a hyphen
30618 by a setting like this:
30619 </para>
30620 <literallayout class="monospaced">
30621 untrusted_set_sender = ^$sender_ident-
30622 </literallayout>
30623 <para>
30624 If you want to allow untrusted users to set envelope sender addresses without
30625 restriction, you can use
30626 </para>
30627 <literallayout class="monospaced">
30628 untrusted_set_sender = *
30629 </literallayout>
30630 <para>
30631 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
30632 only to the setting of the envelope sender. It does not permit untrusted users
30633 to use the other options which trusted user can use to override message
30634 parameters. Furthermore, it does not stop Exim from removing an existing
30635 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
30636 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
30637 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
30638 described in section <xref linkend="SECTthesenhea"/>.
30639 </para>
30640 <para>
30641 The log line for a message&#x2019;s arrival shows the envelope sender following
30642 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
30643 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
30644 envelope sender address, the user&#x2019;s login is shown in parentheses after the
30645 sender address.
30646 </para>
30647 <para>
30648 <indexterm role="option">
30649 <primary><option>uucp_from_pattern</option></primary>
30650 </indexterm>
30651 </para>
30652 <informaltable frame="all">
30653 <tgroup cols="4" colsep="0" rowsep="0">
30654 <colspec colwidth="8*" align="left"/>
30655 <colspec colwidth="6*" align="center"/>
30656 <colspec colwidth="6*" align="center"/>
30657 <colspec colwidth="6*" align="right"/>
30658 <tbody>
30659 <row>
30660 <entry><option>uucp_from_pattern</option></entry>
30661 <entry>Use: <emphasis>main</emphasis></entry>
30662 <entry>Type: <emphasis>string</emphasis></entry>
30663 <entry>Default: <emphasis>see below</emphasis></entry>
30664 </row>
30665 </tbody>
30666 </tgroup>
30667 </informaltable>
30668 <para>
30669 <indexterm role="concept">
30670 <primary><quote>From</quote> line</primary>
30671 </indexterm>
30672 <indexterm role="concept">
30673 <primary>UUCP</primary>
30674 <secondary><quote>From</quote> line</secondary>
30675 </indexterm>
30676 Some applications that pass messages to an MTA via a command line interface use
30677 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
30678 particular, this is used by UUCP software. Exim recognizes such a line by means
30679 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
30680 matches, the sender address is constructed by expanding the contents of
30681 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
30682 default pattern recognizes lines in the following two forms:
30683 </para>
30684 <literallayout class="monospaced">
30685 From ph10 Fri Jan  5 12:35 GMT 1996
30686 From ph10 Fri, 7 Jan 97 14:00:00 GMT
30687 </literallayout>
30688 <para>
30689 The pattern can be seen by running
30690 </para>
30691 <literallayout class="monospaced">
30692 exim -bP uucp_from_pattern
30693 </literallayout>
30694 <para>
30695 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
30696 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
30697 regular expression by a parenthesized subpattern. The default value for
30698 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
30699 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
30700 <option>ignore_fromline_hosts</option>.
30701 </para>
30702 <para>
30703 <indexterm role="option">
30704 <primary><option>uucp_from_sender</option></primary>
30705 </indexterm>
30706 </para>
30707 <informaltable frame="all">
30708 <tgroup cols="4" colsep="0" rowsep="0">
30709 <colspec colwidth="8*" align="left"/>
30710 <colspec colwidth="6*" align="center"/>
30711 <colspec colwidth="6*" align="center"/>
30712 <colspec colwidth="6*" align="right"/>
30713 <tbody>
30714 <row>
30715 <entry><option>uucp_from_sender</option></entry>
30716 <entry>Use: <emphasis>main</emphasis></entry>
30717 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30718 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
30719 </row>
30720 </tbody>
30721 </tgroup>
30722 </informaltable>
30723 <para>
30724 See <option>uucp_from_pattern</option> above.
30725 </para>
30726 <para>
30727 <indexterm role="option">
30728 <primary><option>warn_message_file</option></primary>
30729 </indexterm>
30730 </para>
30731 <informaltable frame="all">
30732 <tgroup cols="4" colsep="0" rowsep="0">
30733 <colspec colwidth="8*" align="left"/>
30734 <colspec colwidth="6*" align="center"/>
30735 <colspec colwidth="6*" align="center"/>
30736 <colspec colwidth="6*" align="right"/>
30737 <tbody>
30738 <row>
30739 <entry><option>warn_message_file</option></entry>
30740 <entry>Use: <emphasis>main</emphasis></entry>
30741 <entry>Type: <emphasis>string</emphasis></entry>
30742 <entry>Default: <emphasis>unset</emphasis></entry>
30743 </row>
30744 </tbody>
30745 </tgroup>
30746 </informaltable>
30747 <para>
30748 <indexterm role="concept">
30749 <primary>warning of delay</primary>
30750 <secondary>customizing the message</secondary>
30751 </indexterm>
30752 <indexterm role="concept">
30753 <primary>customizing</primary>
30754 <secondary>warning message</secondary>
30755 </indexterm>
30756 This option defines a template file containing paragraphs of text to be used
30757 for constructing the warning message which is sent by Exim when a message has
30758 been on the queue for a specified amount of time, as specified by
30759 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
30760 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
30761 </para>
30762 <para>
30763 <indexterm role="option">
30764 <primary><option>write_rejectlog</option></primary>
30765 </indexterm>
30766 </para>
30767 <informaltable frame="all">
30768 <tgroup cols="4" colsep="0" rowsep="0">
30769 <colspec colwidth="8*" align="left"/>
30770 <colspec colwidth="6*" align="center"/>
30771 <colspec colwidth="6*" align="center"/>
30772 <colspec colwidth="6*" align="right"/>
30773 <tbody>
30774 <row>
30775 <entry><option>write_rejectlog</option></entry>
30776 <entry>Use: <emphasis>main</emphasis></entry>
30777 <entry>Type: <emphasis>boolean</emphasis></entry>
30778 <entry>Default: <emphasis>true</emphasis></entry>
30779 </row>
30780 </tbody>
30781 </tgroup>
30782 </informaltable>
30783 <para>
30784 <indexterm role="concept">
30785 <primary>reject log</primary>
30786 <secondary>disabling</secondary>
30787 </indexterm>
30788 If this option is set false, Exim no longer writes anything to the reject log.
30789 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
30790 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
30791 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
30792 </para>
30793 </section>
30794 </chapter>
30795
30796 <chapter id="CHAProutergeneric">
30797 <title>Generic options for routers</title>
30798 <para>
30799 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
30800 <primary>options</primary>
30801 <secondary>generic; for routers</secondary>
30802 </indexterm>
30803 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
30804 <primary>generic options</primary>
30805 <secondary>router</secondary>
30806 </indexterm>
30807 This chapter describes the generic options that apply to all routers.
30808 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
30809 </para>
30810 <para>
30811 For a general description of how a router operates, see sections
30812 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
30813 which the preconditions are tested. The order of expansion of the options that
30814 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
30815 <option>headers_remove</option>, <option>transport</option>.
30816 </para>
30817 <para>
30818 <indexterm role="option">
30819 <primary><option>address_data</option></primary>
30820 </indexterm>
30821 </para>
30822 <informaltable frame="all">
30823 <tgroup cols="4" colsep="0" rowsep="0">
30824 <colspec colwidth="8*" align="left"/>
30825 <colspec colwidth="6*" align="center"/>
30826 <colspec colwidth="6*" align="center"/>
30827 <colspec colwidth="6*" align="right"/>
30828 <tbody>
30829 <row>
30830 <entry><option>address_data</option></entry>
30831 <entry>Use: <emphasis>routers</emphasis></entry>
30832 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30833 <entry>Default: <emphasis>unset</emphasis></entry>
30834 </row>
30835 </tbody>
30836 </tgroup>
30837 </informaltable>
30838 <para>
30839 <indexterm role="concept">
30840 <primary>router</primary>
30841 <secondary>data attached to address</secondary>
30842 </indexterm>
30843 The string is expanded just before the router is run, that is, after all the
30844 precondition tests have succeeded. If the expansion is forced to fail, the
30845 router declines, the value of <option>address_data</option> remains unchanged, and the
30846 <option>more</option> option controls what happens next. Other expansion failures cause
30847 delivery of the address to be deferred.
30848 </para>
30849 <para>
30850 <indexterm role="variable">
30851 <primary><varname>$address_data</varname></primary>
30852 </indexterm>
30853 When the expansion succeeds, the value is retained with the address, and can be
30854 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
30855 routers, and the eventual transport.
30856 </para>
30857 <para>
30858 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
30859 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
30860 in the filter. This is not normally a problem, because such data is usually
30861 either not confidential or it <quote>belongs</quote> to the current user, but if you do
30862 put confidential data into <varname>$address_data</varname> you need to remember this point.
30863 </para>
30864 <para>
30865 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
30866 with the address, though it can be changed by another <option>address_data</option> setting
30867 on a subsequent router. If a router generates child addresses, the value of
30868 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
30869 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
30870 </para>
30871 <para>
30872 The idea of <option>address_data</option> is that you can use it to look up a lot of data
30873 for the address once, and then pick out parts of the data later. For example,
30874 you could use a single LDAP lookup to return a string of the form
30875 </para>
30876 <literallayout class="monospaced">
30877 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
30878 </literallayout>
30879 <para>
30880 In the transport you could pick out the mailbox by a setting such as
30881 </para>
30882 <literallayout class="monospaced">
30883 file = ${extract{mailbox}{$address_data}}
30884 </literallayout>
30885 <para>
30886 This makes the configuration file less messy, and also reduces the number of
30887 lookups (though Exim does cache lookups).
30888 </para>
30889 <para>
30890 <indexterm role="variable">
30891 <primary><varname>$sender_address_data</varname></primary>
30892 </indexterm>
30893 <indexterm role="variable">
30894 <primary><varname>$address_data</varname></primary>
30895 </indexterm>
30896 The <option>address_data</option> facility is also useful as a means of passing information
30897 from one router to another, and from a router to a transport. In addition, if
30898 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
30899 ACL, it remains available for use in the rest of the ACL statement. After
30900 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
30901 </para>
30902 <para>
30903 <indexterm role="option">
30904 <primary><option>address_test</option></primary>
30905 </indexterm>
30906 </para>
30907 <informaltable frame="all">
30908 <tgroup cols="4" colsep="0" rowsep="0">
30909 <colspec colwidth="8*" align="left"/>
30910 <colspec colwidth="6*" align="center"/>
30911 <colspec colwidth="6*" align="center"/>
30912 <colspec colwidth="6*" align="right"/>
30913 <tbody>
30914 <row>
30915 <entry><option>address_test</option></entry>
30916 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30917 <entry>Type: <emphasis>boolean</emphasis></entry>
30918 <entry>Default: <emphasis>true</emphasis></entry>
30919 </row>
30920 </tbody>
30921 </tgroup>
30922 </informaltable>
30923 <para>
30924 <indexterm role="option">
30925 <primary><option>-bt</option></primary>
30926 </indexterm>
30927 <indexterm role="concept">
30928 <primary>router</primary>
30929 <secondary>skipping when address testing</secondary>
30930 </indexterm>
30931 If this option is set false, the router is skipped when routing is being tested
30932 by means of the <option>-bt</option> command line option. This can be a convenience when
30933 your first router sends messages to an external scanner, because it saves you
30934 having to set the <quote>already scanned</quote> indicator when testing real address
30935 routing.
30936 </para>
30937 <para>
30938 <indexterm role="option">
30939 <primary><option>cannot_route_message</option></primary>
30940 </indexterm>
30941 </para>
30942 <informaltable frame="all">
30943 <tgroup cols="4" colsep="0" rowsep="0">
30944 <colspec colwidth="8*" align="left"/>
30945 <colspec colwidth="6*" align="center"/>
30946 <colspec colwidth="6*" align="center"/>
30947 <colspec colwidth="6*" align="right"/>
30948 <tbody>
30949 <row>
30950 <entry><option>cannot_route_message</option></entry>
30951 <entry>Use: <emphasis>routers</emphasis></entry>
30952 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30953 <entry>Default: <emphasis>unset</emphasis></entry>
30954 </row>
30955 </tbody>
30956 </tgroup>
30957 </informaltable>
30958 <para>
30959 <indexterm role="concept">
30960 <primary>router</primary>
30961 <secondary>customizing <quote>cannot route</quote> message</secondary>
30962 </indexterm>
30963 <indexterm role="concept">
30964 <primary>customizing</primary>
30965 <secondary><quote>cannot route</quote> message</secondary>
30966 </indexterm>
30967 This option specifies a text message that is used when an address cannot be
30968 routed because Exim has run out of routers. The default message is
30969 <quote>Unrouteable address</quote>. This option is useful only on routers that have
30970 <option>more</option> set false, or on the very last router in a configuration, because the
30971 value that is used is taken from the last router that is considered. This
30972 includes a router that is skipped because its preconditions are not met, as
30973 well as a router that declines. For example, using the default configuration,
30974 you could put:
30975 </para>
30976 <literallayout class="monospaced">
30977 cannot_route_message = Remote domain not found in DNS
30978 </literallayout>
30979 <para>
30980 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
30981 and
30982 </para>
30983 <literallayout class="monospaced">
30984 cannot_route_message = Unknown local user
30985 </literallayout>
30986 <para>
30987 on the final router that checks for local users. If string expansion fails for
30988 this option, the default message is used. Unless the expansion failure was
30989 explicitly forced, a message about the failure is written to the main and panic
30990 logs, in addition to the normal message about the routing failure.
30991 </para>
30992 <para>
30993 <indexterm role="option">
30994 <primary><option>caseful_local_part</option></primary>
30995 </indexterm>
30996 </para>
30997 <informaltable frame="all">
30998 <tgroup cols="4" colsep="0" rowsep="0">
30999 <colspec colwidth="8*" align="left"/>
31000 <colspec colwidth="6*" align="center"/>
31001 <colspec colwidth="6*" align="center"/>
31002 <colspec colwidth="6*" align="right"/>
31003 <tbody>
31004 <row>
31005 <entry><option>caseful_local_part</option></entry>
31006 <entry>Use: <emphasis>routers</emphasis></entry>
31007 <entry>Type: <emphasis>boolean</emphasis></entry>
31008 <entry>Default: <emphasis>false</emphasis></entry>
31009 </row>
31010 </tbody>
31011 </tgroup>
31012 </informaltable>
31013 <para>
31014 <indexterm role="concept">
31015 <primary>case of local parts</primary>
31016 </indexterm>
31017 <indexterm role="concept">
31018 <primary>router</primary>
31019 <secondary>case of local parts</secondary>
31020 </indexterm>
31021 By default, routers handle the local parts of addresses in a case-insensitive
31022 manner, though the actual case is preserved for transmission with the message.
31023 If you want the case of letters to be significant in a router, you must set
31024 this option true. For individual router options that contain address or local
31025 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
31026 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
31027 more details.
31028 </para>
31029 <para>
31030 <indexterm role="variable">
31031 <primary><varname>$local_part</varname></primary>
31032 </indexterm>
31033 <indexterm role="variable">
31034 <primary><varname>$original_local_part</varname></primary>
31035 </indexterm>
31036 <indexterm role="variable">
31037 <primary><varname>$parent_local_part</varname></primary>
31038 </indexterm>
31039 The value of the <varname>$local_part</varname> variable is forced to lower case while a
31040 router is running unless <option>caseful_local_part</option> is set. When a router assigns
31041 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
31042 is the same as it was in the router. Similarly, when a router generates child
31043 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
31044 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
31045 </para>
31046 <para>
31047 This option applies to the processing of an address by a router. When a
31048 recipient address is being processed in an ACL, there is a separate <option>control</option>
31049 modifier that can be used to specify case-sensitive processing within the ACL
31050 (see section <xref linkend="SECTcontrols"/>).
31051 </para>
31052 <para>
31053 <indexterm role="option">
31054 <primary><option>check_local_user</option></primary>
31055 </indexterm>
31056 </para>
31057 <informaltable frame="all">
31058 <tgroup cols="4" colsep="0" rowsep="0">
31059 <colspec colwidth="8*" align="left"/>
31060 <colspec colwidth="6*" align="center"/>
31061 <colspec colwidth="6*" align="center"/>
31062 <colspec colwidth="6*" align="right"/>
31063 <tbody>
31064 <row>
31065 <entry><option>check_local_user</option></entry>
31066 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31067 <entry>Type: <emphasis>boolean</emphasis></entry>
31068 <entry>Default: <emphasis>false</emphasis></entry>
31069 </row>
31070 </tbody>
31071 </tgroup>
31072 </informaltable>
31073 <para>
31074 <indexterm role="concept">
31075 <primary>local user, checking in router</primary>
31076 </indexterm>
31077 <indexterm role="concept">
31078 <primary>router</primary>
31079 <secondary>checking for local user</secondary>
31080 </indexterm>
31081 <indexterm role="concept">
31082 <primary><filename>/etc/passwd</filename></primary>
31083 </indexterm>
31084 <indexterm role="variable">
31085 <primary><varname>$home</varname></primary>
31086 </indexterm>
31087 When this option is true, Exim checks that the local part of the recipient
31088 address (with affixes removed if relevant) is the name of an account on the
31089 local system. The check is done by calling the <function>getpwnam()</function> function rather
31090 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
31091 holding password data (such as NIS) are supported. If the local part is a local
31092 user, <varname>$home</varname> is set from the password data, and can be tested in other
31093 preconditions that are evaluated after this one (the order of evaluation is
31094 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
31095 overridden by <option>router_home_directory</option>. If the local part is not a local user,
31096 the router is skipped.
31097 </para>
31098 <para>
31099 If you want to check that the local part is either the name of a local user
31100 or matches something else, you cannot combine <option>check_local_user</option> with a
31101 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
31102 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
31103 setting to achieve this. For example:
31104 </para>
31105 <literallayout class="monospaced">
31106 local_parts = passwd;$local_part : lsearch;/etc/other/users
31107 </literallayout>
31108 <para>
31109 Note, however, that the side effects of <option>check_local_user</option> (such as setting
31110 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
31111 <option>local_parts</option> (or any other) precondition.
31112 </para>
31113 <para>
31114 <indexterm role="option">
31115 <primary><option>condition</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>condition</option></entry>
31127 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31128 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31129 <entry>Default: <emphasis>unset</emphasis></entry>
31130 </row>
31131 </tbody>
31132 </tgroup>
31133 </informaltable>
31134 <para>
31135 <indexterm role="concept">
31136 <primary>router</primary>
31137 <secondary>customized precondition</secondary>
31138 </indexterm>
31139 This option specifies a general precondition test that has to succeed for the
31140 router to be called. The <option>condition</option> option is the last precondition to be
31141 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
31142 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
31143 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
31144 router is skipped, and the address is offered to the next one.
31145 </para>
31146 <para>
31147 If the result is any other value, the router is run (as this is the last
31148 precondition to be evaluated, all the other preconditions must be true).
31149 </para>
31150 <para>
31151 This option is unusual in that multiple <option>condition</option> options may be present.
31152 All <option>condition</option> options must succeed.
31153 </para>
31154 <para>
31155 The <option>condition</option> option provides a means of applying custom conditions to the
31156 running of routers. Note that in the case of a simple conditional expansion,
31157 the default expansion values are exactly what is wanted. For example:
31158 </para>
31159 <literallayout class="monospaced">
31160 condition = ${if &gt;{$message_age}{600}}
31161 </literallayout>
31162 <para>
31163 Because of the default behaviour of the string expansion, this is equivalent to
31164 </para>
31165 <literallayout class="monospaced">
31166 condition = ${if &gt;{$message_age}{600}{true}{}}
31167 </literallayout>
31168 <para>
31169 A multiple condition example, which succeeds:
31170 </para>
31171 <literallayout class="monospaced">
31172 condition = ${if &gt;{$message_age}{600}}
31173 condition = ${if !eq{${lc:$local_part}}{postmaster}}
31174 condition = foobar
31175 </literallayout>
31176 <para>
31177 If the expansion fails (other than forced failure) delivery is deferred. Some
31178 of the other precondition options are common special cases that could in fact
31179 be specified using <option>condition</option>.
31180 </para>
31181 <para revisionflag="changed">
31182 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
31183 are far older, and use one set of semantics.  ACLs are newer and when
31184 they were created, the ACL <option>condition</option> process was given far stricter
31185 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
31186 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
31187 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
31188 Router rules processing behavior.
31189 </para>
31190 <para revisionflag="changed">
31191 This is best illustrated in an example:
31192 </para>
31193 <literallayout class="monospaced" revisionflag="changed">
31194 # If used in an ACL condition will fail with a syntax error, but
31195 # in a router condition any extra characters are treated as a string
31196
31197 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
31198 true {yes} {no}}
31199
31200 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
31201  {yes} {no}}
31202 </literallayout>
31203 <para revisionflag="changed">
31204 In each example above, the <option>if</option> statement actually ends after
31205 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
31206 default <option>if</option> behavior is to return a boolean true or a null answer
31207 (which evaluates to false). The rest of the line is then treated as a
31208 string. So the first example resulted in the boolean answer <quote>true</quote>
31209 with the string <quote> {yes} {no}}</quote> appended to it. The second example
31210 resulted in the null output (indicating false) with the string
31211 <quote> {yes} {no}}</quote> appended to it.
31212 </para>
31213 <para revisionflag="changed">
31214 In fact you can put excess forward braces in too.  In the router
31215 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
31216 mean something, like after a <quote>$</quote> or when required as part of a
31217 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
31218 string characters.
31219 </para>
31220 <para revisionflag="changed">
31221 Thus, in a Router, the above expansion strings will both always evaluate
31222 true, as the result of expansion is a non-empty string which doesn&#x2019;t
31223 match an explicit false value.  This can be tricky to debug.  By
31224 contrast, in an ACL either of those strings will always result in an
31225 expansion error because the result doesn&#x2019;t look sufficiently boolean.
31226 </para>
31227 <para>
31228 <indexterm role="option">
31229 <primary><option>debug_print</option></primary>
31230 </indexterm>
31231 </para>
31232 <informaltable frame="all">
31233 <tgroup cols="4" colsep="0" rowsep="0">
31234 <colspec colwidth="8*" align="left"/>
31235 <colspec colwidth="6*" align="center"/>
31236 <colspec colwidth="6*" align="center"/>
31237 <colspec colwidth="6*" align="right"/>
31238 <tbody>
31239 <row>
31240 <entry><option>debug_print</option></entry>
31241 <entry>Use: <emphasis>routers</emphasis></entry>
31242 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31243 <entry>Default: <emphasis>unset</emphasis></entry>
31244 </row>
31245 </tbody>
31246 </tgroup>
31247 </informaltable>
31248 <para>
31249 <indexterm role="concept">
31250 <primary>testing</primary>
31251 <secondary>variables in drivers</secondary>
31252 </indexterm>
31253 If this option is set and debugging is enabled (see the <option>-d</option> command line
31254 option) or in address-testing mode (see the <option>-bt</option> command line option),
31255 the string is expanded and included in the debugging output.
31256 If expansion of the string fails, the error message is written to the debugging
31257 output, and Exim carries on processing.
31258 This option is provided to help with checking out the values of variables and
31259 so on when debugging router configurations. For example, if a <option>condition</option>
31260 option appears not to be working, <option>debug_print</option> can be used to output the
31261 variables it references. The output happens after checks for <option>domains</option>,
31262 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
31263 are tested. A newline is added to the text if it does not end with one.
31264 The variable <varname>$router_name</varname> contains the name of the router.
31265 </para>
31266 <para>
31267 <indexterm role="option">
31268 <primary><option>disable_logging</option></primary>
31269 </indexterm>
31270 </para>
31271 <informaltable frame="all">
31272 <tgroup cols="4" colsep="0" rowsep="0">
31273 <colspec colwidth="8*" align="left"/>
31274 <colspec colwidth="6*" align="center"/>
31275 <colspec colwidth="6*" align="center"/>
31276 <colspec colwidth="6*" align="right"/>
31277 <tbody>
31278 <row>
31279 <entry><option>disable_logging</option></entry>
31280 <entry>Use: <emphasis>routers</emphasis></entry>
31281 <entry>Type: <emphasis>boolean</emphasis></entry>
31282 <entry>Default: <emphasis>false</emphasis></entry>
31283 </row>
31284 </tbody>
31285 </tgroup>
31286 </informaltable>
31287 <para>
31288 If this option is set true, nothing is logged for any routing errors
31289 or for any deliveries caused by this router. You should not set this option
31290 unless you really, really know what you are doing. See also the generic
31291 transport option of the same name.
31292 </para>
31293 <para>
31294 <indexterm role="option">
31295 <primary><option>domains</option></primary>
31296 </indexterm>
31297 </para>
31298 <informaltable frame="all">
31299 <tgroup cols="4" colsep="0" rowsep="0">
31300 <colspec colwidth="8*" align="left"/>
31301 <colspec colwidth="6*" align="center"/>
31302 <colspec colwidth="6*" align="center"/>
31303 <colspec colwidth="6*" align="right"/>
31304 <tbody>
31305 <row>
31306 <entry><option>domains</option></entry>
31307 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31308 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31309 <entry>Default: <emphasis>unset</emphasis></entry>
31310 </row>
31311 </tbody>
31312 </tgroup>
31313 </informaltable>
31314 <para>
31315 <indexterm role="concept">
31316 <primary>router</primary>
31317 <secondary>restricting to specific domains</secondary>
31318 </indexterm>
31319 <indexterm role="variable">
31320 <primary><varname>$domain_data</varname></primary>
31321 </indexterm>
31322 If this option is set, the router is skipped unless the current domain matches
31323 the list. If the match is achieved by means of a file lookup, the data that the
31324 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
31325 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
31326 a list of the order in which preconditions are evaluated.
31327 </para>
31328 <para>
31329 <indexterm role="option">
31330 <primary><option>driver</option></primary>
31331 </indexterm>
31332 </para>
31333 <informaltable frame="all">
31334 <tgroup cols="4" colsep="0" rowsep="0">
31335 <colspec colwidth="8*" align="left"/>
31336 <colspec colwidth="6*" align="center"/>
31337 <colspec colwidth="6*" align="center"/>
31338 <colspec colwidth="6*" align="right"/>
31339 <tbody>
31340 <row>
31341 <entry><option>driver</option></entry>
31342 <entry>Use: <emphasis>routers</emphasis></entry>
31343 <entry>Type: <emphasis>string</emphasis></entry>
31344 <entry>Default: <emphasis>unset</emphasis></entry>
31345 </row>
31346 </tbody>
31347 </tgroup>
31348 </informaltable>
31349 <para>
31350 This option must always be set. It specifies which of the available routers is
31351 to be used.
31352 </para>
31353 <para>
31354 <indexterm role="option">
31355 <primary><option>errors_to</option></primary>
31356 </indexterm>
31357 </para>
31358 <informaltable frame="all">
31359 <tgroup cols="4" colsep="0" rowsep="0">
31360 <colspec colwidth="8*" align="left"/>
31361 <colspec colwidth="6*" align="center"/>
31362 <colspec colwidth="6*" align="center"/>
31363 <colspec colwidth="6*" align="right"/>
31364 <tbody>
31365 <row>
31366 <entry><option>errors_to</option></entry>
31367 <entry>Use: <emphasis>routers</emphasis></entry>
31368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31369 <entry>Default: <emphasis>unset</emphasis></entry>
31370 </row>
31371 </tbody>
31372 </tgroup>
31373 </informaltable>
31374 <para>
31375 <indexterm role="concept">
31376 <primary>envelope sender</primary>
31377 </indexterm>
31378 <indexterm role="concept">
31379 <primary>router</primary>
31380 <secondary>changing address for errors</secondary>
31381 </indexterm>
31382 If a router successfully handles an address, it may assign the address to a
31383 transport for delivery or it may generate child addresses. In both cases, if
31384 there is a delivery problem during later processing, the resulting bounce
31385 message is sent to the address that results from expanding this string,
31386 provided that the address verifies successfully. The <option>errors_to</option> option is
31387 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
31388 </para>
31389 <para>
31390 The <option>errors_to</option> setting associated with an address can be overridden if it
31391 subsequently passes through other routers that have their own <option>errors_to</option>
31392 settings, or if the message is delivered by a transport with a <option>return_path</option>
31393 setting.
31394 </para>
31395 <para>
31396 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
31397 the expansion fails to verify, the errors address associated with the incoming
31398 address is used. At top level, this is the envelope sender. A non-forced
31399 expansion failure causes delivery to be deferred.
31400 </para>
31401 <para>
31402 If an address for which <option>errors_to</option> has been set ends up being delivered over
31403 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
31404 any bounces that are generated by other MTAs on the delivery route are also
31405 sent there. You can set <option>errors_to</option> to the empty string by either of these
31406 settings:
31407 </para>
31408 <literallayout class="monospaced">
31409 errors_to =
31410 errors_to = ""
31411 </literallayout>
31412 <para>
31413 An expansion item that yields an empty string has the same effect. If you do
31414 this, a locally detected delivery error for addresses processed by this router
31415 no longer gives rise to a bounce message; the error is discarded. If the
31416 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
31417 overridden by the <option>return_path</option> option on the transport.
31418 </para>
31419 <para>
31420 <indexterm role="variable">
31421 <primary><varname>$address_data</varname></primary>
31422 </indexterm>
31423 If for some reason you want to discard local errors, but use a non-empty
31424 MAIL command for remote delivery, you can preserve the original return
31425 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
31426 setting <option>return_path</option>.
31427 </para>
31428 <para>
31429 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
31430 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
31431 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
31432 </para>
31433 <para>
31434 <indexterm role="option">
31435 <primary><option>expn</option></primary>
31436 </indexterm>
31437 </para>
31438 <informaltable frame="all">
31439 <tgroup cols="4" colsep="0" rowsep="0">
31440 <colspec colwidth="8*" align="left"/>
31441 <colspec colwidth="6*" align="center"/>
31442 <colspec colwidth="6*" align="center"/>
31443 <colspec colwidth="6*" align="right"/>
31444 <tbody>
31445 <row>
31446 <entry><option>expn</option></entry>
31447 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31448 <entry>Type: <emphasis>boolean</emphasis></entry>
31449 <entry>Default: <emphasis>true</emphasis></entry>
31450 </row>
31451 </tbody>
31452 </tgroup>
31453 </informaltable>
31454 <para>
31455 <indexterm role="concept">
31456 <primary>address</primary>
31457 <secondary>testing</secondary>
31458 </indexterm>
31459 <indexterm role="concept">
31460 <primary>testing</primary>
31461 <secondary>addresses</secondary>
31462 </indexterm>
31463 <indexterm role="concept">
31464 <primary>EXPN</primary>
31465 <secondary>router skipping</secondary>
31466 </indexterm>
31467 <indexterm role="concept">
31468 <primary>router</primary>
31469 <secondary>skipping for EXPN</secondary>
31470 </indexterm>
31471 If this option is turned off, the router is skipped when testing an address
31472 as a result of processing an SMTP EXPN command. You might, for example,
31473 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
31474 on for the system alias file.
31475 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31476 are evaluated.
31477 </para>
31478 <para>
31479 The use of the SMTP EXPN command is controlled by an ACL (see chapter
31480 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
31481 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
31482 </para>
31483 <para>
31484 <indexterm role="option">
31485 <primary><option>fail_verify</option></primary>
31486 </indexterm>
31487 </para>
31488 <informaltable frame="all">
31489 <tgroup cols="4" colsep="0" rowsep="0">
31490 <colspec colwidth="8*" align="left"/>
31491 <colspec colwidth="6*" align="center"/>
31492 <colspec colwidth="6*" align="center"/>
31493 <colspec colwidth="6*" align="right"/>
31494 <tbody>
31495 <row>
31496 <entry><option>fail_verify</option></entry>
31497 <entry>Use: <emphasis>routers</emphasis></entry>
31498 <entry>Type: <emphasis>boolean</emphasis></entry>
31499 <entry>Default: <emphasis>false</emphasis></entry>
31500 </row>
31501 </tbody>
31502 </tgroup>
31503 </informaltable>
31504 <para>
31505 <indexterm role="concept">
31506 <primary>router</primary>
31507 <secondary>forcing verification failure</secondary>
31508 </indexterm>
31509 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
31510 <option>fail_verify_recipient</option> to the same value.
31511 </para>
31512 <para>
31513 <indexterm role="option">
31514 <primary><option>fail_verify_recipient</option></primary>
31515 </indexterm>
31516 </para>
31517 <informaltable frame="all">
31518 <tgroup cols="4" colsep="0" rowsep="0">
31519 <colspec colwidth="8*" align="left"/>
31520 <colspec colwidth="6*" align="center"/>
31521 <colspec colwidth="6*" align="center"/>
31522 <colspec colwidth="6*" align="right"/>
31523 <tbody>
31524 <row>
31525 <entry><option>fail_verify_recipient</option></entry>
31526 <entry>Use: <emphasis>routers</emphasis></entry>
31527 <entry>Type: <emphasis>boolean</emphasis></entry>
31528 <entry>Default: <emphasis>false</emphasis></entry>
31529 </row>
31530 </tbody>
31531 </tgroup>
31532 </informaltable>
31533 <para>
31534 If this option is true and an address is accepted by this router when
31535 verifying a recipient, verification fails.
31536 </para>
31537 <para>
31538 <indexterm role="option">
31539 <primary><option>fail_verify_sender</option></primary>
31540 </indexterm>
31541 </para>
31542 <informaltable frame="all">
31543 <tgroup cols="4" colsep="0" rowsep="0">
31544 <colspec colwidth="8*" align="left"/>
31545 <colspec colwidth="6*" align="center"/>
31546 <colspec colwidth="6*" align="center"/>
31547 <colspec colwidth="6*" align="right"/>
31548 <tbody>
31549 <row>
31550 <entry><option>fail_verify_sender</option></entry>
31551 <entry>Use: <emphasis>routers</emphasis></entry>
31552 <entry>Type: <emphasis>boolean</emphasis></entry>
31553 <entry>Default: <emphasis>false</emphasis></entry>
31554 </row>
31555 </tbody>
31556 </tgroup>
31557 </informaltable>
31558 <para>
31559 If this option is true and an address is accepted by this router when
31560 verifying a sender, verification fails.
31561 </para>
31562 <para>
31563 <indexterm role="option">
31564 <primary><option>fallback_hosts</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>fallback_hosts</option></entry>
31576 <entry>Use: <emphasis>routers</emphasis></entry>
31577 <entry>Type: <emphasis>string list</emphasis></entry>
31578 <entry>Default: <emphasis>unset</emphasis></entry>
31579 </row>
31580 </tbody>
31581 </tgroup>
31582 </informaltable>
31583 <para>
31584 <indexterm role="concept">
31585 <primary>router</primary>
31586 <secondary>fallback hosts</secondary>
31587 </indexterm>
31588 <indexterm role="concept">
31589 <primary>fallback</primary>
31590 <secondary>hosts specified on router</secondary>
31591 </indexterm>
31592 String expansion is not applied to this option. The argument must be a
31593 colon-separated list of host names or IP addresses. The list separator can be
31594 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
31595 each name or address. In fact, the format of each item is exactly the same as
31596 defined for the list of hosts in a <command>manualroute</command> router (see section
31597 <xref linkend="SECTformatonehostitem"/>).
31598 </para>
31599 <para>
31600 If a router queues an address for a remote transport, this host list is
31601 associated with the address, and used instead of the transport&#x2019;s fallback host
31602 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
31603 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
31604 transport for further details.
31605 </para>
31606 <para>
31607 <indexterm role="option">
31608 <primary><option>group</option></primary>
31609 </indexterm>
31610 </para>
31611 <informaltable frame="all">
31612 <tgroup cols="4" colsep="0" rowsep="0">
31613 <colspec colwidth="8*" align="left"/>
31614 <colspec colwidth="6*" align="center"/>
31615 <colspec colwidth="6*" align="center"/>
31616 <colspec colwidth="6*" align="right"/>
31617 <tbody>
31618 <row>
31619 <entry><option>group</option></entry>
31620 <entry>Use: <emphasis>routers</emphasis></entry>
31621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31622 <entry>Default: <emphasis>see below</emphasis></entry>
31623 </row>
31624 </tbody>
31625 </tgroup>
31626 </informaltable>
31627 <para>
31628 <indexterm role="concept">
31629 <primary>gid (group id)</primary>
31630 <secondary>local delivery</secondary>
31631 </indexterm>
31632 <indexterm role="concept">
31633 <primary>local transports</primary>
31634 <secondary>uid and gid</secondary>
31635 </indexterm>
31636 <indexterm role="concept">
31637 <primary>transport</primary>
31638 <secondary>local</secondary>
31639 </indexterm>
31640 <indexterm role="concept">
31641 <primary>router</primary>
31642 <secondary>setting group</secondary>
31643 </indexterm>
31644 When a router queues an address for a transport, and the transport does not
31645 specify a group, the group given here is used when running the delivery
31646 process.
31647 The group may be specified numerically or by name. If expansion fails, the
31648 error is logged and delivery is deferred.
31649 The default is unset, unless <option>check_local_user</option> is set, when the default
31650 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
31651 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31652 </para>
31653 <para>
31654 <indexterm role="option">
31655 <primary><option>headers_add</option></primary>
31656 </indexterm>
31657 </para>
31658 <informaltable frame="all">
31659 <tgroup cols="4" colsep="0" rowsep="0">
31660 <colspec colwidth="8*" align="left"/>
31661 <colspec colwidth="6*" align="center"/>
31662 <colspec colwidth="6*" align="center"/>
31663 <colspec colwidth="6*" align="right"/>
31664 <tbody>
31665 <row>
31666 <entry><option>headers_add</option></entry>
31667 <entry>Use: <emphasis>routers</emphasis></entry>
31668 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31669 <entry>Default: <emphasis>unset</emphasis></entry>
31670 </row>
31671 </tbody>
31672 </tgroup>
31673 </informaltable>
31674 <para>
31675 <indexterm role="concept">
31676 <primary>header lines</primary>
31677 <secondary>adding</secondary>
31678 </indexterm>
31679 <indexterm role="concept">
31680 <primary>router</primary>
31681 <secondary>adding header lines</secondary>
31682 </indexterm>
31683 This option specifies a list of text headers, newline-separated,
31684 that is associated with any addresses that are accepted by the router.
31685 Each item is separately expanded, at routing time.  However, this
31686 option has no effect when an address is just being verified. The way in which
31687 the text is used to add header lines at transport time is described in section
31688 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
31689 message is in the process of being transported. This means that references to
31690 header lines in string expansions in the transport&#x2019;s configuration do not
31691 <quote>see</quote> the added header lines.
31692 </para>
31693 <para>
31694 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
31695 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
31696 an item expansion is forced to fail, the item has no effect. Other expansion
31697 failures are treated as configuration errors.
31698 </para>
31699 <para>
31700 Unlike most options, <option>headers_add</option> can be specified multiple times
31701 for a router; all listed headers are added.
31702 </para>
31703 <para>
31704 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
31705 router that has the <option>one_time</option> option set.
31706 </para>
31707 <para>
31708 <indexterm role="concept">
31709 <primary>duplicate addresses</primary>
31710 </indexterm>
31711 <indexterm role="option">
31712 <primary><option>unseen</option></primary>
31713 </indexterm>
31714 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31715 additions are deleted when the address is passed on to subsequent routers.
31716 For a <option>redirect</option> router, if a generated address is the same as the incoming
31717 address, this can lead to duplicate addresses with different header
31718 modifications. Exim does not do duplicate deliveries (except, in certain
31719 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
31720 which of the duplicates is discarded, so this ambiguous situation should be
31721 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
31722 </para>
31723 <para>
31724 <indexterm role="option">
31725 <primary><option>headers_remove</option></primary>
31726 </indexterm>
31727 </para>
31728 <informaltable frame="all">
31729 <tgroup cols="4" colsep="0" rowsep="0">
31730 <colspec colwidth="8*" align="left"/>
31731 <colspec colwidth="6*" align="center"/>
31732 <colspec colwidth="6*" align="center"/>
31733 <colspec colwidth="6*" align="right"/>
31734 <tbody>
31735 <row>
31736 <entry><option>headers_remove</option></entry>
31737 <entry>Use: <emphasis>routers</emphasis></entry>
31738 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
31739 <entry>Default: <emphasis>unset</emphasis></entry>
31740 </row>
31741 </tbody>
31742 </tgroup>
31743 </informaltable>
31744 <para>
31745 <indexterm role="concept">
31746 <primary>header lines</primary>
31747 <secondary>removing</secondary>
31748 </indexterm>
31749 <indexterm role="concept">
31750 <primary>router</primary>
31751 <secondary>removing header lines</secondary>
31752 </indexterm>
31753 This option specifies a list of text headers, colon-separated,
31754 that is associated with any addresses that are accepted by the router.
31755 Each item is separately expanded, at routing time.  However, this
31756 option has no effect when an address is just being verified. The way in which
31757 the text is used to remove header lines at transport time is described in
31758 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
31759 the message is in the process of being transported. This means that references
31760 to header lines in string expansions in the transport&#x2019;s configuration still
31761 <quote>see</quote> the original header lines.
31762 </para>
31763 <para>
31764 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
31765 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
31766 the item has no effect. Other expansion failures are treated as configuration
31767 errors.
31768 </para>
31769 <para>
31770 Unlike most options, <option>headers_remove</option> can be specified multiple times
31771 for a router; all listed headers are removed.
31772 </para>
31773 <para>
31774 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
31775 router that has the <option>one_time</option> option set.
31776 </para>
31777 <para>
31778 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31779 removal requests are deleted when the address is passed on to subsequent
31780 routers, and this can lead to problems with duplicates -- see the similar
31781 warning for <option>headers_add</option> above.
31782 </para>
31783 <para>
31784 <indexterm role="option">
31785 <primary><option>ignore_target_hosts</option></primary>
31786 </indexterm>
31787 </para>
31788 <informaltable frame="all">
31789 <tgroup cols="4" colsep="0" rowsep="0">
31790 <colspec colwidth="8*" align="left"/>
31791 <colspec colwidth="6*" align="center"/>
31792 <colspec colwidth="6*" align="center"/>
31793 <colspec colwidth="6*" align="right"/>
31794 <tbody>
31795 <row>
31796 <entry><option>ignore_target_hosts</option></entry>
31797 <entry>Use: <emphasis>routers</emphasis></entry>
31798 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31799 <entry>Default: <emphasis>unset</emphasis></entry>
31800 </row>
31801 </tbody>
31802 </tgroup>
31803 </informaltable>
31804 <para>
31805 <indexterm role="concept">
31806 <primary>IP address</primary>
31807 <secondary>discarding</secondary>
31808 </indexterm>
31809 <indexterm role="concept">
31810 <primary>router</primary>
31811 <secondary>discarding IP addresses</secondary>
31812 </indexterm>
31813 Although this option is a host list, it should normally contain IP address
31814 entries rather than names. If any host that is looked up by the router has an
31815 IP address that matches an item in this list, Exim behaves as if that IP
31816 address did not exist. This option allows you to cope with rogue DNS entries
31817 like
31818 </para>
31819 <literallayout class="monospaced">
31820 remote.domain.example.  A  127.0.0.1
31821 </literallayout>
31822 <para>
31823 by setting
31824 </para>
31825 <literallayout class="monospaced">
31826 ignore_target_hosts = 127.0.0.1
31827 </literallayout>
31828 <para>
31829 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
31830 discarded in this way, the router declines. In a conventional configuration, an
31831 attempt to mail to such a domain would normally provoke the <quote>unrouteable
31832 domain</quote> error, and an attempt to verify an address in the domain would fail.
31833 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
31834 router declines if presented with one of the listed addresses.
31835 </para>
31836 <para>
31837 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
31838 means of the first or the second of the following settings, respectively:
31839 </para>
31840 <literallayout class="monospaced">
31841 ignore_target_hosts = 0.0.0.0/0
31842 ignore_target_hosts = &lt;; 0::0/0
31843 </literallayout>
31844 <para>
31845 The pattern in the first line matches all IPv4 addresses, whereas the pattern
31846 in the second line matches all IPv6 addresses.
31847 </para>
31848 <para>
31849 This option may also be useful for ignoring link-local and site-local IPv6
31850 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
31851 is expanded before use as a list, it is possible to make it dependent on the
31852 domain that is being routed.
31853 </para>
31854 <para>
31855 <indexterm role="variable">
31856 <primary><varname>$host_address</varname></primary>
31857 </indexterm>
31858 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
31859 checked.
31860 </para>
31861 <para>
31862 <indexterm role="option">
31863 <primary><option>initgroups</option></primary>
31864 </indexterm>
31865 </para>
31866 <informaltable frame="all">
31867 <tgroup cols="4" colsep="0" rowsep="0">
31868 <colspec colwidth="8*" align="left"/>
31869 <colspec colwidth="6*" align="center"/>
31870 <colspec colwidth="6*" align="center"/>
31871 <colspec colwidth="6*" align="right"/>
31872 <tbody>
31873 <row>
31874 <entry><option>initgroups</option></entry>
31875 <entry>Use: <emphasis>routers</emphasis></entry>
31876 <entry>Type: <emphasis>boolean</emphasis></entry>
31877 <entry>Default: <emphasis>false</emphasis></entry>
31878 </row>
31879 </tbody>
31880 </tgroup>
31881 </informaltable>
31882 <para>
31883 <indexterm role="concept">
31884 <primary>additional groups</primary>
31885 </indexterm>
31886 <indexterm role="concept">
31887 <primary>groups</primary>
31888 <secondary>additional</secondary>
31889 </indexterm>
31890 <indexterm role="concept">
31891 <primary>local transports</primary>
31892 <secondary>uid and gid</secondary>
31893 </indexterm>
31894 <indexterm role="concept">
31895 <primary>transport</primary>
31896 <secondary>local</secondary>
31897 </indexterm>
31898 If the router queues an address for a transport, and this option is true, and
31899 the uid supplied by the router is not overridden by the transport, the
31900 <function>initgroups()</function> function is called when running the transport to ensure that
31901 any additional groups associated with the uid are set up. See also <option>group</option>
31902 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31903 </para>
31904 <para>
31905 <indexterm role="option">
31906 <primary><option>local_part_prefix</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>local_part_prefix</option></entry>
31918 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31919 <entry>Type: <emphasis>string list</emphasis></entry>
31920 <entry>Default: <emphasis>unset</emphasis></entry>
31921 </row>
31922 </tbody>
31923 </tgroup>
31924 </informaltable>
31925 <para>
31926 <indexterm role="concept">
31927 <primary>router</primary>
31928 <secondary>prefix for local part</secondary>
31929 </indexterm>
31930 <indexterm role="concept">
31931 <primary>prefix</primary>
31932 <secondary>for local part, used in router</secondary>
31933 </indexterm>
31934 If this option is set, the router is skipped unless the local part starts with
31935 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
31936 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
31937 evaluated.
31938 </para>
31939 <para>
31940 The list is scanned from left to right, and the first prefix that matches is
31941 used. A limited form of wildcard is available; if the prefix begins with an
31942 asterisk, it matches the longest possible sequence of arbitrary characters at
31943 the start of the local part. An asterisk should therefore always be followed by
31944 some character that does not occur in normal local parts.
31945 <indexterm role="concept">
31946 <primary>multiple mailboxes</primary>
31947 </indexterm>
31948 <indexterm role="concept">
31949 <primary>mailbox</primary>
31950 <secondary>multiple</secondary>
31951 </indexterm>
31952 Wildcarding can be used to set up multiple user mailboxes, as described in
31953 section <xref linkend="SECTmulbox"/>.
31954 </para>
31955 <para>
31956 <indexterm role="variable">
31957 <primary><varname>$local_part</varname></primary>
31958 </indexterm>
31959 <indexterm role="variable">
31960 <primary><varname>$local_part_prefix</varname></primary>
31961 </indexterm>
31962 During the testing of the <option>local_parts</option> option, and while the router is
31963 running, the prefix is removed from the local part, and is available in the
31964 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
31965 the router accepts the address, this remains true during subsequent delivery by
31966 a transport. In particular, the local part that is transmitted in the RCPT
31967 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
31968 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
31969 the relevant transport.
31970 </para>
31971 <para>
31972 When an address is being verified, <option>local_part_prefix</option> affects only the
31973 behaviour of the router. If the callout feature of verification is in use, this
31974 means that the full address, including the prefix, will be used during the
31975 callout.
31976 </para>
31977 <para>
31978 The prefix facility is commonly used to handle local parts of the form
31979 <option>owner-something</option>. Another common use is to support local parts of the form
31980 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
31981 to tell a user their forwarding is broken &ndash; by placing a router like this one
31982 immediately before the router that handles <filename>.forward</filename> files:
31983 </para>
31984 <literallayout class="monospaced">
31985 real_localuser:
31986   driver = accept
31987   local_part_prefix = real-
31988   check_local_user
31989   transport = local_delivery
31990 </literallayout>
31991 <para>
31992 For security, it would probably be a good idea to restrict the use of this
31993 router to locally-generated messages, using a condition such as this:
31994 </para>
31995 <literallayout class="monospaced">
31996   condition = ${if match {$sender_host_address}\
31997                          {\N^(|127\.0\.0\.1)$\N}}
31998 </literallayout>
31999 <para>
32000 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
32001 both conditions must be met if not optional. Care must be taken if wildcards
32002 are used in both a prefix and a suffix on the same router. Different
32003 separator characters must be used to avoid ambiguity.
32004 </para>
32005 <para>
32006 <indexterm role="option">
32007 <primary><option>local_part_prefix_optional</option></primary>
32008 </indexterm>
32009 </para>
32010 <informaltable frame="all">
32011 <tgroup cols="4" colsep="0" rowsep="0">
32012 <colspec colwidth="8*" align="left"/>
32013 <colspec colwidth="6*" align="center"/>
32014 <colspec colwidth="6*" align="center"/>
32015 <colspec colwidth="6*" align="right"/>
32016 <tbody>
32017 <row>
32018 <entry><option>local_part_prefix_optional</option></entry>
32019 <entry>Use: <emphasis>routers</emphasis></entry>
32020 <entry>Type: <emphasis>boolean</emphasis></entry>
32021 <entry>Default: <emphasis>false</emphasis></entry>
32022 </row>
32023 </tbody>
32024 </tgroup>
32025 </informaltable>
32026 <para>
32027 See <option>local_part_prefix</option> above.
32028 </para>
32029 <para>
32030 <indexterm role="option">
32031 <primary><option>local_part_suffix</option></primary>
32032 </indexterm>
32033 </para>
32034 <informaltable frame="all">
32035 <tgroup cols="4" colsep="0" rowsep="0">
32036 <colspec colwidth="8*" align="left"/>
32037 <colspec colwidth="6*" align="center"/>
32038 <colspec colwidth="6*" align="center"/>
32039 <colspec colwidth="6*" align="right"/>
32040 <tbody>
32041 <row>
32042 <entry><option>local_part_suffix</option></entry>
32043 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32044 <entry>Type: <emphasis>string list</emphasis></entry>
32045 <entry>Default: <emphasis>unset</emphasis></entry>
32046 </row>
32047 </tbody>
32048 </tgroup>
32049 </informaltable>
32050 <para>
32051 <indexterm role="concept">
32052 <primary>router</primary>
32053 <secondary>suffix for local part</secondary>
32054 </indexterm>
32055 <indexterm role="concept">
32056 <primary>suffix for local part</primary>
32057 <secondary>used in router</secondary>
32058 </indexterm>
32059 This option operates in the same way as <option>local_part_prefix</option>, except that the
32060 local part must end (rather than start) with the given string, the
32061 <option>local_part_suffix_optional</option> option determines whether the suffix is
32062 mandatory, and the wildcard * character, if present, must be the last
32063 character of the suffix. This option facility is commonly used to handle local
32064 parts of the form <option>something-request</option> and multiple user mailboxes of the form
32065 <option>username-foo</option>.
32066 </para>
32067 <para>
32068 <indexterm role="option">
32069 <primary><option>local_part_suffix_optional</option></primary>
32070 </indexterm>
32071 </para>
32072 <informaltable frame="all">
32073 <tgroup cols="4" colsep="0" rowsep="0">
32074 <colspec colwidth="8*" align="left"/>
32075 <colspec colwidth="6*" align="center"/>
32076 <colspec colwidth="6*" align="center"/>
32077 <colspec colwidth="6*" align="right"/>
32078 <tbody>
32079 <row>
32080 <entry><option>local_part_suffix_optional</option></entry>
32081 <entry>Use: <emphasis>routers</emphasis></entry>
32082 <entry>Type: <emphasis>boolean</emphasis></entry>
32083 <entry>Default: <emphasis>false</emphasis></entry>
32084 </row>
32085 </tbody>
32086 </tgroup>
32087 </informaltable>
32088 <para>
32089 See <option>local_part_suffix</option> above.
32090 </para>
32091 <para>
32092 <indexterm role="option">
32093 <primary><option>local_parts</option></primary>
32094 </indexterm>
32095 </para>
32096 <informaltable frame="all">
32097 <tgroup cols="4" colsep="0" rowsep="0">
32098 <colspec colwidth="8*" align="left"/>
32099 <colspec colwidth="6*" align="center"/>
32100 <colspec colwidth="6*" align="center"/>
32101 <colspec colwidth="6*" align="right"/>
32102 <tbody>
32103 <row>
32104 <entry><option>local_parts</option></entry>
32105 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32106 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
32107 <entry>Default: <emphasis>unset</emphasis></entry>
32108 </row>
32109 </tbody>
32110 </tgroup>
32111 </informaltable>
32112 <para>
32113 <indexterm role="concept">
32114 <primary>router</primary>
32115 <secondary>restricting to specific local parts</secondary>
32116 </indexterm>
32117 <indexterm role="concept">
32118 <primary>local part</primary>
32119 <secondary>checking in router</secondary>
32120 </indexterm>
32121 The router is run only if the local part of the address matches the list.
32122 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32123 are evaluated, and
32124 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
32125 string is expanded, it is possible to make it depend on the domain, for
32126 example:
32127 </para>
32128 <literallayout class="monospaced">
32129 local_parts = dbm;/usr/local/specials/$domain
32130 </literallayout>
32131 <para>
32132 <indexterm role="variable">
32133 <primary><varname>$local_part_data</varname></primary>
32134 </indexterm>
32135 If the match is achieved by a lookup, the data that the lookup returned
32136 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
32137 expansions of the router&#x2019;s private options. You might use this option, for
32138 example, if you have a large number of local virtual domains, and you want to
32139 send all postmaster mail to the same place without having to set up an alias in
32140 each virtual domain:
32141 </para>
32142 <literallayout class="monospaced">
32143 postmaster:
32144   driver = redirect
32145   local_parts = postmaster
32146   data = postmaster@real.domain.example
32147 </literallayout>
32148 <para>
32149 <indexterm role="option">
32150 <primary><option>log_as_local</option></primary>
32151 </indexterm>
32152 </para>
32153 <informaltable frame="all">
32154 <tgroup cols="4" colsep="0" rowsep="0">
32155 <colspec colwidth="8*" align="left"/>
32156 <colspec colwidth="6*" align="center"/>
32157 <colspec colwidth="6*" align="center"/>
32158 <colspec colwidth="6*" align="right"/>
32159 <tbody>
32160 <row>
32161 <entry><option>log_as_local</option></entry>
32162 <entry>Use: <emphasis>routers</emphasis></entry>
32163 <entry>Type: <emphasis>boolean</emphasis></entry>
32164 <entry>Default: <emphasis>see below</emphasis></entry>
32165 </row>
32166 </tbody>
32167 </tgroup>
32168 </informaltable>
32169 <para>
32170 <indexterm role="concept">
32171 <primary>log</primary>
32172 <secondary>delivery line</secondary>
32173 </indexterm>
32174 <indexterm role="concept">
32175 <primary>delivery</primary>
32176 <secondary>log line format</secondary>
32177 </indexterm>
32178 Exim has two logging styles for delivery, the idea being to make local
32179 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
32180 recipient address is given just as the local part, without a domain. The use of
32181 this style is controlled by this option. It defaults to true for the <command>accept</command>
32182 router, and false for all the others. This option applies only when a
32183 router assigns an address to a transport. It has no effect on routers that
32184 redirect addresses.
32185 </para>
32186 <para>
32187 <indexterm role="option">
32188 <primary><option>more</option></primary>
32189 </indexterm>
32190 </para>
32191 <informaltable frame="all">
32192 <tgroup cols="4" colsep="0" rowsep="0">
32193 <colspec colwidth="8*" align="left"/>
32194 <colspec colwidth="6*" align="center"/>
32195 <colspec colwidth="6*" align="center"/>
32196 <colspec colwidth="6*" align="right"/>
32197 <tbody>
32198 <row>
32199 <entry><option>more</option></entry>
32200 <entry>Use: <emphasis>routers</emphasis></entry>
32201 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32202 <entry>Default: <emphasis>true</emphasis></entry>
32203 </row>
32204 </tbody>
32205 </tgroup>
32206 </informaltable>
32207 <para>
32208 The result of string expansion for this option must be a valid boolean value,
32209 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32210 result causes an error, and delivery is deferred. If the expansion is forced to
32211 fail, the default value for the option (true) is used. Other failures cause
32212 delivery to be deferred.
32213 </para>
32214 <para>
32215 If this option is set false, and the router declines to handle the address, no
32216 further routers are tried, routing fails, and the address is bounced.
32217 <indexterm role="option">
32218 <primary><option>self</option></primary>
32219 </indexterm>
32220 However, if the router explicitly passes an address to the following router by
32221 means of the setting
32222 </para>
32223 <literallayout class="monospaced">
32224 self = pass
32225 </literallayout>
32226 <para>
32227 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
32228 does not affect the behaviour if one of the precondition tests fails. In that
32229 case, the address is always passed to the next router.
32230 </para>
32231 <para>
32232 Note that <option>address_data</option> is not considered to be a precondition. If its
32233 expansion is forced to fail, the router declines, and the value of <option>more</option>
32234 controls what happens next.
32235 </para>
32236 <para>
32237 <indexterm role="option">
32238 <primary><option>pass_on_timeout</option></primary>
32239 </indexterm>
32240 </para>
32241 <informaltable frame="all">
32242 <tgroup cols="4" colsep="0" rowsep="0">
32243 <colspec colwidth="8*" align="left"/>
32244 <colspec colwidth="6*" align="center"/>
32245 <colspec colwidth="6*" align="center"/>
32246 <colspec colwidth="6*" align="right"/>
32247 <tbody>
32248 <row>
32249 <entry><option>pass_on_timeout</option></entry>
32250 <entry>Use: <emphasis>routers</emphasis></entry>
32251 <entry>Type: <emphasis>boolean</emphasis></entry>
32252 <entry>Default: <emphasis>false</emphasis></entry>
32253 </row>
32254 </tbody>
32255 </tgroup>
32256 </informaltable>
32257 <para>
32258 <indexterm role="concept">
32259 <primary>timeout</primary>
32260 <secondary>of router</secondary>
32261 </indexterm>
32262 <indexterm role="concept">
32263 <primary>router</primary>
32264 <secondary>timeout</secondary>
32265 </indexterm>
32266 If a router times out during a host lookup, it normally causes deferral of the
32267 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
32268 router, overriding <option>no_more</option>. This may be helpful for systems that are
32269 intermittently connected to the Internet, or those that want to pass to a smart
32270 host any messages that cannot immediately be delivered.
32271 </para>
32272 <para>
32273 There are occasional other temporary errors that can occur while doing DNS
32274 lookups. They are treated in the same way as a timeout, and this option
32275 applies to all of them.
32276 </para>
32277 <para>
32278 <indexterm role="option">
32279 <primary><option>pass_router</option></primary>
32280 </indexterm>
32281 </para>
32282 <informaltable frame="all">
32283 <tgroup cols="4" colsep="0" rowsep="0">
32284 <colspec colwidth="8*" align="left"/>
32285 <colspec colwidth="6*" align="center"/>
32286 <colspec colwidth="6*" align="center"/>
32287 <colspec colwidth="6*" align="right"/>
32288 <tbody>
32289 <row>
32290 <entry><option>pass_router</option></entry>
32291 <entry>Use: <emphasis>routers</emphasis></entry>
32292 <entry>Type: <emphasis>string</emphasis></entry>
32293 <entry>Default: <emphasis>unset</emphasis></entry>
32294 </row>
32295 </tbody>
32296 </tgroup>
32297 </informaltable>
32298 <para>
32299 <indexterm role="concept">
32300 <primary>router</primary>
32301 <secondary>go to after <quote>pass</quote></secondary>
32302 </indexterm>
32303 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
32304 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
32305 routing to continue, and overriding a false setting of <option>more</option>. When one of
32306 these routers returns <quote>pass</quote>, the address is normally handed on to the next
32307 router in sequence. This can be changed by setting <option>pass_router</option> to the name
32308 of another router. However (unlike <option>redirect_router</option>) the named router must
32309 be below the current router, to avoid loops. Note that this option applies only
32310 to the special case of <quote>pass</quote>. It does not apply when a router returns
32311 <quote>decline</quote> because it cannot handle an address.
32312 </para>
32313 <para>
32314 <indexterm role="option">
32315 <primary><option>redirect_router</option></primary>
32316 </indexterm>
32317 </para>
32318 <informaltable frame="all">
32319 <tgroup cols="4" colsep="0" rowsep="0">
32320 <colspec colwidth="8*" align="left"/>
32321 <colspec colwidth="6*" align="center"/>
32322 <colspec colwidth="6*" align="center"/>
32323 <colspec colwidth="6*" align="right"/>
32324 <tbody>
32325 <row>
32326 <entry><option>redirect_router</option></entry>
32327 <entry>Use: <emphasis>routers</emphasis></entry>
32328 <entry>Type: <emphasis>string</emphasis></entry>
32329 <entry>Default: <emphasis>unset</emphasis></entry>
32330 </row>
32331 </tbody>
32332 </tgroup>
32333 </informaltable>
32334 <para>
32335 <indexterm role="concept">
32336 <primary>router</primary>
32337 <secondary>start at after redirection</secondary>
32338 </indexterm>
32339 Sometimes an administrator knows that it is pointless to reprocess addresses
32340 generated from alias or forward files with the same router again. For
32341 example, if an alias file translates real names into login ids there is no
32342 point searching the alias file a second time, especially if it is a large file.
32343 </para>
32344 <para>
32345 The <option>redirect_router</option> option can be set to the name of any router instance.
32346 It causes the routing of any generated addresses to start at the named router
32347 instead of at the first router. This option has no effect if the router in
32348 which it is set does not generate new addresses.
32349 </para>
32350 <para>
32351 <indexterm role="option">
32352 <primary><option>require_files</option></primary>
32353 </indexterm>
32354 </para>
32355 <informaltable frame="all">
32356 <tgroup cols="4" colsep="0" rowsep="0">
32357 <colspec colwidth="8*" align="left"/>
32358 <colspec colwidth="6*" align="center"/>
32359 <colspec colwidth="6*" align="center"/>
32360 <colspec colwidth="6*" align="right"/>
32361 <tbody>
32362 <row>
32363 <entry><option>require_files</option></entry>
32364 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32365 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32366 <entry>Default: <emphasis>unset</emphasis></entry>
32367 </row>
32368 </tbody>
32369 </tgroup>
32370 </informaltable>
32371 <para>
32372 <indexterm role="concept">
32373 <primary>file</primary>
32374 <secondary>requiring for router</secondary>
32375 </indexterm>
32376 <indexterm role="concept">
32377 <primary>router</primary>
32378 <secondary>requiring file existence</secondary>
32379 </indexterm>
32380 This option provides a general mechanism for predicating the running of a
32381 router on the existence or non-existence of certain files or directories.
32382 Before running a router, as one of its precondition tests, Exim works its way
32383 through the <option>require_files</option> list, expanding each item separately.
32384 </para>
32385 <para>
32386 Because the list is split before expansion, any colons in expansion items must
32387 be doubled, or the facility for using a different list separator must be used.
32388 If any expansion is forced to fail, the item is ignored. Other expansion
32389 failures cause routing of the address to be deferred.
32390 </para>
32391 <para>
32392 If any expanded string is empty, it is ignored. Otherwise, except as described
32393 below, each string must be a fully qualified file path, optionally preceded by
32394 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
32395 existence of the files or directories. The router is skipped if any paths not
32396 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
32397 </para>
32398 <para>
32399 <indexterm role="concept">
32400 <primary>NFS</primary>
32401 </indexterm>
32402 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
32403 the message is deferred. This can happen when NFS-mounted filesystems are
32404 unavailable.
32405 </para>
32406 <para>
32407 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
32408 options, so you cannot use it to check for the existence of a file in which to
32409 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
32410 full list of the order in which preconditions are evaluated.) However, as
32411 these options are all expanded, you can use the <option>exists</option> expansion condition
32412 to make such tests. The <option>require_files</option> option is intended for checking files
32413 that the router may be going to use internally, or which are needed by a
32414 transport (for example <filename>.procmailrc</filename>).
32415 </para>
32416 <para>
32417 During delivery, the <function>stat()</function> function is run as root, but there is a
32418 facility for some checking of the accessibility of a file by another user.
32419 This is not a proper permissions check, but just a <quote>rough</quote> check that
32420 operates as follows:
32421 </para>
32422 <para>
32423 If an item in a <option>require_files</option> list does not contain any forward slash
32424 characters, it is taken to be the user (and optional group, separated by a
32425 comma) to be checked for subsequent files in the list. If no group is specified
32426 but the user is specified symbolically, the gid associated with the uid is
32427 used. For example:
32428 </para>
32429 <literallayout class="monospaced">
32430 require_files = mail:/some/file
32431 require_files = $local_part:$home/.procmailrc
32432 </literallayout>
32433 <para>
32434 If a user or group name in a <option>require_files</option> list does not exist, the
32435 <option>require_files</option> condition fails.
32436 </para>
32437 <para>
32438 Exim performs the check by scanning along the components of the file path, and
32439 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
32440 directories, and <quote>r</quote> access on the final file. Note that this means that file
32441 access control lists, if the operating system has them, are ignored.
32442 </para>
32443 <para>
32444 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
32445 incoming SMTP message, Exim is not running as root, but under its own uid. This
32446 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
32447 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
32448 user is not permitted to read one of the directories on the file&#x2019;s path.
32449 </para>
32450 <para>
32451 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
32452 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
32453 without root access. In this case, if a check for access by a particular user
32454 is requested, Exim creates a subprocess that runs as that user, and tries the
32455 check again in that process.
32456 </para>
32457 <para>
32458 The default action for handling an unresolved EACCES is to consider it to
32459 be caused by a configuration error, and routing is deferred because the
32460 existence or non-existence of the file cannot be determined. However, in some
32461 circumstances it may be desirable to treat this condition as if the file did
32462 not exist. If the file name (or the exclamation mark that precedes the file
32463 name for non-existence) is preceded by a plus sign, the EACCES error is treated
32464 as if the file did not exist. For example:
32465 </para>
32466 <literallayout class="monospaced">
32467 require_files = +/some/file
32468 </literallayout>
32469 <para>
32470 If the router is not an essential part of verification (for example, it
32471 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
32472 option false so that the router is skipped when verifying.
32473 </para>
32474 <para>
32475 <indexterm role="option">
32476 <primary><option>retry_use_local_part</option></primary>
32477 </indexterm>
32478 </para>
32479 <informaltable frame="all">
32480 <tgroup cols="4" colsep="0" rowsep="0">
32481 <colspec colwidth="8*" align="left"/>
32482 <colspec colwidth="6*" align="center"/>
32483 <colspec colwidth="6*" align="center"/>
32484 <colspec colwidth="6*" align="right"/>
32485 <tbody>
32486 <row>
32487 <entry><option>retry_use_local_part</option></entry>
32488 <entry>Use: <emphasis>routers</emphasis></entry>
32489 <entry>Type: <emphasis>boolean</emphasis></entry>
32490 <entry>Default: <emphasis>see below</emphasis></entry>
32491 </row>
32492 </tbody>
32493 </tgroup>
32494 </informaltable>
32495 <para>
32496 <indexterm role="concept">
32497 <primary>hints database</primary>
32498 <secondary>retry keys</secondary>
32499 </indexterm>
32500 <indexterm role="concept">
32501 <primary>local part</primary>
32502 <secondary>in retry keys</secondary>
32503 </indexterm>
32504 When a delivery suffers a temporary routing failure, a retry record is created
32505 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
32506 domain, the key for the retry record should not involve the local part, but for
32507 other addresses, both the domain and the local part should be included.
32508 Usually, remote routing is of the former kind, and local routing is of the
32509 latter kind.
32510 </para>
32511 <para>
32512 This option controls whether the local part is used to form the key for retry
32513 hints for addresses that suffer temporary errors while being handled by this
32514 router. The default value is true for any router that has <option>check_local_user</option>
32515 set, and false otherwise. Note that this option does not apply to hints keys
32516 for transport delays; they are controlled by a generic transport option of the
32517 same name.
32518 </para>
32519 <para>
32520 The setting of <option>retry_use_local_part</option> applies only to the router on which it
32521 appears. If the router generates child addresses, they are routed
32522 independently; this setting does not become attached to them.
32523 </para>
32524 <para>
32525 <indexterm role="option">
32526 <primary><option>router_home_directory</option></primary>
32527 </indexterm>
32528 </para>
32529 <informaltable frame="all">
32530 <tgroup cols="4" colsep="0" rowsep="0">
32531 <colspec colwidth="8*" align="left"/>
32532 <colspec colwidth="6*" align="center"/>
32533 <colspec colwidth="6*" align="center"/>
32534 <colspec colwidth="6*" align="right"/>
32535 <tbody>
32536 <row>
32537 <entry><option>router_home_directory</option></entry>
32538 <entry>Use: <emphasis>routers</emphasis></entry>
32539 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32540 <entry>Default: <emphasis>unset</emphasis></entry>
32541 </row>
32542 </tbody>
32543 </tgroup>
32544 </informaltable>
32545 <para>
32546 <indexterm role="concept">
32547 <primary>router</primary>
32548 <secondary>home directory for</secondary>
32549 </indexterm>
32550 <indexterm role="concept">
32551 <primary>home directory</primary>
32552 <secondary>for router</secondary>
32553 </indexterm>
32554 <indexterm role="variable">
32555 <primary><varname>$home</varname></primary>
32556 </indexterm>
32557 This option sets a home directory for use while the router is running. (Compare
32558 <option>transport_home_directory</option>, which sets a home directory for later
32559 transporting.) In particular, if used on a <command>redirect</command> router, this option
32560 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
32561 forced expansion failure causes the option to be ignored &ndash; other failures
32562 cause the router to defer.
32563 </para>
32564 <para>
32565 Expansion of <option>router_home_directory</option> happens immediately after the
32566 <option>check_local_user</option> test (if configured), before any further expansions take
32567 place.
32568 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32569 are evaluated.)
32570 While the router is running, <option>router_home_directory</option> overrides the value of
32571 <varname>$home</varname> that came from <option>check_local_user</option>.
32572 </para>
32573 <para>
32574 When a router accepts an address and assigns it to a local transport (including
32575 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
32576 delivery), the home directory setting for the transport is taken from the first
32577 of these values that is set:
32578 </para>
32579 <itemizedlist>
32580 <listitem>
32581 <para>
32582 The <option>home_directory</option> option on the transport;
32583 </para>
32584 </listitem>
32585 <listitem>
32586 <para>
32587 The <option>transport_home_directory</option> option on the router;
32588 </para>
32589 </listitem>
32590 <listitem>
32591 <para>
32592 The password data if <option>check_local_user</option> is set on the router;
32593 </para>
32594 </listitem>
32595 <listitem>
32596 <para>
32597 The <option>router_home_directory</option> option on the router.
32598 </para>
32599 </listitem>
32600 </itemizedlist>
32601 <para>
32602 In other words, <option>router_home_directory</option> overrides the password data for the
32603 router, but not for the transport.
32604 </para>
32605 <para>
32606 <indexterm role="option">
32607 <primary><option>self</option></primary>
32608 </indexterm>
32609 </para>
32610 <informaltable frame="all">
32611 <tgroup cols="4" colsep="0" rowsep="0">
32612 <colspec colwidth="8*" align="left"/>
32613 <colspec colwidth="6*" align="center"/>
32614 <colspec colwidth="6*" align="center"/>
32615 <colspec colwidth="6*" align="right"/>
32616 <tbody>
32617 <row>
32618 <entry><option>self</option></entry>
32619 <entry>Use: <emphasis>routers</emphasis></entry>
32620 <entry>Type: <emphasis>string</emphasis></entry>
32621 <entry>Default: <emphasis>freeze</emphasis></entry>
32622 </row>
32623 </tbody>
32624 </tgroup>
32625 </informaltable>
32626 <para>
32627 <indexterm role="concept">
32628 <primary>MX record</primary>
32629 <secondary>pointing to local host</secondary>
32630 </indexterm>
32631 <indexterm role="concept">
32632 <primary>local host</primary>
32633 <secondary>MX pointing to</secondary>
32634 </indexterm>
32635 This option applies to those routers that use a recipient address to find a
32636 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
32637 and <command>manualroute</command> routers.
32638 Certain configurations of the <command>queryprogram</command> router can also specify a list
32639 of remote hosts.
32640 Usually such routers are configured to send the message to a remote host via an
32641 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
32642 host on the list turns out to be the local host.
32643 The way in which Exim checks for the local host is described in section
32644 <xref linkend="SECTreclocipadd"/>.
32645 </para>
32646 <para>
32647 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
32648 example, the router should be configured not to process this domain), or an
32649 error in the DNS (for example, the MX should not point to this host). For this
32650 reason, the default action is to log the incident, defer the address, and
32651 freeze the message. The following alternatives are provided for use in special
32652 cases:
32653 </para>
32654 <variablelist>
32655 <varlistentry>
32656 <term><option>defer</option></term>
32657 <listitem>
32658 <para>
32659 Delivery of the message is tried again later, but the message is not frozen.
32660 </para>
32661 </listitem></varlistentry>
32662 <varlistentry>
32663 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
32664 <listitem>
32665 <para>
32666 The domain is changed to the given domain, and the address is passed back to
32667 be reprocessed by the routers. No rewriting of headers takes place. This
32668 behaviour is essentially a redirection.
32669 </para>
32670 </listitem></varlistentry>
32671 <varlistentry>
32672 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
32673 <listitem>
32674 <para>
32675 The domain is changed to the given domain, and the address is passed back to be
32676 reprocessed by the routers. Any headers that contain the original domain are
32677 rewritten.
32678 </para>
32679 </listitem></varlistentry>
32680 <varlistentry>
32681 <term><option>pass</option></term>
32682 <listitem>
32683 <para>
32684 <indexterm role="option">
32685 <primary><option>more</option></primary>
32686 </indexterm>
32687 <indexterm role="variable">
32688 <primary><varname>$self_hostname</varname></primary>
32689 </indexterm>
32690 The router passes the address to the next router, or to the router named in the
32691 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
32692 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
32693 name of the local host that the router encountered. This can be used to
32694 distinguish between different cases for hosts with multiple names. The
32695 combination
32696 </para>
32697 <literallayout class="monospaced">
32698 self = pass
32699 no_more
32700 </literallayout>
32701 <para>
32702 ensures that only those addresses that routed to the local host are passed on.
32703 Without <option>no_more</option>, addresses that were declined for other reasons would also
32704 be passed to the next router.
32705 </para>
32706 </listitem></varlistentry>
32707 <varlistentry>
32708 <term><option>fail</option></term>
32709 <listitem>
32710 <para>
32711 Delivery fails and an error report is generated.
32712 </para>
32713 </listitem></varlistentry>
32714 <varlistentry>
32715 <term><option>send</option></term>
32716 <listitem>
32717 <para>
32718 <indexterm role="concept">
32719 <primary>local host</primary>
32720 <secondary>sending to</secondary>
32721 </indexterm>
32722 The anomaly is ignored and the address is queued for the transport. This
32723 setting should be used with extreme caution. For an <command>smtp</command> transport, it
32724 makes sense only in cases where the program that is listening on the SMTP port
32725 is not this version of Exim. That is, it must be some other MTA, or Exim with a
32726 different configuration file that handles the domain in another way.
32727 </para>
32728 </listitem></varlistentry>
32729 </variablelist>
32730 <para>
32731 <indexterm role="option">
32732 <primary><option>senders</option></primary>
32733 </indexterm>
32734 </para>
32735 <informaltable frame="all">
32736 <tgroup cols="4" colsep="0" rowsep="0">
32737 <colspec colwidth="8*" align="left"/>
32738 <colspec colwidth="6*" align="center"/>
32739 <colspec colwidth="6*" align="center"/>
32740 <colspec colwidth="6*" align="right"/>
32741 <tbody>
32742 <row>
32743 <entry><option>senders</option></entry>
32744 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32745 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32746 <entry>Default: <emphasis>unset</emphasis></entry>
32747 </row>
32748 </tbody>
32749 </tgroup>
32750 </informaltable>
32751 <para>
32752 <indexterm role="concept">
32753 <primary>router</primary>
32754 <secondary>checking senders</secondary>
32755 </indexterm>
32756 If this option is set, the router is skipped unless the message&#x2019;s sender
32757 address matches something on the list.
32758 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32759 are evaluated.
32760 </para>
32761 <para>
32762 There are issues concerning verification when the running of routers is
32763 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
32764 setting, it sets the sender to the null string. When using the <option>-bt</option> option
32765 to check a configuration file, it is necessary also to use the <option>-f</option> option to
32766 set an appropriate sender. For incoming mail, the sender is unset when
32767 verifying the sender, but is available when verifying any recipients. If the
32768 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
32769 matters.
32770 </para>
32771 <para>
32772 <indexterm role="option">
32773 <primary><option>translate_ip_address</option></primary>
32774 </indexterm>
32775 </para>
32776 <informaltable frame="all">
32777 <tgroup cols="4" colsep="0" rowsep="0">
32778 <colspec colwidth="8*" align="left"/>
32779 <colspec colwidth="6*" align="center"/>
32780 <colspec colwidth="6*" align="center"/>
32781 <colspec colwidth="6*" align="right"/>
32782 <tbody>
32783 <row>
32784 <entry><option>translate_ip_address</option></entry>
32785 <entry>Use: <emphasis>routers</emphasis></entry>
32786 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32787 <entry>Default: <emphasis>unset</emphasis></entry>
32788 </row>
32789 </tbody>
32790 </tgroup>
32791 </informaltable>
32792 <para>
32793 <indexterm role="concept">
32794 <primary>IP address</primary>
32795 <secondary>translating</secondary>
32796 </indexterm>
32797 <indexterm role="concept">
32798 <primary>packet radio</primary>
32799 </indexterm>
32800 <indexterm role="concept">
32801 <primary>router</primary>
32802 <secondary>IP address translation</secondary>
32803 </indexterm>
32804 There exist some rare networking situations (for example, packet radio) where
32805 it is helpful to be able to translate IP addresses generated by normal routing
32806 mechanisms into other IP addresses, thus performing a kind of manual IP
32807 routing. This should be done only if the normal IP routing of the TCP/IP stack
32808 is inadequate or broken. Because this is an extremely uncommon requirement, the
32809 code to support this option is not included in the Exim binary unless
32810 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
32811 </para>
32812 <para>
32813 <indexterm role="variable">
32814 <primary><varname>$host_address</varname></primary>
32815 </indexterm>
32816 The <option>translate_ip_address</option> string is expanded for every IP address generated
32817 by the router, with the generated address set in <varname>$host_address</varname>. If the
32818 expansion is forced to fail, no action is taken.
32819 For any other expansion error, delivery of the message is deferred.
32820 If the result of the expansion is an IP address, that replaces the original
32821 address; otherwise the result is assumed to be a host name &ndash; this is looked
32822 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
32823 produce one or more replacement IP addresses. For example, to subvert all IP
32824 addresses in some specific networks, this could be added to a router:
32825 </para>
32826 <literallayout class="monospaced">
32827 translate_ip_address = \
32828   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
32829     {$value}fail}}
32830 </literallayout>
32831 <para>
32832 The file would contain lines like
32833 </para>
32834 <literallayout class="monospaced">
32835 10.2.3.128/26    some.host
32836 10.8.4.34/26     10.44.8.15
32837 </literallayout>
32838 <para>
32839 You should not make use of this facility unless you really understand what you
32840 are doing.
32841 </para>
32842 <para>
32843 <indexterm role="option">
32844 <primary><option>transport</option></primary>
32845 </indexterm>
32846 </para>
32847 <informaltable frame="all">
32848 <tgroup cols="4" colsep="0" rowsep="0">
32849 <colspec colwidth="8*" align="left"/>
32850 <colspec colwidth="6*" align="center"/>
32851 <colspec colwidth="6*" align="center"/>
32852 <colspec colwidth="6*" align="right"/>
32853 <tbody>
32854 <row>
32855 <entry><option>transport</option></entry>
32856 <entry>Use: <emphasis>routers</emphasis></entry>
32857 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32858 <entry>Default: <emphasis>unset</emphasis></entry>
32859 </row>
32860 </tbody>
32861 </tgroup>
32862 </informaltable>
32863 <para>
32864 This option specifies the transport to be used when a router accepts an address
32865 and sets it up for delivery. A transport is never needed if a router is used
32866 only for verification. The value of the option is expanded at routing time,
32867 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
32868 and result must be the name of one of the configured transports. If it is not,
32869 delivery is deferred.
32870 </para>
32871 <para>
32872 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
32873 have some private options that set up transports for pipe and file deliveries
32874 (see chapter <xref linkend="CHAPredirect"/>).
32875 </para>
32876 <para>
32877 <indexterm role="option">
32878 <primary><option>transport_current_directory</option></primary>
32879 </indexterm>
32880 </para>
32881 <informaltable frame="all">
32882 <tgroup cols="4" colsep="0" rowsep="0">
32883 <colspec colwidth="8*" align="left"/>
32884 <colspec colwidth="6*" align="center"/>
32885 <colspec colwidth="6*" align="center"/>
32886 <colspec colwidth="6*" align="right"/>
32887 <tbody>
32888 <row>
32889 <entry><option>transport_current_directory</option></entry>
32890 <entry>Use: <emphasis>routers</emphasis></entry>
32891 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32892 <entry>Default: <emphasis>unset</emphasis></entry>
32893 </row>
32894 </tbody>
32895 </tgroup>
32896 </informaltable>
32897 <para>
32898 <indexterm role="concept">
32899 <primary>current directory for local transport</primary>
32900 </indexterm>
32901 This option associates a current directory with any address that is routed
32902 to a local transport. This can happen either because a transport is
32903 explicitly configured for the router, or because it generates a delivery to a
32904 file or a pipe. During the delivery process (that is, at transport time), this
32905 option string is expanded and is set as the current directory, unless
32906 overridden by a setting on the transport.
32907 If the expansion fails for any reason, including forced failure, an error is
32908 logged, and delivery is deferred.
32909 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
32910 environment.
32911 </para>
32912 <para>
32913 <indexterm role="option">
32914 <primary><option>transport_home_directory</option></primary>
32915 </indexterm>
32916 </para>
32917 <informaltable frame="all">
32918 <tgroup cols="4" colsep="0" rowsep="0">
32919 <colspec colwidth="8*" align="left"/>
32920 <colspec colwidth="6*" align="center"/>
32921 <colspec colwidth="6*" align="center"/>
32922 <colspec colwidth="6*" align="right"/>
32923 <tbody>
32924 <row>
32925 <entry><option>transport_home_directory</option></entry>
32926 <entry>Use: <emphasis>routers</emphasis></entry>
32927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32928 <entry>Default: <emphasis>see below</emphasis></entry>
32929 </row>
32930 </tbody>
32931 </tgroup>
32932 </informaltable>
32933 <para>
32934 <indexterm role="concept">
32935 <primary>home directory</primary>
32936 <secondary>for local transport</secondary>
32937 </indexterm>
32938 This option associates a home directory with any address that is routed to a
32939 local transport. This can happen either because a transport is explicitly
32940 configured for the router, or because it generates a delivery to a file or a
32941 pipe. During the delivery process (that is, at transport time), the option
32942 string is expanded and is set as the home directory, unless overridden by a
32943 setting of <option>home_directory</option> on the transport.
32944 If the expansion fails for any reason, including forced failure, an error is
32945 logged, and delivery is deferred.
32946 </para>
32947 <para>
32948 If the transport does not specify a home directory, and
32949 <option>transport_home_directory</option> is not set for the router, the home directory for
32950 the transport is taken from the password data if <option>check_local_user</option> is set for
32951 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
32952 is set; if not, no home directory is set for the transport.
32953 </para>
32954 <para>
32955 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
32956 environment.
32957 </para>
32958 <para>
32959 <indexterm role="option">
32960 <primary><option>unseen</option></primary>
32961 </indexterm>
32962 </para>
32963 <informaltable frame="all">
32964 <tgroup cols="4" colsep="0" rowsep="0">
32965 <colspec colwidth="8*" align="left"/>
32966 <colspec colwidth="6*" align="center"/>
32967 <colspec colwidth="6*" align="center"/>
32968 <colspec colwidth="6*" align="right"/>
32969 <tbody>
32970 <row>
32971 <entry><option>unseen</option></entry>
32972 <entry>Use: <emphasis>routers</emphasis></entry>
32973 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32974 <entry>Default: <emphasis>false</emphasis></entry>
32975 </row>
32976 </tbody>
32977 </tgroup>
32978 </informaltable>
32979 <para>
32980 <indexterm role="concept">
32981 <primary>router</primary>
32982 <secondary>carrying on after success</secondary>
32983 </indexterm>
32984 The result of string expansion for this option must be a valid boolean value,
32985 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32986 result causes an error, and delivery is deferred. If the expansion is forced to
32987 fail, the default value for the option (false) is used. Other failures cause
32988 delivery to be deferred.
32989 </para>
32990 <para>
32991 When this option is set true, routing does not cease if the router accepts the
32992 address. Instead, a copy of the incoming address is passed to the next router,
32993 overriding a false setting of <option>more</option>. There is little point in setting
32994 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
32995 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
32996 sometimes true and sometimes false).
32997 </para>
32998 <para>
32999 <indexterm role="concept">
33000 <primary>copy of message (<option>unseen</option> option)</primary>
33001 </indexterm>
33002 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
33003 qualifier in filter files. It can be used to cause copies of messages to be
33004 delivered to some other destination, while also carrying out a normal delivery.
33005 In effect, the current address is made into a <quote>parent</quote> that has two children
33006 &ndash; one that is delivered as specified by this router, and a clone that goes on
33007 to be routed further. For this reason, <option>unseen</option> may not be combined with the
33008 <option>one_time</option> option in a <command>redirect</command> router.
33009 </para>
33010 <para>
33011 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
33012 this router or by previous routers affect the <quote>unseen</quote> copy of the message
33013 only. The clone that continues to be processed by further routers starts with
33014 no added headers and none specified for removal. For a <option>redirect</option> router, if
33015 a generated address is the same as the incoming address, this can lead to
33016 duplicate addresses with different header modifications. Exim does not do
33017 duplicate deliveries (except, in certain circumstances, to pipes -- see section
33018 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
33019 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
33020 <option>redirect</option> router may be of help.
33021 </para>
33022 <para>
33023 Unlike the handling of header modifications, any data that was set by the
33024 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
33025 subsequent routers.
33026 </para>
33027 <para>
33028 <indexterm role="option">
33029 <primary><option>user</option></primary>
33030 </indexterm>
33031 </para>
33032 <informaltable frame="all">
33033 <tgroup cols="4" colsep="0" rowsep="0">
33034 <colspec colwidth="8*" align="left"/>
33035 <colspec colwidth="6*" align="center"/>
33036 <colspec colwidth="6*" align="center"/>
33037 <colspec colwidth="6*" align="right"/>
33038 <tbody>
33039 <row>
33040 <entry><option>user</option></entry>
33041 <entry>Use: <emphasis>routers</emphasis></entry>
33042 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33043 <entry>Default: <emphasis>see below</emphasis></entry>
33044 </row>
33045 </tbody>
33046 </tgroup>
33047 </informaltable>
33048 <para>
33049 <indexterm role="concept">
33050 <primary>uid (user id)</primary>
33051 <secondary>local delivery</secondary>
33052 </indexterm>
33053 <indexterm role="concept">
33054 <primary>local transports</primary>
33055 <secondary>uid and gid</secondary>
33056 </indexterm>
33057 <indexterm role="concept">
33058 <primary>transport</primary>
33059 <secondary>local</secondary>
33060 </indexterm>
33061 <indexterm role="concept">
33062 <primary>router</primary>
33063 <secondary>user for filter processing</secondary>
33064 </indexterm>
33065 <indexterm role="concept">
33066 <primary>filter</primary>
33067 <secondary>user for processing</secondary>
33068 </indexterm>
33069 When a router queues an address for a transport, and the transport does not
33070 specify a user, the user given here is used when running the delivery process.
33071 The user may be specified numerically or by name. If expansion fails, the
33072 error is logged and delivery is deferred.
33073 This user is also used by the <command>redirect</command> router when running a filter file.
33074 The default is unset, except when <option>check_local_user</option> is set. In this case,
33075 the default is taken from the password information. If the user is specified as
33076 a name, and <option>group</option> is not set, the group associated with the user is used.
33077 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
33078 <xref linkend="CHAPenvironment"/>.
33079 </para>
33080 <para>
33081 <indexterm role="option">
33082 <primary><option>verify</option></primary>
33083 </indexterm>
33084 </para>
33085 <informaltable frame="all">
33086 <tgroup cols="4" colsep="0" rowsep="0">
33087 <colspec colwidth="8*" align="left"/>
33088 <colspec colwidth="6*" align="center"/>
33089 <colspec colwidth="6*" align="center"/>
33090 <colspec colwidth="6*" align="right"/>
33091 <tbody>
33092 <row>
33093 <entry><option>verify</option></entry>
33094 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33095 <entry>Type: <emphasis>boolean</emphasis></entry>
33096 <entry>Default: <emphasis>true</emphasis></entry>
33097 </row>
33098 </tbody>
33099 </tgroup>
33100 </informaltable>
33101 <para>
33102 Setting this option has the effect of setting <option>verify_sender</option> and
33103 <option>verify_recipient</option> to the same value.
33104 </para>
33105 <para>
33106 <indexterm role="option">
33107 <primary><option>verify_only</option></primary>
33108 </indexterm>
33109 </para>
33110 <informaltable frame="all">
33111 <tgroup cols="4" colsep="0" rowsep="0">
33112 <colspec colwidth="8*" align="left"/>
33113 <colspec colwidth="6*" align="center"/>
33114 <colspec colwidth="6*" align="center"/>
33115 <colspec colwidth="6*" align="right"/>
33116 <tbody>
33117 <row>
33118 <entry><option>verify_only</option></entry>
33119 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33120 <entry>Type: <emphasis>boolean</emphasis></entry>
33121 <entry>Default: <emphasis>false</emphasis></entry>
33122 </row>
33123 </tbody>
33124 </tgroup>
33125 </informaltable>
33126 <para>
33127 <indexterm role="concept">
33128 <primary>EXPN</primary>
33129 <secondary>with <option>verify_only</option></secondary>
33130 </indexterm>
33131 <indexterm role="option">
33132 <primary><option>-bv</option></primary>
33133 </indexterm>
33134 <indexterm role="concept">
33135 <primary>router</primary>
33136 <secondary>used only when verifying</secondary>
33137 </indexterm>
33138 If this option is set, the router is used only when verifying an address,
33139 delivering in cutthrough mode or
33140 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
33141 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
33142 restricted to verifying only senders or recipients by means of
33143 <option>verify_sender</option> and <option>verify_recipient</option>.
33144 </para>
33145 <para>
33146 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
33147 SMTP message, Exim is not running as root, but under its own uid. If the router
33148 accesses any files, you need to make sure that they are accessible to the Exim
33149 user or group.
33150 </para>
33151 <para>
33152 <indexterm role="option">
33153 <primary><option>verify_recipient</option></primary>
33154 </indexterm>
33155 </para>
33156 <informaltable frame="all">
33157 <tgroup cols="4" colsep="0" rowsep="0">
33158 <colspec colwidth="8*" align="left"/>
33159 <colspec colwidth="6*" align="center"/>
33160 <colspec colwidth="6*" align="center"/>
33161 <colspec colwidth="6*" align="right"/>
33162 <tbody>
33163 <row>
33164 <entry><option>verify_recipient</option></entry>
33165 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33166 <entry>Type: <emphasis>boolean</emphasis></entry>
33167 <entry>Default: <emphasis>true</emphasis></entry>
33168 </row>
33169 </tbody>
33170 </tgroup>
33171 </informaltable>
33172 <para>
33173 If this option is false, the router is skipped when verifying recipient
33174 addresses,
33175 delivering in cutthrough mode
33176 or testing recipient verification using <option>-bv</option>.
33177 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33178 are evaluated.
33179 See also the <varname>$verify_mode</varname> variable.
33180 </para>
33181 <para>
33182 <indexterm role="option">
33183 <primary><option>verify_sender</option></primary>
33184 </indexterm>
33185 </para>
33186 <informaltable frame="all">
33187 <tgroup cols="4" colsep="0" rowsep="0">
33188 <colspec colwidth="8*" align="left"/>
33189 <colspec colwidth="6*" align="center"/>
33190 <colspec colwidth="6*" align="center"/>
33191 <colspec colwidth="6*" align="right"/>
33192 <tbody>
33193 <row>
33194 <entry><option>verify_sender</option></entry>
33195 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33196 <entry>Type: <emphasis>boolean</emphasis></entry>
33197 <entry>Default: <emphasis>true</emphasis></entry>
33198 </row>
33199 </tbody>
33200 </tgroup>
33201 </informaltable>
33202 <para>
33203 If this option is false, the router is skipped when verifying sender addresses
33204 or testing sender verification using <option>-bvs</option>.
33205 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33206 are evaluated.
33207 See also the <varname>$verify_mode</varname> variable.
33208 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
33209 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
33210 </para>
33211 </chapter>
33212
33213 <chapter id="CHID4">
33214 <title>The accept router</title>
33215 <para>
33216 <indexterm role="concept">
33217 <primary><command>accept</command> router</primary>
33218 </indexterm>
33219 <indexterm role="concept">
33220 <primary>routers</primary>
33221 <secondary><command>accept</command></secondary>
33222 </indexterm>
33223 The <command>accept</command> router has no private options of its own. Unless it is being
33224 used purely for verification (see <option>verify_only</option>) a transport is required to
33225 be defined by the generic <option>transport</option> option. If the preconditions that are
33226 specified by generic options are met, the router accepts the address and queues
33227 it for the given transport. The most common use of this router is for setting
33228 up deliveries to local mailboxes. For example:
33229 </para>
33230 <literallayout class="monospaced">
33231 localusers:
33232   driver = accept
33233   domains = mydomain.example
33234   check_local_user
33235   transport = local_delivery
33236 </literallayout>
33237 <para>
33238 The <option>domains</option> condition in this example checks the domain of the address, and
33239 <option>check_local_user</option> checks that the local part is the login of a local user.
33240 When both preconditions are met, the <command>accept</command> router runs, and queues the
33241 address for the <command>local_delivery</command> transport.
33242 </para>
33243 </chapter>
33244
33245 <chapter id="CHAPdnslookup">
33246 <title>The dnslookup router</title>
33247 <para>
33248 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
33249 <primary><command>dnslookup</command> router</primary>
33250 </indexterm>
33251 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
33252 <primary>routers</primary>
33253 <secondary><command>dnslookup</command></secondary>
33254 </indexterm>
33255 The <command>dnslookup</command> router looks up the hosts that handle mail for the
33256 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
33257 unless <option>verify_only</option> is set.
33258 </para>
33259 <para>
33260 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
33261 SRV records. If none are found, or if SRV support is not configured,
33262 MX records are looked up. If no MX records exist, address records are sought.
33263 However, <option>mx_domains</option> can be set to disable the direct use of address
33264 records.
33265 </para>
33266 <para>
33267 MX records of equal priority are sorted by Exim into a random order. Exim then
33268 looks for address records for the host names obtained from MX or SRV records.
33269 When a host has more than one IP address, they are sorted into a random order,
33270 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
33271 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
33272 generic option, the router declines.
33273 </para>
33274 <para>
33275 Unless they have the highest priority (lowest MX value), MX records that point
33276 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
33277 are discarded, together with any other MX records of equal or lower priority.
33278 </para>
33279 <para>
33280 <indexterm role="concept">
33281 <primary>MX record</primary>
33282 <secondary>pointing to local host</secondary>
33283 </indexterm>
33284 <indexterm role="concept">
33285 <primary>local host</primary>
33286 <secondary>MX pointing to</secondary>
33287 </indexterm>
33288 <indexterm role="option">
33289 <primary><option>self</option></primary>
33290 <secondary>in <command>dnslookup</command> router</secondary>
33291 </indexterm>
33292 If the host pointed to by the highest priority MX record, or looked up as an
33293 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
33294 happens is controlled by the generic <option>self</option> option.
33295 </para>
33296 <section id="SECTprowitdnsloo">
33297 <title>Problems with DNS lookups</title>
33298 <para>
33299 There have been problems with DNS servers when SRV records are looked up.
33300 Some mis-behaving servers return a DNS error or timeout when a non-existent
33301 SRV record is sought. Similar problems have in the past been reported for
33302 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
33303 problem, but it is heavy-handed because it is a global option.
33304 </para>
33305 <para>
33306 For this reason, there are two options, <option>srv_fail_domains</option> and
33307 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
33308 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
33309 an attempt to look up an SRV or MX record causes one of these results, and the
33310 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
33311 such record</quote>. In the case of an SRV lookup, this means that the router
33312 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
33313 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
33314 case routing fails.
33315 </para>
33316 </section>
33317 <section id="SECTdnslookupdecline">
33318 <title>Declining addresses by dnslookup</title>
33319 <para>
33320 <indexterm role="concept">
33321 <primary><command>dnslookup</command> router</primary>
33322 <secondary>declines</secondary>
33323 </indexterm>
33324 There are a few cases where a <command>dnslookup</command> router will decline to accept
33325 an address; if such a router is expected to handle "all remaining non-local
33326 domains", then it is important to set <option>no_more</option>.
33327 </para>
33328 <para>
33329 Reasons for a <command>dnslookup</command> router to decline currently include:
33330 </para>
33331 <itemizedlist>
33332 <listitem>
33333 <para>
33334 The domain does not exist in DNS
33335 </para>
33336 </listitem>
33337 <listitem>
33338 <para>
33339 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
33340 convention (borrowed from SRV) used to indicate that there is no such service
33341 for this domain and to not fall back to trying A/AAAA records.
33342 </para>
33343 </listitem>
33344 <listitem>
33345 <para>
33346 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
33347 </para>
33348 </listitem>
33349 <listitem>
33350 <para>
33351 MX record points to a non-existent host.
33352 </para>
33353 </listitem>
33354 <listitem>
33355 <para>
33356 MX record points to an IP address and the main section option
33357 <option>allow_mx_to_ip</option> is not set.
33358 </para>
33359 </listitem>
33360 <listitem>
33361 <para>
33362 MX records exist and point to valid hosts, but all hosts resolve only to
33363 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
33364 </para>
33365 </listitem>
33366 <listitem>
33367 <para>
33368 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
33369 <option>dns_check_names_pattern</option> for handling one variant of this)
33370 </para>
33371 </listitem>
33372 <listitem>
33373 <para>
33374 <option>check_secondary_mx</option> is set on this router but the local host can
33375 not be found in the MX records (see below)
33376 </para>
33377 </listitem>
33378 </itemizedlist>
33379 </section>
33380 <section id="SECID118">
33381 <title>Private options for dnslookup</title>
33382 <para>
33383 <indexterm role="concept">
33384 <primary>options</primary>
33385 <secondary><command>dnslookup</command> router</secondary>
33386 </indexterm>
33387 The private options for the <command>dnslookup</command> router are as follows:
33388 </para>
33389 <para>
33390 <indexterm role="option">
33391 <primary><option>check_secondary_mx</option></primary>
33392 </indexterm>
33393 </para>
33394 <informaltable frame="all">
33395 <tgroup cols="4" colsep="0" rowsep="0">
33396 <colspec colwidth="8*" align="left"/>
33397 <colspec colwidth="6*" align="center"/>
33398 <colspec colwidth="6*" align="center"/>
33399 <colspec colwidth="6*" align="right"/>
33400 <tbody>
33401 <row>
33402 <entry><option>check_secondary_mx</option></entry>
33403 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33404 <entry>Type: <emphasis>boolean</emphasis></entry>
33405 <entry>Default: <emphasis>false</emphasis></entry>
33406 </row>
33407 </tbody>
33408 </tgroup>
33409 </informaltable>
33410 <para>
33411 <indexterm role="concept">
33412 <primary>MX record</primary>
33413 <secondary>checking for secondary</secondary>
33414 </indexterm>
33415 If this option is set, the router declines unless the local host is found in
33416 (and removed from) the list of hosts obtained by MX lookup. This can be used to
33417 process domains for which the local host is a secondary mail exchanger
33418 differently to other domains. The way in which Exim decides whether a host is
33419 the local host is described in section <xref linkend="SECTreclocipadd"/>.
33420 </para>
33421 <para>
33422 <indexterm role="option">
33423 <primary><option>check_srv</option></primary>
33424 </indexterm>
33425 </para>
33426 <informaltable frame="all">
33427 <tgroup cols="4" colsep="0" rowsep="0">
33428 <colspec colwidth="8*" align="left"/>
33429 <colspec colwidth="6*" align="center"/>
33430 <colspec colwidth="6*" align="center"/>
33431 <colspec colwidth="6*" align="right"/>
33432 <tbody>
33433 <row>
33434 <entry><option>check_srv</option></entry>
33435 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33436 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33437 <entry>Default: <emphasis>unset</emphasis></entry>
33438 </row>
33439 </tbody>
33440 </tgroup>
33441 </informaltable>
33442 <para>
33443 <indexterm role="concept">
33444 <primary>SRV record</primary>
33445 <secondary>enabling use of</secondary>
33446 </indexterm>
33447 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
33448 addition to MX and address records. The support is disabled by default. To
33449 enable SRV support, set the <option>check_srv</option> option to the name of the service
33450 required. For example,
33451 </para>
33452 <literallayout class="monospaced">
33453 check_srv = smtp
33454 </literallayout>
33455 <para>
33456 looks for SRV records that refer to the normal smtp service. The option is
33457 expanded, so the service name can vary from message to message or address
33458 to address. This might be helpful if SRV records are being used for a
33459 submission service. If the expansion is forced to fail, the <option>check_srv</option>
33460 option is ignored, and the router proceeds to look for MX records in the
33461 normal way.
33462 </para>
33463 <para>
33464 When the expansion succeeds, the router searches first for SRV records for
33465 the given service (it assumes TCP protocol). A single SRV record with a
33466 host name that consists of just a single dot indicates <quote>no such service for
33467 this domain</quote>; if this is encountered, the router declines. If other kinds of
33468 SRV record are found, they are used to construct a host list for delivery
33469 according to the rules of RFC 2782. MX records are not sought in this case.
33470 </para>
33471 <para>
33472 When no SRV records are found, MX records (and address records) are sought in
33473 the traditional way. In other words, SRV records take precedence over MX
33474 records, just as MX records take precedence over address records. Note that
33475 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
33476 defined it. It is apparently believed that MX records are sufficient for email
33477 and that SRV records should not be used for this purpose. However, SRV records
33478 have an additional <quote>weight</quote> feature which some people might find useful when
33479 trying to split an SMTP load between hosts of different power.
33480 </para>
33481 <para>
33482 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
33483 when there is a DNS lookup error.
33484 </para>
33485 <para>
33486 <indexterm role="option">
33487 <primary><option>dnssec_request_domains</option></primary>
33488 </indexterm>
33489 </para>
33490 <informaltable frame="all">
33491 <tgroup cols="4" colsep="0" rowsep="0">
33492 <colspec colwidth="8*" align="left"/>
33493 <colspec colwidth="6*" align="center"/>
33494 <colspec colwidth="6*" align="center"/>
33495 <colspec colwidth="6*" align="right"/>
33496 <tbody>
33497 <row>
33498 <entry><option>dnssec_request_domains</option></entry>
33499 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33500 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33501 <entry>Default: <emphasis>unset</emphasis></entry>
33502 </row>
33503 </tbody>
33504 </tgroup>
33505 </informaltable>
33506 <para>
33507 <indexterm role="concept">
33508 <primary>MX record</primary>
33509 <secondary>security</secondary>
33510 </indexterm>
33511 <indexterm role="concept">
33512 <primary>DNSSEC</primary>
33513 <secondary>MX lookup</secondary>
33514 </indexterm>
33515 <indexterm role="concept">
33516 <primary>security</primary>
33517 <secondary>MX lookup</secondary>
33518 </indexterm>
33519 <indexterm role="concept">
33520 <primary>DNS</primary>
33521 <secondary>DNSSEC</secondary>
33522 </indexterm>
33523 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33524 the dnssec request bit set.
33525 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33526 </para>
33527 <para>
33528 <indexterm role="option">
33529 <primary><option>dnssec_require_domains</option></primary>
33530 </indexterm>
33531 </para>
33532 <informaltable frame="all">
33533 <tgroup cols="4" colsep="0" rowsep="0">
33534 <colspec colwidth="8*" align="left"/>
33535 <colspec colwidth="6*" align="center"/>
33536 <colspec colwidth="6*" align="center"/>
33537 <colspec colwidth="6*" align="right"/>
33538 <tbody>
33539 <row>
33540 <entry><option>dnssec_require_domains</option></entry>
33541 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33542 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33543 <entry>Default: <emphasis>unset</emphasis></entry>
33544 </row>
33545 </tbody>
33546 </tgroup>
33547 </informaltable>
33548 <para>
33549 <indexterm role="concept">
33550 <primary>MX record</primary>
33551 <secondary>security</secondary>
33552 </indexterm>
33553 <indexterm role="concept">
33554 <primary>DNSSEC</primary>
33555 <secondary>MX lookup</secondary>
33556 </indexterm>
33557 <indexterm role="concept">
33558 <primary>security</primary>
33559 <secondary>MX lookup</secondary>
33560 </indexterm>
33561 <indexterm role="concept">
33562 <primary>DNS</primary>
33563 <secondary>DNSSEC</secondary>
33564 </indexterm>
33565 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
33566 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33567 (AD bit) set wil be ignored and logged as a host-lookup failure.
33568 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
33569 </para>
33570 <para>
33571 <indexterm role="option">
33572 <primary><option>mx_domains</option></primary>
33573 </indexterm>
33574 </para>
33575 <informaltable frame="all">
33576 <tgroup cols="4" colsep="0" rowsep="0">
33577 <colspec colwidth="8*" align="left"/>
33578 <colspec colwidth="6*" align="center"/>
33579 <colspec colwidth="6*" align="center"/>
33580 <colspec colwidth="6*" align="right"/>
33581 <tbody>
33582 <row>
33583 <entry><option>mx_domains</option></entry>
33584 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33585 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33586 <entry>Default: <emphasis>unset</emphasis></entry>
33587 </row>
33588 </tbody>
33589 </tgroup>
33590 </informaltable>
33591 <para>
33592 <indexterm role="concept">
33593 <primary>MX record</primary>
33594 <secondary>required to exist</secondary>
33595 </indexterm>
33596 <indexterm role="concept">
33597 <primary>SRV record</primary>
33598 <secondary>required to exist</secondary>
33599 </indexterm>
33600 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
33601 record in order to be recognized. (The name of this option could be improved.)
33602 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
33603 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
33604 setting:
33605 </para>
33606 <literallayout class="monospaced">
33607 mx_domains = ! *.discworld.fict.example : *.fict.example
33608 </literallayout>
33609 <para>
33610 This specifies that messages addressed to a domain that matches the list but
33611 has no MX record should be bounced immediately instead of being routed using
33612 the address record.
33613 </para>
33614 <para>
33615 <indexterm role="option">
33616 <primary><option>mx_fail_domains</option></primary>
33617 </indexterm>
33618 </para>
33619 <informaltable frame="all">
33620 <tgroup cols="4" colsep="0" rowsep="0">
33621 <colspec colwidth="8*" align="left"/>
33622 <colspec colwidth="6*" align="center"/>
33623 <colspec colwidth="6*" align="center"/>
33624 <colspec colwidth="6*" align="right"/>
33625 <tbody>
33626 <row>
33627 <entry><option>mx_fail_domains</option></entry>
33628 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33629 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33630 <entry>Default: <emphasis>unset</emphasis></entry>
33631 </row>
33632 </tbody>
33633 </tgroup>
33634 </informaltable>
33635 <para>
33636 If the DNS lookup for MX records for one of the domains in this list causes a
33637 DNS lookup error, Exim behaves as if no MX records were found. See section
33638 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33639 </para>
33640 <para>
33641 <indexterm role="option">
33642 <primary><option>qualify_single</option></primary>
33643 </indexterm>
33644 </para>
33645 <informaltable frame="all">
33646 <tgroup cols="4" colsep="0" rowsep="0">
33647 <colspec colwidth="8*" align="left"/>
33648 <colspec colwidth="6*" align="center"/>
33649 <colspec colwidth="6*" align="center"/>
33650 <colspec colwidth="6*" align="right"/>
33651 <tbody>
33652 <row>
33653 <entry><option>qualify_single</option></entry>
33654 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33655 <entry>Type: <emphasis>boolean</emphasis></entry>
33656 <entry>Default: <emphasis>true</emphasis></entry>
33657 </row>
33658 </tbody>
33659 </tgroup>
33660 </informaltable>
33661 <para>
33662 <indexterm role="concept">
33663 <primary>DNS</primary>
33664 <secondary>resolver options</secondary>
33665 </indexterm>
33666 <indexterm role="concept">
33667 <primary>DNS</primary>
33668 <secondary>qualifying single-component names</secondary>
33669 </indexterm>
33670 When this option is true, the resolver option RES_DEFNAMES is set for DNS
33671 lookups. Typically, but not standardly, this causes the resolver to qualify
33672 single-component names with the default domain. For example, on a machine
33673 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
33674 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
33675 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
33676 <emphasis>resolv.conf</emphasis>.
33677 </para>
33678 <para>
33679 <indexterm role="option">
33680 <primary><option>rewrite_headers</option></primary>
33681 </indexterm>
33682 </para>
33683 <informaltable frame="all">
33684 <tgroup cols="4" colsep="0" rowsep="0">
33685 <colspec colwidth="8*" align="left"/>
33686 <colspec colwidth="6*" align="center"/>
33687 <colspec colwidth="6*" align="center"/>
33688 <colspec colwidth="6*" align="right"/>
33689 <tbody>
33690 <row>
33691 <entry><option>rewrite_headers</option></entry>
33692 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33693 <entry>Type: <emphasis>boolean</emphasis></entry>
33694 <entry>Default: <emphasis>true</emphasis></entry>
33695 </row>
33696 </tbody>
33697 </tgroup>
33698 </informaltable>
33699 <para>
33700 <indexterm role="concept">
33701 <primary>rewriting</primary>
33702 <secondary>header lines</secondary>
33703 </indexterm>
33704 <indexterm role="concept">
33705 <primary>header lines</primary>
33706 <secondary>rewriting</secondary>
33707 </indexterm>
33708 If the domain name in the address that is being processed is not fully
33709 qualified, it may be expanded to its full form by a DNS lookup. For example, if
33710 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
33711 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
33712 occur as a result of setting the <option>widen_domains</option> option. If
33713 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
33714 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
33715 header lines of the message are rewritten with the full domain name.
33716 </para>
33717 <para>
33718 This option should be turned off only when it is known that no message is
33719 ever going to be sent outside an environment where the abbreviation makes
33720 sense.
33721 </para>
33722 <para>
33723 When an MX record is looked up in the DNS and matches a wildcard record, name
33724 servers normally return a record containing the name that has been looked up,
33725 making it impossible to detect whether a wildcard was present or not. However,
33726 some name servers have recently been seen to return the wildcard entry. If the
33727 name returned by a DNS lookup begins with an asterisk, it is not used for
33728 header rewriting.
33729 </para>
33730 <para>
33731 <indexterm role="option">
33732 <primary><option>same_domain_copy_routing</option></primary>
33733 </indexterm>
33734 </para>
33735 <informaltable frame="all">
33736 <tgroup cols="4" colsep="0" rowsep="0">
33737 <colspec colwidth="8*" align="left"/>
33738 <colspec colwidth="6*" align="center"/>
33739 <colspec colwidth="6*" align="center"/>
33740 <colspec colwidth="6*" align="right"/>
33741 <tbody>
33742 <row>
33743 <entry><option>same_domain_copy_routing</option></entry>
33744 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33745 <entry>Type: <emphasis>boolean</emphasis></entry>
33746 <entry>Default: <emphasis>false</emphasis></entry>
33747 </row>
33748 </tbody>
33749 </tgroup>
33750 </informaltable>
33751 <para>
33752 <indexterm role="concept">
33753 <primary>address</primary>
33754 <secondary>copying routing</secondary>
33755 </indexterm>
33756 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
33757 to the same list of hosts. However, this cannot be presumed, because the router
33758 options and preconditions may refer to the local part of the address. By
33759 default, therefore, Exim routes each address in a message independently. DNS
33760 servers run caches, so repeated DNS lookups are not normally expensive, and in
33761 any case, personal messages rarely have more than a few recipients.
33762 </para>
33763 <para>
33764 If you are running mailing lists with large numbers of subscribers at the same
33765 domain, and you are using a <command>dnslookup</command> router which is independent of the
33766 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33767 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
33768 routes an address to a remote transport, any other unrouted addresses in the
33769 message that have the same domain are automatically given the same routing
33770 without processing them independently,
33771 provided the following conditions are met:
33772 </para>
33773 <itemizedlist>
33774 <listitem>
33775 <para>
33776 No router that processed the address specified <option>headers_add</option> or
33777 <option>headers_remove</option>.
33778 </para>
33779 </listitem>
33780 <listitem>
33781 <para>
33782 The router did not change the address in any way, for example, by <quote>widening</quote>
33783 the domain.
33784 </para>
33785 </listitem>
33786 </itemizedlist>
33787 <para>
33788 <indexterm role="option">
33789 <primary><option>search_parents</option></primary>
33790 </indexterm>
33791 </para>
33792 <informaltable frame="all">
33793 <tgroup cols="4" colsep="0" rowsep="0">
33794 <colspec colwidth="8*" align="left"/>
33795 <colspec colwidth="6*" align="center"/>
33796 <colspec colwidth="6*" align="center"/>
33797 <colspec colwidth="6*" align="right"/>
33798 <tbody>
33799 <row>
33800 <entry><option>search_parents</option></entry>
33801 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33802 <entry>Type: <emphasis>boolean</emphasis></entry>
33803 <entry>Default: <emphasis>false</emphasis></entry>
33804 </row>
33805 </tbody>
33806 </tgroup>
33807 </informaltable>
33808 <para>
33809 <indexterm role="concept">
33810 <primary>DNS</primary>
33811 <secondary>resolver options</secondary>
33812 </indexterm>
33813 When this option is true, the resolver option RES_DNSRCH is set for DNS
33814 lookups. This is different from the <option>qualify_single</option> option in that it
33815 applies to domains containing dots. Typically, but not standardly, it causes
33816 the resolver to search for the name in the current domain and in parent
33817 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
33818 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
33819 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
33820 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
33821 </para>
33822 <para>
33823 Setting this option true can cause problems in domains that have a wildcard MX
33824 record, because any domain that does not have its own MX record matches the
33825 local wildcard.
33826 </para>
33827 <para>
33828 <indexterm role="option">
33829 <primary><option>srv_fail_domains</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>srv_fail_domains</option></entry>
33841 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33842 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33843 <entry>Default: <emphasis>unset</emphasis></entry>
33844 </row>
33845 </tbody>
33846 </tgroup>
33847 </informaltable>
33848 <para>
33849 If the DNS lookup for SRV records for one of the domains in this list causes a
33850 DNS lookup error, Exim behaves as if no SRV records were found. See section
33851 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33852 </para>
33853 <para>
33854 <indexterm role="option">
33855 <primary><option>widen_domains</option></primary>
33856 </indexterm>
33857 </para>
33858 <informaltable frame="all">
33859 <tgroup cols="4" colsep="0" rowsep="0">
33860 <colspec colwidth="8*" align="left"/>
33861 <colspec colwidth="6*" align="center"/>
33862 <colspec colwidth="6*" align="center"/>
33863 <colspec colwidth="6*" align="right"/>
33864 <tbody>
33865 <row>
33866 <entry><option>widen_domains</option></entry>
33867 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33868 <entry>Type: <emphasis>string list</emphasis></entry>
33869 <entry>Default: <emphasis>unset</emphasis></entry>
33870 </row>
33871 </tbody>
33872 </tgroup>
33873 </informaltable>
33874 <para>
33875 <indexterm role="concept">
33876 <primary>domain</primary>
33877 <secondary>partial; widening</secondary>
33878 </indexterm>
33879 If a DNS lookup fails and this option is set, each of its strings in turn is
33880 added onto the end of the domain, and the lookup is tried again. For example,
33881 if
33882 </para>
33883 <literallayout class="monospaced">
33884 widen_domains = fict.example:ref.example
33885 </literallayout>
33886 <para>
33887 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
33888 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
33889 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
33890 and <option>search_parents</option> options can cause some widening to be undertaken inside
33891 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
33892 when verifying, unless <option>rewrite_headers</option> is false (not the default).
33893 </para>
33894 </section>
33895 <section id="SECID119">
33896 <title>Effect of qualify_single and search_parents</title>
33897 <para>
33898 When a domain from an envelope recipient is changed by the resolver as a result
33899 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
33900 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
33901 is set false. Exim then re-routes the address, using the full domain.
33902 </para>
33903 <para>
33904 These two options affect only the DNS lookup that takes place inside the router
33905 for the domain of the address that is being routed. They do not affect lookups
33906 such as that implied by
33907 </para>
33908 <literallayout class="monospaced">
33909 domains = @mx_any
33910 </literallayout>
33911 <para>
33912 that may happen while processing a router precondition before the router is
33913 entered. No widening ever takes place for these lookups.
33914 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
33915 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
33916 </para>
33917 </section>
33918 </chapter>
33919
33920 <chapter id="CHID5">
33921 <title>The ipliteral router</title>
33922 <para>
33923 <indexterm role="concept">
33924 <primary><command>ipliteral</command> router</primary>
33925 </indexterm>
33926 <indexterm role="concept">
33927 <primary>domain literal</primary>
33928 <secondary>routing</secondary>
33929 </indexterm>
33930 <indexterm role="concept">
33931 <primary>routers</primary>
33932 <secondary><command>ipliteral</command></secondary>
33933 </indexterm>
33934 This router has no private options. Unless it is being used purely for
33935 verification (see <option>verify_only</option>) a transport is required to be defined by the
33936 generic <option>transport</option> option. The router accepts the address if its domain part
33937 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
33938 router handles the address
33939 </para>
33940 <literallayout class="monospaced">
33941 root@[192.168.1.1]
33942 </literallayout>
33943 <para>
33944 by setting up delivery to the host with that IP address. IPv4 domain literals
33945 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
33946 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
33947 </para>
33948 <literallayout class="monospaced">
33949 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
33950 </literallayout>
33951 <para>
33952 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
33953 grounds that sooner or later somebody will try it.
33954 </para>
33955 <para>
33956 <indexterm role="option">
33957 <primary><option>self</option></primary>
33958 <secondary>in <command>ipliteral</command> router</secondary>
33959 </indexterm>
33960 If the IP address matches something in <option>ignore_target_hosts</option>, the router
33961 declines. If an IP literal turns out to refer to the local host, the generic
33962 <option>self</option> option determines what happens.
33963 </para>
33964 <para>
33965 The RFCs require support for domain literals; however, their use is
33966 controversial in today&#x2019;s Internet. If you want to use this router, you must
33967 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
33968 Exim will not recognize the domain literal syntax in addresses.
33969 </para>
33970 </chapter>
33971
33972 <chapter id="CHID6">
33973 <title>The iplookup router</title>
33974 <para>
33975 <indexterm role="concept">
33976 <primary><command>iplookup</command> router</primary>
33977 </indexterm>
33978 <indexterm role="concept">
33979 <primary>routers</primary>
33980 <secondary><command>iplookup</command></secondary>
33981 </indexterm>
33982 The <command>iplookup</command> router was written to fulfil a specific requirement in
33983 Cambridge University (which in fact no longer exists). For this reason, it is
33984 not included in the binary of Exim by default. If you want to include it, you
33985 must set
33986 </para>
33987 <literallayout class="monospaced">
33988 ROUTER_IPLOOKUP=yes
33989 </literallayout>
33990 <para>
33991 in your <filename>Local/Makefile</filename> configuration file.
33992 </para>
33993 <para>
33994 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
33995 connection to one or more specific hosts. The host can then return the same or
33996 a different address &ndash; in effect rewriting the recipient address in the
33997 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
33998 this process fails, the address can be passed on to other routers, or delivery
33999 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
34000 must not be specified for it.
34001 </para>
34002 <para>
34003 <indexterm role="concept">
34004 <primary>options</primary>
34005 <secondary><command>iplookup</command> router</secondary>
34006 </indexterm>
34007 <indexterm role="option">
34008 <primary><option>hosts</option></primary>
34009 </indexterm>
34010 </para>
34011 <informaltable frame="all">
34012 <tgroup cols="4" colsep="0" rowsep="0">
34013 <colspec colwidth="8*" align="left"/>
34014 <colspec colwidth="6*" align="center"/>
34015 <colspec colwidth="6*" align="center"/>
34016 <colspec colwidth="6*" align="right"/>
34017 <tbody>
34018 <row>
34019 <entry><option>hosts</option></entry>
34020 <entry>Use: <emphasis>iplookup</emphasis></entry>
34021 <entry>Type: <emphasis>string</emphasis></entry>
34022 <entry>Default: <emphasis>unset</emphasis></entry>
34023 </row>
34024 </tbody>
34025 </tgroup>
34026 </informaltable>
34027 <para>
34028 This option must be supplied. Its value is a colon-separated list of host
34029 names. The hosts are looked up using <function>gethostbyname()</function>
34030 (or <function>getipnodebyname()</function> when available)
34031 and are tried in order until one responds to the query. If none respond, what
34032 happens is controlled by <option>optional</option>.
34033 </para>
34034 <para>
34035 <indexterm role="option">
34036 <primary><option>optional</option></primary>
34037 </indexterm>
34038 </para>
34039 <informaltable frame="all">
34040 <tgroup cols="4" colsep="0" rowsep="0">
34041 <colspec colwidth="8*" align="left"/>
34042 <colspec colwidth="6*" align="center"/>
34043 <colspec colwidth="6*" align="center"/>
34044 <colspec colwidth="6*" align="right"/>
34045 <tbody>
34046 <row>
34047 <entry><option>optional</option></entry>
34048 <entry>Use: <emphasis>iplookup</emphasis></entry>
34049 <entry>Type: <emphasis>boolean</emphasis></entry>
34050 <entry>Default: <emphasis>false</emphasis></entry>
34051 </row>
34052 </tbody>
34053 </tgroup>
34054 </informaltable>
34055 <para>
34056 If <option>optional</option> is true, if no response is obtained from any host, the address
34057 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
34058 delivery to the address is deferred.
34059 </para>
34060 <para>
34061 <indexterm role="option">
34062 <primary><option>port</option></primary>
34063 </indexterm>
34064 </para>
34065 <informaltable frame="all">
34066 <tgroup cols="4" colsep="0" rowsep="0">
34067 <colspec colwidth="8*" align="left"/>
34068 <colspec colwidth="6*" align="center"/>
34069 <colspec colwidth="6*" align="center"/>
34070 <colspec colwidth="6*" align="right"/>
34071 <tbody>
34072 <row>
34073 <entry><option>port</option></entry>
34074 <entry>Use: <emphasis>iplookup</emphasis></entry>
34075 <entry>Type: <emphasis>integer</emphasis></entry>
34076 <entry>Default: <emphasis>0</emphasis></entry>
34077 </row>
34078 </tbody>
34079 </tgroup>
34080 </informaltable>
34081 <para>
34082 <indexterm role="concept">
34083 <primary>port</primary>
34084 <secondary><command>iplookup</command> router</secondary>
34085 </indexterm>
34086 This option must be supplied. It specifies the port number for the TCP or UDP
34087 call.
34088 </para>
34089 <para>
34090 <indexterm role="option">
34091 <primary><option>protocol</option></primary>
34092 </indexterm>
34093 </para>
34094 <informaltable frame="all">
34095 <tgroup cols="4" colsep="0" rowsep="0">
34096 <colspec colwidth="8*" align="left"/>
34097 <colspec colwidth="6*" align="center"/>
34098 <colspec colwidth="6*" align="center"/>
34099 <colspec colwidth="6*" align="right"/>
34100 <tbody>
34101 <row>
34102 <entry><option>protocol</option></entry>
34103 <entry>Use: <emphasis>iplookup</emphasis></entry>
34104 <entry>Type: <emphasis>string</emphasis></entry>
34105 <entry>Default: <emphasis>udp</emphasis></entry>
34106 </row>
34107 </tbody>
34108 </tgroup>
34109 </informaltable>
34110 <para>
34111 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
34112 protocols is to be used.
34113 </para>
34114 <para>
34115 <indexterm role="option">
34116 <primary><option>query</option></primary>
34117 </indexterm>
34118 </para>
34119 <informaltable frame="all">
34120 <tgroup cols="4" colsep="0" rowsep="0">
34121 <colspec colwidth="8*" align="left"/>
34122 <colspec colwidth="6*" align="center"/>
34123 <colspec colwidth="6*" align="center"/>
34124 <colspec colwidth="6*" align="right"/>
34125 <tbody>
34126 <row>
34127 <entry><option>query</option></entry>
34128 <entry>Use: <emphasis>iplookup</emphasis></entry>
34129 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34130 <entry>Default: <emphasis>see below</emphasis></entry>
34131 </row>
34132 </tbody>
34133 </tgroup>
34134 </informaltable>
34135 <para>
34136 This defines the content of the query that is sent to the remote hosts. The
34137 default value is:
34138 </para>
34139 <literallayout class="monospaced">
34140 $local_part@$domain $local_part@$domain
34141 </literallayout>
34142 <para>
34143 The repetition serves as a way of checking that a response is to the correct
34144 query in the default case (see <option>response_pattern</option> below).
34145 </para>
34146 <para>
34147 <indexterm role="option">
34148 <primary><option>reroute</option></primary>
34149 </indexterm>
34150 </para>
34151 <informaltable frame="all">
34152 <tgroup cols="4" colsep="0" rowsep="0">
34153 <colspec colwidth="8*" align="left"/>
34154 <colspec colwidth="6*" align="center"/>
34155 <colspec colwidth="6*" align="center"/>
34156 <colspec colwidth="6*" align="right"/>
34157 <tbody>
34158 <row>
34159 <entry><option>reroute</option></entry>
34160 <entry>Use: <emphasis>iplookup</emphasis></entry>
34161 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34162 <entry>Default: <emphasis>unset</emphasis></entry>
34163 </row>
34164 </tbody>
34165 </tgroup>
34166 </informaltable>
34167 <para>
34168 If this option is not set, the rerouted address is precisely the byte string
34169 returned by the remote host, up to the first white space, if any. If set, the
34170 string is expanded to form the rerouted address. It can include parts matched
34171 in the response by <option>response_pattern</option> by means of numeric variables such as
34172 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
34173 whether or not a pattern is in use. In all cases, the rerouted address must end
34174 up in the form <emphasis>local_part@domain</emphasis>.
34175 </para>
34176 <para>
34177 <indexterm role="option">
34178 <primary><option>response_pattern</option></primary>
34179 </indexterm>
34180 </para>
34181 <informaltable frame="all">
34182 <tgroup cols="4" colsep="0" rowsep="0">
34183 <colspec colwidth="8*" align="left"/>
34184 <colspec colwidth="6*" align="center"/>
34185 <colspec colwidth="6*" align="center"/>
34186 <colspec colwidth="6*" align="right"/>
34187 <tbody>
34188 <row>
34189 <entry><option>response_pattern</option></entry>
34190 <entry>Use: <emphasis>iplookup</emphasis></entry>
34191 <entry>Type: <emphasis>string</emphasis></entry>
34192 <entry>Default: <emphasis>unset</emphasis></entry>
34193 </row>
34194 </tbody>
34195 </tgroup>
34196 </informaltable>
34197 <para>
34198 This option can be set to a regular expression that is applied to the string
34199 returned from the remote host. If the pattern does not match the response, the
34200 router declines. If <option>response_pattern</option> is not set, no checking of the
34201 response is done, unless the query was defaulted, in which case there is a
34202 check that the text returned after the first white space is the original
34203 address. This checks that the answer that has been received is in response to
34204 the correct question. For example, if the response is just a new domain, the
34205 following could be used:
34206 </para>
34207 <literallayout class="monospaced">
34208 response_pattern = ^([^@]+)$
34209 reroute = $local_part@$1
34210 </literallayout>
34211 <para>
34212 <indexterm role="option">
34213 <primary><option>timeout</option></primary>
34214 </indexterm>
34215 </para>
34216 <informaltable frame="all">
34217 <tgroup cols="4" colsep="0" rowsep="0">
34218 <colspec colwidth="8*" align="left"/>
34219 <colspec colwidth="6*" align="center"/>
34220 <colspec colwidth="6*" align="center"/>
34221 <colspec colwidth="6*" align="right"/>
34222 <tbody>
34223 <row>
34224 <entry><option>timeout</option></entry>
34225 <entry>Use: <emphasis>iplookup</emphasis></entry>
34226 <entry>Type: <emphasis>time</emphasis></entry>
34227 <entry>Default: <emphasis>5s</emphasis></entry>
34228 </row>
34229 </tbody>
34230 </tgroup>
34231 </informaltable>
34232 <para>
34233 This specifies the amount of time to wait for a response from the remote
34234 machine. The same timeout is used for the <function>connect()</function> function for a TCP
34235 call. It does not apply to UDP.
34236 </para>
34237 </chapter>
34238
34239 <chapter id="CHID7">
34240 <title>The manualroute router</title>
34241 <para>
34242 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
34243 <primary><command>manualroute</command> router</primary>
34244 </indexterm>
34245 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
34246 <primary>routers</primary>
34247 <secondary><command>manualroute</command></secondary>
34248 </indexterm>
34249 <indexterm role="concept">
34250 <primary>domain</primary>
34251 <secondary>manually routing</secondary>
34252 </indexterm>
34253 The <command>manualroute</command> router is so-called because it provides a way of manually
34254 routing an address according to its domain. It is mainly used when you want to
34255 route addresses to remote hosts according to your own rules, bypassing the
34256 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
34257 route to local transports, a facility that may be useful if you want to save
34258 messages for dial-in hosts in local files.
34259 </para>
34260 <para>
34261 The <command>manualroute</command> router compares a list of domain patterns with the domain
34262 it is trying to route. If there is no match, the router declines. Each pattern
34263 has associated with it a list of hosts and some other optional data, which may
34264 include a transport. The combination of a pattern and its data is called a
34265 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
34266 generic <option>transport</option> option must specify a transport, unless the router is
34267 being used purely for verification (see <option>verify_only</option>).
34268 </para>
34269 <para>
34270 <indexterm role="variable">
34271 <primary><varname>$host</varname></primary>
34272 </indexterm>
34273 In the case of verification, matching the domain pattern is sufficient for the
34274 router to accept the address. When actually routing an address for delivery,
34275 an address that matches a domain pattern is queued for the associated
34276 transport. If the transport is not a local one, a host list must be associated
34277 with the pattern; IP addresses are looked up for the hosts, and these are
34278 passed to the transport along with the mail address. For local transports, a
34279 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
34280 text string.
34281 </para>
34282 <para>
34283 The list of routing rules can be provided as an inline string in
34284 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
34285 or database by setting <option>route_data</option>. Only one of these settings may appear in
34286 any one instance of <command>manualroute</command>. The format of routing rules is described
34287 below, following the list of private options.
34288 </para>
34289 <section id="SECTprioptman">
34290 <title>Private options for manualroute</title>
34291 <para>
34292 <indexterm role="concept">
34293 <primary>options</primary>
34294 <secondary><command>manualroute</command> router</secondary>
34295 </indexterm>
34296 The private options for the <command>manualroute</command> router are as follows:
34297 </para>
34298 <para>
34299 <indexterm role="option">
34300 <primary><option>host_all_ignored</option></primary>
34301 </indexterm>
34302 </para>
34303 <informaltable frame="all">
34304 <tgroup cols="4" colsep="0" rowsep="0">
34305 <colspec colwidth="8*" align="left"/>
34306 <colspec colwidth="6*" align="center"/>
34307 <colspec colwidth="6*" align="center"/>
34308 <colspec colwidth="6*" align="right"/>
34309 <tbody>
34310 <row>
34311 <entry><option>host_all_ignored</option></entry>
34312 <entry>Use: <emphasis>manualroute</emphasis></entry>
34313 <entry>Type: <emphasis>string</emphasis></entry>
34314 <entry>Default: <emphasis>defer</emphasis></entry>
34315 </row>
34316 </tbody>
34317 </tgroup>
34318 </informaltable>
34319 <para>
34320 See <option>host_find_failed</option>.
34321 </para>
34322 <para>
34323 <indexterm role="option">
34324 <primary><option>host_find_failed</option></primary>
34325 </indexterm>
34326 </para>
34327 <informaltable frame="all">
34328 <tgroup cols="4" colsep="0" rowsep="0">
34329 <colspec colwidth="8*" align="left"/>
34330 <colspec colwidth="6*" align="center"/>
34331 <colspec colwidth="6*" align="center"/>
34332 <colspec colwidth="6*" align="right"/>
34333 <tbody>
34334 <row>
34335 <entry><option>host_find_failed</option></entry>
34336 <entry>Use: <emphasis>manualroute</emphasis></entry>
34337 <entry>Type: <emphasis>string</emphasis></entry>
34338 <entry>Default: <emphasis>freeze</emphasis></entry>
34339 </row>
34340 </tbody>
34341 </tgroup>
34342 </informaltable>
34343 <para>
34344 This option controls what happens when <command>manualroute</command> tries to find an IP
34345 address for a host, and the host does not exist. The option can be set to one
34346 of the following values:
34347 </para>
34348 <literallayout class="monospaced">
34349 decline
34350 defer
34351 fail
34352 freeze
34353 ignore
34354 pass
34355 </literallayout>
34356 <para>
34357 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
34358 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
34359 forces the address to be passed to the next router (or the router defined by
34360 <option>pass_router</option>),
34361 <indexterm role="option">
34362 <primary><option>more</option></primary>
34363 </indexterm>
34364 overriding <option>no_more</option>, whereas the latter passes the address to the next
34365 router only if <option>more</option> is true.
34366 </para>
34367 <para>
34368 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
34369 cannot be found. If all the hosts in the list are ignored, the behaviour is
34370 controlled by the <option>host_all_ignored</option> option. This takes the same values
34371 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
34372 </para>
34373 <para>
34374 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
34375 state; if a host lookup gets a temporary error, delivery is deferred unless the
34376 generic <option>pass_on_timeout</option> option is set.
34377 </para>
34378 <para>
34379 <indexterm role="option">
34380 <primary><option>hosts_randomize</option></primary>
34381 </indexterm>
34382 </para>
34383 <informaltable frame="all">
34384 <tgroup cols="4" colsep="0" rowsep="0">
34385 <colspec colwidth="8*" align="left"/>
34386 <colspec colwidth="6*" align="center"/>
34387 <colspec colwidth="6*" align="center"/>
34388 <colspec colwidth="6*" align="right"/>
34389 <tbody>
34390 <row>
34391 <entry><option>hosts_randomize</option></entry>
34392 <entry>Use: <emphasis>manualroute</emphasis></entry>
34393 <entry>Type: <emphasis>boolean</emphasis></entry>
34394 <entry>Default: <emphasis>false</emphasis></entry>
34395 </row>
34396 </tbody>
34397 </tgroup>
34398 </informaltable>
34399 <para>
34400 <indexterm role="concept">
34401 <primary>randomized host list</primary>
34402 </indexterm>
34403 <indexterm role="concept">
34404 <primary>host</primary>
34405 <secondary>list of; randomized</secondary>
34406 </indexterm>
34407 If this option is set, the order of the items in a host list in a routing rule
34408 is randomized each time the list is used, unless an option in the routing rule
34409 overrides (see below). Randomizing the order of a host list can be used to do
34410 crude load sharing. However, if more than one mail address is routed by the
34411 same router to the same host list, the host lists are considered to be the same
34412 (even though they may be randomized into different orders) for the purpose of
34413 deciding whether to batch the deliveries into a single SMTP transaction.
34414 </para>
34415 <para>
34416 When <option>hosts_randomize</option> is true, a host list may be split
34417 into groups whose order is separately randomized. This makes it possible to
34418 set up MX-like behaviour. The boundaries between groups are indicated by an
34419 item that is just <literal>+</literal> in the host list. For example:
34420 </para>
34421 <literallayout class="monospaced">
34422 route_list = * host1:host2:host3:+:host4:host5
34423 </literallayout>
34424 <para>
34425 The order of the first three hosts and the order of the last two hosts is
34426 randomized for each use, but the first three always end up before the last two.
34427 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
34428 randomized host list is passed to an <command>smtp</command> transport that also has
34429 <option>hosts_randomize set</option>, the list is not re-randomized.
34430 </para>
34431 <para>
34432 <indexterm role="option">
34433 <primary><option>route_data</option></primary>
34434 </indexterm>
34435 </para>
34436 <informaltable frame="all">
34437 <tgroup cols="4" colsep="0" rowsep="0">
34438 <colspec colwidth="8*" align="left"/>
34439 <colspec colwidth="6*" align="center"/>
34440 <colspec colwidth="6*" align="center"/>
34441 <colspec colwidth="6*" align="right"/>
34442 <tbody>
34443 <row>
34444 <entry><option>route_data</option></entry>
34445 <entry>Use: <emphasis>manualroute</emphasis></entry>
34446 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34447 <entry>Default: <emphasis>unset</emphasis></entry>
34448 </row>
34449 </tbody>
34450 </tgroup>
34451 </informaltable>
34452 <para>
34453 If this option is set, it must expand to yield the data part of a routing rule.
34454 Typically, the expansion string includes a lookup based on the domain. For
34455 example:
34456 </para>
34457 <literallayout class="monospaced">
34458 route_data = ${lookup{$domain}dbm{/etc/routes}}
34459 </literallayout>
34460 <para>
34461 If the expansion is forced to fail, or the result is an empty string, the
34462 router declines. Other kinds of expansion failure cause delivery to be
34463 deferred.
34464 </para>
34465 <para>
34466 <indexterm role="option">
34467 <primary><option>route_list</option></primary>
34468 </indexterm>
34469 </para>
34470 <informaltable frame="all">
34471 <tgroup cols="4" colsep="0" rowsep="0">
34472 <colspec colwidth="8*" align="left"/>
34473 <colspec colwidth="6*" align="center"/>
34474 <colspec colwidth="6*" align="center"/>
34475 <colspec colwidth="6*" align="right"/>
34476 <tbody>
34477 <row>
34478 <entry><option>route_list</option></entry>
34479 <entry>Use: <emphasis>manualroute</emphasis></entry>
34480 <entry>Type: <emphasis>string list</emphasis></entry>
34481 <entry>Default: <emphasis>unset</emphasis></entry>
34482 </row>
34483 </tbody>
34484 </tgroup>
34485 </informaltable>
34486 <para>
34487 This string is a list of routing rules, in the form defined below. Note that,
34488 unlike most string lists, the items are separated by semicolons. This is so
34489 that they may contain colon-separated host lists.
34490 </para>
34491 <para>
34492 <indexterm role="option">
34493 <primary><option>same_domain_copy_routing</option></primary>
34494 </indexterm>
34495 </para>
34496 <informaltable frame="all">
34497 <tgroup cols="4" colsep="0" rowsep="0">
34498 <colspec colwidth="8*" align="left"/>
34499 <colspec colwidth="6*" align="center"/>
34500 <colspec colwidth="6*" align="center"/>
34501 <colspec colwidth="6*" align="right"/>
34502 <tbody>
34503 <row>
34504 <entry><option>same_domain_copy_routing</option></entry>
34505 <entry>Use: <emphasis>manualroute</emphasis></entry>
34506 <entry>Type: <emphasis>boolean</emphasis></entry>
34507 <entry>Default: <emphasis>false</emphasis></entry>
34508 </row>
34509 </tbody>
34510 </tgroup>
34511 </informaltable>
34512 <para>
34513 <indexterm role="concept">
34514 <primary>address</primary>
34515 <secondary>copying routing</secondary>
34516 </indexterm>
34517 Addresses with the same domain are normally routed by the <command>manualroute</command>
34518 router to the same list of hosts. However, this cannot be presumed, because the
34519 router options and preconditions may refer to the local part of the address. By
34520 default, therefore, Exim routes each address in a message independently. DNS
34521 servers run caches, so repeated DNS lookups are not normally expensive, and in
34522 any case, personal messages rarely have more than a few recipients.
34523 </para>
34524 <para>
34525 If you are running mailing lists with large numbers of subscribers at the same
34526 domain, and you are using a <command>manualroute</command> router which is independent of the
34527 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
34528 lookups for identical domains in one message. In this case, when
34529 <command>manualroute</command> routes an address to a remote transport, any other unrouted
34530 addresses in the message that have the same domain are automatically given the
34531 same routing without processing them independently. However, this is only done
34532 if <option>headers_add</option> and <option>headers_remove</option> are unset.
34533 </para>
34534 </section>
34535 <section id="SECID120">
34536 <title>Routing rules in route_list</title>
34537 <para>
34538 The value of <option>route_list</option> is a string consisting of a sequence of routing
34539 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
34540 entered as two semicolons. Alternatively, the list separator can be changed as
34541 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
34542 Empty rules are ignored. The format of each rule is
34543 </para>
34544 <literallayout>
34545 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
34546 </literallayout>
34547 <para>
34548 The following example contains two rules, each with a simple domain pattern and
34549 no options:
34550 </para>
34551 <literallayout class="monospaced">
34552 route_list = \
34553   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
34554   thes.ref.example  mail-3.ref.example:mail-4.ref.example
34555 </literallayout>
34556 <para>
34557 The three parts of a rule are separated by white space. The pattern and the
34558 list of hosts can be enclosed in quotes if necessary, and if they are, the
34559 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
34560 single domain pattern, which is the only mandatory item in the rule. The
34561 pattern is in the same format as one item in a domain list (see section
34562 <xref linkend="SECTdomainlist"/>),
34563 except that it may not be the name of an interpolated file.
34564 That is, it may be wildcarded, or a regular expression, or a file or database
34565 lookup (with semicolons doubled, because of the use of semicolon as a separator
34566 in a <option>route_list</option>).
34567 </para>
34568 <para>
34569 The rules in <option>route_list</option> are searched in order until one of the patterns
34570 matches the domain that is being routed. The list of hosts and then options are
34571 then used as described below. If there is no match, the router declines. When
34572 <option>route_list</option> is set, <option>route_data</option> must not be set.
34573 </para>
34574 </section>
34575 <section id="SECID121">
34576 <title>Routing rules in route_data</title>
34577 <para>
34578 The use of <option>route_list</option> is convenient when there are only a small number of
34579 routing rules. For larger numbers, it is easier to use a file or database to
34580 hold the routing information, and use the <option>route_data</option> option instead.
34581 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
34582 Most commonly, <option>route_data</option> is set as a string that contains an
34583 expansion lookup. For example, suppose we place two routing rules in a file
34584 like this:
34585 </para>
34586 <literallayout class="monospaced">
34587 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
34588 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
34589 </literallayout>
34590 <para>
34591 This data can be accessed by setting
34592 </para>
34593 <literallayout class="monospaced">
34594 route_data = ${lookup{$domain}lsearch{/the/file/name}}
34595 </literallayout>
34596 <para>
34597 Failure of the lookup results in an empty string, causing the router to
34598 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
34599 requirement is that the result of expanding the string is a list of hosts,
34600 possibly followed by options, separated by white space. The list of hosts must
34601 be enclosed in quotes if it contains white space.
34602 </para>
34603 </section>
34604 <section id="SECID122">
34605 <title>Format of the list of hosts</title>
34606 <para>
34607 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
34608 always separately expanded before use. If the expansion fails, the router
34609 declines. The result of the expansion must be a colon-separated list of names
34610 and/or IP addresses, optionally also including ports. The format of each item
34611 in the list is described in the next section. The list separator can be changed
34612 as described in section <xref linkend="SECTlistconstruct"/>.
34613 </para>
34614 <para>
34615 If the list of hosts was obtained from a <option>route_list</option> item, the following
34616 variables are set during its expansion:
34617 </para>
34618 <itemizedlist>
34619 <listitem>
34620 <para>
34621 <indexterm role="concept">
34622 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
34623 <secondary>in <command>manualroute</command> router</secondary>
34624 </indexterm>
34625 If the domain was matched against a regular expression, the numeric variables
34626 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
34627 </para>
34628 <literallayout class="monospaced">
34629 route_list = ^domain(\d+)   host-$1.text.example
34630 </literallayout>
34631 </listitem>
34632 <listitem>
34633 <para>
34634 <varname>$0</varname> is always set to the entire domain.
34635 </para>
34636 </listitem>
34637 <listitem>
34638 <para>
34639 <varname>$1</varname> is also set when partial matching is done in a file lookup.
34640 </para>
34641 </listitem>
34642 <listitem>
34643 <para>
34644 <indexterm role="variable">
34645 <primary><varname>$value</varname></primary>
34646 </indexterm>
34647 If the pattern that matched the domain was a lookup item, the data that was
34648 looked up is available in the expansion variable <varname>$value</varname>. For example:
34649 </para>
34650 <literallayout class="monospaced">
34651 route_list = lsearch;;/some/file.routes  $value
34652 </literallayout>
34653 </listitem>
34654 </itemizedlist>
34655 <para>
34656 Note the doubling of the semicolon in the pattern that is necessary because
34657 semicolon is the default route list separator.
34658 </para>
34659 </section>
34660 <section id="SECTformatonehostitem">
34661 <title>Format of one host item</title>
34662 <para>
34663 Each item in the list of hosts is either a host name or an IP address,
34664 optionally with an attached port number. When no port is given, an IP address
34665 is not enclosed in brackets. When a port is specified, it overrides the port
34666 specification on the transport. The port is separated from the name or address
34667 by a colon. This leads to some complications:
34668 </para>
34669 <itemizedlist>
34670 <listitem>
34671 <para>
34672 Because colon is the default separator for the list of hosts, either
34673 the colon that specifies a port must be doubled, or the list separator must
34674 be changed. The following two examples have the same effect:
34675 </para>
34676 <literallayout class="monospaced">
34677 route_list = * "host1.tld::1225 : host2.tld::1226"
34678 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
34679 </literallayout>
34680 </listitem>
34681 <listitem>
34682 <para>
34683 When IPv6 addresses are involved, it gets worse, because they contain
34684 colons of their own. To make this case easier, it is permitted to
34685 enclose an IP address (either v4 or v6) in square brackets if a port
34686 number follows. For example:
34687 </para>
34688 <literallayout class="monospaced">
34689 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
34690 </literallayout>
34691 </listitem>
34692 </itemizedlist>
34693 </section>
34694 <section id="SECThostshowused">
34695 <title>How the list of hosts is used</title>
34696 <para>
34697 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
34698 the hosts is tried, in the order specified, when carrying out the SMTP
34699 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
34700 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
34701 transport.
34702 </para>
34703 <para>
34704 Hosts may be listed by name or by IP address. An unadorned name in the list of
34705 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
34706 interpreted as an indirection to a sublist of hosts obtained by looking up MX
34707 records in the DNS. For example:
34708 </para>
34709 <literallayout class="monospaced">
34710 route_list = *  x.y.z:p.q.r/MX:e.f.g
34711 </literallayout>
34712 <para>
34713 If this feature is used with a port specifier, the port must come last. For
34714 example:
34715 </para>
34716 <literallayout class="monospaced">
34717 route_list = *  dom1.tld/mx::1225
34718 </literallayout>
34719 <para>
34720 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
34721 randomized before any lookups are done. Exim then scans the list; for any name
34722 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
34723 be an interface on the local host and the item is not the first in the list,
34724 Exim discards it and any subsequent items. If it is the first item, what
34725 happens is controlled by the
34726 <indexterm role="option">
34727 <primary><option>self</option></primary>
34728 <secondary>in <command>manualroute</command> router</secondary>
34729 </indexterm>
34730 <option>self</option> option of the router.
34731 </para>
34732 <para>
34733 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
34734 hosts obtained by looking up MX records for the name. This is always a DNS
34735 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
34736 below) are not relevant here. The order of these hosts is determined by the
34737 preference values in the MX records, according to the usual rules. Because
34738 randomizing happens before the MX lookup, it does not affect the order that is
34739 defined by MX preferences.
34740 </para>
34741 <para>
34742 If the local host is present in the sublist obtained from MX records, but is
34743 not the most preferred host in that list, it and any equally or less
34744 preferred hosts are removed before the sublist is inserted into the main list.
34745 </para>
34746 <para>
34747 If the local host is the most preferred host in the MX list, what happens
34748 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
34749 is not the first item (that is, there are previous hosts in the main list),
34750 Exim discards this name and any subsequent items in the main list.
34751 </para>
34752 <para>
34753 If the MX item is first in the list of hosts, and the local host is the
34754 most preferred host, what happens is controlled by the <option>self</option> option of the
34755 router.
34756 </para>
34757 <para>
34758 DNS failures when lookup up the MX records are treated in the same way as DNS
34759 failures when looking up IP addresses: <option>pass_on_timeout</option> and
34760 <option>host_find_failed</option> are used when relevant.
34761 </para>
34762 <para>
34763 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
34764 whether obtained from an MX lookup or not.
34765 </para>
34766 </section>
34767 <section id="SECThowoptused">
34768 <title>How the options are used</title>
34769 <para>
34770 The options are a sequence of words; in practice no more than three are ever
34771 present. One of the words can be the name of a transport; this overrides the
34772 <option>transport</option> option on the router for this particular routing rule only. The
34773 other words (if present) control randomization of the list of hosts on a
34774 per-rule basis, and how the IP addresses of the hosts are to be found when
34775 routing to a remote transport. These options are as follows:
34776 </para>
34777 <itemizedlist>
34778 <listitem>
34779 <para>
34780 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
34781 setting of <option>hosts_randomize</option> for this routing rule only.
34782 </para>
34783 </listitem>
34784 <listitem>
34785 <para>
34786 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
34787 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
34788 </para>
34789 </listitem>
34790 <listitem>
34791 <para>
34792 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
34793 find IP addresses. This function may ultimately cause a DNS lookup, but it may
34794 also look in <filename>/etc/hosts</filename> or other sources of information.
34795 </para>
34796 </listitem>
34797 <listitem>
34798 <para>
34799 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
34800 no address records are found. If there is a temporary DNS error (such as a
34801 timeout), delivery is deferred.
34802 </para>
34803 </listitem>
34804 </itemizedlist>
34805 <para>
34806 For example:
34807 </para>
34808 <literallayout class="monospaced">
34809 route_list = domain1  host1:host2:host3  randomize bydns;\
34810              domain2  host4:host5
34811 </literallayout>
34812 <para>
34813 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
34814 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
34815 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
34816 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
34817 call.
34818 </para>
34819 <para>
34820 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
34821 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
34822 instead of TRY_AGAIN. That is why the default action is to try a DNS
34823 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
34824 function called.
34825 </para>
34826 <para>
34827 If no IP address for a host can be found, what happens is controlled by the
34828 <option>host_find_failed</option> option.
34829 </para>
34830 <para>
34831 <indexterm role="variable">
34832 <primary><varname>$host</varname></primary>
34833 </indexterm>
34834 When an address is routed to a local transport, IP addresses are not looked up.
34835 The host list is passed to the transport in the <varname>$host</varname> variable.
34836 </para>
34837 </section>
34838 <section id="SECID123">
34839 <title>Manualroute examples</title>
34840 <para>
34841 In some of the examples that follow, the presence of the <option>remote_smtp</option>
34842 transport, as defined in the default configuration file, is assumed:
34843 </para>
34844 <itemizedlist>
34845 <listitem>
34846 <para>
34847 <indexterm role="concept">
34848 <primary>smart host</primary>
34849 <secondary>example router</secondary>
34850 </indexterm>
34851 The <command>manualroute</command> router can be used to forward all external mail to a
34852 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
34853 named domain list that contains your local domains, for example:
34854 </para>
34855 <literallayout class="monospaced">
34856 domainlist local_domains = my.domain.example
34857 </literallayout>
34858 <para>
34859 You can arrange for all other domains to be routed to a smart host by making
34860 your first router something like this:
34861 </para>
34862 <literallayout class="monospaced">
34863 smart_route:
34864   driver = manualroute
34865   domains = !+local_domains
34866   transport = remote_smtp
34867   route_list = * smarthost.ref.example
34868 </literallayout>
34869 <para>
34870 This causes all non-local addresses to be sent to the single host
34871 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
34872 they are tried in order
34873 (but you can use <option>hosts_randomize</option> to vary the order each time).
34874 Another way of configuring the same thing is this:
34875 </para>
34876 <literallayout class="monospaced">
34877 smart_route:
34878   driver = manualroute
34879   transport = remote_smtp
34880   route_list = !+local_domains  smarthost.ref.example
34881 </literallayout>
34882 <para>
34883 There is no difference in behaviour between these two routers as they stand.
34884 However, they behave differently if <option>no_more</option> is added to them. In the first
34885 example, the router is skipped if the domain does not match the <option>domains</option>
34886 precondition; the following router is always tried. If the router runs, it
34887 always matches the domain and so can never decline. Therefore, <option>no_more</option>
34888 would have no effect. In the second case, the router is never skipped; it
34889 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
34890 <option>no_more</option> would prevent subsequent routers from running.
34891 </para>
34892 </listitem>
34893 <listitem>
34894 <para>
34895 <indexterm role="concept">
34896 <primary>mail hub example</primary>
34897 </indexterm>
34898 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
34899 records in the DNS and delivers it via its own private routing mechanism. Often
34900 the final destinations are behind a firewall, with the mail hub being the one
34901 machine that can connect to machines both inside and outside the firewall. The
34902 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
34903 to the correct hosts. For a small number of domains, the routing can be inline,
34904 using the <option>route_list</option> option, but for a larger number a file or database
34905 lookup is easier to manage.
34906 </para>
34907 <para>
34908 If the domain names are in fact the names of the machines to which the mail is
34909 to be sent by the mail hub, the configuration can be quite simple. For
34910 example:
34911 </para>
34912 <literallayout class="monospaced">
34913 hub_route:
34914   driver = manualroute
34915   transport = remote_smtp
34916   route_list = *.rhodes.tvs.example  $domain
34917 </literallayout>
34918 <para>
34919 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
34920 whose names are the same as the mail domains. A similar approach can be taken
34921 if the host name can be obtained from the domain name by a string manipulation
34922 that the expansion facilities can handle. Otherwise, a lookup based on the
34923 domain can be used to find the host:
34924 </para>
34925 <literallayout class="monospaced">
34926 through_firewall:
34927   driver = manualroute
34928   transport = remote_smtp
34929   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
34930 </literallayout>
34931 <para>
34932 The result of the lookup must be the name or IP address of the host (or
34933 hosts) to which the address is to be routed. If the lookup fails, the route
34934 data is empty, causing the router to decline. The address then passes to the
34935 next router.
34936 </para>
34937 </listitem>
34938 <listitem>
34939 <para>
34940 <indexterm role="concept">
34941 <primary>batched SMTP output example</primary>
34942 </indexterm>
34943 <indexterm role="concept">
34944 <primary>SMTP</primary>
34945 <secondary>batched outgoing; example</secondary>
34946 </indexterm>
34947 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
34948 SMTP format for onward transportation by some other means. This is one way of
34949 storing mail for a dial-up host when it is not connected. The route list entry
34950 can be as simple as a single domain name in a configuration like this:
34951 </para>
34952 <literallayout class="monospaced">
34953 save_in_file:
34954   driver = manualroute
34955   transport = batchsmtp_appendfile
34956   route_list = saved.domain.example
34957 </literallayout>
34958 <para>
34959 though often a pattern is used to pick up more than one domain. If there are
34960 several domains or groups of domains with different transport requirements,
34961 different transports can be listed in the routing information:
34962 </para>
34963 <literallayout class="monospaced">
34964 save_in_file:
34965   driver = manualroute
34966   route_list = \
34967     *.saved.domain1.example  $domain  batch_appendfile; \
34968     *.saved.domain2.example  \
34969       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
34970       batch_pipe
34971 </literallayout>
34972 <para>
34973 <indexterm role="variable">
34974 <primary><varname>$domain</varname></primary>
34975 </indexterm>
34976 <indexterm role="variable">
34977 <primary><varname>$host</varname></primary>
34978 </indexterm>
34979 The first of these just passes the domain in the <varname>$host</varname> variable, which
34980 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
34981 file lookup to find a value to pass, causing the router to decline to handle
34982 the address if the lookup fails.
34983 </para>
34984 </listitem>
34985 <listitem>
34986 <para>
34987 <indexterm role="concept">
34988 <primary>UUCP</primary>
34989 <secondary>example of router for</secondary>
34990 </indexterm>
34991 Routing mail directly to UUCP software is a specific case of the use of
34992 <command>manualroute</command> in a gateway to another mail environment. This is an example of
34993 one way it can be done:
34994 </para>
34995 <literallayout class="monospaced">
34996 # Transport
34997 uucp:
34998   driver = pipe
34999   user = nobody
35000   command = /usr/local/bin/uux -r - \
35001     ${substr_-5:$host}!rmail ${local_part}
35002   return_fail_output = true
35003
35004 # Router
35005 uucphost:
35006   transport = uucp
35007   driver = manualroute
35008   route_data = \
35009     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
35010 </literallayout>
35011 <para>
35012 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
35013 </para>
35014 <literallayout class="monospaced">
35015 darksite.ethereal.example:           darksite.UUCP
35016 </literallayout>
35017 <para>
35018 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
35019 makes clear the distinction between the domain name
35020 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
35021 </para>
35022 </listitem>
35023 </itemizedlist>
35024 <para>
35025 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
35026 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
35027 </para>
35028 </section>
35029 </chapter>
35030
35031 <chapter id="CHAPdriverlast">
35032 <title>The queryprogram router</title>
35033 <para>
35034 <indexterm role="concept" id="IIDquerou1" class="startofrange">
35035 <primary><command>queryprogram</command> router</primary>
35036 </indexterm>
35037 <indexterm role="concept" id="IIDquerou2" class="startofrange">
35038 <primary>routers</primary>
35039 <secondary><command>queryprogram</command></secondary>
35040 </indexterm>
35041 <indexterm role="concept">
35042 <primary>routing</primary>
35043 <secondary>by external program</secondary>
35044 </indexterm>
35045 The <command>queryprogram</command> router routes an address by running an external command
35046 and acting on its output. This is an expensive way to route, and is intended
35047 mainly for use in lightly-loaded systems, or for performing experiments.
35048 However, if it is possible to use the precondition options (<option>domains</option>,
35049 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
35050 be used in special cases, even on a busy host. There are the following private
35051 options:
35052 <indexterm role="concept">
35053 <primary>options</primary>
35054 <secondary><command>queryprogram</command> router</secondary>
35055 </indexterm>
35056 </para>
35057 <para>
35058 <indexterm role="option">
35059 <primary><option>command</option></primary>
35060 </indexterm>
35061 </para>
35062 <informaltable frame="all">
35063 <tgroup cols="4" colsep="0" rowsep="0">
35064 <colspec colwidth="8*" align="left"/>
35065 <colspec colwidth="6*" align="center"/>
35066 <colspec colwidth="6*" align="center"/>
35067 <colspec colwidth="6*" align="right"/>
35068 <tbody>
35069 <row>
35070 <entry><option>command</option></entry>
35071 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35072 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35073 <entry>Default: <emphasis>unset</emphasis></entry>
35074 </row>
35075 </tbody>
35076 </tgroup>
35077 </informaltable>
35078 <para>
35079 This option must be set. It specifies the command that is to be run. The
35080 command is split up into a command name and arguments, and then each is
35081 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
35082 <xref linkend="CHAPpipetransport"/>).
35083 </para>
35084 <para>
35085 <indexterm role="option">
35086 <primary><option>command_group</option></primary>
35087 </indexterm>
35088 </para>
35089 <informaltable frame="all">
35090 <tgroup cols="4" colsep="0" rowsep="0">
35091 <colspec colwidth="8*" align="left"/>
35092 <colspec colwidth="6*" align="center"/>
35093 <colspec colwidth="6*" align="center"/>
35094 <colspec colwidth="6*" align="right"/>
35095 <tbody>
35096 <row>
35097 <entry><option>command_group</option></entry>
35098 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35099 <entry>Type: <emphasis>string</emphasis></entry>
35100 <entry>Default: <emphasis>unset</emphasis></entry>
35101 </row>
35102 </tbody>
35103 </tgroup>
35104 </informaltable>
35105 <para>
35106 <indexterm role="concept">
35107 <primary>gid (group id)</primary>
35108 <secondary>in <command>queryprogram</command> router</secondary>
35109 </indexterm>
35110 This option specifies a gid to be set when running the command while routing an
35111 address for deliver. It must be set if <option>command_user</option> specifies a numerical
35112 uid. If it begins with a digit, it is interpreted as the numerical value of the
35113 gid. Otherwise it is looked up using <function>getgrnam()</function>.
35114 </para>
35115 <para>
35116 <indexterm role="option">
35117 <primary><option>command_user</option></primary>
35118 </indexterm>
35119 </para>
35120 <informaltable frame="all">
35121 <tgroup cols="4" colsep="0" rowsep="0">
35122 <colspec colwidth="8*" align="left"/>
35123 <colspec colwidth="6*" align="center"/>
35124 <colspec colwidth="6*" align="center"/>
35125 <colspec colwidth="6*" align="right"/>
35126 <tbody>
35127 <row>
35128 <entry><option>command_user</option></entry>
35129 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35130 <entry>Type: <emphasis>string</emphasis></entry>
35131 <entry>Default: <emphasis>unset</emphasis></entry>
35132 </row>
35133 </tbody>
35134 </tgroup>
35135 </informaltable>
35136 <para>
35137 <indexterm role="concept">
35138 <primary>uid (user id)</primary>
35139 <secondary>for <command>queryprogram</command></secondary>
35140 </indexterm>
35141 This option must be set. It specifies the uid which is set when running the
35142 command while routing an address for delivery. If the value begins with a digit,
35143 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
35144 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
35145 not set, a value for the gid also.
35146 </para>
35147 <para>
35148 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
35149 root, which it does during a normal delivery in a conventional configuration.
35150 However, when an address is being verified during message reception, Exim is
35151 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
35152 is called from a non-root process, Exim cannot change uid or gid before running
35153 the command. In this circumstance the command runs under the current uid and
35154 gid.
35155 </para>
35156 <para>
35157 <indexterm role="option">
35158 <primary><option>current_directory</option></primary>
35159 </indexterm>
35160 </para>
35161 <informaltable frame="all">
35162 <tgroup cols="4" colsep="0" rowsep="0">
35163 <colspec colwidth="8*" align="left"/>
35164 <colspec colwidth="6*" align="center"/>
35165 <colspec colwidth="6*" align="center"/>
35166 <colspec colwidth="6*" align="right"/>
35167 <tbody>
35168 <row>
35169 <entry><option>current_directory</option></entry>
35170 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35171 <entry>Type: <emphasis>string</emphasis></entry>
35172 <entry>Default: <emphasis>/</emphasis></entry>
35173 </row>
35174 </tbody>
35175 </tgroup>
35176 </informaltable>
35177 <para>
35178 This option specifies an absolute path which is made the current directory
35179 before running the command.
35180 </para>
35181 <para>
35182 <indexterm role="option">
35183 <primary><option>timeout</option></primary>
35184 </indexterm>
35185 </para>
35186 <informaltable frame="all">
35187 <tgroup cols="4" colsep="0" rowsep="0">
35188 <colspec colwidth="8*" align="left"/>
35189 <colspec colwidth="6*" align="center"/>
35190 <colspec colwidth="6*" align="center"/>
35191 <colspec colwidth="6*" align="right"/>
35192 <tbody>
35193 <row>
35194 <entry><option>timeout</option></entry>
35195 <entry>Use: <emphasis>queryprogram</emphasis></entry>
35196 <entry>Type: <emphasis>time</emphasis></entry>
35197 <entry>Default: <emphasis>1h</emphasis></entry>
35198 </row>
35199 </tbody>
35200 </tgroup>
35201 </informaltable>
35202 <para>
35203 If the command does not complete within the timeout period, its process group
35204 is killed and the message is frozen. A value of zero time specifies no
35205 timeout.
35206 </para>
35207 <para>
35208 The standard output of the command is connected to a pipe, which is read when
35209 the command terminates. It should consist of a single line of output,
35210 containing up to five fields, separated by white space. The maximum length of
35211 the line is 1023 characters. Longer lines are silently truncated. The first
35212 field is one of the following words (case-insensitive):
35213 </para>
35214 <itemizedlist>
35215 <listitem>
35216 <para>
35217 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
35218 below).
35219 </para>
35220 </listitem>
35221 <listitem>
35222 <para>
35223 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
35224 <option>no_more</option> is set.
35225 </para>
35226 </listitem>
35227 <listitem>
35228 <para>
35229 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
35230 subsequent text on the line is an error message. If the router is run as part
35231 of address verification during an incoming SMTP message, the message is
35232 included in the SMTP response.
35233 </para>
35234 </listitem>
35235 <listitem>
35236 <para>
35237 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
35238 subsequent text on the line is an error message which is logged. It is not
35239 included in any SMTP response.
35240 </para>
35241 </listitem>
35242 <listitem>
35243 <para>
35244 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
35245 </para>
35246 </listitem>
35247 <listitem>
35248 <para>
35249 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
35250 <option>pass_router</option>), overriding <option>no_more</option>.
35251 </para>
35252 </listitem>
35253 <listitem>
35254 <para>
35255 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
35256 new addresses, which are routed independently, starting with the first router,
35257 or the router specified by <option>redirect_router</option>, if set.
35258 </para>
35259 </listitem>
35260 </itemizedlist>
35261 <para>
35262 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
35263 number of keyed data values, as follows (split into two lines here, to fit on
35264 the page):
35265 </para>
35266 <literallayout class="monospaced">
35267 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
35268 LOOKUP=byname|bydns DATA=&lt;text&gt;
35269 </literallayout>
35270 <para>
35271 The data items can be given in any order, and all are optional. If no transport
35272 is included, the transport specified by the generic <option>transport</option> option is
35273 used. The list of hosts and the lookup type are needed only if the transport is
35274 an <command>smtp</command> transport that does not itself supply a list of hosts.
35275 </para>
35276 <para>
35277 The format of the list of hosts is the same as for the <command>manualroute</command> router.
35278 As well as host names and IP addresses with optional port numbers, as described
35279 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
35280 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
35281 (see section <xref linkend="SECThostshowused"/>).
35282 </para>
35283 <para>
35284 If the lookup type is not specified, Exim behaves as follows when trying to
35285 find an IP address for each host: First, a DNS lookup is done. If this yields
35286 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
35287 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
35288 result of the lookup is the result of that call.
35289 </para>
35290 <para>
35291 <indexterm role="variable">
35292 <primary><varname>$address_data</varname></primary>
35293 </indexterm>
35294 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
35295 variable. For example, this return line
35296 </para>
35297 <literallayout class="monospaced">
35298 accept hosts=x1.y.example:x2.y.example data="rule1"
35299 </literallayout>
35300 <para>
35301 routes the address to the default transport, passing a list of two hosts. When
35302 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
35303 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
35304 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
35305 </para>
35306 </chapter>
35307
35308 <chapter id="CHAPredirect">
35309 <title>The redirect router</title>
35310 <para>
35311 <indexterm role="concept" id="IIDredrou1" class="startofrange">
35312 <primary><command>redirect</command> router</primary>
35313 </indexterm>
35314 <indexterm role="concept" id="IIDredrou2" class="startofrange">
35315 <primary>routers</primary>
35316 <secondary><command>redirect</command></secondary>
35317 </indexterm>
35318 <indexterm role="concept">
35319 <primary>alias file</primary>
35320 <secondary>in a <command>redirect</command> router</secondary>
35321 </indexterm>
35322 <indexterm role="concept">
35323 <primary>address redirection</primary>
35324 <secondary><command>redirect</command> router</secondary>
35325 </indexterm>
35326 The <command>redirect</command> router handles several kinds of address redirection. Its most
35327 common uses are for resolving local part aliases from a central alias file
35328 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
35329 files, but it has many other potential uses. The incoming address can be
35330 redirected in several different ways:
35331 </para>
35332 <itemizedlist>
35333 <listitem>
35334 <para>
35335 It can be replaced by one or more new addresses which are themselves routed
35336 independently.
35337 </para>
35338 </listitem>
35339 <listitem>
35340 <para>
35341 It can be routed to be delivered to a given file or directory.
35342 </para>
35343 </listitem>
35344 <listitem>
35345 <para>
35346 It can be routed to be delivered to a specified pipe command.
35347 </para>
35348 </listitem>
35349 <listitem>
35350 <para>
35351 It can cause an automatic reply to be generated.
35352 </para>
35353 </listitem>
35354 <listitem>
35355 <para>
35356 It can be forced to fail, optionally with a custom error message.
35357 </para>
35358 </listitem>
35359 <listitem>
35360 <para>
35361 It can be temporarily deferred, optionally with a custom message.
35362 </para>
35363 </listitem>
35364 <listitem>
35365 <para>
35366 It can be discarded.
35367 </para>
35368 </listitem>
35369 </itemizedlist>
35370 <para>
35371 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
35372 However, there are some private options which define transports for delivery to
35373 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
35374 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
35375 </para>
35376 <section id="SECID124">
35377 <title>Redirection data</title>
35378 <para>
35379 The router operates by interpreting a text string which it obtains either by
35380 expanding the contents of the <option>data</option> option, or by reading the entire
35381 contents of a file whose name is given in the <option>file</option> option. These two
35382 options are mutually exclusive. The first is commonly used for handling system
35383 aliases, in a configuration like this:
35384 </para>
35385 <literallayout class="monospaced">
35386 system_aliases:
35387   driver = redirect
35388   data = ${lookup{$local_part}lsearch{/etc/aliases}}
35389 </literallayout>
35390 <para>
35391 If the lookup fails, the expanded string in this example is empty. When the
35392 expansion of <option>data</option> results in an empty string, the router declines. A forced
35393 expansion failure also causes the router to decline; other expansion failures
35394 cause delivery to be deferred.
35395 </para>
35396 <para>
35397 A configuration using <option>file</option> is commonly used for handling users&#x2019;
35398 <filename>.forward</filename> files, like this:
35399 </para>
35400 <literallayout class="monospaced">
35401 userforward:
35402   driver = redirect
35403   check_local_user
35404   file = $home/.forward
35405   no_verify
35406 </literallayout>
35407 <para>
35408 If the file does not exist, or causes no action to be taken (for example, it is
35409 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
35410 is not the case when the file contains syntactically valid items that happen to
35411 yield empty addresses, for example, items containing only RFC 2822 address
35412 comments.
35413 </para>
35414 </section>
35415 <section id="SECID125">
35416 <title>Forward files and address verification</title>
35417 <para>
35418 <indexterm role="concept">
35419 <primary>address redirection</primary>
35420 <secondary>while verifying</secondary>
35421 </indexterm>
35422 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
35423 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
35424 </para>
35425 <itemizedlist>
35426 <listitem>
35427 <para>
35428 When Exim is receiving an incoming SMTP message from a remote host, it is
35429 running under the Exim uid, not as root. Exim is unable to change uid to read
35430 the file as the user, and it may not be able to read it as the Exim user. So in
35431 practice the router may not be able to operate.
35432 </para>
35433 </listitem>
35434 <listitem>
35435 <para>
35436 However, even when the router can operate, the existence of a <filename>.forward</filename> file
35437 is unimportant when verifying an address. What should be checked is whether the
35438 local part is a valid user name or not. Cutting out the redirection processing
35439 saves some resources.
35440 </para>
35441 </listitem>
35442 </itemizedlist>
35443 </section>
35444 <section id="SECID126">
35445 <title>Interpreting redirection data</title>
35446 <para>
35447 <indexterm role="concept">
35448 <primary>Sieve filter</primary>
35449 <secondary>specifying in redirection data</secondary>
35450 </indexterm>
35451 <indexterm role="concept">
35452 <primary>filter</primary>
35453 <secondary>specifying in redirection data</secondary>
35454 </indexterm>
35455 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
35456 can be interpreted in two different ways:
35457 </para>
35458 <itemizedlist>
35459 <listitem>
35460 <para>
35461 If the <option>allow_filter</option> option is set true, and the data begins with the text
35462 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
35463 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
35464 respectively. Details of the syntax and semantics of filter files are described
35465 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
35466 document is intended for use by end users.
35467 </para>
35468 </listitem>
35469 <listitem>
35470 <para>
35471 Otherwise, the data must be a comma-separated list of redirection items, as
35472 described in the next section.
35473 </para>
35474 </listitem>
35475 </itemizedlist>
35476 <para>
35477 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
35478 in a non-filter redirection list must always be an absolute path. A filter may
35479 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
35480 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
35481 for the <command>appendfile</command> transport.
35482 </para>
35483 </section>
35484 <section id="SECTitenonfilred">
35485 <title>Items in a non-filter redirection list</title>
35486 <para>
35487 <indexterm role="concept">
35488 <primary>address redirection</primary>
35489 <secondary>non-filter list items</secondary>
35490 </indexterm>
35491 When the redirection data is not an Exim or Sieve filter, for example, if it
35492 comes from a conventional alias or forward file, it consists of a list of
35493 addresses, file names, pipe commands, or certain special items (see section
35494 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
35495 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
35496 depending on their default values. The items in the list are separated by
35497 commas or newlines.
35498 If a comma is required in an item, the entire item must be enclosed in double
35499 quotes.
35500 </para>
35501 <para>
35502 Lines starting with a # character are comments, and are ignored, and # may
35503 also appear following a comma, in which case everything between the # and the
35504 next newline character is ignored.
35505 </para>
35506 <para>
35507 If an item is entirely enclosed in double quotes, these are removed. Otherwise
35508 double quotes are retained because some forms of mail address require their use
35509 (but never to enclose the entire address). In the following description,
35510 <quote>item</quote> refers to what remains after any surrounding double quotes have been
35511 removed.
35512 </para>
35513 <para>
35514 <indexterm role="variable">
35515 <primary><varname>$local_part</varname></primary>
35516 </indexterm>
35517 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
35518 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
35519 of the <option>quote_local_part</option> expansion operator, in case the local part contains
35520 special characters. For example, to redirect all mail for the domain
35521 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
35522 setting:
35523 </para>
35524 <literallayout class="monospaced">
35525 data = ${quote_local_part:$local_part}@newdomain.example
35526 </literallayout>
35527 </section>
35528 <section id="SECTredlocmai">
35529 <title>Redirecting to a local mailbox</title>
35530 <para>
35531 <indexterm role="concept">
35532 <primary>routing</primary>
35533 <secondary>loops in</secondary>
35534 </indexterm>
35535 <indexterm role="concept">
35536 <primary>loop</primary>
35537 <secondary>while routing, avoidance of</secondary>
35538 </indexterm>
35539 <indexterm role="concept">
35540 <primary>address redirection</primary>
35541 <secondary>to local mailbox</secondary>
35542 </indexterm>
35543 A redirection item may safely be the same as the address currently under
35544 consideration. This does not cause a routing loop, because a router is
35545 automatically skipped if any ancestor of the address that is being processed
35546 is the same as the current address and was processed by the current router.
35547 Such an address is therefore passed to the following routers, so it is handled
35548 as if there were no redirection. When making this loop-avoidance test, the
35549 complete local part, including any prefix or suffix, is used.
35550 </para>
35551 <para>
35552 <indexterm role="concept">
35553 <primary>address redirection</primary>
35554 <secondary>local part without domain</secondary>
35555 </indexterm>
35556 Specifying the same local part without a domain is a common usage in personal
35557 filter files when the user wants to have messages delivered to the local
35558 mailbox and also forwarded elsewhere. For example, the user whose login is
35559 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
35560 </para>
35561 <literallayout class="monospaced">
35562 cleo, cleopatra@egypt.example
35563 </literallayout>
35564 <para>
35565 <indexterm role="concept">
35566 <primary>backslash in alias file</primary>
35567 </indexterm>
35568 <indexterm role="concept">
35569 <primary>alias file</primary>
35570 <secondary>backslash in</secondary>
35571 </indexterm>
35572 For compatibility with other MTAs, such unqualified local parts may be
35573 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
35574 it does make a difference if more than one domain is being handled
35575 synonymously.
35576 </para>
35577 <para>
35578 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
35579 2822 address that does not include a domain, the item is qualified using the
35580 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
35581 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
35582 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
35583 </para>
35584 <para>
35585 Care must be taken if there are alias names for local users.
35586 Consider an MTA handling a single local domain where the system alias file
35587 contains:
35588 </para>
35589 <literallayout class="monospaced">
35590 Sam.Reman: spqr
35591 </literallayout>
35592 <para>
35593 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
35594 messages in the local mailbox, and also forward copies elsewhere. He creates
35595 this forward file:
35596 </para>
35597 <literallayout class="monospaced">
35598 Sam.Reman, spqr@reme.elsewhere.example
35599 </literallayout>
35600 <para>
35601 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
35602 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
35603 second time round, because it has previously routed it,
35604 and the following routers presumably cannot handle the alias. The forward file
35605 should really contain
35606 </para>
35607 <literallayout class="monospaced">
35608 spqr, spqr@reme.elsewhere.example
35609 </literallayout>
35610 <para>
35611 but because this is such a common error, the <option>check_ancestor</option> option (see
35612 below) exists to provide a way to get round it. This is normally set on a
35613 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
35614 </para>
35615 </section>
35616 <section id="SECTspecitredli">
35617 <title>Special items in redirection lists</title>
35618 <para>
35619 In addition to addresses, the following types of item may appear in redirection
35620 lists (that is, in non-filter redirection data):
35621 </para>
35622 <itemizedlist>
35623 <listitem>
35624 <para>
35625 <indexterm role="concept">
35626 <primary>pipe</primary>
35627 <secondary>in redirection list</secondary>
35628 </indexterm>
35629 <indexterm role="concept">
35630 <primary>address redirection</primary>
35631 <secondary>to pipe</secondary>
35632 </indexterm>
35633 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
35634 as a valid RFC 2822 address that includes a domain. A transport for running the
35635 command must be specified by the <option>pipe_transport</option> option.
35636 Normally, either the router or the transport specifies a user and a group under
35637 which to run the delivery. The default is to use the Exim user and group.
35638 </para>
35639 <para>
35640 Single or double quotes can be used for enclosing the individual arguments of
35641 the pipe command; no interpretation of escapes is done for single quotes. If
35642 the command contains a comma character, it is necessary to put the whole item
35643 in double quotes, for example:
35644 </para>
35645 <literallayout class="monospaced">
35646 "|/some/command ready,steady,go"
35647 </literallayout>
35648 <para>
35649 since items in redirection lists are terminated by commas. Do not, however,
35650 quote just the command. An item such as
35651 </para>
35652 <literallayout class="monospaced">
35653 |"/some/command ready,steady,go"
35654 </literallayout>
35655 <para>
35656 is interpreted as a pipe with a rather strange command name, and no arguments.
35657 </para>
35658 <para>
35659 Note that the above example assumes that the text comes from a lookup source
35660 of some sort, so that the quotes are part of the data.  If composing a
35661 redirect router with a <option>data</option> option directly specifying this command, the
35662 quotes will be used by the configuration parser to define the extent of one
35663 string, but will not be passed down into the redirect router itself.  There
35664 are two main approaches to get around this: escape quotes to be part of the
35665 data itself, or avoid using this mechanism and instead create a custom
35666 transport with the <option>command</option> option set and reference that transport from
35667 an <option>accept</option> router.
35668 </para>
35669 </listitem>
35670 <listitem>
35671 <para>
35672 <indexterm role="concept">
35673 <primary>file</primary>
35674 <secondary>in redirection list</secondary>
35675 </indexterm>
35676 <indexterm role="concept">
35677 <primary>address redirection</primary>
35678 <secondary>to file</secondary>
35679 </indexterm>
35680 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
35681 parse as a valid RFC 2822 address that includes a domain. For example,
35682 </para>
35683 <literallayout class="monospaced">
35684 /home/world/minbari
35685 </literallayout>
35686 <para>
35687 is treated as a file name, but
35688 </para>
35689 <literallayout class="monospaced">
35690 /s=molari/o=babylon/@x400gate.way
35691 </literallayout>
35692 <para>
35693 is treated as an address. For a file name, a transport must be specified using
35694 the <option>file_transport</option> option. However, if the generated path name ends with a
35695 forward slash character, it is interpreted as a directory name rather than a
35696 file name, and <option>directory_transport</option> is used instead.
35697 </para>
35698 <para>
35699 Normally, either the router or the transport specifies a user and a group under
35700 which to run the delivery. The default is to use the Exim user and group.
35701 </para>
35702 <para>
35703 <indexterm role="concept">
35704 <primary><filename>/dev/null</filename></primary>
35705 </indexterm>
35706 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
35707 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
35708 instead of a transport name. In this case the user and group are not used.
35709 </para>
35710 </listitem>
35711 <listitem>
35712 <para>
35713 <indexterm role="concept">
35714 <primary>included address list</primary>
35715 </indexterm>
35716 <indexterm role="concept">
35717 <primary>address redirection</primary>
35718 <secondary>included external list</secondary>
35719 </indexterm>
35720 If an item is of the form
35721 </para>
35722 <literallayout class="monospaced">
35723 :include:&lt;path name&gt;
35724 </literallayout>
35725 <para>
35726 a list of further items is taken from the given file and included at that
35727 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
35728 out-of-line addition to the list. The items in the included list are separated
35729 by commas or newlines and are not subject to expansion. If this is the first
35730 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
35731 the alias name. This example is incorrect:
35732 </para>
35733 <literallayout class="monospaced">
35734 list1    :include:/opt/lists/list1
35735 </literallayout>
35736 <para>
35737 It must be given as
35738 </para>
35739 <literallayout class="monospaced">
35740 list1:   :include:/opt/lists/list1
35741 </literallayout>
35742 </listitem>
35743 <listitem>
35744 <para>
35745 <indexterm role="concept">
35746 <primary>address redirection</primary>
35747 <secondary>to black hole</secondary>
35748 </indexterm>
35749 Sometimes you want to throw away mail to a particular local part. Making the
35750 <option>data</option> option expand to an empty string does not work, because that causes
35751 the router to decline. Instead, the alias item
35752 <indexterm role="concept">
35753 <primary>black hole</primary>
35754 </indexterm>
35755 <indexterm role="concept">
35756 <primary>abandoning mail</primary>
35757 </indexterm>
35758 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
35759 done, and no error message is generated. This has the same effect as specifing
35760 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
35761 </para>
35762 <para>
35763 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
35764 delivery is done for the original local part, even if other redirection items
35765 are present. If you are generating a multi-item list (for example, by reading a
35766 database) and need the ability to provide a no-op item, you must use
35767 <filename>/dev/null</filename>.
35768 </para>
35769 </listitem>
35770 <listitem>
35771 <para>
35772 <indexterm role="concept">
35773 <primary>delivery</primary>
35774 <secondary>forcing failure</secondary>
35775 </indexterm>
35776 <indexterm role="concept">
35777 <primary>delivery</primary>
35778 <secondary>forcing deferral</secondary>
35779 </indexterm>
35780 <indexterm role="concept">
35781 <primary>failing delivery</primary>
35782 <secondary>forcing</secondary>
35783 </indexterm>
35784 <indexterm role="concept">
35785 <primary>deferred delivery, forcing</primary>
35786 </indexterm>
35787 <indexterm role="concept">
35788 <primary>customizing</primary>
35789 <secondary>failure message</secondary>
35790 </indexterm>
35791 An attempt to deliver a particular address can be deferred or forced to fail by
35792 redirection items of the form
35793 </para>
35794 <literallayout class="monospaced">
35795 :defer:
35796 :fail:
35797 </literallayout>
35798 <para>
35799 respectively. When a redirection list contains such an item, it applies
35800 to the entire redirection; any other items in the list are ignored. Any
35801 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
35802 associated with the failure. For example, an alias file might contain:
35803 </para>
35804 <literallayout class="monospaced">
35805 X.Employee:  :fail: Gone away, no forwarding address
35806 </literallayout>
35807 <para>
35808 In the case of an address that is being verified from an ACL or as the subject
35809 of a
35810 <indexterm role="concept">
35811 <primary>VRFY</primary>
35812 <secondary>error text, display of</secondary>
35813 </indexterm>
35814 VRFY command, the text is included in the SMTP error response by
35815 default.
35816 <indexterm role="concept">
35817 <primary>EXPN</primary>
35818 <secondary>error text, display of</secondary>
35819 </indexterm>
35820 The text is not included in the response to an EXPN command. In non-SMTP cases
35821 the text is included in the error message that Exim generates.
35822 </para>
35823 <para>
35824 <indexterm role="concept">
35825 <primary>SMTP</primary>
35826 <secondary>error codes</secondary>
35827 </indexterm>
35828 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
35829 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
35830 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
35831 followed by a space, and the very first digit is the same as the default error
35832 code, the code from the message is used instead. If the very first digit is
35833 incorrect, a panic error is logged, and the default code is used. You can
35834 suppress the use of the supplied code in a redirect router by setting the
35835 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
35836 ignored.
35837 </para>
35838 <para>
35839 <indexterm role="variable">
35840 <primary><varname>$acl_verify_message</varname></primary>
35841 </indexterm>
35842 In an ACL, an explicitly provided message overrides the default, but the
35843 default message is available in the variable <varname>$acl_verify_message</varname> and can
35844 therefore be included in a custom message if this is desired.
35845 </para>
35846 <para>
35847 Normally the error text is the rest of the redirection list &ndash; a comma does
35848 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
35849 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
35850 as part of the continuation process, but they may exist in other kinds of
35851 lookup and in <emphasis>:include:</emphasis> files.
35852 </para>
35853 <para>
35854 During routing for message delivery (as opposed to verification), a redirection
35855 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
35856 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
35857 subsequent delivery attempt can happen at a later time. If an address is
35858 deferred for too long, it will ultimately fail, because the normal retry
35859 rules still apply.
35860 </para>
35861 </listitem>
35862 <listitem>
35863 <para>
35864 <indexterm role="concept">
35865 <primary>alias file</primary>
35866 <secondary>exception to default</secondary>
35867 </indexterm>
35868 Sometimes it is useful to use a single-key search type with a default (see
35869 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
35870 for exceptions to the default. These can be handled by aliasing them to
35871 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
35872 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
35873 results in an empty redirection list has the same effect.
35874 </para>
35875 </listitem>
35876 </itemizedlist>
35877 </section>
35878 <section id="SECTdupaddr">
35879 <title>Duplicate addresses</title>
35880 <para>
35881 <indexterm role="concept">
35882 <primary>duplicate addresses</primary>
35883 </indexterm>
35884 <indexterm role="concept">
35885 <primary>address duplicate, discarding</primary>
35886 </indexterm>
35887 <indexterm role="concept">
35888 <primary>pipe</primary>
35889 <secondary>duplicated</secondary>
35890 </indexterm>
35891 Exim removes duplicate addresses from the list to which it is delivering, so as
35892 to deliver just one copy to each address. This does not apply to deliveries
35893 routed to pipes by different immediate parent addresses, but an indirect
35894 aliasing scheme of the type
35895 </para>
35896 <literallayout class="monospaced">
35897 pipe:       |/some/command $local_part
35898 localpart1: pipe
35899 localpart2: pipe
35900 </literallayout>
35901 <para>
35902 does not work with a message that is addressed to both local parts, because
35903 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
35904 discarded as being the same as a previously handled address. However, a scheme
35905 such as
35906 </para>
35907 <literallayout class="monospaced">
35908 localpart1: |/some/command $local_part
35909 localpart2: |/some/command $local_part
35910 </literallayout>
35911 <para>
35912 does result in two different pipe deliveries, because the immediate parents of
35913 the pipes are distinct.
35914 </para>
35915 </section>
35916 <section id="SECID128">
35917 <title>Repeated redirection expansion</title>
35918 <para>
35919 <indexterm role="concept">
35920 <primary>repeated redirection expansion</primary>
35921 </indexterm>
35922 <indexterm role="concept">
35923 <primary>address redirection</primary>
35924 <secondary>repeated for each delivery attempt</secondary>
35925 </indexterm>
35926 When a message cannot be delivered to all of its recipients immediately,
35927 leading to two or more delivery attempts, redirection expansion is carried out
35928 afresh each time for those addresses whose children were not all previously
35929 delivered. If redirection is being used as a mailing list, this can lead to new
35930 members of the list receiving copies of old messages. The <option>one_time</option> option
35931 can be used to avoid this.
35932 </para>
35933 </section>
35934 <section id="SECID129">
35935 <title>Errors in redirection lists</title>
35936 <para>
35937 <indexterm role="concept">
35938 <primary>address redirection</primary>
35939 <secondary>errors</secondary>
35940 </indexterm>
35941 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
35942 error is skipped, and an entry is written to the main log. This may be useful
35943 for mailing lists that are automatically managed. Otherwise, if an error is
35944 detected while generating the list of new addresses, the original address is
35945 deferred. See also <option>syntax_errors_to</option>.
35946 </para>
35947 </section>
35948 <section id="SECID130">
35949 <title>Private options for the redirect router</title>
35950 <para>
35951 <indexterm role="concept">
35952 <primary>options</primary>
35953 <secondary><command>redirect</command> router</secondary>
35954 </indexterm>
35955 The private options for the <command>redirect</command> router are as follows:
35956 </para>
35957 <para>
35958 <indexterm role="option">
35959 <primary><option>allow_defer</option></primary>
35960 </indexterm>
35961 </para>
35962 <informaltable frame="all">
35963 <tgroup cols="4" colsep="0" rowsep="0">
35964 <colspec colwidth="8*" align="left"/>
35965 <colspec colwidth="6*" align="center"/>
35966 <colspec colwidth="6*" align="center"/>
35967 <colspec colwidth="6*" align="right"/>
35968 <tbody>
35969 <row>
35970 <entry><option>allow_defer</option></entry>
35971 <entry>Use: <emphasis>redirect</emphasis></entry>
35972 <entry>Type: <emphasis>boolean</emphasis></entry>
35973 <entry>Default: <emphasis>false</emphasis></entry>
35974 </row>
35975 </tbody>
35976 </tgroup>
35977 </informaltable>
35978 <para>
35979 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
35980 data, or the <option>defer</option> command in an Exim filter file.
35981 </para>
35982 <para>
35983 <indexterm role="option">
35984 <primary><option>allow_fail</option></primary>
35985 </indexterm>
35986 </para>
35987 <informaltable frame="all">
35988 <tgroup cols="4" colsep="0" rowsep="0">
35989 <colspec colwidth="8*" align="left"/>
35990 <colspec colwidth="6*" align="center"/>
35991 <colspec colwidth="6*" align="center"/>
35992 <colspec colwidth="6*" align="right"/>
35993 <tbody>
35994 <row>
35995 <entry><option>allow_fail</option></entry>
35996 <entry>Use: <emphasis>redirect</emphasis></entry>
35997 <entry>Type: <emphasis>boolean</emphasis></entry>
35998 <entry>Default: <emphasis>false</emphasis></entry>
35999 </row>
36000 </tbody>
36001 </tgroup>
36002 </informaltable>
36003 <para>
36004 <indexterm role="concept">
36005 <primary>failing delivery</primary>
36006 <secondary>from filter</secondary>
36007 </indexterm>
36008 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
36009 and the <option>fail</option> command may be used in an Exim filter file.
36010 </para>
36011 <para>
36012 <indexterm role="option">
36013 <primary><option>allow_filter</option></primary>
36014 </indexterm>
36015 </para>
36016 <informaltable frame="all">
36017 <tgroup cols="4" colsep="0" rowsep="0">
36018 <colspec colwidth="8*" align="left"/>
36019 <colspec colwidth="6*" align="center"/>
36020 <colspec colwidth="6*" align="center"/>
36021 <colspec colwidth="6*" align="right"/>
36022 <tbody>
36023 <row>
36024 <entry><option>allow_filter</option></entry>
36025 <entry>Use: <emphasis>redirect</emphasis></entry>
36026 <entry>Type: <emphasis>boolean</emphasis></entry>
36027 <entry>Default: <emphasis>false</emphasis></entry>
36028 </row>
36029 </tbody>
36030 </tgroup>
36031 </informaltable>
36032 <para>
36033 <indexterm role="concept">
36034 <primary>filter</primary>
36035 <secondary>enabling use of</secondary>
36036 </indexterm>
36037 <indexterm role="concept">
36038 <primary>Sieve filter</primary>
36039 <secondary>enabling use of</secondary>
36040 </indexterm>
36041 Setting this option allows Exim to interpret redirection data that starts with
36042 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
36043 are some features of Exim filter files that some administrators may wish to
36044 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
36045 </para>
36046 <para>
36047 It is also possible to lock out Exim filters or Sieve filters while allowing
36048 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
36049 </para>
36050 <para>
36051 The filter is run using the uid and gid set by the generic <option>user</option> and
36052 <option>group</option> options. These take their defaults from the password data if
36053 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
36054 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
36055 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
36056 </para>
36057 <para>
36058 <indexterm role="option">
36059 <primary><option>allow_freeze</option></primary>
36060 </indexterm>
36061 </para>
36062 <informaltable frame="all">
36063 <tgroup cols="4" colsep="0" rowsep="0">
36064 <colspec colwidth="8*" align="left"/>
36065 <colspec colwidth="6*" align="center"/>
36066 <colspec colwidth="6*" align="center"/>
36067 <colspec colwidth="6*" align="right"/>
36068 <tbody>
36069 <row>
36070 <entry><option>allow_freeze</option></entry>
36071 <entry>Use: <emphasis>redirect</emphasis></entry>
36072 <entry>Type: <emphasis>boolean</emphasis></entry>
36073 <entry>Default: <emphasis>false</emphasis></entry>
36074 </row>
36075 </tbody>
36076 </tgroup>
36077 </informaltable>
36078 <para>
36079 <indexterm role="concept">
36080 <primary>freezing messages</primary>
36081 <secondary>allowing in filter</secondary>
36082 </indexterm>
36083 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
36084 This command is more normally encountered in system filters, and is disabled by
36085 default for redirection filters because it isn&#x2019;t something you usually want to
36086 let ordinary users do.
36087 </para>
36088 <para>
36089 <indexterm role="option">
36090 <primary><option>check_ancestor</option></primary>
36091 </indexterm>
36092 </para>
36093 <informaltable frame="all">
36094 <tgroup cols="4" colsep="0" rowsep="0">
36095 <colspec colwidth="8*" align="left"/>
36096 <colspec colwidth="6*" align="center"/>
36097 <colspec colwidth="6*" align="center"/>
36098 <colspec colwidth="6*" align="right"/>
36099 <tbody>
36100 <row>
36101 <entry><option>check_ancestor</option></entry>
36102 <entry>Use: <emphasis>redirect</emphasis></entry>
36103 <entry>Type: <emphasis>boolean</emphasis></entry>
36104 <entry>Default: <emphasis>false</emphasis></entry>
36105 </row>
36106 </tbody>
36107 </tgroup>
36108 </informaltable>
36109 <para>
36110 This option is concerned with handling generated addresses that are the same
36111 as some address in the list of redirection ancestors of the current address.
36112 Although it is turned off by default in the code, it is set in the default
36113 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
36114 for this use of the <command>redirect</command> router.
36115 </para>
36116 <para>
36117 When <option>check_ancestor</option> is set, if a generated address (including the domain)
36118 is the same as any ancestor of the current address, it is replaced by a copy of
36119 the current address. This helps in the case where local part A is aliased to B,
36120 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
36121 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
36122 <filename>&nbsp;jb/.forward</filename> contains:
36123 </para>
36124 <literallayout class="monospaced">
36125 \Joe.Bloggs, &lt;other item(s)&gt;
36126 </literallayout>
36127 <para>
36128 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
36129 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
36130 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
36131 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
36132 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
36133 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
36134 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
36135 original address. See also the <option>repeat_use</option> option below.
36136 </para>
36137 <para>
36138 <indexterm role="option">
36139 <primary><option>check_group</option></primary>
36140 </indexterm>
36141 </para>
36142 <informaltable frame="all">
36143 <tgroup cols="4" colsep="0" rowsep="0">
36144 <colspec colwidth="8*" align="left"/>
36145 <colspec colwidth="6*" align="center"/>
36146 <colspec colwidth="6*" align="center"/>
36147 <colspec colwidth="6*" align="right"/>
36148 <tbody>
36149 <row>
36150 <entry><option>check_group</option></entry>
36151 <entry>Use: <emphasis>redirect</emphasis></entry>
36152 <entry>Type: <emphasis>boolean</emphasis></entry>
36153 <entry>Default: <emphasis>see below</emphasis></entry>
36154 </row>
36155 </tbody>
36156 </tgroup>
36157 </informaltable>
36158 <para>
36159 When the <option>file</option> option is used, the group owner of the file is checked only
36160 when this option is set. The permitted groups are those listed in the
36161 <option>owngroups</option> option, together with the user&#x2019;s default group if
36162 <option>check_local_user</option> is set. If the file has the wrong group, routing is
36163 deferred. The default setting for this option is true if <option>check_local_user</option>
36164 is set and the <option>modemask</option> option permits the group write bit, or if the
36165 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
36166 </para>
36167 <para>
36168 <indexterm role="option">
36169 <primary><option>check_owner</option></primary>
36170 </indexterm>
36171 </para>
36172 <informaltable frame="all">
36173 <tgroup cols="4" colsep="0" rowsep="0">
36174 <colspec colwidth="8*" align="left"/>
36175 <colspec colwidth="6*" align="center"/>
36176 <colspec colwidth="6*" align="center"/>
36177 <colspec colwidth="6*" align="right"/>
36178 <tbody>
36179 <row>
36180 <entry><option>check_owner</option></entry>
36181 <entry>Use: <emphasis>redirect</emphasis></entry>
36182 <entry>Type: <emphasis>boolean</emphasis></entry>
36183 <entry>Default: <emphasis>see below</emphasis></entry>
36184 </row>
36185 </tbody>
36186 </tgroup>
36187 </informaltable>
36188 <para>
36189 When the <option>file</option> option is used, the owner of the file is checked only when
36190 this option is set. If <option>check_local_user</option> is set, the local user is
36191 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
36192 option. The default value for this option is true if <option>check_local_user</option> or
36193 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
36194 </para>
36195 <para>
36196 <indexterm role="option">
36197 <primary><option>data</option></primary>
36198 </indexterm>
36199 </para>
36200 <informaltable frame="all">
36201 <tgroup cols="4" colsep="0" rowsep="0">
36202 <colspec colwidth="8*" align="left"/>
36203 <colspec colwidth="6*" align="center"/>
36204 <colspec colwidth="6*" align="center"/>
36205 <colspec colwidth="6*" align="right"/>
36206 <tbody>
36207 <row>
36208 <entry><option>data</option></entry>
36209 <entry>Use: <emphasis>redirect</emphasis></entry>
36210 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36211 <entry>Default: <emphasis>unset</emphasis></entry>
36212 </row>
36213 </tbody>
36214 </tgroup>
36215 </informaltable>
36216 <para>
36217 This option is mutually exclusive with <option>file</option>. One or other of them must be
36218 set, but not both. The contents of <option>data</option> are expanded, and then used as the
36219 list of forwarding items, or as a set of filtering instructions. If the
36220 expansion is forced to fail, or the result is an empty string or a string that
36221 has no effect (consists entirely of comments), the router declines.
36222 </para>
36223 <para>
36224 When filtering instructions are used, the string must begin with <quote>#Exim
36225 filter</quote>, and all comments in the string, including this initial one, must be
36226 terminated with newline characters. For example:
36227 </para>
36228 <literallayout class="monospaced">
36229 data = #Exim filter\n\
36230        if $h_to: contains Exim then save $home/mail/exim endif
36231 </literallayout>
36232 <para>
36233 If you are reading the data from a database where newlines cannot be included,
36234 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
36235 choice into a newline.
36236 </para>
36237 <para>
36238 <indexterm role="option">
36239 <primary><option>directory_transport</option></primary>
36240 </indexterm>
36241 </para>
36242 <informaltable frame="all">
36243 <tgroup cols="4" colsep="0" rowsep="0">
36244 <colspec colwidth="8*" align="left"/>
36245 <colspec colwidth="6*" align="center"/>
36246 <colspec colwidth="6*" align="center"/>
36247 <colspec colwidth="6*" align="right"/>
36248 <tbody>
36249 <row>
36250 <entry><option>directory_transport</option></entry>
36251 <entry>Use: <emphasis>redirect</emphasis></entry>
36252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36253 <entry>Default: <emphasis>unset</emphasis></entry>
36254 </row>
36255 </tbody>
36256 </tgroup>
36257 </informaltable>
36258 <para>
36259 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
36260 ending with a slash is specified as a new <quote>address</quote>. The transport used is
36261 specified by this option, which, after expansion, must be the name of a
36262 configured transport. This should normally be an <command>appendfile</command> transport.
36263 </para>
36264 <para>
36265 <indexterm role="option">
36266 <primary><option>file</option></primary>
36267 </indexterm>
36268 </para>
36269 <informaltable frame="all">
36270 <tgroup cols="4" colsep="0" rowsep="0">
36271 <colspec colwidth="8*" align="left"/>
36272 <colspec colwidth="6*" align="center"/>
36273 <colspec colwidth="6*" align="center"/>
36274 <colspec colwidth="6*" align="right"/>
36275 <tbody>
36276 <row>
36277 <entry><option>file</option></entry>
36278 <entry>Use: <emphasis>redirect</emphasis></entry>
36279 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36280 <entry>Default: <emphasis>unset</emphasis></entry>
36281 </row>
36282 </tbody>
36283 </tgroup>
36284 </informaltable>
36285 <para>
36286 This option specifies the name of a file that contains the redirection data. It
36287 is mutually exclusive with the <option>data</option> option. The string is expanded before
36288 use; if the expansion is forced to fail, the router declines. Other expansion
36289 failures cause delivery to be deferred. The result of a successful expansion
36290 must be an absolute path. The entire file is read and used as the redirection
36291 data. If the data is an empty string or a string that has no effect (consists
36292 entirely of comments), the router declines.
36293 </para>
36294 <para>
36295 <indexterm role="concept">
36296 <primary>NFS</primary>
36297 <secondary>checking for file existence</secondary>
36298 </indexterm>
36299 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
36300 runs a check on the containing directory,
36301 unless <option>ignore_enotdir</option> is true (see below).
36302 If the directory does not appear to exist, delivery is deferred. This can
36303 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
36304 is a mount problem. If the containing directory does exist, but the file does
36305 not, the router declines.
36306 </para>
36307 <para>
36308 <indexterm role="option">
36309 <primary><option>file_transport</option></primary>
36310 </indexterm>
36311 </para>
36312 <informaltable frame="all">
36313 <tgroup cols="4" colsep="0" rowsep="0">
36314 <colspec colwidth="8*" align="left"/>
36315 <colspec colwidth="6*" align="center"/>
36316 <colspec colwidth="6*" align="center"/>
36317 <colspec colwidth="6*" align="right"/>
36318 <tbody>
36319 <row>
36320 <entry><option>file_transport</option></entry>
36321 <entry>Use: <emphasis>redirect</emphasis></entry>
36322 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36323 <entry>Default: <emphasis>unset</emphasis></entry>
36324 </row>
36325 </tbody>
36326 </tgroup>
36327 </informaltable>
36328 <para>
36329 <indexterm role="variable">
36330 <primary><varname>$address_file</varname></primary>
36331 </indexterm>
36332 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
36333 ending in a slash is specified as a new <quote>address</quote>. The transport used is
36334 specified by this option, which, after expansion, must be the name of a
36335 configured transport. This should normally be an <command>appendfile</command> transport. When
36336 it is running, the file name is in <varname>$address_file</varname>.
36337 </para>
36338 <para>
36339 <indexterm role="option">
36340 <primary><option>filter_prepend_home</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>filter_prepend_home</option></entry>
36352 <entry>Use: <emphasis>redirect</emphasis></entry>
36353 <entry>Type: <emphasis>boolean</emphasis></entry>
36354 <entry>Default: <emphasis>true</emphasis></entry>
36355 </row>
36356 </tbody>
36357 </tgroup>
36358 </informaltable>
36359 <para>
36360 When this option is true, if a <command>save</command> command in an Exim filter specifies a
36361 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
36362 relative path. If this option is set false, this action does not happen. The
36363 relative path is then passed to the transport unmodified.
36364 </para>
36365 <para>
36366 <indexterm role="option">
36367 <primary><option>forbid_blackhole</option></primary>
36368 </indexterm>
36369 </para>
36370 <informaltable frame="all">
36371 <tgroup cols="4" colsep="0" rowsep="0">
36372 <colspec colwidth="8*" align="left"/>
36373 <colspec colwidth="6*" align="center"/>
36374 <colspec colwidth="6*" align="center"/>
36375 <colspec colwidth="6*" align="right"/>
36376 <tbody>
36377 <row>
36378 <entry><option>forbid_blackhole</option></entry>
36379 <entry>Use: <emphasis>redirect</emphasis></entry>
36380 <entry>Type: <emphasis>boolean</emphasis></entry>
36381 <entry>Default: <emphasis>false</emphasis></entry>
36382 </row>
36383 </tbody>
36384 </tgroup>
36385 </informaltable>
36386 <para>
36387 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
36388 redirection list.
36389 </para>
36390 <para>
36391 <indexterm role="option">
36392 <primary><option>forbid_exim_filter</option></primary>
36393 </indexterm>
36394 </para>
36395 <informaltable frame="all">
36396 <tgroup cols="4" colsep="0" rowsep="0">
36397 <colspec colwidth="8*" align="left"/>
36398 <colspec colwidth="6*" align="center"/>
36399 <colspec colwidth="6*" align="center"/>
36400 <colspec colwidth="6*" align="right"/>
36401 <tbody>
36402 <row>
36403 <entry><option>forbid_exim_filter</option></entry>
36404 <entry>Use: <emphasis>redirect</emphasis></entry>
36405 <entry>Type: <emphasis>boolean</emphasis></entry>
36406 <entry>Default: <emphasis>false</emphasis></entry>
36407 </row>
36408 </tbody>
36409 </tgroup>
36410 </informaltable>
36411 <para>
36412 If this option is set true, only Sieve filters are permitted when
36413 <option>allow_filter</option> is true.
36414 </para>
36415 <para>
36416 <indexterm role="option">
36417 <primary><option>forbid_file</option></primary>
36418 </indexterm>
36419 </para>
36420 <informaltable frame="all">
36421 <tgroup cols="4" colsep="0" rowsep="0">
36422 <colspec colwidth="8*" align="left"/>
36423 <colspec colwidth="6*" align="center"/>
36424 <colspec colwidth="6*" align="center"/>
36425 <colspec colwidth="6*" align="right"/>
36426 <tbody>
36427 <row>
36428 <entry><option>forbid_file</option></entry>
36429 <entry>Use: <emphasis>redirect</emphasis></entry>
36430 <entry>Type: <emphasis>boolean</emphasis></entry>
36431 <entry>Default: <emphasis>false</emphasis></entry>
36432 </row>
36433 </tbody>
36434 </tgroup>
36435 </informaltable>
36436 <para>
36437 <indexterm role="concept">
36438 <primary>delivery</primary>
36439 <secondary>to file; forbidding</secondary>
36440 </indexterm>
36441 <indexterm role="concept">
36442 <primary>Sieve filter</primary>
36443 <secondary>forbidding delivery to a file</secondary>
36444 </indexterm>
36445 <indexterm role="concept">
36446 <primary>Sieve filter</primary>
36447 <secondary><quote>keep</quote> facility; disabling</secondary>
36448 </indexterm>
36449 If this option is true, this router may not generate a new address that
36450 specifies delivery to a local file or directory, either from a filter or from a
36451 conventional forward file. This option is forced to be true if <option>one_time</option> is
36452 set. It applies to Sieve filters as well as to Exim filters, but if true, it
36453 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
36454 </para>
36455 <para>
36456 <indexterm role="option">
36457 <primary><option>forbid_filter_dlfunc</option></primary>
36458 </indexterm>
36459 </para>
36460 <informaltable frame="all">
36461 <tgroup cols="4" colsep="0" rowsep="0">
36462 <colspec colwidth="8*" align="left"/>
36463 <colspec colwidth="6*" align="center"/>
36464 <colspec colwidth="6*" align="center"/>
36465 <colspec colwidth="6*" align="right"/>
36466 <tbody>
36467 <row>
36468 <entry><option>forbid_filter_dlfunc</option></entry>
36469 <entry>Use: <emphasis>redirect</emphasis></entry>
36470 <entry>Type: <emphasis>boolean</emphasis></entry>
36471 <entry>Default: <emphasis>false</emphasis></entry>
36472 </row>
36473 </tbody>
36474 </tgroup>
36475 </informaltable>
36476 <para>
36477 <indexterm role="concept">
36478 <primary>filter</primary>
36479 <secondary>locking out certain features</secondary>
36480 </indexterm>
36481 If this option is true, string expansions in Exim filters are not allowed to
36482 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
36483 functions.
36484 </para>
36485 <para>
36486 <indexterm role="option">
36487 <primary><option>forbid_filter_existstest</option></primary>
36488 </indexterm>
36489 </para>
36490 <informaltable frame="all">
36491 <tgroup cols="4" colsep="0" rowsep="0">
36492 <colspec colwidth="8*" align="left"/>
36493 <colspec colwidth="6*" align="center"/>
36494 <colspec colwidth="6*" align="center"/>
36495 <colspec colwidth="6*" align="right"/>
36496 <tbody>
36497 <row>
36498 <entry><option>forbid_filter_existstest</option></entry>
36499 <entry>Use: <emphasis>redirect</emphasis></entry>
36500 <entry>Type: <emphasis>boolean</emphasis></entry>
36501 <entry>Default: <emphasis>false</emphasis></entry>
36502 </row>
36503 </tbody>
36504 </tgroup>
36505 </informaltable>
36506 <para>
36507 <indexterm role="concept">
36508 <primary>expansion</primary>
36509 <secondary>statting a file</secondary>
36510 </indexterm>
36511 If this option is true, string expansions in Exim filters are not allowed to
36512 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
36513 </para>
36514 <para>
36515 <indexterm role="option">
36516 <primary><option>forbid_filter_logwrite</option></primary>
36517 </indexterm>
36518 </para>
36519 <informaltable frame="all">
36520 <tgroup cols="4" colsep="0" rowsep="0">
36521 <colspec colwidth="8*" align="left"/>
36522 <colspec colwidth="6*" align="center"/>
36523 <colspec colwidth="6*" align="center"/>
36524 <colspec colwidth="6*" align="right"/>
36525 <tbody>
36526 <row>
36527 <entry><option>forbid_filter_logwrite</option></entry>
36528 <entry>Use: <emphasis>redirect</emphasis></entry>
36529 <entry>Type: <emphasis>boolean</emphasis></entry>
36530 <entry>Default: <emphasis>false</emphasis></entry>
36531 </row>
36532 </tbody>
36533 </tgroup>
36534 </informaltable>
36535 <para>
36536 If this option is true, use of the logging facility in Exim filters is not
36537 permitted. Logging is in any case available only if the filter is being run
36538 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
36539 <filename>.forward</filename> files).
36540 </para>
36541 <para>
36542 <indexterm role="option">
36543 <primary><option>forbid_filter_lookup</option></primary>
36544 </indexterm>
36545 </para>
36546 <informaltable frame="all">
36547 <tgroup cols="4" colsep="0" rowsep="0">
36548 <colspec colwidth="8*" align="left"/>
36549 <colspec colwidth="6*" align="center"/>
36550 <colspec colwidth="6*" align="center"/>
36551 <colspec colwidth="6*" align="right"/>
36552 <tbody>
36553 <row>
36554 <entry><option>forbid_filter_lookup</option></entry>
36555 <entry>Use: <emphasis>redirect</emphasis></entry>
36556 <entry>Type: <emphasis>boolean</emphasis></entry>
36557 <entry>Default: <emphasis>false</emphasis></entry>
36558 </row>
36559 </tbody>
36560 </tgroup>
36561 </informaltable>
36562 <para>
36563 If this option is true, string expansions in Exim filter files are not allowed
36564 to make use of <option>lookup</option> items.
36565 </para>
36566 <para>
36567 <indexterm role="option">
36568 <primary><option>forbid_filter_perl</option></primary>
36569 </indexterm>
36570 </para>
36571 <informaltable frame="all">
36572 <tgroup cols="4" colsep="0" rowsep="0">
36573 <colspec colwidth="8*" align="left"/>
36574 <colspec colwidth="6*" align="center"/>
36575 <colspec colwidth="6*" align="center"/>
36576 <colspec colwidth="6*" align="right"/>
36577 <tbody>
36578 <row>
36579 <entry><option>forbid_filter_perl</option></entry>
36580 <entry>Use: <emphasis>redirect</emphasis></entry>
36581 <entry>Type: <emphasis>boolean</emphasis></entry>
36582 <entry>Default: <emphasis>false</emphasis></entry>
36583 </row>
36584 </tbody>
36585 </tgroup>
36586 </informaltable>
36587 <para>
36588 This option has an effect only if Exim is built with embedded Perl support. If
36589 it is true, string expansions in Exim filter files are not allowed to make use
36590 of the embedded Perl support.
36591 </para>
36592 <para>
36593 <indexterm role="option">
36594 <primary><option>forbid_filter_readfile</option></primary>
36595 </indexterm>
36596 </para>
36597 <informaltable frame="all">
36598 <tgroup cols="4" colsep="0" rowsep="0">
36599 <colspec colwidth="8*" align="left"/>
36600 <colspec colwidth="6*" align="center"/>
36601 <colspec colwidth="6*" align="center"/>
36602 <colspec colwidth="6*" align="right"/>
36603 <tbody>
36604 <row>
36605 <entry><option>forbid_filter_readfile</option></entry>
36606 <entry>Use: <emphasis>redirect</emphasis></entry>
36607 <entry>Type: <emphasis>boolean</emphasis></entry>
36608 <entry>Default: <emphasis>false</emphasis></entry>
36609 </row>
36610 </tbody>
36611 </tgroup>
36612 </informaltable>
36613 <para>
36614 If this option is true, string expansions in Exim filter files are not allowed
36615 to make use of <option>readfile</option> items.
36616 </para>
36617 <para>
36618 <indexterm role="option">
36619 <primary><option>forbid_filter_readsocket</option></primary>
36620 </indexterm>
36621 </para>
36622 <informaltable frame="all">
36623 <tgroup cols="4" colsep="0" rowsep="0">
36624 <colspec colwidth="8*" align="left"/>
36625 <colspec colwidth="6*" align="center"/>
36626 <colspec colwidth="6*" align="center"/>
36627 <colspec colwidth="6*" align="right"/>
36628 <tbody>
36629 <row>
36630 <entry><option>forbid_filter_readsocket</option></entry>
36631 <entry>Use: <emphasis>redirect</emphasis></entry>
36632 <entry>Type: <emphasis>boolean</emphasis></entry>
36633 <entry>Default: <emphasis>false</emphasis></entry>
36634 </row>
36635 </tbody>
36636 </tgroup>
36637 </informaltable>
36638 <para>
36639 If this option is true, string expansions in Exim filter files are not allowed
36640 to make use of <option>readsocket</option> items.
36641 </para>
36642 <para>
36643 <indexterm role="option">
36644 <primary><option>forbid_filter_reply</option></primary>
36645 </indexterm>
36646 </para>
36647 <informaltable frame="all">
36648 <tgroup cols="4" colsep="0" rowsep="0">
36649 <colspec colwidth="8*" align="left"/>
36650 <colspec colwidth="6*" align="center"/>
36651 <colspec colwidth="6*" align="center"/>
36652 <colspec colwidth="6*" align="right"/>
36653 <tbody>
36654 <row>
36655 <entry><option>forbid_filter_reply</option></entry>
36656 <entry>Use: <emphasis>redirect</emphasis></entry>
36657 <entry>Type: <emphasis>boolean</emphasis></entry>
36658 <entry>Default: <emphasis>false</emphasis></entry>
36659 </row>
36660 </tbody>
36661 </tgroup>
36662 </informaltable>
36663 <para>
36664 If this option is true, this router may not generate an automatic reply
36665 message. Automatic replies can be generated only from Exim or Sieve filter
36666 files, not from traditional forward files. This option is forced to be true if
36667 <option>one_time</option> is set.
36668 </para>
36669 <para>
36670 <indexterm role="option">
36671 <primary><option>forbid_filter_run</option></primary>
36672 </indexterm>
36673 </para>
36674 <informaltable frame="all">
36675 <tgroup cols="4" colsep="0" rowsep="0">
36676 <colspec colwidth="8*" align="left"/>
36677 <colspec colwidth="6*" align="center"/>
36678 <colspec colwidth="6*" align="center"/>
36679 <colspec colwidth="6*" align="right"/>
36680 <tbody>
36681 <row>
36682 <entry><option>forbid_filter_run</option></entry>
36683 <entry>Use: <emphasis>redirect</emphasis></entry>
36684 <entry>Type: <emphasis>boolean</emphasis></entry>
36685 <entry>Default: <emphasis>false</emphasis></entry>
36686 </row>
36687 </tbody>
36688 </tgroup>
36689 </informaltable>
36690 <para>
36691 If this option is true, string expansions in Exim filter files are not allowed
36692 to make use of <option>run</option> items.
36693 </para>
36694 <para>
36695 <indexterm role="option">
36696 <primary><option>forbid_include</option></primary>
36697 </indexterm>
36698 </para>
36699 <informaltable frame="all">
36700 <tgroup cols="4" colsep="0" rowsep="0">
36701 <colspec colwidth="8*" align="left"/>
36702 <colspec colwidth="6*" align="center"/>
36703 <colspec colwidth="6*" align="center"/>
36704 <colspec colwidth="6*" align="right"/>
36705 <tbody>
36706 <row>
36707 <entry><option>forbid_include</option></entry>
36708 <entry>Use: <emphasis>redirect</emphasis></entry>
36709 <entry>Type: <emphasis>boolean</emphasis></entry>
36710 <entry>Default: <emphasis>false</emphasis></entry>
36711 </row>
36712 </tbody>
36713 </tgroup>
36714 </informaltable>
36715 <para>
36716 If this option is true, items of the form
36717 </para>
36718 <literallayout class="monospaced">
36719 :include:&lt;path name&gt;
36720 </literallayout>
36721 <para>
36722 are not permitted in non-filter redirection lists.
36723 </para>
36724 <para>
36725 <indexterm role="option">
36726 <primary><option>forbid_pipe</option></primary>
36727 </indexterm>
36728 </para>
36729 <informaltable frame="all">
36730 <tgroup cols="4" colsep="0" rowsep="0">
36731 <colspec colwidth="8*" align="left"/>
36732 <colspec colwidth="6*" align="center"/>
36733 <colspec colwidth="6*" align="center"/>
36734 <colspec colwidth="6*" align="right"/>
36735 <tbody>
36736 <row>
36737 <entry><option>forbid_pipe</option></entry>
36738 <entry>Use: <emphasis>redirect</emphasis></entry>
36739 <entry>Type: <emphasis>boolean</emphasis></entry>
36740 <entry>Default: <emphasis>false</emphasis></entry>
36741 </row>
36742 </tbody>
36743 </tgroup>
36744 </informaltable>
36745 <para>
36746 <indexterm role="concept">
36747 <primary>delivery</primary>
36748 <secondary>to pipe; forbidding</secondary>
36749 </indexterm>
36750 If this option is true, this router may not generate a new address which
36751 specifies delivery to a pipe, either from an Exim filter or from a conventional
36752 forward file. This option is forced to be true if <option>one_time</option> is set.
36753 </para>
36754 <para>
36755 <indexterm role="option">
36756 <primary><option>forbid_sieve_filter</option></primary>
36757 </indexterm>
36758 </para>
36759 <informaltable frame="all">
36760 <tgroup cols="4" colsep="0" rowsep="0">
36761 <colspec colwidth="8*" align="left"/>
36762 <colspec colwidth="6*" align="center"/>
36763 <colspec colwidth="6*" align="center"/>
36764 <colspec colwidth="6*" align="right"/>
36765 <tbody>
36766 <row>
36767 <entry><option>forbid_sieve_filter</option></entry>
36768 <entry>Use: <emphasis>redirect</emphasis></entry>
36769 <entry>Type: <emphasis>boolean</emphasis></entry>
36770 <entry>Default: <emphasis>false</emphasis></entry>
36771 </row>
36772 </tbody>
36773 </tgroup>
36774 </informaltable>
36775 <para>
36776 If this option is set true, only Exim filters are permitted when
36777 <option>allow_filter</option> is true.
36778 </para>
36779 <para>
36780 <indexterm role="concept">
36781 <primary>SMTP</primary>
36782 <secondary>error codes</secondary>
36783 </indexterm>
36784 <indexterm role="option">
36785 <primary><option>forbid_smtp_code</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>forbid_smtp_code</option></entry>
36797 <entry>Use: <emphasis>redirect</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 If this option is set true, any SMTP error codes that are present at the start
36806 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
36807 the default codes (451 and 550, respectively) are always used.
36808 </para>
36809 <para>
36810 <indexterm role="option">
36811 <primary><option>hide_child_in_errmsg</option></primary>
36812 </indexterm>
36813 </para>
36814 <informaltable frame="all">
36815 <tgroup cols="4" colsep="0" rowsep="0">
36816 <colspec colwidth="8*" align="left"/>
36817 <colspec colwidth="6*" align="center"/>
36818 <colspec colwidth="6*" align="center"/>
36819 <colspec colwidth="6*" align="right"/>
36820 <tbody>
36821 <row>
36822 <entry><option>hide_child_in_errmsg</option></entry>
36823 <entry>Use: <emphasis>redirect</emphasis></entry>
36824 <entry>Type: <emphasis>boolean</emphasis></entry>
36825 <entry>Default: <emphasis>false</emphasis></entry>
36826 </row>
36827 </tbody>
36828 </tgroup>
36829 </informaltable>
36830 <para>
36831 <indexterm role="concept">
36832 <primary>bounce message</primary>
36833 <secondary>redirection details; suppressing</secondary>
36834 </indexterm>
36835 If this option is true, it prevents Exim from quoting a child address if it
36836 generates a bounce or delay message for it. Instead it says <quote>an address
36837 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
36838 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
36839 bounce may well quote the generated address.
36840 </para>
36841 <para>
36842 <indexterm role="option">
36843 <primary><option>ignore_eacces</option></primary>
36844 </indexterm>
36845 </para>
36846 <informaltable frame="all">
36847 <tgroup cols="4" colsep="0" rowsep="0">
36848 <colspec colwidth="8*" align="left"/>
36849 <colspec colwidth="6*" align="center"/>
36850 <colspec colwidth="6*" align="center"/>
36851 <colspec colwidth="6*" align="right"/>
36852 <tbody>
36853 <row>
36854 <entry><option>ignore_eacces</option></entry>
36855 <entry>Use: <emphasis>redirect</emphasis></entry>
36856 <entry>Type: <emphasis>boolean</emphasis></entry>
36857 <entry>Default: <emphasis>false</emphasis></entry>
36858 </row>
36859 </tbody>
36860 </tgroup>
36861 </informaltable>
36862 <para>
36863 <indexterm role="concept">
36864 <primary>EACCES</primary>
36865 </indexterm>
36866 If this option is set and an attempt to open a redirection file yields the
36867 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
36868 file did not exist.
36869 </para>
36870 <para>
36871 <indexterm role="option">
36872 <primary><option>ignore_enotdir</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>ignore_enotdir</option></entry>
36884 <entry>Use: <emphasis>redirect</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 <indexterm role="concept">
36893 <primary>ENOTDIR</primary>
36894 </indexterm>
36895 If this option is set and an attempt to open a redirection file yields the
36896 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
36897 router behaves as if the file did not exist.
36898 </para>
36899 <para>
36900 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
36901 router that has the <option>file</option> option set discovers that the file does not exist
36902 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
36903 against unmounted NFS directories. If the parent can not be statted, delivery
36904 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
36905 is set, because that option tells Exim to ignore <quote>something on the path is not
36906 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
36907 that some operating systems give ENOENT where others give ENOTDIR.
36908 </para>
36909 <para>
36910 <indexterm role="option">
36911 <primary><option>include_directory</option></primary>
36912 </indexterm>
36913 </para>
36914 <informaltable frame="all">
36915 <tgroup cols="4" colsep="0" rowsep="0">
36916 <colspec colwidth="8*" align="left"/>
36917 <colspec colwidth="6*" align="center"/>
36918 <colspec colwidth="6*" align="center"/>
36919 <colspec colwidth="6*" align="right"/>
36920 <tbody>
36921 <row>
36922 <entry><option>include_directory</option></entry>
36923 <entry>Use: <emphasis>redirect</emphasis></entry>
36924 <entry>Type: <emphasis>string</emphasis></entry>
36925 <entry>Default: <emphasis>unset</emphasis></entry>
36926 </row>
36927 </tbody>
36928 </tgroup>
36929 </informaltable>
36930 <para>
36931 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
36932 redirection list must start with this directory.
36933 </para>
36934 <para>
36935 <indexterm role="option">
36936 <primary><option>modemask</option></primary>
36937 </indexterm>
36938 </para>
36939 <informaltable frame="all">
36940 <tgroup cols="4" colsep="0" rowsep="0">
36941 <colspec colwidth="8*" align="left"/>
36942 <colspec colwidth="6*" align="center"/>
36943 <colspec colwidth="6*" align="center"/>
36944 <colspec colwidth="6*" align="right"/>
36945 <tbody>
36946 <row>
36947 <entry><option>modemask</option></entry>
36948 <entry>Use: <emphasis>redirect</emphasis></entry>
36949 <entry>Type: <emphasis>octal integer</emphasis></entry>
36950 <entry>Default: <emphasis>022</emphasis></entry>
36951 </row>
36952 </tbody>
36953 </tgroup>
36954 </informaltable>
36955 <para>
36956 This specifies mode bits which must not be set for a file specified by the
36957 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
36958 </para>
36959 <para>
36960 <indexterm role="option">
36961 <primary><option>one_time</option></primary>
36962 </indexterm>
36963 </para>
36964 <informaltable frame="all">
36965 <tgroup cols="4" colsep="0" rowsep="0">
36966 <colspec colwidth="8*" align="left"/>
36967 <colspec colwidth="6*" align="center"/>
36968 <colspec colwidth="6*" align="center"/>
36969 <colspec colwidth="6*" align="right"/>
36970 <tbody>
36971 <row>
36972 <entry><option>one_time</option></entry>
36973 <entry>Use: <emphasis>redirect</emphasis></entry>
36974 <entry>Type: <emphasis>boolean</emphasis></entry>
36975 <entry>Default: <emphasis>false</emphasis></entry>
36976 </row>
36977 </tbody>
36978 </tgroup>
36979 </informaltable>
36980 <para>
36981 <indexterm role="concept">
36982 <primary>one-time aliasing/forwarding expansion</primary>
36983 </indexterm>
36984 <indexterm role="concept">
36985 <primary>alias file</primary>
36986 <secondary>one-time expansion</secondary>
36987 </indexterm>
36988 <indexterm role="concept">
36989 <primary>forward file</primary>
36990 <secondary>one-time expansion</secondary>
36991 </indexterm>
36992 <indexterm role="concept">
36993 <primary>mailing lists</primary>
36994 <secondary>one-time expansion</secondary>
36995 </indexterm>
36996 <indexterm role="concept">
36997 <primary>address redirection</primary>
36998 <secondary>one-time expansion</secondary>
36999 </indexterm>
37000 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
37001 files each time it tries to deliver a message causes a problem when one or more
37002 of the generated addresses fails be delivered at the first attempt. The problem
37003 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
37004 but of what happens when the redirection list changes during the time that the
37005 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
37006 lists, where new subscribers might receive copies of messages that were posted
37007 before they subscribed.
37008 </para>
37009 <para>
37010 If <option>one_time</option> is set and any addresses generated by the router fail to
37011 deliver at the first attempt, the failing addresses are added to the message as
37012 <quote>top level</quote> addresses, and the parent address that generated them is marked
37013 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
37014 attempt.
37015 </para>
37016 <para>
37017 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
37018 router would be lost if delivery did not succeed at the first attempt. For this
37019 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
37020 permitted when <option>one_time</option> is set.
37021 </para>
37022 <para>
37023 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
37024 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
37025 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
37026 </para>
37027 <para>
37028 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
37029 <option>one_time</option>.
37030 </para>
37031 <para>
37032 The original top-level address is remembered with each of the generated
37033 addresses, and is output in any log messages. However, any intermediate parent
37034 addresses are not recorded. This makes a difference to the log only if
37035 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
37036 typically be used for mailing lists, where there is normally just one level of
37037 expansion.
37038 </para>
37039 <para>
37040 <indexterm role="option">
37041 <primary><option>owners</option></primary>
37042 </indexterm>
37043 </para>
37044 <informaltable frame="all">
37045 <tgroup cols="4" colsep="0" rowsep="0">
37046 <colspec colwidth="8*" align="left"/>
37047 <colspec colwidth="6*" align="center"/>
37048 <colspec colwidth="6*" align="center"/>
37049 <colspec colwidth="6*" align="right"/>
37050 <tbody>
37051 <row>
37052 <entry><option>owners</option></entry>
37053 <entry>Use: <emphasis>redirect</emphasis></entry>
37054 <entry>Type: <emphasis>string list</emphasis></entry>
37055 <entry>Default: <emphasis>unset</emphasis></entry>
37056 </row>
37057 </tbody>
37058 </tgroup>
37059 </informaltable>
37060 <para>
37061 <indexterm role="concept">
37062 <primary>ownership</primary>
37063 <secondary>alias file</secondary>
37064 </indexterm>
37065 <indexterm role="concept">
37066 <primary>ownership</primary>
37067 <secondary>forward file</secondary>
37068 </indexterm>
37069 <indexterm role="concept">
37070 <primary>alias file</primary>
37071 <secondary>ownership</secondary>
37072 </indexterm>
37073 <indexterm role="concept">
37074 <primary>forward file</primary>
37075 <secondary>ownership</secondary>
37076 </indexterm>
37077 This specifies a list of permitted owners for the file specified by <option>file</option>.
37078 This list is in addition to the local user when <option>check_local_user</option> is set.
37079 See <option>check_owner</option> above.
37080 </para>
37081 <para>
37082 <indexterm role="option">
37083 <primary><option>owngroups</option></primary>
37084 </indexterm>
37085 </para>
37086 <informaltable frame="all">
37087 <tgroup cols="4" colsep="0" rowsep="0">
37088 <colspec colwidth="8*" align="left"/>
37089 <colspec colwidth="6*" align="center"/>
37090 <colspec colwidth="6*" align="center"/>
37091 <colspec colwidth="6*" align="right"/>
37092 <tbody>
37093 <row>
37094 <entry><option>owngroups</option></entry>
37095 <entry>Use: <emphasis>redirect</emphasis></entry>
37096 <entry>Type: <emphasis>string list</emphasis></entry>
37097 <entry>Default: <emphasis>unset</emphasis></entry>
37098 </row>
37099 </tbody>
37100 </tgroup>
37101 </informaltable>
37102 <para>
37103 This specifies a list of permitted groups for the file specified by <option>file</option>.
37104 The list is in addition to the local user&#x2019;s primary group when
37105 <option>check_local_user</option> is set. See <option>check_group</option> above.
37106 </para>
37107 <para>
37108 <indexterm role="option">
37109 <primary><option>pipe_transport</option></primary>
37110 </indexterm>
37111 </para>
37112 <informaltable frame="all">
37113 <tgroup cols="4" colsep="0" rowsep="0">
37114 <colspec colwidth="8*" align="left"/>
37115 <colspec colwidth="6*" align="center"/>
37116 <colspec colwidth="6*" align="center"/>
37117 <colspec colwidth="6*" align="right"/>
37118 <tbody>
37119 <row>
37120 <entry><option>pipe_transport</option></entry>
37121 <entry>Use: <emphasis>redirect</emphasis></entry>
37122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37123 <entry>Default: <emphasis>unset</emphasis></entry>
37124 </row>
37125 </tbody>
37126 </tgroup>
37127 </informaltable>
37128 <para>
37129 <indexterm role="variable">
37130 <primary><varname>$address_pipe</varname></primary>
37131 </indexterm>
37132 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
37133 starting with a vertical bar character is specified as a new <quote>address</quote>. The
37134 transport used is specified by this option, which, after expansion, must be the
37135 name of a configured transport. This should normally be a <command>pipe</command> transport.
37136 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
37137 </para>
37138 <para>
37139 <indexterm role="option">
37140 <primary><option>qualify_domain</option></primary>
37141 </indexterm>
37142 </para>
37143 <informaltable frame="all">
37144 <tgroup cols="4" colsep="0" rowsep="0">
37145 <colspec colwidth="8*" align="left"/>
37146 <colspec colwidth="6*" align="center"/>
37147 <colspec colwidth="6*" align="center"/>
37148 <colspec colwidth="6*" align="right"/>
37149 <tbody>
37150 <row>
37151 <entry><option>qualify_domain</option></entry>
37152 <entry>Use: <emphasis>redirect</emphasis></entry>
37153 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37154 <entry>Default: <emphasis>unset</emphasis></entry>
37155 </row>
37156 </tbody>
37157 </tgroup>
37158 </informaltable>
37159 <para>
37160 <indexterm role="variable">
37161 <primary><varname>$qualify_recipient</varname></primary>
37162 </indexterm>
37163 If this option is set, and an unqualified address (one without a domain) is
37164 generated, and that address would normally be qualified by the global setting
37165 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
37166 expanding this string. If the expansion fails, the router declines. If you want
37167 to revert to the default, you can have the expansion generate
37168 <varname>$qualify_recipient</varname>.
37169 </para>
37170 <para>
37171 This option applies to all unqualified addresses generated by Exim filters,
37172 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
37173 not preceded by a backslash. Sieve filters cannot generate unqualified
37174 addresses.
37175 </para>
37176 <para>
37177 <indexterm role="option">
37178 <primary><option>qualify_preserve_domain</option></primary>
37179 </indexterm>
37180 </para>
37181 <informaltable frame="all">
37182 <tgroup cols="4" colsep="0" rowsep="0">
37183 <colspec colwidth="8*" align="left"/>
37184 <colspec colwidth="6*" align="center"/>
37185 <colspec colwidth="6*" align="center"/>
37186 <colspec colwidth="6*" align="right"/>
37187 <tbody>
37188 <row>
37189 <entry><option>qualify_preserve_domain</option></entry>
37190 <entry>Use: <emphasis>redirect</emphasis></entry>
37191 <entry>Type: <emphasis>boolean</emphasis></entry>
37192 <entry>Default: <emphasis>false</emphasis></entry>
37193 </row>
37194 </tbody>
37195 </tgroup>
37196 </informaltable>
37197 <para>
37198 <indexterm role="concept">
37199 <primary>domain</primary>
37200 <secondary>in redirection; preserving</secondary>
37201 </indexterm>
37202 <indexterm role="concept">
37203 <primary>preserving domain in redirection</primary>
37204 </indexterm>
37205 <indexterm role="concept">
37206 <primary>address redirection</primary>
37207 <secondary>domain; preserving</secondary>
37208 </indexterm>
37209 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
37210 set (a configuration error occurs if it is). If an unqualified address (one
37211 without a domain) is generated, it is qualified with the domain of the parent
37212 address (the immediately preceding ancestor) instead of the global
37213 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
37214 this applies whether or not the address is preceded by a backslash.
37215 </para>
37216 <para>
37217 <indexterm role="option">
37218 <primary><option>repeat_use</option></primary>
37219 </indexterm>
37220 </para>
37221 <informaltable frame="all">
37222 <tgroup cols="4" colsep="0" rowsep="0">
37223 <colspec colwidth="8*" align="left"/>
37224 <colspec colwidth="6*" align="center"/>
37225 <colspec colwidth="6*" align="center"/>
37226 <colspec colwidth="6*" align="right"/>
37227 <tbody>
37228 <row>
37229 <entry><option>repeat_use</option></entry>
37230 <entry>Use: <emphasis>redirect</emphasis></entry>
37231 <entry>Type: <emphasis>boolean</emphasis></entry>
37232 <entry>Default: <emphasis>true</emphasis></entry>
37233 </row>
37234 </tbody>
37235 </tgroup>
37236 </informaltable>
37237 <para>
37238 If this option is set false, the router is skipped for a child address that has
37239 any ancestor that was routed by this router. This test happens before any of
37240 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
37241 only when the ancestor is the same as the current address. See also
37242 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
37243 </para>
37244 <para>
37245 <indexterm role="option">
37246 <primary><option>reply_transport</option></primary>
37247 </indexterm>
37248 </para>
37249 <informaltable frame="all">
37250 <tgroup cols="4" colsep="0" rowsep="0">
37251 <colspec colwidth="8*" align="left"/>
37252 <colspec colwidth="6*" align="center"/>
37253 <colspec colwidth="6*" align="center"/>
37254 <colspec colwidth="6*" align="right"/>
37255 <tbody>
37256 <row>
37257 <entry><option>reply_transport</option></entry>
37258 <entry>Use: <emphasis>redirect</emphasis></entry>
37259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37260 <entry>Default: <emphasis>unset</emphasis></entry>
37261 </row>
37262 </tbody>
37263 </tgroup>
37264 </informaltable>
37265 <para>
37266 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
37267 <option>vacation</option> command is used in a filter file. The transport used is specified
37268 by this option, which, after expansion, must be the name of a configured
37269 transport. This should normally be an <command>autoreply</command> transport. Other transports
37270 are unlikely to do anything sensible or useful.
37271 </para>
37272 <para>
37273 <indexterm role="option">
37274 <primary><option>rewrite</option></primary>
37275 </indexterm>
37276 </para>
37277 <informaltable frame="all">
37278 <tgroup cols="4" colsep="0" rowsep="0">
37279 <colspec colwidth="8*" align="left"/>
37280 <colspec colwidth="6*" align="center"/>
37281 <colspec colwidth="6*" align="center"/>
37282 <colspec colwidth="6*" align="right"/>
37283 <tbody>
37284 <row>
37285 <entry><option>rewrite</option></entry>
37286 <entry>Use: <emphasis>redirect</emphasis></entry>
37287 <entry>Type: <emphasis>boolean</emphasis></entry>
37288 <entry>Default: <emphasis>true</emphasis></entry>
37289 </row>
37290 </tbody>
37291 </tgroup>
37292 </informaltable>
37293 <para>
37294 <indexterm role="concept">
37295 <primary>address redirection</primary>
37296 <secondary>disabling rewriting</secondary>
37297 </indexterm>
37298 If this option is set false, addresses generated by the router are not
37299 subject to address rewriting. Otherwise, they are treated like new addresses
37300 and are rewritten according to the global rewriting rules.
37301 </para>
37302 <para>
37303 <indexterm role="option">
37304 <primary><option>sieve_subaddress</option></primary>
37305 </indexterm>
37306 </para>
37307 <informaltable frame="all">
37308 <tgroup cols="4" colsep="0" rowsep="0">
37309 <colspec colwidth="8*" align="left"/>
37310 <colspec colwidth="6*" align="center"/>
37311 <colspec colwidth="6*" align="center"/>
37312 <colspec colwidth="6*" align="right"/>
37313 <tbody>
37314 <row>
37315 <entry><option>sieve_subaddress</option></entry>
37316 <entry>Use: <emphasis>redirect</emphasis></entry>
37317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37318 <entry>Default: <emphasis>unset</emphasis></entry>
37319 </row>
37320 </tbody>
37321 </tgroup>
37322 </informaltable>
37323 <para>
37324 The value of this option is passed to a Sieve filter to specify the
37325 :subaddress part of an address.
37326 </para>
37327 <para>
37328 <indexterm role="option">
37329 <primary><option>sieve_useraddress</option></primary>
37330 </indexterm>
37331 </para>
37332 <informaltable frame="all">
37333 <tgroup cols="4" colsep="0" rowsep="0">
37334 <colspec colwidth="8*" align="left"/>
37335 <colspec colwidth="6*" align="center"/>
37336 <colspec colwidth="6*" align="center"/>
37337 <colspec colwidth="6*" align="right"/>
37338 <tbody>
37339 <row>
37340 <entry><option>sieve_useraddress</option></entry>
37341 <entry>Use: <emphasis>redirect</emphasis></entry>
37342 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37343 <entry>Default: <emphasis>unset</emphasis></entry>
37344 </row>
37345 </tbody>
37346 </tgroup>
37347 </informaltable>
37348 <para>
37349 The value of this option is passed to a Sieve filter to specify the :user part
37350 of an address. However, if it is unset, the entire original local part
37351 (including any prefix or suffix) is used for :user.
37352 </para>
37353 <para>
37354 <indexterm role="option">
37355 <primary><option>sieve_vacation_directory</option></primary>
37356 </indexterm>
37357 </para>
37358 <informaltable frame="all">
37359 <tgroup cols="4" colsep="0" rowsep="0">
37360 <colspec colwidth="8*" align="left"/>
37361 <colspec colwidth="6*" align="center"/>
37362 <colspec colwidth="6*" align="center"/>
37363 <colspec colwidth="6*" align="right"/>
37364 <tbody>
37365 <row>
37366 <entry><option>sieve_vacation_directory</option></entry>
37367 <entry>Use: <emphasis>redirect</emphasis></entry>
37368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37369 <entry>Default: <emphasis>unset</emphasis></entry>
37370 </row>
37371 </tbody>
37372 </tgroup>
37373 </informaltable>
37374 <para>
37375 <indexterm role="concept">
37376 <primary>Sieve filter</primary>
37377 <secondary>vacation directory</secondary>
37378 </indexterm>
37379 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
37380 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
37381 (do not put anything else in that directory), and ensure that the
37382 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
37383 needs their own directory; Exim will create it if necessary.
37384 </para>
37385 <para>
37386 <indexterm role="option">
37387 <primary><option>skip_syntax_errors</option></primary>
37388 </indexterm>
37389 </para>
37390 <informaltable frame="all">
37391 <tgroup cols="4" colsep="0" rowsep="0">
37392 <colspec colwidth="8*" align="left"/>
37393 <colspec colwidth="6*" align="center"/>
37394 <colspec colwidth="6*" align="center"/>
37395 <colspec colwidth="6*" align="right"/>
37396 <tbody>
37397 <row>
37398 <entry><option>skip_syntax_errors</option></entry>
37399 <entry>Use: <emphasis>redirect</emphasis></entry>
37400 <entry>Type: <emphasis>boolean</emphasis></entry>
37401 <entry>Default: <emphasis>false</emphasis></entry>
37402 </row>
37403 </tbody>
37404 </tgroup>
37405 </informaltable>
37406 <para>
37407 <indexterm role="concept">
37408 <primary>forward file</primary>
37409 <secondary>broken</secondary>
37410 </indexterm>
37411 <indexterm role="concept">
37412 <primary>address redirection</primary>
37413 <secondary>broken files</secondary>
37414 </indexterm>
37415 <indexterm role="concept">
37416 <primary>alias file</primary>
37417 <secondary>broken</secondary>
37418 </indexterm>
37419 <indexterm role="concept">
37420 <primary>broken alias or forward files</primary>
37421 </indexterm>
37422 <indexterm role="concept">
37423 <primary>ignoring faulty addresses</primary>
37424 </indexterm>
37425 <indexterm role="concept">
37426 <primary>skipping faulty addresses</primary>
37427 </indexterm>
37428 <indexterm role="concept">
37429 <primary>error</primary>
37430 <secondary>skipping bad syntax</secondary>
37431 </indexterm>
37432 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
37433 non-filter redirection data are skipped, and each failing address is logged. If
37434 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
37435 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
37436 are expanded and placed at the head of the error message generated by
37437 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
37438 be the same address as the generic <option>errors_to</option> option. The
37439 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
37440 </para>
37441 <para>
37442 If all the addresses in a redirection list are skipped because of syntax
37443 errors, the router declines to handle the original address, and it is passed to
37444 the following routers.
37445 </para>
37446 <para>
37447 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
37448 error in the filter causes filtering to be abandoned without any action being
37449 taken. The incident is logged, and the router declines to handle the address,
37450 so it is passed to the following routers.
37451 </para>
37452 <para>
37453 <indexterm role="concept">
37454 <primary>Sieve filter</primary>
37455 <secondary>syntax errors in</secondary>
37456 </indexterm>
37457 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
37458 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
37459 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
37460 </para>
37461 <para>
37462 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
37463 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
37464 option, used with an address that does not get redirected, can be used to
37465 notify users of these errors, by means of a router like this:
37466 </para>
37467 <literallayout class="monospaced">
37468 userforward:
37469   driver = redirect
37470   allow_filter
37471   check_local_user
37472   file = $home/.forward
37473   file_transport = address_file
37474   pipe_transport = address_pipe
37475   reply_transport = address_reply
37476   no_verify
37477   skip_syntax_errors
37478   syntax_errors_to = real-$local_part@$domain
37479   syntax_errors_text = \
37480    This is an automatically generated message. An error has\n\
37481    been found in your .forward file. Details of the error are\n\
37482    reported below. While this error persists, you will receive\n\
37483    a copy of this message for every message that is addressed\n\
37484    to you. If your .forward file is a filter file, or if it is\n\
37485    a non-filter file containing no valid forwarding addresses,\n\
37486    a copy of each incoming message will be put in your normal\n\
37487    mailbox. If a non-filter file contains at least one valid\n\
37488    forwarding address, forwarding to the valid addresses will\n\
37489    happen, and those will be the only deliveries that occur.
37490 </literallayout>
37491 <para>
37492 You also need a router to ensure that local addresses that are prefixed by
37493 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
37494 put this immediately before the <command>userforward</command> router:
37495 </para>
37496 <literallayout class="monospaced">
37497 real_localuser:
37498   driver = accept
37499   check_local_user
37500   local_part_prefix = real-
37501   transport = local_delivery
37502 </literallayout>
37503 <para>
37504 For security, it would probably be a good idea to restrict the use of this
37505 router to locally-generated messages, using a condition such as this:
37506 </para>
37507 <literallayout class="monospaced">
37508   condition = ${if match {$sender_host_address}\
37509                          {\N^(|127\.0\.0\.1)$\N}}
37510 </literallayout>
37511 <para>
37512 <indexterm role="option">
37513 <primary><option>syntax_errors_text</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>syntax_errors_text</option></entry>
37525 <entry>Use: <emphasis>redirect</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 See <option>skip_syntax_errors</option> above.
37534 </para>
37535 <para>
37536 <indexterm role="option">
37537 <primary><option>syntax_errors_to</option></primary>
37538 </indexterm>
37539 </para>
37540 <informaltable frame="all">
37541 <tgroup cols="4" colsep="0" rowsep="0">
37542 <colspec colwidth="8*" align="left"/>
37543 <colspec colwidth="6*" align="center"/>
37544 <colspec colwidth="6*" align="center"/>
37545 <colspec colwidth="6*" align="right"/>
37546 <tbody>
37547 <row>
37548 <entry><option>syntax_errors_to</option></entry>
37549 <entry>Use: <emphasis>redirect</emphasis></entry>
37550 <entry>Type: <emphasis>string</emphasis></entry>
37551 <entry>Default: <emphasis>unset</emphasis></entry>
37552 </row>
37553 </tbody>
37554 </tgroup>
37555 </informaltable>
37556 <para>
37557 See <option>skip_syntax_errors</option> above.
37558 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
37559 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
37560 </para>
37561 </section>
37562 </chapter>
37563
37564 <chapter id="CHAPenvironment">
37565 <title>Environment for running local transports</title>
37566 <titleabbrev>Environment for local transports</titleabbrev>
37567 <para>
37568 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
37569 <primary>local transports</primary>
37570 <secondary>environment for</secondary>
37571 </indexterm>
37572 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
37573 <primary>environment for local transports</primary>
37574 </indexterm>
37575 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
37576 <primary>transport</primary>
37577 <secondary>local; environment for</secondary>
37578 </indexterm>
37579 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
37580 transport can be thought of as similar to a pipe.) Exim always runs transports
37581 in subprocesses, under specified uids and gids. Typical deliveries to local
37582 mailboxes run under the uid and gid of the local user.
37583 </para>
37584 <para>
37585 Exim also sets a specific current directory while running the transport; for
37586 some transports a home directory setting is also relevant. The <command>pipe</command>
37587 transport is the only one that sets up environment variables; see section
37588 <xref linkend="SECTpipeenv"/> for details.
37589 </para>
37590 <para>
37591 The values used for the uid, gid, and the directories may come from several
37592 different places. In many cases, the router that handles the address associates
37593 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
37594 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
37595 configuration, and these override anything that comes from the router.
37596 </para>
37597 <section id="SECID131">
37598 <title>Concurrent deliveries</title>
37599 <para>
37600 <indexterm role="concept">
37601 <primary>concurrent deliveries</primary>
37602 </indexterm>
37603 <indexterm role="concept">
37604 <primary>simultaneous deliveries</primary>
37605 </indexterm>
37606 If two different messages for the same local recipient arrive more or less
37607 simultaneously, the two delivery processes are likely to run concurrently. When
37608 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
37609 rules to stop concurrent processes from writing to the same file at the same
37610 time.
37611 </para>
37612 <para>
37613 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
37614 locking that is needed. Here is a silly example:
37615 </para>
37616 <literallayout class="monospaced">
37617 my_transport:
37618   driver = pipe
37619   command = /bin/sh -c 'cat &gt;&gt;/some/file'
37620 </literallayout>
37621 <para>
37622 This is supposed to write the message at the end of the file. However, if two
37623 messages arrive at the same time, the file will be scrambled. You can use the
37624 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
37625 file using the same algorithm that Exim itself uses.
37626 </para>
37627 </section>
37628 <section id="SECTenvuidgid">
37629 <title>Uids and gids</title>
37630 <para>
37631 <indexterm role="concept">
37632 <primary>local transports</primary>
37633 <secondary>uid and gid</secondary>
37634 </indexterm>
37635 <indexterm role="concept">
37636 <primary>transport</primary>
37637 <secondary>local; uid and gid</secondary>
37638 </indexterm>
37639 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
37640 overrides any group that the router set in the address, even if <option>user</option> is not
37641 set for the transport. This makes it possible, for example, to run local mail
37642 delivery under the uid of the recipient (set by the router), but in a special
37643 group (set by the transport). For example:
37644 </para>
37645 <literallayout class="monospaced">
37646 # Routers ...
37647 # User/group are set by check_local_user in this router
37648 local_users:
37649   driver = accept
37650   check_local_user
37651   transport = group_delivery
37652
37653 # Transports ...
37654 # This transport overrides the group
37655 group_delivery:
37656   driver = appendfile
37657   file = /var/spool/mail/$local_part
37658   group = mail
37659 </literallayout>
37660 <para>
37661 If <option>user</option> is set for a transport, its value overrides what is set in the
37662 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
37663 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
37664 set.
37665 </para>
37666 <para>
37667 <indexterm role="option">
37668 <primary><option>initgroups</option></primary>
37669 </indexterm>
37670 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
37671 function is called for the groups associated with that uid if the
37672 <option>initgroups</option> option is set for the transport. When the uid is not specified
37673 by the transport, but is associated with the address by a router, the option
37674 for calling <function>initgroups()</function> is taken from the router configuration.
37675 </para>
37676 <para>
37677 <indexterm role="concept">
37678 <primary><command>pipe</command> transport</primary>
37679 <secondary>uid for</secondary>
37680 </indexterm>
37681 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
37682 is set and <option>user</option> is not set, the uid of the process that called Exim to
37683 receive the message is used, and if <option>group</option> is not set, the corresponding
37684 original gid is also used.
37685 </para>
37686 <para>
37687 This is the detailed preference order for obtaining a gid; the first of the
37688 following that is set is used:
37689 </para>
37690 <itemizedlist>
37691 <listitem>
37692 <para>
37693 A <option>group</option> setting of the transport;
37694 </para>
37695 </listitem>
37696 <listitem>
37697 <para>
37698 A <option>group</option> setting of the router;
37699 </para>
37700 </listitem>
37701 <listitem>
37702 <para>
37703 A gid associated with a user setting of the router, either as a result of
37704 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
37705 </para>
37706 </listitem>
37707 <listitem>
37708 <para>
37709 The group associated with a non-numeric <option>user</option> setting of the transport;
37710 </para>
37711 </listitem>
37712 <listitem>
37713 <para>
37714 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
37715 the uid is the creator&#x2019;s uid;
37716 </para>
37717 </listitem>
37718 <listitem>
37719 <para>
37720 The Exim gid if the Exim uid is being used as a default.
37721 </para>
37722 </listitem>
37723 </itemizedlist>
37724 <para>
37725 If, for example, the user is specified numerically on the router and there are
37726 no group settings, no gid is available. In this situation, an error occurs.
37727 This is different for the uid, for which there always is an ultimate default.
37728 The first of the following that is set is used:
37729 </para>
37730 <itemizedlist>
37731 <listitem>
37732 <para>
37733 A <option>user</option> setting of the transport;
37734 </para>
37735 </listitem>
37736 <listitem>
37737 <para>
37738 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
37739 </para>
37740 </listitem>
37741 <listitem>
37742 <para>
37743 A <option>user</option> setting of the router;
37744 </para>
37745 </listitem>
37746 <listitem>
37747 <para>
37748 A <option>check_local_user</option> setting of the router;
37749 </para>
37750 </listitem>
37751 <listitem>
37752 <para>
37753 The Exim uid.
37754 </para>
37755 </listitem>
37756 </itemizedlist>
37757 <para>
37758 Of course, an error will still occur if the uid that is chosen is on the
37759 <option>never_users</option> list.
37760 </para>
37761 </section>
37762 <section id="SECID132">
37763 <title>Current and home directories</title>
37764 <para>
37765 <indexterm role="concept">
37766 <primary>current directory for local transport</primary>
37767 </indexterm>
37768 <indexterm role="concept">
37769 <primary>home directory</primary>
37770 <secondary>for local transport</secondary>
37771 </indexterm>
37772 <indexterm role="concept">
37773 <primary>transport</primary>
37774 <secondary>local; home directory for</secondary>
37775 </indexterm>
37776 <indexterm role="concept">
37777 <primary>transport</primary>
37778 <secondary>local; current directory for</secondary>
37779 </indexterm>
37780 Routers may set current and home directories for local transports by means of
37781 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
37782 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
37783 are set, they override the router&#x2019;s values. In detail, the home directory
37784 for a local transport is taken from the first of these values that is set:
37785 </para>
37786 <itemizedlist>
37787 <listitem>
37788 <para>
37789 The <option>home_directory</option> option on the transport;
37790 </para>
37791 </listitem>
37792 <listitem>
37793 <para>
37794 The <option>transport_home_directory</option> option on the router;
37795 </para>
37796 </listitem>
37797 <listitem>
37798 <para>
37799 The password data if <option>check_local_user</option> is set on the router;
37800 </para>
37801 </listitem>
37802 <listitem>
37803 <para>
37804 The <option>router_home_directory</option> option on the router.
37805 </para>
37806 </listitem>
37807 </itemizedlist>
37808 <para>
37809 The current directory is taken from the first of these values that is set:
37810 </para>
37811 <itemizedlist>
37812 <listitem>
37813 <para>
37814 The <option>current_directory</option> option on the transport;
37815 </para>
37816 </listitem>
37817 <listitem>
37818 <para>
37819 The <option>transport_current_directory</option> option on the router.
37820 </para>
37821 </listitem>
37822 </itemizedlist>
37823 <para>
37824 If neither the router nor the transport sets a current directory, Exim uses the
37825 value of the home directory, if it is set. Otherwise it sets the current
37826 directory to <filename>/</filename> before running a local transport.
37827 </para>
37828 </section>
37829 <section id="SECID133">
37830 <title>Expansion variables derived from the address</title>
37831 <para>
37832 <indexterm role="variable">
37833 <primary><varname>$domain</varname></primary>
37834 </indexterm>
37835 <indexterm role="variable">
37836 <primary><varname>$local_part</varname></primary>
37837 </indexterm>
37838 <indexterm role="variable">
37839 <primary><varname>$original_domain</varname></primary>
37840 </indexterm>
37841 Normally a local delivery is handling a single address, and in that case the
37842 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
37843 deliveries. However, in some circumstances more than one address may be handled
37844 at once (for example, while writing batch SMTP for onward transmission by some
37845 other means). In this case, the variables associated with the local part are
37846 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
37847 and <varname>$original_domain</varname> is never set.
37848 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
37849 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
37850 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
37851 </para>
37852 </section>
37853 </chapter>
37854
37855 <chapter id="CHAPtransportgeneric">
37856 <title>Generic options for transports</title>
37857 <para>
37858 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
37859 <primary>generic options</primary>
37860 <secondary>transport</secondary>
37861 </indexterm>
37862 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
37863 <primary>options</primary>
37864 <secondary>generic; for transports</secondary>
37865 </indexterm>
37866 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
37867 <primary>transport</primary>
37868 <secondary>generic options for</secondary>
37869 </indexterm>
37870 The following generic options apply to all transports:
37871 </para>
37872 <para>
37873 <indexterm role="option">
37874 <primary><option>body_only</option></primary>
37875 </indexterm>
37876 </para>
37877 <informaltable frame="all">
37878 <tgroup cols="4" colsep="0" rowsep="0">
37879 <colspec colwidth="8*" align="left"/>
37880 <colspec colwidth="6*" align="center"/>
37881 <colspec colwidth="6*" align="center"/>
37882 <colspec colwidth="6*" align="right"/>
37883 <tbody>
37884 <row>
37885 <entry><option>body_only</option></entry>
37886 <entry>Use: <emphasis>transports</emphasis></entry>
37887 <entry>Type: <emphasis>boolean</emphasis></entry>
37888 <entry>Default: <emphasis>false</emphasis></entry>
37889 </row>
37890 </tbody>
37891 </tgroup>
37892 </informaltable>
37893 <para>
37894 <indexterm role="concept">
37895 <primary>transport</primary>
37896 <secondary>body only</secondary>
37897 </indexterm>
37898 <indexterm role="concept">
37899 <primary>message</primary>
37900 <secondary>transporting body only</secondary>
37901 </indexterm>
37902 <indexterm role="concept">
37903 <primary>body of message</primary>
37904 <secondary>transporting</secondary>
37905 </indexterm>
37906 If this option is set, the message&#x2019;s headers are not transported. It is
37907 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
37908 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
37909 <option>message_suffix</option> should be checked, because this option does not
37910 automatically suppress them.
37911 </para>
37912 <para>
37913 <indexterm role="option">
37914 <primary><option>current_directory</option></primary>
37915 </indexterm>
37916 </para>
37917 <informaltable frame="all">
37918 <tgroup cols="4" colsep="0" rowsep="0">
37919 <colspec colwidth="8*" align="left"/>
37920 <colspec colwidth="6*" align="center"/>
37921 <colspec colwidth="6*" align="center"/>
37922 <colspec colwidth="6*" align="right"/>
37923 <tbody>
37924 <row>
37925 <entry><option>current_directory</option></entry>
37926 <entry>Use: <emphasis>transports</emphasis></entry>
37927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37928 <entry>Default: <emphasis>unset</emphasis></entry>
37929 </row>
37930 </tbody>
37931 </tgroup>
37932 </informaltable>
37933 <para>
37934 <indexterm role="concept">
37935 <primary>transport</primary>
37936 <secondary>current directory for</secondary>
37937 </indexterm>
37938 This specifies the current directory that is to be set while running the
37939 transport, overriding any value that may have been set by the router.
37940 If the expansion fails for any reason, including forced failure, an error is
37941 logged, and delivery is deferred.
37942 </para>
37943 <para>
37944 <indexterm role="option">
37945 <primary><option>disable_logging</option></primary>
37946 </indexterm>
37947 </para>
37948 <informaltable frame="all">
37949 <tgroup cols="4" colsep="0" rowsep="0">
37950 <colspec colwidth="8*" align="left"/>
37951 <colspec colwidth="6*" align="center"/>
37952 <colspec colwidth="6*" align="center"/>
37953 <colspec colwidth="6*" align="right"/>
37954 <tbody>
37955 <row>
37956 <entry><option>disable_logging</option></entry>
37957 <entry>Use: <emphasis>transports</emphasis></entry>
37958 <entry>Type: <emphasis>boolean</emphasis></entry>
37959 <entry>Default: <emphasis>false</emphasis></entry>
37960 </row>
37961 </tbody>
37962 </tgroup>
37963 </informaltable>
37964 <para>
37965 If this option is set true, nothing is logged for any
37966 deliveries by the transport or for any
37967 transport errors. You should not set this option unless you really, really know
37968 what you are doing.
37969 </para>
37970 <para>
37971 <indexterm role="option">
37972 <primary><option>debug_print</option></primary>
37973 </indexterm>
37974 </para>
37975 <informaltable frame="all">
37976 <tgroup cols="4" colsep="0" rowsep="0">
37977 <colspec colwidth="8*" align="left"/>
37978 <colspec colwidth="6*" align="center"/>
37979 <colspec colwidth="6*" align="center"/>
37980 <colspec colwidth="6*" align="right"/>
37981 <tbody>
37982 <row>
37983 <entry><option>debug_print</option></entry>
37984 <entry>Use: <emphasis>transports</emphasis></entry>
37985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37986 <entry>Default: <emphasis>unset</emphasis></entry>
37987 </row>
37988 </tbody>
37989 </tgroup>
37990 </informaltable>
37991 <para>
37992 <indexterm role="concept">
37993 <primary>testing</primary>
37994 <secondary>variables in drivers</secondary>
37995 </indexterm>
37996 If this option is set and debugging is enabled (see the <option>-d</option> command line
37997 option), the string is expanded and included in the debugging output when the
37998 transport is run.
37999 If expansion of the string fails, the error message is written to the debugging
38000 output, and Exim carries on processing.
38001 This facility is provided to help with checking out the values of variables and
38002 so on when debugging driver configurations. For example, if a <option>headers_add</option>
38003 option is not working properly, <option>debug_print</option> could be used to output the
38004 variables it references. A newline is added to the text if it does not end with
38005 one.
38006 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
38007 transport and the router that called it.
38008 </para>
38009 <para>
38010 <indexterm role="option">
38011 <primary><option>delivery_date_add</option></primary>
38012 </indexterm>
38013 </para>
38014 <informaltable frame="all">
38015 <tgroup cols="4" colsep="0" rowsep="0">
38016 <colspec colwidth="8*" align="left"/>
38017 <colspec colwidth="6*" align="center"/>
38018 <colspec colwidth="6*" align="center"/>
38019 <colspec colwidth="6*" align="right"/>
38020 <tbody>
38021 <row>
38022 <entry><option>delivery_date_add</option></entry>
38023 <entry>Use: <emphasis>transports</emphasis></entry>
38024 <entry>Type: <emphasis>boolean</emphasis></entry>
38025 <entry>Default: <emphasis>false</emphasis></entry>
38026 </row>
38027 </tbody>
38028 </tgroup>
38029 </informaltable>
38030 <para>
38031 <indexterm role="concept">
38032 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
38033 </indexterm>
38034 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
38035 This gives the actual time the delivery was made. As this is not a standard
38036 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
38037 requests its removal from incoming messages, so that delivered messages can
38038 safely be resent to other recipients.
38039 </para>
38040 <para>
38041 <indexterm role="option">
38042 <primary><option>driver</option></primary>
38043 </indexterm>
38044 </para>
38045 <informaltable frame="all">
38046 <tgroup cols="4" colsep="0" rowsep="0">
38047 <colspec colwidth="8*" align="left"/>
38048 <colspec colwidth="6*" align="center"/>
38049 <colspec colwidth="6*" align="center"/>
38050 <colspec colwidth="6*" align="right"/>
38051 <tbody>
38052 <row>
38053 <entry><option>driver</option></entry>
38054 <entry>Use: <emphasis>transports</emphasis></entry>
38055 <entry>Type: <emphasis>string</emphasis></entry>
38056 <entry>Default: <emphasis>unset</emphasis></entry>
38057 </row>
38058 </tbody>
38059 </tgroup>
38060 </informaltable>
38061 <para>
38062 This specifies which of the available transport drivers is to be used.
38063 There is no default, and this option must be set for every transport.
38064 </para>
38065 <para>
38066 <indexterm role="option">
38067 <primary><option>envelope_to_add</option></primary>
38068 </indexterm>
38069 </para>
38070 <informaltable frame="all">
38071 <tgroup cols="4" colsep="0" rowsep="0">
38072 <colspec colwidth="8*" align="left"/>
38073 <colspec colwidth="6*" align="center"/>
38074 <colspec colwidth="6*" align="center"/>
38075 <colspec colwidth="6*" align="right"/>
38076 <tbody>
38077 <row>
38078 <entry><option>envelope_to_add</option></entry>
38079 <entry>Use: <emphasis>transports</emphasis></entry>
38080 <entry>Type: <emphasis>boolean</emphasis></entry>
38081 <entry>Default: <emphasis>false</emphasis></entry>
38082 </row>
38083 </tbody>
38084 </tgroup>
38085 </informaltable>
38086 <para>
38087 <indexterm role="concept">
38088 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38089 </indexterm>
38090 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
38091 This gives the original address(es) in the incoming envelope that caused this
38092 delivery to happen. More than one address may be present if the transport is
38093 configured to handle several addresses at once, or if more than one original
38094 address was redirected to the same final address. As this is not a standard
38095 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
38096 its removal from incoming messages, so that delivered messages can safely be
38097 resent to other recipients.
38098 </para>
38099 <para>
38100 <indexterm role="option">
38101 <primary><option>group</option></primary>
38102 </indexterm>
38103 </para>
38104 <informaltable frame="all">
38105 <tgroup cols="4" colsep="0" rowsep="0">
38106 <colspec colwidth="8*" align="left"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="center"/>
38109 <colspec colwidth="6*" align="right"/>
38110 <tbody>
38111 <row>
38112 <entry><option>group</option></entry>
38113 <entry>Use: <emphasis>transports</emphasis></entry>
38114 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38115 <entry>Default: <emphasis>Exim group</emphasis></entry>
38116 </row>
38117 </tbody>
38118 </tgroup>
38119 </informaltable>
38120 <para>
38121 <indexterm role="concept">
38122 <primary>transport</primary>
38123 <secondary>group; specifying</secondary>
38124 </indexterm>
38125 This option specifies a gid for running the transport process, overriding any
38126 value that the router supplies, and also overriding any value associated with
38127 <option>user</option> (see below).
38128 </para>
38129 <para>
38130 <indexterm role="option">
38131 <primary><option>headers_add</option></primary>
38132 </indexterm>
38133 </para>
38134 <informaltable frame="all">
38135 <tgroup cols="4" colsep="0" rowsep="0">
38136 <colspec colwidth="8*" align="left"/>
38137 <colspec colwidth="6*" align="center"/>
38138 <colspec colwidth="6*" align="center"/>
38139 <colspec colwidth="6*" align="right"/>
38140 <tbody>
38141 <row>
38142 <entry><option>headers_add</option></entry>
38143 <entry>Use: <emphasis>transports</emphasis></entry>
38144 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38145 <entry>Default: <emphasis>unset</emphasis></entry>
38146 </row>
38147 </tbody>
38148 </tgroup>
38149 </informaltable>
38150 <para>
38151 <indexterm role="concept">
38152 <primary>header lines</primary>
38153 <secondary>adding in transport</secondary>
38154 </indexterm>
38155 <indexterm role="concept">
38156 <primary>transport</primary>
38157 <secondary>header lines; adding</secondary>
38158 </indexterm>
38159 This option specifies a list of text headers, newline-separated,
38160 which are (separately) expanded and added to the header
38161 portion of a message as it is transported, as described in section
38162 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
38163 routers. If the result of the expansion is an empty string, or if the expansion
38164 is forced to fail, no action is taken. Other expansion failures are treated as
38165 errors and cause the delivery to be deferred.
38166 </para>
38167 <para>
38168 Unlike most options, <option>headers_add</option> can be specified multiple times
38169 for a transport; all listed headers are added.
38170 </para>
38171 <para>
38172 <indexterm role="option">
38173 <primary><option>headers_only</option></primary>
38174 </indexterm>
38175 </para>
38176 <informaltable frame="all">
38177 <tgroup cols="4" colsep="0" rowsep="0">
38178 <colspec colwidth="8*" align="left"/>
38179 <colspec colwidth="6*" align="center"/>
38180 <colspec colwidth="6*" align="center"/>
38181 <colspec colwidth="6*" align="right"/>
38182 <tbody>
38183 <row>
38184 <entry><option>headers_only</option></entry>
38185 <entry>Use: <emphasis>transports</emphasis></entry>
38186 <entry>Type: <emphasis>boolean</emphasis></entry>
38187 <entry>Default: <emphasis>false</emphasis></entry>
38188 </row>
38189 </tbody>
38190 </tgroup>
38191 </informaltable>
38192 <para>
38193 <indexterm role="concept">
38194 <primary>transport</primary>
38195 <secondary>header lines only</secondary>
38196 </indexterm>
38197 <indexterm role="concept">
38198 <primary>message</primary>
38199 <secondary>transporting headers only</secondary>
38200 </indexterm>
38201 <indexterm role="concept">
38202 <primary>header lines</primary>
38203 <secondary>transporting</secondary>
38204 </indexterm>
38205 If this option is set, the message&#x2019;s body is not transported. It is mutually
38206 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
38207 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
38208 checked, since this option does not automatically suppress them.
38209 </para>
38210 <para>
38211 <indexterm role="option">
38212 <primary><option>headers_remove</option></primary>
38213 </indexterm>
38214 </para>
38215 <informaltable frame="all">
38216 <tgroup cols="4" colsep="0" rowsep="0">
38217 <colspec colwidth="8*" align="left"/>
38218 <colspec colwidth="6*" align="center"/>
38219 <colspec colwidth="6*" align="center"/>
38220 <colspec colwidth="6*" align="right"/>
38221 <tbody>
38222 <row>
38223 <entry><option>headers_remove</option></entry>
38224 <entry>Use: <emphasis>transports</emphasis></entry>
38225 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
38226 <entry>Default: <emphasis>unset</emphasis></entry>
38227 </row>
38228 </tbody>
38229 </tgroup>
38230 </informaltable>
38231 <para>
38232 <indexterm role="concept">
38233 <primary>header lines</primary>
38234 <secondary>removing</secondary>
38235 </indexterm>
38236 <indexterm role="concept">
38237 <primary>transport</primary>
38238 <secondary>header lines; removing</secondary>
38239 </indexterm>
38240 This option specifies a list of header names, colon-separated;
38241 these headers are omitted from the message as it is transported, as described
38242 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
38243 routers.
38244 Each list item is separately expanded.
38245 If the result of the expansion is an empty string, or if the expansion
38246 is forced to fail, no action is taken. Other expansion failures are treated as
38247 errors and cause the delivery to be deferred.
38248 </para>
38249 <para>
38250 Unlike most options, <option>headers_remove</option> can be specified multiple times
38251 for a router; all listed headers are removed.
38252 </para>
38253 <para>
38254 <indexterm role="option">
38255 <primary><option>headers_rewrite</option></primary>
38256 </indexterm>
38257 </para>
38258 <informaltable frame="all">
38259 <tgroup cols="4" colsep="0" rowsep="0">
38260 <colspec colwidth="8*" align="left"/>
38261 <colspec colwidth="6*" align="center"/>
38262 <colspec colwidth="6*" align="center"/>
38263 <colspec colwidth="6*" align="right"/>
38264 <tbody>
38265 <row>
38266 <entry><option>headers_rewrite</option></entry>
38267 <entry>Use: <emphasis>transports</emphasis></entry>
38268 <entry>Type: <emphasis>string</emphasis></entry>
38269 <entry>Default: <emphasis>unset</emphasis></entry>
38270 </row>
38271 </tbody>
38272 </tgroup>
38273 </informaltable>
38274 <para>
38275 <indexterm role="concept">
38276 <primary>transport</primary>
38277 <secondary>header lines; rewriting</secondary>
38278 </indexterm>
38279 <indexterm role="concept">
38280 <primary>rewriting</primary>
38281 <secondary>at transport time</secondary>
38282 </indexterm>
38283 This option allows addresses in header lines to be rewritten at transport time,
38284 that is, as the message is being copied to its destination. The contents of the
38285 option are a colon-separated list of rewriting rules. Each rule is in exactly
38286 the same form as one of the general rewriting rules that are applied when a
38287 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
38288 example,
38289 </para>
38290 <literallayout class="monospaced">
38291 headers_rewrite = a@b c@d f : \
38292                   x@y w@z
38293 </literallayout>
38294 <para>
38295 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
38296 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
38297 header lines just before they are written out at transport time, so they affect
38298 only those copies of the message that pass through the transport. However, only
38299 the message&#x2019;s original header lines, and any that were added by a system
38300 filter, are rewritten. If a router or transport adds header lines, they are not
38301 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
38302 envelope. You can change the return path using <option>return_path</option>, but you cannot
38303 change envelope recipients at this time.
38304 </para>
38305 <para>
38306 <indexterm role="option">
38307 <primary><option>home_directory</option></primary>
38308 </indexterm>
38309 </para>
38310 <informaltable frame="all">
38311 <tgroup cols="4" colsep="0" rowsep="0">
38312 <colspec colwidth="8*" align="left"/>
38313 <colspec colwidth="6*" align="center"/>
38314 <colspec colwidth="6*" align="center"/>
38315 <colspec colwidth="6*" align="right"/>
38316 <tbody>
38317 <row>
38318 <entry><option>home_directory</option></entry>
38319 <entry>Use: <emphasis>transports</emphasis></entry>
38320 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38321 <entry>Default: <emphasis>unset</emphasis></entry>
38322 </row>
38323 </tbody>
38324 </tgroup>
38325 </informaltable>
38326 <para>
38327 <indexterm role="concept">
38328 <primary>transport</primary>
38329 <secondary>home directory for</secondary>
38330 </indexterm>
38331 <indexterm role="variable">
38332 <primary><varname>$home</varname></primary>
38333 </indexterm>
38334 This option specifies a home directory setting for a local transport,
38335 overriding any value that may be set by the router. The home directory is
38336 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
38337 used as the current directory if no current directory is set by the
38338 <option>current_directory</option> option on the transport or the
38339 <option>transport_current_directory</option> option on the router. If the expansion fails
38340 for any reason, including forced failure, an error is logged, and delivery is
38341 deferred.
38342 </para>
38343 <para>
38344 <indexterm role="option">
38345 <primary><option>initgroups</option></primary>
38346 </indexterm>
38347 </para>
38348 <informaltable frame="all">
38349 <tgroup cols="4" colsep="0" rowsep="0">
38350 <colspec colwidth="8*" align="left"/>
38351 <colspec colwidth="6*" align="center"/>
38352 <colspec colwidth="6*" align="center"/>
38353 <colspec colwidth="6*" align="right"/>
38354 <tbody>
38355 <row>
38356 <entry><option>initgroups</option></entry>
38357 <entry>Use: <emphasis>transports</emphasis></entry>
38358 <entry>Type: <emphasis>boolean</emphasis></entry>
38359 <entry>Default: <emphasis>false</emphasis></entry>
38360 </row>
38361 </tbody>
38362 </tgroup>
38363 </informaltable>
38364 <para>
38365 <indexterm role="concept">
38366 <primary>additional groups</primary>
38367 </indexterm>
38368 <indexterm role="concept">
38369 <primary>groups</primary>
38370 <secondary>additional</secondary>
38371 </indexterm>
38372 <indexterm role="concept">
38373 <primary>transport</primary>
38374 <secondary>group; additional</secondary>
38375 </indexterm>
38376 If this option is true and the uid for the delivery process is provided by the
38377 transport, the <function>initgroups()</function> function is called when running the transport
38378 to ensure that any additional groups associated with the uid are set up.
38379 </para>
38380 <para>
38381 <indexterm role="option">
38382 <primary><option>message_size_limit</option></primary>
38383 </indexterm>
38384 </para>
38385 <informaltable frame="all">
38386 <tgroup cols="4" colsep="0" rowsep="0">
38387 <colspec colwidth="8*" align="left"/>
38388 <colspec colwidth="6*" align="center"/>
38389 <colspec colwidth="6*" align="center"/>
38390 <colspec colwidth="6*" align="right"/>
38391 <tbody>
38392 <row>
38393 <entry><option>message_size_limit</option></entry>
38394 <entry>Use: <emphasis>transports</emphasis></entry>
38395 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38396 <entry>Default: <emphasis>0</emphasis></entry>
38397 </row>
38398 </tbody>
38399 </tgroup>
38400 </informaltable>
38401 <para>
38402 <indexterm role="concept">
38403 <primary>limit</primary>
38404 <secondary>message size per transport</secondary>
38405 </indexterm>
38406 <indexterm role="concept">
38407 <primary>size</primary>
38408 <secondary>of message, limit</secondary>
38409 </indexterm>
38410 <indexterm role="concept">
38411 <primary>transport</primary>
38412 <secondary>message size; limiting</secondary>
38413 </indexterm>
38414 This option controls the size of messages passed through the transport. It is
38415 expanded before use; the result of the expansion must be a sequence of decimal
38416 digits, optionally followed by K or M. If the expansion fails for any reason,
38417 including forced failure, or if the result is not of the required form,
38418 delivery is deferred. If the value is greater than zero and the size of a
38419 message exceeds this limit, the address is failed. If there is any chance that
38420 the resulting bounce message could be routed to the same transport, you should
38421 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
38422 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
38423 delivered.
38424 </para>
38425 <para>
38426 <indexterm role="option">
38427 <primary><option>rcpt_include_affixes</option></primary>
38428 </indexterm>
38429 </para>
38430 <informaltable frame="all">
38431 <tgroup cols="4" colsep="0" rowsep="0">
38432 <colspec colwidth="8*" align="left"/>
38433 <colspec colwidth="6*" align="center"/>
38434 <colspec colwidth="6*" align="center"/>
38435 <colspec colwidth="6*" align="right"/>
38436 <tbody>
38437 <row>
38438 <entry><option>rcpt_include_affixes</option></entry>
38439 <entry>Use: <emphasis>transports</emphasis></entry>
38440 <entry>Type: <emphasis>boolean</emphasis></entry>
38441 <entry>Default: <emphasis>false</emphasis></entry>
38442 </row>
38443 </tbody>
38444 </tgroup>
38445 </informaltable>
38446 <para>
38447 <indexterm role="concept">
38448 <primary>prefix</primary>
38449 <secondary>for local part, including in envelope</secondary>
38450 </indexterm>
38451 <indexterm role="concept">
38452 <primary>suffix for local part</primary>
38453 <secondary>including in envelope</secondary>
38454 </indexterm>
38455 <indexterm role="concept">
38456 <primary>local part</primary>
38457 <secondary>prefix</secondary>
38458 </indexterm>
38459 <indexterm role="concept">
38460 <primary>local part</primary>
38461 <secondary>suffix</secondary>
38462 </indexterm>
38463 When this option is false (the default), and an address that has had any
38464 affixes (prefixes or suffixes) removed from the local part is delivered by any
38465 form of SMTP or LMTP, the affixes are not included. For example, if a router
38466 that contains
38467 </para>
38468 <literallayout class="monospaced">
38469 local_part_prefix = *-
38470 </literallayout>
38471 <para>
38472 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
38473 is delivered with
38474 </para>
38475 <literallayout class="monospaced">
38476 RCPT TO:&lt;xyz@some.domain&gt;
38477 </literallayout>
38478 <para>
38479 This is also the case when an ACL-time callout is being used to verify a
38480 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
38481 whole local part is included in the RCPT command. This option applies to BSMTP
38482 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
38483 <command>lmtp</command> and <command>smtp</command> transports.
38484 </para>
38485 <para>
38486 <indexterm role="option">
38487 <primary><option>retry_use_local_part</option></primary>
38488 </indexterm>
38489 </para>
38490 <informaltable frame="all">
38491 <tgroup cols="4" colsep="0" rowsep="0">
38492 <colspec colwidth="8*" align="left"/>
38493 <colspec colwidth="6*" align="center"/>
38494 <colspec colwidth="6*" align="center"/>
38495 <colspec colwidth="6*" align="right"/>
38496 <tbody>
38497 <row>
38498 <entry><option>retry_use_local_part</option></entry>
38499 <entry>Use: <emphasis>transports</emphasis></entry>
38500 <entry>Type: <emphasis>boolean</emphasis></entry>
38501 <entry>Default: <emphasis>see below</emphasis></entry>
38502 </row>
38503 </tbody>
38504 </tgroup>
38505 </informaltable>
38506 <para>
38507 <indexterm role="concept">
38508 <primary>hints database</primary>
38509 <secondary>retry keys</secondary>
38510 </indexterm>
38511 When a delivery suffers a temporary failure, a retry record is created
38512 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
38513 is based on the name and/or IP address of the failing remote host. For local
38514 deliveries, the key is normally the entire address, including both the local
38515 part and the domain. This is suitable for most common cases of local delivery
38516 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
38517 deliveries to that mailbox, not to the whole domain.
38518 </para>
38519 <para>
38520 However, in some special cases you may want to treat a temporary local delivery
38521 as a failure associated with the domain, and not with a particular local part.
38522 (For example, if you are storing all mail for some domain in files.) You can do
38523 this by setting <option>retry_use_local_part</option> false.
38524 </para>
38525 <para>
38526 For all the local transports, its default value is true. For remote transports,
38527 the default value is false for tidiness, but changing the value has no effect
38528 on a remote transport in the current implementation.
38529 </para>
38530 <para>
38531 <indexterm role="option">
38532 <primary><option>return_path</option></primary>
38533 </indexterm>
38534 </para>
38535 <informaltable frame="all">
38536 <tgroup cols="4" colsep="0" rowsep="0">
38537 <colspec colwidth="8*" align="left"/>
38538 <colspec colwidth="6*" align="center"/>
38539 <colspec colwidth="6*" align="center"/>
38540 <colspec colwidth="6*" align="right"/>
38541 <tbody>
38542 <row>
38543 <entry><option>return_path</option></entry>
38544 <entry>Use: <emphasis>transports</emphasis></entry>
38545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38546 <entry>Default: <emphasis>unset</emphasis></entry>
38547 </row>
38548 </tbody>
38549 </tgroup>
38550 </informaltable>
38551 <para>
38552 <indexterm role="concept">
38553 <primary>envelope sender</primary>
38554 </indexterm>
38555 <indexterm role="concept">
38556 <primary>transport</primary>
38557 <secondary>return path; changing</secondary>
38558 </indexterm>
38559 <indexterm role="concept">
38560 <primary>return path</primary>
38561 <secondary>changing in transport</secondary>
38562 </indexterm>
38563 If this option is set, the string is expanded at transport time and replaces
38564 the existing return path (envelope sender) value in the copy of the message
38565 that is being delivered. An empty return path is permitted. This feature is
38566 designed for remote deliveries, where the value of this option is used in the
38567 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
38568 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
38569 header line, if one is added to the message (see the next option).
38570 </para>
38571 <para>
38572 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
38573 <option>return_path_on_delivery</option> to the log selector.
38574 </para>
38575 <para>
38576 <indexterm role="variable">
38577 <primary><varname>$return_path</varname></primary>
38578 </indexterm>
38579 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
38580 either the message&#x2019;s envelope sender, or an address set by the
38581 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
38582 replacement occurs; if it fails for another reason, delivery is deferred. This
38583 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
38584 section <xref linkend="SECTverp"/>.
38585 </para>
38586 <para>
38587 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
38588 remote server rejects a message at SMTP time, the bounce message is not sent to
38589 the value of this option. It is sent to the previously set errors address.
38590 This defaults to the incoming sender address, but can be changed by setting
38591 <option>errors_to</option> in a router.
38592 </para>
38593 <para>
38594 <indexterm role="option">
38595 <primary><option>return_path_add</option></primary>
38596 </indexterm>
38597 </para>
38598 <informaltable frame="all">
38599 <tgroup cols="4" colsep="0" rowsep="0">
38600 <colspec colwidth="8*" align="left"/>
38601 <colspec colwidth="6*" align="center"/>
38602 <colspec colwidth="6*" align="center"/>
38603 <colspec colwidth="6*" align="right"/>
38604 <tbody>
38605 <row>
38606 <entry><option>return_path_add</option></entry>
38607 <entry>Use: <emphasis>transports</emphasis></entry>
38608 <entry>Type: <emphasis>boolean</emphasis></entry>
38609 <entry>Default: <emphasis>false</emphasis></entry>
38610 </row>
38611 </tbody>
38612 </tgroup>
38613 </informaltable>
38614 <para>
38615 <indexterm role="concept">
38616 <primary><emphasis>Return-path:</emphasis> header line</primary>
38617 </indexterm>
38618 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
38619 Although the return path is normally available in the prefix line of BSD
38620 mailboxes, this is commonly not displayed by MUAs, and so the user does not
38621 have easy access to it.
38622 </para>
38623 <para>
38624 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
38625 the delivery SMTP server makes the final delivery</quote>. This implies that this
38626 header should not be present in incoming messages. Exim has a configuration
38627 option, <option>return_path_remove</option>, which requests removal of this header from
38628 incoming messages, so that delivered messages can safely be resent to other
38629 recipients.
38630 </para>
38631 <para>
38632 <indexterm role="option">
38633 <primary><option>shadow_condition</option></primary>
38634 </indexterm>
38635 </para>
38636 <informaltable frame="all">
38637 <tgroup cols="4" colsep="0" rowsep="0">
38638 <colspec colwidth="8*" align="left"/>
38639 <colspec colwidth="6*" align="center"/>
38640 <colspec colwidth="6*" align="center"/>
38641 <colspec colwidth="6*" align="right"/>
38642 <tbody>
38643 <row>
38644 <entry><option>shadow_condition</option></entry>
38645 <entry>Use: <emphasis>transports</emphasis></entry>
38646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38647 <entry>Default: <emphasis>unset</emphasis></entry>
38648 </row>
38649 </tbody>
38650 </tgroup>
38651 </informaltable>
38652 <para>
38653 See <option>shadow_transport</option> below.
38654 </para>
38655 <para>
38656 <indexterm role="option">
38657 <primary><option>shadow_transport</option></primary>
38658 </indexterm>
38659 </para>
38660 <informaltable frame="all">
38661 <tgroup cols="4" colsep="0" rowsep="0">
38662 <colspec colwidth="8*" align="left"/>
38663 <colspec colwidth="6*" align="center"/>
38664 <colspec colwidth="6*" align="center"/>
38665 <colspec colwidth="6*" align="right"/>
38666 <tbody>
38667 <row>
38668 <entry><option>shadow_transport</option></entry>
38669 <entry>Use: <emphasis>transports</emphasis></entry>
38670 <entry>Type: <emphasis>string</emphasis></entry>
38671 <entry>Default: <emphasis>unset</emphasis></entry>
38672 </row>
38673 </tbody>
38674 </tgroup>
38675 </informaltable>
38676 <para>
38677 <indexterm role="concept">
38678 <primary>shadow transport</primary>
38679 </indexterm>
38680 <indexterm role="concept">
38681 <primary>transport</primary>
38682 <secondary>shadow</secondary>
38683 </indexterm>
38684 A local transport may set the <option>shadow_transport</option> option to the name of
38685 another local transport. Shadow remote transports are not supported.
38686 </para>
38687 <para>
38688 Whenever a delivery to the main transport succeeds, and either
38689 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
38690 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
38691 passed to the shadow transport, with the same delivery address or addresses. If
38692 expansion fails, no action is taken except that non-forced expansion failures
38693 cause a log line to be written.
38694 </para>
38695 <para>
38696 The result of the shadow transport is discarded and does not affect the
38697 subsequent processing of the message. Only a single level of shadowing is
38698 provided; the <option>shadow_transport</option> option is ignored on any transport when it
38699 is running as a shadow. Options concerned with output from pipes are also
38700 ignored. The log line for the successful delivery has an item added on the end,
38701 of the form
38702 </para>
38703 <literallayout class="monospaced">
38704 ST=&lt;shadow transport name&gt;
38705 </literallayout>
38706 <para>
38707 If the shadow transport did not succeed, the error message is put in
38708 parentheses afterwards. Shadow transports can be used for a number of different
38709 purposes, including keeping more detailed log information than Exim normally
38710 provides, and implementing automatic acknowledgment policies based on message
38711 headers that some sites insist on.
38712 </para>
38713 <para>
38714 <indexterm role="option">
38715 <primary><option>transport_filter</option></primary>
38716 </indexterm>
38717 </para>
38718 <informaltable frame="all">
38719 <tgroup cols="4" colsep="0" rowsep="0">
38720 <colspec colwidth="8*" align="left"/>
38721 <colspec colwidth="6*" align="center"/>
38722 <colspec colwidth="6*" align="center"/>
38723 <colspec colwidth="6*" align="right"/>
38724 <tbody>
38725 <row>
38726 <entry><option>transport_filter</option></entry>
38727 <entry>Use: <emphasis>transports</emphasis></entry>
38728 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38729 <entry>Default: <emphasis>unset</emphasis></entry>
38730 </row>
38731 </tbody>
38732 </tgroup>
38733 </informaltable>
38734 <para>
38735 <indexterm role="concept">
38736 <primary>transport</primary>
38737 <secondary>filter</secondary>
38738 </indexterm>
38739 <indexterm role="concept">
38740 <primary>filter</primary>
38741 <secondary>transport filter</secondary>
38742 </indexterm>
38743 This option sets up a filtering (in the Unix shell sense) process for messages
38744 at transport time. It should not be confused with mail filtering as set up by
38745 individual users or via a system filter.
38746 </para>
38747 <para>
38748 When the message is about to be written out, the command specified by
38749 <option>transport_filter</option> is started up in a separate, parallel process, and
38750 the entire message, including the header lines, is passed to it on its standard
38751 input (this in fact is done from a third process, to avoid deadlock). The
38752 command must be specified as an absolute path.
38753 </para>
38754 <para>
38755 The lines of the message that are written to the transport filter are
38756 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
38757 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
38758 lines beginning with a dot, and also before any processing implied by the
38759 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
38760 <command>pipe</command> transports.
38761 </para>
38762 <para>
38763 The standard error for the filter process is set to the same destination as its
38764 standard output; this is read and written to the message&#x2019;s ultimate
38765 destination. The process that writes the message to the filter, the
38766 filter itself, and the original process that reads the result and delivers it
38767 are all run in parallel, like a shell pipeline.
38768 </para>
38769 <para>
38770 The filter can perform any transformations it likes, but of course should take
38771 care not to break RFC 2822 syntax. Exim does not check the result, except to
38772 test for a final newline when SMTP is in use. All messages transmitted over
38773 SMTP must end with a newline, so Exim supplies one if it is missing.
38774 </para>
38775 <para>
38776 <indexterm role="concept">
38777 <primary>content scanning</primary>
38778 <secondary>per user</secondary>
38779 </indexterm>
38780 A transport filter can be used to provide content-scanning on a per-user basis
38781 at delivery time if the only required effect of the scan is to modify the
38782 message. For example, a content scan could insert a new header line containing
38783 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
38784 not possible to discard a message at this stage.
38785 </para>
38786 <para>
38787 <indexterm role="concept">
38788 <primary>SMTP</primary>
38789 <secondary>SIZE</secondary>
38790 </indexterm>
38791 A problem might arise if the filter increases the size of a message that is
38792 being sent down an SMTP connection. If the receiving SMTP server has indicated
38793 support for the SIZE parameter, Exim will have sent the size of the message
38794 at the start of the SMTP session. If what is actually sent is substantially
38795 more, the server might reject the message. This can be worked round by setting
38796 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
38797 additions to the message, or to disable the use of SIZE altogether.
38798 </para>
38799 <para>
38800 <indexterm role="variable">
38801 <primary><varname>$pipe_addresses</varname></primary>
38802 </indexterm>
38803 The value of the <option>transport_filter</option> option is the command string for starting
38804 the filter, which is run directly from Exim, not under a shell. The string is
38805 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
38806 Exim breaks it up into arguments and then expands each argument separately (see
38807 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
38808 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
38809 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
38810 an ideal name for this feature here, but as it was already implemented for the
38811 <command>pipe</command> transport, it seemed sensible not to change it.)
38812 </para>
38813 <para>
38814 <indexterm role="variable">
38815 <primary><varname>$host</varname></primary>
38816 </indexterm>
38817 <indexterm role="variable">
38818 <primary><varname>$host_address</varname></primary>
38819 </indexterm>
38820 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
38821 transport is a remote one. They contain the name and IP address of the host to
38822 which the message is being sent. For example:
38823 </para>
38824 <literallayout class="monospaced">
38825 transport_filter = /some/directory/transport-filter.pl \
38826   $host $host_address $sender_address $pipe_addresses
38827 </literallayout>
38828 <para>
38829 Two problems arise if you want to use more complicated expansion items to
38830 generate transport filter commands, both of which due to the fact that the
38831 command is split up <emphasis>before</emphasis> expansion.
38832 </para>
38833 <itemizedlist>
38834 <listitem>
38835 <para>
38836 If an expansion item contains white space, you must quote it, so that it is all
38837 part of the same command item. If the entire option setting is one such
38838 expansion item, you have to take care what kind of quoting you use. For
38839 example:
38840 </para>
38841 <literallayout class="monospaced">
38842 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
38843 </literallayout>
38844 <para>
38845 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
38846 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
38847 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
38848 the single quotes were missing, the line would be split into two items,
38849 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
38850 Exim tried to expand the first one.
38851 </para>
38852 </listitem>
38853 <listitem>
38854 <para>
38855 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
38856 expansion cannot generate multiple arguments, or a command name followed by
38857 arguments. Consider this example:
38858 </para>
38859 <literallayout class="monospaced">
38860 transport_filter = ${lookup{$host}lsearch{/a/file}\
38861                     {$value}{/bin/cat}}
38862 </literallayout>
38863 <para>
38864 The result of the lookup is interpreted as the name of the command, even
38865 if it contains white space. The simplest way round this is to use a shell:
38866 </para>
38867 <literallayout class="monospaced">
38868 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
38869                                {$value}{/bin/cat}}
38870 </literallayout>
38871 </listitem>
38872 </itemizedlist>
38873 <para>
38874 The filter process is run under the same uid and gid as the normal delivery.
38875 For remote deliveries this is the Exim uid/gid by default. The command should
38876 normally yield a zero return code. Transport filters are not supposed to fail.
38877 A non-zero code is taken to mean that the transport filter encountered some
38878 serious problem. Delivery of the message is deferred; the message remains on
38879 the queue and is tried again later. It is not possible to cause a message to be
38880 bounced from a transport filter.
38881 </para>
38882 <para>
38883 If a transport filter is set on an autoreply transport, the original message is
38884 passed through the filter as it is being copied into the newly generated
38885 message, which happens if the <option>return_message</option> option is set.
38886 </para>
38887 <para>
38888 <indexterm role="option">
38889 <primary><option>transport_filter_timeout</option></primary>
38890 </indexterm>
38891 </para>
38892 <informaltable frame="all">
38893 <tgroup cols="4" colsep="0" rowsep="0">
38894 <colspec colwidth="8*" align="left"/>
38895 <colspec colwidth="6*" align="center"/>
38896 <colspec colwidth="6*" align="center"/>
38897 <colspec colwidth="6*" align="right"/>
38898 <tbody>
38899 <row>
38900 <entry><option>transport_filter_timeout</option></entry>
38901 <entry>Use: <emphasis>transports</emphasis></entry>
38902 <entry>Type: <emphasis>time</emphasis></entry>
38903 <entry>Default: <emphasis>5m</emphasis></entry>
38904 </row>
38905 </tbody>
38906 </tgroup>
38907 </informaltable>
38908 <para>
38909 <indexterm role="concept">
38910 <primary>transport</primary>
38911 <secondary>filter, timeout</secondary>
38912 </indexterm>
38913 When Exim is reading the output of a transport filter, it applies a timeout
38914 that can be set by this option. Exceeding the timeout is normally treated as a
38915 temporary delivery failure. However, if a transport filter is used with a
38916 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
38917 way as a timeout in the pipe command itself. By default, a timeout is a hard
38918 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
38919 becomes a temporary error.
38920 </para>
38921 <para>
38922 <indexterm role="option">
38923 <primary><option>user</option></primary>
38924 </indexterm>
38925 </para>
38926 <informaltable frame="all">
38927 <tgroup cols="4" colsep="0" rowsep="0">
38928 <colspec colwidth="8*" align="left"/>
38929 <colspec colwidth="6*" align="center"/>
38930 <colspec colwidth="6*" align="center"/>
38931 <colspec colwidth="6*" align="right"/>
38932 <tbody>
38933 <row>
38934 <entry><option>user</option></entry>
38935 <entry>Use: <emphasis>transports</emphasis></entry>
38936 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38937 <entry>Default: <emphasis>Exim user</emphasis></entry>
38938 </row>
38939 </tbody>
38940 </tgroup>
38941 </informaltable>
38942 <para>
38943 <indexterm role="concept">
38944 <primary>uid (user id)</primary>
38945 <secondary>local delivery</secondary>
38946 </indexterm>
38947 <indexterm role="concept">
38948 <primary>transport</primary>
38949 <secondary>user, specifying</secondary>
38950 </indexterm>
38951 This option specifies the user under whose uid the delivery process is to be
38952 run, overriding any uid that may have been set by the router. If the user is
38953 given as a name, the uid is looked up from the password data, and the
38954 associated group is taken as the value of the gid to be used if the <option>group</option>
38955 option is not set.
38956 </para>
38957 <para>
38958 For deliveries that use local transports, a user and group are normally
38959 specified explicitly or implicitly (for example, as a result of
38960 <option>check_local_user</option>) by the router or transport.
38961 </para>
38962 <para>
38963 <indexterm role="concept">
38964 <primary>hints database</primary>
38965 <secondary>access by remote transport</secondary>
38966 </indexterm>
38967 For remote transports, you should leave this option unset unless you really are
38968 sure you know what you are doing. When a remote transport is running, it needs
38969 to be able to access Exim&#x2019;s hints databases, because each host may have its own
38970 retry data.
38971 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
38972 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
38973 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
38974 </para>
38975 </chapter>
38976
38977 <chapter id="CHAPbatching">
38978 <title>Address batching in local transports</title>
38979 <titleabbrev>Address batching</titleabbrev>
38980 <para>
38981 <indexterm role="concept">
38982 <primary>transport</primary>
38983 <secondary>local; address batching in</secondary>
38984 </indexterm>
38985 The only remote transport (<command>smtp</command>) is normally configured to handle more than
38986 one address at a time, so that when several addresses are routed to the same
38987 remote host, just one copy of the message is sent. Local transports, however,
38988 normally handle one address at a time. That is, a separate instance of the
38989 transport is run for each address that is routed to the transport. A separate
38990 copy of the message is delivered each time.
38991 </para>
38992 <para>
38993 <indexterm role="concept">
38994 <primary>batched local delivery</primary>
38995 </indexterm>
38996 <indexterm role="option">
38997 <primary><option>batch_max</option></primary>
38998 </indexterm>
38999 <indexterm role="option">
39000 <primary><option>batch_id</option></primary>
39001 </indexterm>
39002 In special cases, it may be desirable to handle several addresses at once in a
39003 local transport, for example:
39004 </para>
39005 <itemizedlist>
39006 <listitem>
39007 <para>
39008 In an <command>appendfile</command> transport, when storing messages in files for later
39009 delivery by some other means, a single copy of the message with multiple
39010 recipients saves space.
39011 </para>
39012 </listitem>
39013 <listitem>
39014 <para>
39015 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
39016 a single copy saves time, and is the normal way LMTP is expected to work.
39017 </para>
39018 </listitem>
39019 <listitem>
39020 <para>
39021 In a <command>pipe</command> transport, when passing the message
39022 to a scanner program or
39023 to some other delivery mechanism such as UUCP, multiple recipients may be
39024 acceptable.
39025 </para>
39026 </listitem>
39027 </itemizedlist>
39028 <para>
39029 These three local transports all have the same options for controlling multiple
39030 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
39031 repeating the information for each transport, these options are described here.
39032 </para>
39033 <para>
39034 The <option>batch_max</option> option specifies the maximum number of addresses that can be
39035 delivered together in a single run of the transport. Its default value is one
39036 (no batching). When more than one address is routed to a transport that has a
39037 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
39038 (that is, in a single run of the transport with multiple recipients), subject
39039 to certain conditions:
39040 </para>
39041 <itemizedlist>
39042 <listitem>
39043 <para>
39044 <indexterm role="variable">
39045 <primary><varname>$local_part</varname></primary>
39046 </indexterm>
39047 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
39048 batching is possible.
39049 </para>
39050 </listitem>
39051 <listitem>
39052 <para>
39053 <indexterm role="variable">
39054 <primary><varname>$domain</varname></primary>
39055 </indexterm>
39056 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
39057 addresses with the same domain are batched.
39058 </para>
39059 </listitem>
39060 <listitem>
39061 <para>
39062 <indexterm role="concept">
39063 <primary>customizing</primary>
39064 <secondary>batching condition</secondary>
39065 </indexterm>
39066 If <option>batch_id</option> is set, it is expanded for each address, and only those
39067 addresses with the same expanded value are batched. This allows you to specify
39068 customized batching conditions. Failure of the expansion for any reason,
39069 including forced failure, disables batching, but it does not stop the delivery
39070 from taking place.
39071 </para>
39072 </listitem>
39073 <listitem>
39074 <para>
39075 Batched addresses must also have the same errors address (where to send
39076 delivery errors), the same header additions and removals, the same user and
39077 group for the transport, and if a host list is present, the first host must
39078 be the same.
39079 </para>
39080 </listitem>
39081 </itemizedlist>
39082 <para>
39083 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
39084 both when the file or pipe command is specified in the transport, and when it
39085 is specified by a <command>redirect</command> router, but all the batched addresses must of
39086 course be routed to the same file or pipe command. These two transports have an
39087 option called <option>use_bsmtp</option>, which causes them to deliver the message in
39088 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
39089 <option>check_string</option> and <option>escape_string</option> options are forced to the values
39090 </para>
39091 <literallayout class="monospaced">
39092 check_string = "."
39093 escape_string = ".."
39094 </literallayout>
39095 <para>
39096 when batched SMTP is in use. A full description of the batch SMTP mechanism is
39097 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
39098 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
39099 </para>
39100 <para>
39101 <indexterm role="concept">
39102 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39103 </indexterm>
39104 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
39105 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
39106 that are being processed together. If you are using a batching <command>appendfile</command>
39107 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
39108 addresses is to set the <option>envelope_to_add</option> option.
39109 </para>
39110 <para>
39111 <indexterm role="concept">
39112 <primary><command>pipe</command> transport</primary>
39113 <secondary>with multiple addresses</secondary>
39114 </indexterm>
39115 <indexterm role="variable">
39116 <primary><varname>$pipe_addresses</varname></primary>
39117 </indexterm>
39118 If you are using a <command>pipe</command> transport without BSMTP, and setting the
39119 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
39120 the command. This is not a true variable; it is a bit of magic that causes each
39121 of the recipient addresses to be inserted into the command as a separate
39122 argument. This provides a way of accessing all the addresses that are being
39123 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
39124 are specified by a <command>redirect</command> router.
39125 </para>
39126 </chapter>
39127
39128 <chapter id="CHAPappendfile">
39129 <title>The appendfile transport</title>
39130 <para>
39131 <indexterm role="concept" id="IIDapptra1" class="startofrange">
39132 <primary><command>appendfile</command> transport</primary>
39133 </indexterm>
39134 <indexterm role="concept" id="IIDapptra2" class="startofrange">
39135 <primary>transports</primary>
39136 <secondary><command>appendfile</command></secondary>
39137 </indexterm>
39138 <indexterm role="concept">
39139 <primary>directory creation</primary>
39140 </indexterm>
39141 <indexterm role="concept">
39142 <primary>creating directories</primary>
39143 </indexterm>
39144 The <command>appendfile</command> transport delivers a message by appending it to an existing
39145 file, or by creating an entirely new file in a specified directory. Single
39146 files to which messages are appended can be in the traditional Unix mailbox
39147 format, or optionally in the MBX format supported by the Pine MUA and
39148 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
39149 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
39150 to give added protection against failures that happen part-way through the
39151 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
39152 supported. For all file formats, Exim attempts to create as many levels of
39153 directory as necessary, provided that <option>create_directory</option> is set.
39154 </para>
39155 <para>
39156 The code for the optional formats is not included in the Exim binary by
39157 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
39158 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
39159 included.
39160 </para>
39161 <para>
39162 <indexterm role="concept">
39163 <primary>quota</primary>
39164 <secondary>system</secondary>
39165 </indexterm>
39166 Exim recognizes system quota errors, and generates an appropriate message. Exim
39167 also supports its own quota control within the transport, for use when the
39168 system facility is unavailable or cannot be used for some reason.
39169 </para>
39170 <para>
39171 If there is an error while appending to a file (for example, quota exceeded or
39172 partition filled), Exim attempts to reset the file&#x2019;s length and last
39173 modification time back to what they were before. If there is an error while
39174 creating an entirely new file, the new file is removed.
39175 </para>
39176 <para>
39177 Before appending to a file, a number of security checks are made, and the
39178 file is locked. A detailed description is given below, after the list of
39179 private options.
39180 </para>
39181 <para>
39182 The <command>appendfile</command> transport is most commonly used for local deliveries to
39183 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
39184 putting messages into files for remote delivery by some means other than Exim.
39185 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
39186 option).
39187 </para>
39188 <section id="SECTfildiropt">
39189 <title>The file and directory options</title>
39190 <para>
39191 The <option>file</option> option specifies a single file, to which the message is appended;
39192 the <option>directory</option> option specifies a directory, in which a new file containing
39193 the message is created. Only one of these two options can be set, and for
39194 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
39195 </para>
39196 <para>
39197 <indexterm role="variable">
39198 <primary><varname>$address_file</varname></primary>
39199 </indexterm>
39200 <indexterm role="variable">
39201 <primary><varname>$local_part</varname></primary>
39202 </indexterm>
39203 However, <command>appendfile</command> is also used for delivering messages to files or
39204 directories whose names (or parts of names) are obtained from alias,
39205 forwarding, or filtering operations (for example, a <option>save</option> command in a
39206 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
39207 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
39208 name (or partial name) of the file or directory generated by the redirection
39209 operation. There are two cases:
39210 </para>
39211 <itemizedlist>
39212 <listitem>
39213 <para>
39214 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
39215 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
39216 common case when users with local accounts use filtering to sort mail into
39217 different folders. See for example, the <command>address_file</command> transport in the
39218 default configuration. If the path ends with a slash, it is assumed to be the
39219 name of a directory. A delivery to a directory can also be forced by setting
39220 <option>maildir_format</option> or <option>mailstore_format</option>.
39221 </para>
39222 </listitem>
39223 <listitem>
39224 <para>
39225 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
39226 used to determine the file or directory name for the delivery. Normally, the
39227 contents of <varname>$address_file</varname> are used in some way in the string expansion.
39228 </para>
39229 </listitem>
39230 </itemizedlist>
39231 <para>
39232 <indexterm role="concept">
39233 <primary>Sieve filter</primary>
39234 <secondary>configuring <command>appendfile</command></secondary>
39235 </indexterm>
39236 <indexterm role="concept">
39237 <primary>Sieve filter</primary>
39238 <secondary>relative mailbox path handling</secondary>
39239 </indexterm>
39240 As an example of the second case, consider an environment where users do not
39241 have home directories. They may be permitted to use Exim filter commands of the
39242 form:
39243 </para>
39244 <literallayout class="monospaced">
39245 save folder23
39246 </literallayout>
39247 <para>
39248 or Sieve filter commands of the form:
39249 </para>
39250 <literallayout class="monospaced">
39251 require "fileinto";
39252 fileinto "folder23";
39253 </literallayout>
39254 <para>
39255 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
39256 must transform the relative path into an appropriate absolute file name. In the
39257 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
39258 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
39259 way of handling this requirement:
39260 </para>
39261 <literallayout class="monospaced">
39262 file = ${if eq{$address_file}{inbox} \
39263             {/var/mail/$local_part} \
39264             {${if eq{${substr_0_1:$address_file}}{/} \
39265                   {$address_file} \
39266                   {$home/mail/$address_file} \
39267             }} \
39268        }
39269 </literallayout>
39270 <para>
39271 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
39272 location, absolute paths are used without change, and other folders are in the
39273 <filename>mail</filename> directory within the home directory.
39274 </para>
39275 <para>
39276 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
39277 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
39278 the router. In particular, this is the case if <option>check_local_user</option> is set. If
39279 you want to prevent this happening at routing time, you can set
39280 <option>router_home_directory</option> empty. This forces the router to pass the relative
39281 path to the transport.
39282 </para>
39283 <para>
39284 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
39285 the <option>file</option> or <option>directory</option> option is still used if it is set.
39286 </para>
39287 </section>
39288 <section id="SECID134">
39289 <title>Private options for appendfile</title>
39290 <para>
39291 <indexterm role="concept">
39292 <primary>options</primary>
39293 <secondary><command>appendfile</command> transport</secondary>
39294 </indexterm>
39295 </para>
39296 <para>
39297 <indexterm role="option">
39298 <primary><option>allow_fifo</option></primary>
39299 </indexterm>
39300 </para>
39301 <informaltable frame="all">
39302 <tgroup cols="4" colsep="0" rowsep="0">
39303 <colspec colwidth="8*" align="left"/>
39304 <colspec colwidth="6*" align="center"/>
39305 <colspec colwidth="6*" align="center"/>
39306 <colspec colwidth="6*" align="right"/>
39307 <tbody>
39308 <row>
39309 <entry><option>allow_fifo</option></entry>
39310 <entry>Use: <emphasis>appendfile</emphasis></entry>
39311 <entry>Type: <emphasis>boolean</emphasis></entry>
39312 <entry>Default: <emphasis>false</emphasis></entry>
39313 </row>
39314 </tbody>
39315 </tgroup>
39316 </informaltable>
39317 <para>
39318 <indexterm role="concept">
39319 <primary>fifo (named pipe)</primary>
39320 </indexterm>
39321 <indexterm role="concept">
39322 <primary>named pipe (fifo)</primary>
39323 </indexterm>
39324 <indexterm role="concept">
39325 <primary>pipe</primary>
39326 <secondary>named (fifo)</secondary>
39327 </indexterm>
39328 Setting this option permits delivery to named pipes (FIFOs) as well as to
39329 regular files. If no process is reading the named pipe at delivery time, the
39330 delivery is deferred.
39331 </para>
39332 <para>
39333 <indexterm role="option">
39334 <primary><option>allow_symlink</option></primary>
39335 </indexterm>
39336 </para>
39337 <informaltable frame="all">
39338 <tgroup cols="4" colsep="0" rowsep="0">
39339 <colspec colwidth="8*" align="left"/>
39340 <colspec colwidth="6*" align="center"/>
39341 <colspec colwidth="6*" align="center"/>
39342 <colspec colwidth="6*" align="right"/>
39343 <tbody>
39344 <row>
39345 <entry><option>allow_symlink</option></entry>
39346 <entry>Use: <emphasis>appendfile</emphasis></entry>
39347 <entry>Type: <emphasis>boolean</emphasis></entry>
39348 <entry>Default: <emphasis>false</emphasis></entry>
39349 </row>
39350 </tbody>
39351 </tgroup>
39352 </informaltable>
39353 <para>
39354 <indexterm role="concept">
39355 <primary>symbolic link</primary>
39356 <secondary>to mailbox</secondary>
39357 </indexterm>
39358 <indexterm role="concept">
39359 <primary>mailbox</primary>
39360 <secondary>symbolic link</secondary>
39361 </indexterm>
39362 By default, <command>appendfile</command> will not deliver if the path name for the file is
39363 that of a symbolic link. Setting this option relaxes that constraint, but there
39364 are security issues involved in the use of symbolic links. Be sure you know
39365 what you are doing if you set this. Details of exactly what this option affects
39366 are included in the discussion which follows this list of options.
39367 </para>
39368 <para>
39369 <indexterm role="option">
39370 <primary><option>batch_id</option></primary>
39371 </indexterm>
39372 </para>
39373 <informaltable frame="all">
39374 <tgroup cols="4" colsep="0" rowsep="0">
39375 <colspec colwidth="8*" align="left"/>
39376 <colspec colwidth="6*" align="center"/>
39377 <colspec colwidth="6*" align="center"/>
39378 <colspec colwidth="6*" align="right"/>
39379 <tbody>
39380 <row>
39381 <entry><option>batch_id</option></entry>
39382 <entry>Use: <emphasis>appendfile</emphasis></entry>
39383 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39384 <entry>Default: <emphasis>unset</emphasis></entry>
39385 </row>
39386 </tbody>
39387 </tgroup>
39388 </informaltable>
39389 <para>
39390 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39391 However, batching is automatically disabled for <command>appendfile</command> deliveries that
39392 happen as a result of forwarding or aliasing or other redirection directly to a
39393 file.
39394 </para>
39395 <para>
39396 <indexterm role="option">
39397 <primary><option>batch_max</option></primary>
39398 </indexterm>
39399 </para>
39400 <informaltable frame="all">
39401 <tgroup cols="4" colsep="0" rowsep="0">
39402 <colspec colwidth="8*" align="left"/>
39403 <colspec colwidth="6*" align="center"/>
39404 <colspec colwidth="6*" align="center"/>
39405 <colspec colwidth="6*" align="right"/>
39406 <tbody>
39407 <row>
39408 <entry><option>batch_max</option></entry>
39409 <entry>Use: <emphasis>appendfile</emphasis></entry>
39410 <entry>Type: <emphasis>integer</emphasis></entry>
39411 <entry>Default: <emphasis>1</emphasis></entry>
39412 </row>
39413 </tbody>
39414 </tgroup>
39415 </informaltable>
39416 <para>
39417 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39418 </para>
39419 <para>
39420 <indexterm role="option">
39421 <primary><option>check_group</option></primary>
39422 </indexterm>
39423 </para>
39424 <informaltable frame="all">
39425 <tgroup cols="4" colsep="0" rowsep="0">
39426 <colspec colwidth="8*" align="left"/>
39427 <colspec colwidth="6*" align="center"/>
39428 <colspec colwidth="6*" align="center"/>
39429 <colspec colwidth="6*" align="right"/>
39430 <tbody>
39431 <row>
39432 <entry><option>check_group</option></entry>
39433 <entry>Use: <emphasis>appendfile</emphasis></entry>
39434 <entry>Type: <emphasis>boolean</emphasis></entry>
39435 <entry>Default: <emphasis>false</emphasis></entry>
39436 </row>
39437 </tbody>
39438 </tgroup>
39439 </informaltable>
39440 <para>
39441 When this option is set, the group owner of the file defined by the <option>file</option>
39442 option is checked to see that it is the same as the group under which the
39443 delivery process is running. The default setting is false because the default
39444 file mode is 0600, which means that the group is irrelevant.
39445 </para>
39446 <para>
39447 <indexterm role="option">
39448 <primary><option>check_owner</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>check_owner</option></entry>
39460 <entry>Use: <emphasis>appendfile</emphasis></entry>
39461 <entry>Type: <emphasis>boolean</emphasis></entry>
39462 <entry>Default: <emphasis>true</emphasis></entry>
39463 </row>
39464 </tbody>
39465 </tgroup>
39466 </informaltable>
39467 <para>
39468 When this option is set, the owner of the file defined by the <option>file</option> option
39469 is checked to ensure that it is the same as the user under which the delivery
39470 process is running.
39471 </para>
39472 <para>
39473 <indexterm role="option">
39474 <primary><option>check_string</option></primary>
39475 </indexterm>
39476 </para>
39477 <informaltable frame="all">
39478 <tgroup cols="4" colsep="0" rowsep="0">
39479 <colspec colwidth="8*" align="left"/>
39480 <colspec colwidth="6*" align="center"/>
39481 <colspec colwidth="6*" align="center"/>
39482 <colspec colwidth="6*" align="right"/>
39483 <tbody>
39484 <row>
39485 <entry><option>check_string</option></entry>
39486 <entry>Use: <emphasis>appendfile</emphasis></entry>
39487 <entry>Type: <emphasis>string</emphasis></entry>
39488 <entry>Default: <emphasis>see below</emphasis></entry>
39489 </row>
39490 </tbody>
39491 </tgroup>
39492 </informaltable>
39493 <para>
39494 <indexterm role="concept">
39495 <primary><quote>From</quote> line</primary>
39496 </indexterm>
39497 As <command>appendfile</command> writes the message, the start of each line is tested for
39498 matching <option>check_string</option>, and if it does, the initial matching characters are
39499 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
39500 a literal string, not a regular expression, and the case of any letters it
39501 contains is significant.
39502 </para>
39503 <para>
39504 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
39505 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
39506 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
39507 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
39508 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
39509 </para>
39510 <para>
39511 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
39512 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
39513 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
39514 if another format is used. For example, to deliver to mailboxes in MMDF format:
39515 <indexterm role="concept">
39516 <primary>MMDF format mailbox</primary>
39517 </indexterm>
39518 <indexterm role="concept">
39519 <primary>mailbox</primary>
39520 <secondary>MMDF format</secondary>
39521 </indexterm>
39522 </para>
39523 <literallayout class="monospaced">
39524 check_string = "\1\1\1\1\n"
39525 escape_string = "\1\1\1\1 \n"
39526 message_prefix = "\1\1\1\1\n"
39527 message_suffix = "\1\1\1\1\n"
39528 </literallayout>
39529 <para>
39530 <indexterm role="option">
39531 <primary><option>create_directory</option></primary>
39532 </indexterm>
39533 </para>
39534 <informaltable frame="all">
39535 <tgroup cols="4" colsep="0" rowsep="0">
39536 <colspec colwidth="8*" align="left"/>
39537 <colspec colwidth="6*" align="center"/>
39538 <colspec colwidth="6*" align="center"/>
39539 <colspec colwidth="6*" align="right"/>
39540 <tbody>
39541 <row>
39542 <entry><option>create_directory</option></entry>
39543 <entry>Use: <emphasis>appendfile</emphasis></entry>
39544 <entry>Type: <emphasis>boolean</emphasis></entry>
39545 <entry>Default: <emphasis>true</emphasis></entry>
39546 </row>
39547 </tbody>
39548 </tgroup>
39549 </informaltable>
39550 <para>
39551 <indexterm role="concept">
39552 <primary>directory creation</primary>
39553 </indexterm>
39554 When this option is true, Exim attempts to create any missing superior
39555 directories for the file that it is about to write. A created directory&#x2019;s mode
39556 is given by the <option>directory_mode</option> option.
39557 </para>
39558 <para>
39559 The group ownership of a newly created directory is highly dependent on the
39560 operating system (and possibly the file system) that is being used. For
39561 example, in Solaris, if the parent directory has the setgid bit set, its group
39562 is propagated to the child; if not, the currently set group is used. However,
39563 in FreeBSD, the parent&#x2019;s group is always used.
39564 </para>
39565 <para>
39566 <indexterm role="option">
39567 <primary><option>create_file</option></primary>
39568 </indexterm>
39569 </para>
39570 <informaltable frame="all">
39571 <tgroup cols="4" colsep="0" rowsep="0">
39572 <colspec colwidth="8*" align="left"/>
39573 <colspec colwidth="6*" align="center"/>
39574 <colspec colwidth="6*" align="center"/>
39575 <colspec colwidth="6*" align="right"/>
39576 <tbody>
39577 <row>
39578 <entry><option>create_file</option></entry>
39579 <entry>Use: <emphasis>appendfile</emphasis></entry>
39580 <entry>Type: <emphasis>string</emphasis></entry>
39581 <entry>Default: <emphasis>anywhere</emphasis></entry>
39582 </row>
39583 </tbody>
39584 </tgroup>
39585 </informaltable>
39586 <para>
39587 This option constrains the location of files and directories that are created
39588 by this transport. It applies to files defined by the <option>file</option> option and
39589 directories defined by the <option>directory</option> option. In the case of maildir
39590 delivery, it applies to the top level directory, not the maildir directories
39591 beneath.
39592 </para>
39593 <para>
39594 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
39595 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
39596 set for the transport. This option is not useful when an explicit file name is
39597 given for normal mailbox deliveries. It is intended for the case when file
39598 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
39599 by an <command>appendfile</command> transport called <option>address_file</option>. See also
39600 <option>file_must_exist</option>.
39601 </para>
39602 <para>
39603 <indexterm role="option">
39604 <primary><option>directory</option></primary>
39605 </indexterm>
39606 </para>
39607 <informaltable frame="all">
39608 <tgroup cols="4" colsep="0" rowsep="0">
39609 <colspec colwidth="8*" align="left"/>
39610 <colspec colwidth="6*" align="center"/>
39611 <colspec colwidth="6*" align="center"/>
39612 <colspec colwidth="6*" align="right"/>
39613 <tbody>
39614 <row>
39615 <entry><option>directory</option></entry>
39616 <entry>Use: <emphasis>appendfile</emphasis></entry>
39617 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39618 <entry>Default: <emphasis>unset</emphasis></entry>
39619 </row>
39620 </tbody>
39621 </tgroup>
39622 </informaltable>
39623 <para>
39624 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
39625 or <option>directory</option> must be set, unless the delivery is the direct result of a
39626 redirection (see section <xref linkend="SECTfildiropt"/>).
39627 </para>
39628 <para>
39629 When <option>directory</option> is set, the string is expanded, and the message is delivered
39630 into a new file or files in or below the given directory, instead of being
39631 appended to a single mailbox file. A number of different formats are provided
39632 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
39633 <xref linkend="SECTopdir"/> for further details of this form of delivery.
39634 </para>
39635 <para>
39636 <indexterm role="option">
39637 <primary><option>directory_file</option></primary>
39638 </indexterm>
39639 </para>
39640 <informaltable frame="all">
39641 <tgroup cols="4" colsep="0" rowsep="0">
39642 <colspec colwidth="8*" align="left"/>
39643 <colspec colwidth="6*" align="center"/>
39644 <colspec colwidth="6*" align="center"/>
39645 <colspec colwidth="6*" align="right"/>
39646 <tbody>
39647 <row>
39648 <entry><option>directory_file</option></entry>
39649 <entry>Use: <emphasis>appendfile</emphasis></entry>
39650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39651 <entry>Default: <emphasis>see below</emphasis></entry>
39652 </row>
39653 </tbody>
39654 </tgroup>
39655 </informaltable>
39656 <para>
39657 <indexterm role="concept">
39658 <primary>base62</primary>
39659 </indexterm>
39660 <indexterm role="variable">
39661 <primary><varname>$inode</varname></primary>
39662 </indexterm>
39663 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
39664 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
39665 whose name is obtained by expanding this string. The default value is:
39666 </para>
39667 <literallayout class="monospaced">
39668 q${base62:$tod_epoch}-$inode
39669 </literallayout>
39670 <para>
39671 This generates a unique name from the current time, in base 62 form, and the
39672 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
39673 option.
39674 </para>
39675 <para>
39676 <indexterm role="option">
39677 <primary><option>directory_mode</option></primary>
39678 </indexterm>
39679 </para>
39680 <informaltable frame="all">
39681 <tgroup cols="4" colsep="0" rowsep="0">
39682 <colspec colwidth="8*" align="left"/>
39683 <colspec colwidth="6*" align="center"/>
39684 <colspec colwidth="6*" align="center"/>
39685 <colspec colwidth="6*" align="right"/>
39686 <tbody>
39687 <row>
39688 <entry><option>directory_mode</option></entry>
39689 <entry>Use: <emphasis>appendfile</emphasis></entry>
39690 <entry>Type: <emphasis>octal integer</emphasis></entry>
39691 <entry>Default: <emphasis>0700</emphasis></entry>
39692 </row>
39693 </tbody>
39694 </tgroup>
39695 </informaltable>
39696 <para>
39697 If <command>appendfile</command> creates any directories as a result of the
39698 <option>create_directory</option> option, their mode is specified by this option.
39699 </para>
39700 <para>
39701 <indexterm role="option">
39702 <primary><option>escape_string</option></primary>
39703 </indexterm>
39704 </para>
39705 <informaltable frame="all">
39706 <tgroup cols="4" colsep="0" rowsep="0">
39707 <colspec colwidth="8*" align="left"/>
39708 <colspec colwidth="6*" align="center"/>
39709 <colspec colwidth="6*" align="center"/>
39710 <colspec colwidth="6*" align="right"/>
39711 <tbody>
39712 <row>
39713 <entry><option>escape_string</option></entry>
39714 <entry>Use: <emphasis>appendfile</emphasis></entry>
39715 <entry>Type: <emphasis>string</emphasis></entry>
39716 <entry>Default: <emphasis>see description</emphasis></entry>
39717 </row>
39718 </tbody>
39719 </tgroup>
39720 </informaltable>
39721 <para>
39722 See <option>check_string</option> above.
39723 </para>
39724 <para>
39725 <indexterm role="option">
39726 <primary><option>file</option></primary>
39727 </indexterm>
39728 </para>
39729 <informaltable frame="all">
39730 <tgroup cols="4" colsep="0" rowsep="0">
39731 <colspec colwidth="8*" align="left"/>
39732 <colspec colwidth="6*" align="center"/>
39733 <colspec colwidth="6*" align="center"/>
39734 <colspec colwidth="6*" align="right"/>
39735 <tbody>
39736 <row>
39737 <entry><option>file</option></entry>
39738 <entry>Use: <emphasis>appendfile</emphasis></entry>
39739 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39740 <entry>Default: <emphasis>unset</emphasis></entry>
39741 </row>
39742 </tbody>
39743 </tgroup>
39744 </informaltable>
39745 <para>
39746 This option is mutually exclusive with the <option>directory</option> option, but one of
39747 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
39748 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
39749 specifies a single file, to which the message is appended. One or more of
39750 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
39751 <option>file</option>.
39752 </para>
39753 <para>
39754 <indexterm role="concept">
39755 <primary>NFS</primary>
39756 <secondary>lock file</secondary>
39757 </indexterm>
39758 <indexterm role="concept">
39759 <primary>locking files</primary>
39760 </indexterm>
39761 <indexterm role="concept">
39762 <primary>lock files</primary>
39763 </indexterm>
39764 If you are using more than one host to deliver over NFS into the same
39765 mailboxes, you should always use lock files.
39766 </para>
39767 <para>
39768 The string value is expanded for each delivery, and must yield an absolute
39769 path. The most common settings of this option are variations on one of these
39770 examples:
39771 </para>
39772 <literallayout class="monospaced">
39773 file = /var/spool/mail/$local_part
39774 file = /home/$local_part/inbox
39775 file = $home/inbox
39776 </literallayout>
39777 <para>
39778 <indexterm role="concept">
39779 <primary><quote>sticky</quote> bit</primary>
39780 </indexterm>
39781 In the first example, all deliveries are done into the same directory. If Exim
39782 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
39783 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
39784 deliveries to be possible, or alternatively the <option>group</option> option can be used to
39785 run the delivery under a group id which has write access to the directory.
39786 </para>
39787 <para>
39788 <indexterm role="option">
39789 <primary><option>file_format</option></primary>
39790 </indexterm>
39791 </para>
39792 <informaltable frame="all">
39793 <tgroup cols="4" colsep="0" rowsep="0">
39794 <colspec colwidth="8*" align="left"/>
39795 <colspec colwidth="6*" align="center"/>
39796 <colspec colwidth="6*" align="center"/>
39797 <colspec colwidth="6*" align="right"/>
39798 <tbody>
39799 <row>
39800 <entry><option>file_format</option></entry>
39801 <entry>Use: <emphasis>appendfile</emphasis></entry>
39802 <entry>Type: <emphasis>string</emphasis></entry>
39803 <entry>Default: <emphasis>unset</emphasis></entry>
39804 </row>
39805 </tbody>
39806 </tgroup>
39807 </informaltable>
39808 <para>
39809 <indexterm role="concept">
39810 <primary>file</primary>
39811 <secondary>mailbox; checking existing format</secondary>
39812 </indexterm>
39813 This option requests the transport to check the format of an existing file
39814 before adding to it. The check consists of matching a specific string at the
39815 start of the file. The value of the option consists of an even number of
39816 colon-separated strings. The first of each pair is the test string, and the
39817 second is the name of a transport. If the transport associated with a matched
39818 string is not the current transport, control is passed over to the other
39819 transport. For example, suppose the standard <command>local_delivery</command> transport has
39820 this added to it:
39821 </para>
39822 <literallayout class="monospaced">
39823 file_format = "From       : local_delivery :\
39824                \1\1\1\1\n : local_mmdf_delivery"
39825 </literallayout>
39826 <para>
39827 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
39828 a mailbox begins with four binary ones followed by a newline, control is passed
39829 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
39830 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
39831 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
39832 match any string, or if the transport named for a given string is not defined,
39833 delivery is deferred.
39834 </para>
39835 <para>
39836 <indexterm role="option">
39837 <primary><option>file_must_exist</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>file_must_exist</option></entry>
39849 <entry>Use: <emphasis>appendfile</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 If this option is true, the file specified by the <option>file</option> option must exist.
39858 A temporary error occurs if it does not, causing delivery to be deferred.
39859 If this option is false, the file is created if it does not exist.
39860 </para>
39861 <para>
39862 <indexterm role="option">
39863 <primary><option>lock_fcntl_timeout</option></primary>
39864 </indexterm>
39865 </para>
39866 <informaltable frame="all">
39867 <tgroup cols="4" colsep="0" rowsep="0">
39868 <colspec colwidth="8*" align="left"/>
39869 <colspec colwidth="6*" align="center"/>
39870 <colspec colwidth="6*" align="center"/>
39871 <colspec colwidth="6*" align="right"/>
39872 <tbody>
39873 <row>
39874 <entry><option>lock_fcntl_timeout</option></entry>
39875 <entry>Use: <emphasis>appendfile</emphasis></entry>
39876 <entry>Type: <emphasis>time</emphasis></entry>
39877 <entry>Default: <emphasis>0s</emphasis></entry>
39878 </row>
39879 </tbody>
39880 </tgroup>
39881 </informaltable>
39882 <para>
39883 <indexterm role="concept">
39884 <primary>timeout</primary>
39885 <secondary>mailbox locking</secondary>
39886 </indexterm>
39887 <indexterm role="concept">
39888 <primary>mailbox</primary>
39889 <secondary>locking, blocking and non-blocking</secondary>
39890 </indexterm>
39891 <indexterm role="concept">
39892 <primary>locking files</primary>
39893 </indexterm>
39894 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
39895 when locking an open mailbox file. If the call fails, the delivery process
39896 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
39897 Non-blocking calls are used so that the file is not kept open during the wait
39898 for the lock; the reason for this is to make it as safe as possible for
39899 deliveries over NFS in the case when processes might be accessing an NFS
39900 mailbox without using a lock file. This should not be done, but
39901 misunderstandings and hence misconfigurations are not unknown.
39902 </para>
39903 <para>
39904 On a busy system, however, the performance of a non-blocking lock approach is
39905 not as good as using a blocking lock with a timeout. In this case, the waiting
39906 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
39907 and can proceed as soon as the previous lock holder releases it.
39908 </para>
39909 <para>
39910 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
39911 timeout, are used. There may still be some retrying: the maximum number of
39912 retries is
39913 </para>
39914 <literallayout class="monospaced">
39915 (lock_retries * lock_interval) / lock_fcntl_timeout
39916 </literallayout>
39917 <para>
39918 rounded up to the next whole number. In other words, the total time during
39919 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
39920 <option>lock_fcntl_timeout</option> is set very large.
39921 </para>
39922 <para>
39923 You should consider setting this option if you are getting a lot of delayed
39924 local deliveries because of errors of the form
39925 </para>
39926 <literallayout class="monospaced">
39927 failed to lock mailbox /some/file (fcntl)
39928 </literallayout>
39929 <para>
39930 <indexterm role="option">
39931 <primary><option>lock_flock_timeout</option></primary>
39932 </indexterm>
39933 </para>
39934 <informaltable frame="all">
39935 <tgroup cols="4" colsep="0" rowsep="0">
39936 <colspec colwidth="8*" align="left"/>
39937 <colspec colwidth="6*" align="center"/>
39938 <colspec colwidth="6*" align="center"/>
39939 <colspec colwidth="6*" align="right"/>
39940 <tbody>
39941 <row>
39942 <entry><option>lock_flock_timeout</option></entry>
39943 <entry>Use: <emphasis>appendfile</emphasis></entry>
39944 <entry>Type: <emphasis>time</emphasis></entry>
39945 <entry>Default: <emphasis>0s</emphasis></entry>
39946 </row>
39947 </tbody>
39948 </tgroup>
39949 </informaltable>
39950 <para>
39951 This timeout applies to file locking when using <function>flock()</function> (see
39952 <option>use_flock</option>); the timeout operates in a similar manner to
39953 <option>lock_fcntl_timeout</option>.
39954 </para>
39955 <para>
39956 <indexterm role="option">
39957 <primary><option>lock_interval</option></primary>
39958 </indexterm>
39959 </para>
39960 <informaltable frame="all">
39961 <tgroup cols="4" colsep="0" rowsep="0">
39962 <colspec colwidth="8*" align="left"/>
39963 <colspec colwidth="6*" align="center"/>
39964 <colspec colwidth="6*" align="center"/>
39965 <colspec colwidth="6*" align="right"/>
39966 <tbody>
39967 <row>
39968 <entry><option>lock_interval</option></entry>
39969 <entry>Use: <emphasis>appendfile</emphasis></entry>
39970 <entry>Type: <emphasis>time</emphasis></entry>
39971 <entry>Default: <emphasis>3s</emphasis></entry>
39972 </row>
39973 </tbody>
39974 </tgroup>
39975 </informaltable>
39976 <para>
39977 This specifies the time to wait between attempts to lock the file. See below
39978 for details of locking.
39979 </para>
39980 <para>
39981 <indexterm role="option">
39982 <primary><option>lock_retries</option></primary>
39983 </indexterm>
39984 </para>
39985 <informaltable frame="all">
39986 <tgroup cols="4" colsep="0" rowsep="0">
39987 <colspec colwidth="8*" align="left"/>
39988 <colspec colwidth="6*" align="center"/>
39989 <colspec colwidth="6*" align="center"/>
39990 <colspec colwidth="6*" align="right"/>
39991 <tbody>
39992 <row>
39993 <entry><option>lock_retries</option></entry>
39994 <entry>Use: <emphasis>appendfile</emphasis></entry>
39995 <entry>Type: <emphasis>integer</emphasis></entry>
39996 <entry>Default: <emphasis>10</emphasis></entry>
39997 </row>
39998 </tbody>
39999 </tgroup>
40000 </informaltable>
40001 <para>
40002 This specifies the maximum number of attempts to lock the file. A value of zero
40003 is treated as 1. See below for details of locking.
40004 </para>
40005 <para>
40006 <indexterm role="option">
40007 <primary><option>lockfile_mode</option></primary>
40008 </indexterm>
40009 </para>
40010 <informaltable frame="all">
40011 <tgroup cols="4" colsep="0" rowsep="0">
40012 <colspec colwidth="8*" align="left"/>
40013 <colspec colwidth="6*" align="center"/>
40014 <colspec colwidth="6*" align="center"/>
40015 <colspec colwidth="6*" align="right"/>
40016 <tbody>
40017 <row>
40018 <entry><option>lockfile_mode</option></entry>
40019 <entry>Use: <emphasis>appendfile</emphasis></entry>
40020 <entry>Type: <emphasis>octal integer</emphasis></entry>
40021 <entry>Default: <emphasis>0600</emphasis></entry>
40022 </row>
40023 </tbody>
40024 </tgroup>
40025 </informaltable>
40026 <para>
40027 This specifies the mode of the created lock file, when a lock file is being
40028 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
40029 </para>
40030 <para>
40031 <indexterm role="option">
40032 <primary><option>lockfile_timeout</option></primary>
40033 </indexterm>
40034 </para>
40035 <informaltable frame="all">
40036 <tgroup cols="4" colsep="0" rowsep="0">
40037 <colspec colwidth="8*" align="left"/>
40038 <colspec colwidth="6*" align="center"/>
40039 <colspec colwidth="6*" align="center"/>
40040 <colspec colwidth="6*" align="right"/>
40041 <tbody>
40042 <row>
40043 <entry><option>lockfile_timeout</option></entry>
40044 <entry>Use: <emphasis>appendfile</emphasis></entry>
40045 <entry>Type: <emphasis>time</emphasis></entry>
40046 <entry>Default: <emphasis>30m</emphasis></entry>
40047 </row>
40048 </tbody>
40049 </tgroup>
40050 </informaltable>
40051 <para>
40052 <indexterm role="concept">
40053 <primary>timeout</primary>
40054 <secondary>mailbox locking</secondary>
40055 </indexterm>
40056 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
40057 exists and is older than this value, it is assumed to have been left behind by
40058 accident, and Exim attempts to remove it.
40059 </para>
40060 <para>
40061 <indexterm role="option">
40062 <primary><option>mailbox_filecount</option></primary>
40063 </indexterm>
40064 </para>
40065 <informaltable frame="all">
40066 <tgroup cols="4" colsep="0" rowsep="0">
40067 <colspec colwidth="8*" align="left"/>
40068 <colspec colwidth="6*" align="center"/>
40069 <colspec colwidth="6*" align="center"/>
40070 <colspec colwidth="6*" align="right"/>
40071 <tbody>
40072 <row>
40073 <entry><option>mailbox_filecount</option></entry>
40074 <entry>Use: <emphasis>appendfile</emphasis></entry>
40075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40076 <entry>Default: <emphasis>unset</emphasis></entry>
40077 </row>
40078 </tbody>
40079 </tgroup>
40080 </informaltable>
40081 <para>
40082 <indexterm role="concept">
40083 <primary>mailbox</primary>
40084 <secondary>specifying size of</secondary>
40085 </indexterm>
40086 <indexterm role="concept">
40087 <primary>size</primary>
40088 <secondary>of mailbox</secondary>
40089 </indexterm>
40090 If this option is set, it is expanded, and the result is taken as the current
40091 number of files in the mailbox. It must be a decimal number, optionally
40092 followed by K or M. This provides a way of obtaining this information from an
40093 external source that maintains the data.
40094 </para>
40095 <para>
40096 <indexterm role="option">
40097 <primary><option>mailbox_size</option></primary>
40098 </indexterm>
40099 </para>
40100 <informaltable frame="all">
40101 <tgroup cols="4" colsep="0" rowsep="0">
40102 <colspec colwidth="8*" align="left"/>
40103 <colspec colwidth="6*" align="center"/>
40104 <colspec colwidth="6*" align="center"/>
40105 <colspec colwidth="6*" align="right"/>
40106 <tbody>
40107 <row>
40108 <entry><option>mailbox_size</option></entry>
40109 <entry>Use: <emphasis>appendfile</emphasis></entry>
40110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40111 <entry>Default: <emphasis>unset</emphasis></entry>
40112 </row>
40113 </tbody>
40114 </tgroup>
40115 </informaltable>
40116 <para>
40117 <indexterm role="concept">
40118 <primary>mailbox</primary>
40119 <secondary>specifying size of</secondary>
40120 </indexterm>
40121 <indexterm role="concept">
40122 <primary>size</primary>
40123 <secondary>of mailbox</secondary>
40124 </indexterm>
40125 If this option is set, it is expanded, and the result is taken as the current
40126 size the mailbox. It must be a decimal number, optionally followed by K or M.
40127 This provides a way of obtaining this information from an external source that
40128 maintains the data. This is likely to be helpful for maildir deliveries where
40129 it is computationally expensive to compute the size of a mailbox.
40130 </para>
40131 <para>
40132 <indexterm role="option">
40133 <primary><option>maildir_format</option></primary>
40134 </indexterm>
40135 </para>
40136 <informaltable frame="all">
40137 <tgroup cols="4" colsep="0" rowsep="0">
40138 <colspec colwidth="8*" align="left"/>
40139 <colspec colwidth="6*" align="center"/>
40140 <colspec colwidth="6*" align="center"/>
40141 <colspec colwidth="6*" align="right"/>
40142 <tbody>
40143 <row>
40144 <entry><option>maildir_format</option></entry>
40145 <entry>Use: <emphasis>appendfile</emphasis></entry>
40146 <entry>Type: <emphasis>boolean</emphasis></entry>
40147 <entry>Default: <emphasis>false</emphasis></entry>
40148 </row>
40149 </tbody>
40150 </tgroup>
40151 </informaltable>
40152 <para>
40153 <indexterm role="concept">
40154 <primary>maildir format</primary>
40155 <secondary>specifying</secondary>
40156 </indexterm>
40157 If this option is set with the <option>directory</option> option, the delivery is into a new
40158 file, in the <quote>maildir</quote> format that is used by other mail software. When the
40159 transport is activated directly from a <command>redirect</command> router (for example, the
40160 <command>address_file</command> transport in the default configuration), setting
40161 <option>maildir_format</option> causes the path received from the router to be treated as a
40162 directory, whether or not it ends with <literal>/</literal>. This option is available only if
40163 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
40164 <xref linkend="SECTmaildirdelivery"/> below for further details.
40165 </para>
40166 <para>
40167 <indexterm role="option">
40168 <primary><option>maildir_quota_directory_regex</option></primary>
40169 </indexterm>
40170 </para>
40171 <informaltable frame="all">
40172 <tgroup cols="4" colsep="0" rowsep="0">
40173 <colspec colwidth="8*" align="left"/>
40174 <colspec colwidth="6*" align="center"/>
40175 <colspec colwidth="6*" align="center"/>
40176 <colspec colwidth="6*" align="right"/>
40177 <tbody>
40178 <row>
40179 <entry><option>maildir_quota_directory_regex</option></entry>
40180 <entry>Use: <emphasis>appendfile</emphasis></entry>
40181 <entry>Type: <emphasis>string</emphasis></entry>
40182 <entry>Default: <emphasis>See below</emphasis></entry>
40183 </row>
40184 </tbody>
40185 </tgroup>
40186 </informaltable>
40187 <para>
40188 <indexterm role="concept">
40189 <primary>maildir format</primary>
40190 <secondary>quota; directories included in</secondary>
40191 </indexterm>
40192 <indexterm role="concept">
40193 <primary>quota</primary>
40194 <secondary>maildir; directories included in</secondary>
40195 </indexterm>
40196 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
40197 a regular expression for specifying directories, relative to the quota
40198 directory (see <option>quota_directory</option>), that should be included in the quota
40199 calculation. The default value is:
40200 </para>
40201 <literallayout class="monospaced">
40202 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
40203 </literallayout>
40204 <para>
40205 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
40206 (directories whose names begin with a dot). If you want to exclude the
40207 <filename>Trash</filename>
40208 folder from the count (as some sites do), you need to change this setting to
40209 </para>
40210 <literallayout class="monospaced">
40211 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
40212 </literallayout>
40213 <para>
40214 This uses a negative lookahead in the regular expression to exclude the
40215 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
40216 calculations, quota processing is bypassed for any messages that are delivered
40217 directly into that directory.
40218 </para>
40219 <para>
40220 <indexterm role="option">
40221 <primary><option>maildir_retries</option></primary>
40222 </indexterm>
40223 </para>
40224 <informaltable frame="all">
40225 <tgroup cols="4" colsep="0" rowsep="0">
40226 <colspec colwidth="8*" align="left"/>
40227 <colspec colwidth="6*" align="center"/>
40228 <colspec colwidth="6*" align="center"/>
40229 <colspec colwidth="6*" align="right"/>
40230 <tbody>
40231 <row>
40232 <entry><option>maildir_retries</option></entry>
40233 <entry>Use: <emphasis>appendfile</emphasis></entry>
40234 <entry>Type: <emphasis>integer</emphasis></entry>
40235 <entry>Default: <emphasis>10</emphasis></entry>
40236 </row>
40237 </tbody>
40238 </tgroup>
40239 </informaltable>
40240 <para>
40241 This option specifies the number of times to retry when writing a file in
40242 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
40243 </para>
40244 <para>
40245 <indexterm role="option">
40246 <primary><option>maildir_tag</option></primary>
40247 </indexterm>
40248 </para>
40249 <informaltable frame="all">
40250 <tgroup cols="4" colsep="0" rowsep="0">
40251 <colspec colwidth="8*" align="left"/>
40252 <colspec colwidth="6*" align="center"/>
40253 <colspec colwidth="6*" align="center"/>
40254 <colspec colwidth="6*" align="right"/>
40255 <tbody>
40256 <row>
40257 <entry><option>maildir_tag</option></entry>
40258 <entry>Use: <emphasis>appendfile</emphasis></entry>
40259 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40260 <entry>Default: <emphasis>unset</emphasis></entry>
40261 </row>
40262 </tbody>
40263 </tgroup>
40264 </informaltable>
40265 <para>
40266 This option applies only to deliveries in maildir format, and is described in
40267 section <xref linkend="SECTmaildirdelivery"/> below.
40268 </para>
40269 <para>
40270 <indexterm role="option">
40271 <primary><option>maildir_use_size_file</option></primary>
40272 </indexterm>
40273 </para>
40274 <informaltable frame="all">
40275 <tgroup cols="4" colsep="0" rowsep="0">
40276 <colspec colwidth="8*" align="left"/>
40277 <colspec colwidth="6*" align="center"/>
40278 <colspec colwidth="6*" align="center"/>
40279 <colspec colwidth="6*" align="right"/>
40280 <tbody>
40281 <row>
40282 <entry><option>maildir_use_size_file</option></entry>
40283 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
40284 <entry>Type: <emphasis>boolean</emphasis></entry>
40285 <entry>Default: <emphasis>false</emphasis></entry>
40286 </row>
40287 </tbody>
40288 </tgroup>
40289 </informaltable>
40290 <para>
40291 <indexterm role="concept">
40292 <primary>maildir format</primary>
40293 <secondary><filename>maildirsize</filename> file</secondary>
40294 </indexterm>
40295 The result of string expansion for this option must be a valid boolean value.
40296 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
40297 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
40298 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
40299 value is zero. See <option>maildir_quota_directory_regex</option> above and section
40300 <xref linkend="SECTmaildirdelivery"/> below for further details.
40301 </para>
40302 <para>
40303 <indexterm role="option">
40304 <primary><option>maildirfolder_create_regex</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>maildirfolder_create_regex</option></entry>
40316 <entry>Use: <emphasis>appendfile</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 <indexterm role="concept">
40325 <primary>maildir format</primary>
40326 <secondary><filename>maildirfolder</filename> file</secondary>
40327 </indexterm>
40328 <indexterm role="concept">
40329 <primary><filename>maildirfolder</filename>, creating</primary>
40330 </indexterm>
40331 The value of this option is a regular expression. If it is unset, it has no
40332 effect. Otherwise, before a maildir delivery takes place, the pattern is
40333 matched against the name of the maildir directory, that is, the directory
40334 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
40335 delivery. If there is a match, Exim checks for the existence of a file called
40336 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
40337 See section <xref linkend="SECTmaildirdelivery"/> for more details.
40338 </para>
40339 <para>
40340 <indexterm role="option">
40341 <primary><option>mailstore_format</option></primary>
40342 </indexterm>
40343 </para>
40344 <informaltable frame="all">
40345 <tgroup cols="4" colsep="0" rowsep="0">
40346 <colspec colwidth="8*" align="left"/>
40347 <colspec colwidth="6*" align="center"/>
40348 <colspec colwidth="6*" align="center"/>
40349 <colspec colwidth="6*" align="right"/>
40350 <tbody>
40351 <row>
40352 <entry><option>mailstore_format</option></entry>
40353 <entry>Use: <emphasis>appendfile</emphasis></entry>
40354 <entry>Type: <emphasis>boolean</emphasis></entry>
40355 <entry>Default: <emphasis>false</emphasis></entry>
40356 </row>
40357 </tbody>
40358 </tgroup>
40359 </informaltable>
40360 <para>
40361 <indexterm role="concept">
40362 <primary>mailstore format</primary>
40363 <secondary>specifying</secondary>
40364 </indexterm>
40365 If this option is set with the <option>directory</option> option, the delivery is into two
40366 new files in  <quote>mailstore</quote> format. The option is available only if
40367 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
40368 below for further details.
40369 </para>
40370 <para>
40371 <indexterm role="option">
40372 <primary><option>mailstore_prefix</option></primary>
40373 </indexterm>
40374 </para>
40375 <informaltable frame="all">
40376 <tgroup cols="4" colsep="0" rowsep="0">
40377 <colspec colwidth="8*" align="left"/>
40378 <colspec colwidth="6*" align="center"/>
40379 <colspec colwidth="6*" align="center"/>
40380 <colspec colwidth="6*" align="right"/>
40381 <tbody>
40382 <row>
40383 <entry><option>mailstore_prefix</option></entry>
40384 <entry>Use: <emphasis>appendfile</emphasis></entry>
40385 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40386 <entry>Default: <emphasis>unset</emphasis></entry>
40387 </row>
40388 </tbody>
40389 </tgroup>
40390 </informaltable>
40391 <para>
40392 This option applies only to deliveries in mailstore format, and is described in
40393 section <xref linkend="SECTopdir"/> below.
40394 </para>
40395 <para>
40396 <indexterm role="option">
40397 <primary><option>mailstore_suffix</option></primary>
40398 </indexterm>
40399 </para>
40400 <informaltable frame="all">
40401 <tgroup cols="4" colsep="0" rowsep="0">
40402 <colspec colwidth="8*" align="left"/>
40403 <colspec colwidth="6*" align="center"/>
40404 <colspec colwidth="6*" align="center"/>
40405 <colspec colwidth="6*" align="right"/>
40406 <tbody>
40407 <row>
40408 <entry><option>mailstore_suffix</option></entry>
40409 <entry>Use: <emphasis>appendfile</emphasis></entry>
40410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40411 <entry>Default: <emphasis>unset</emphasis></entry>
40412 </row>
40413 </tbody>
40414 </tgroup>
40415 </informaltable>
40416 <para>
40417 This option applies only to deliveries in mailstore format, and is described in
40418 section <xref linkend="SECTopdir"/> below.
40419 </para>
40420 <para>
40421 <indexterm role="option">
40422 <primary><option>mbx_format</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>mbx_format</option></entry>
40434 <entry>Use: <emphasis>appendfile</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>locking files</primary>
40444 </indexterm>
40445 <indexterm role="concept">
40446 <primary>file</primary>
40447 <secondary>locking</secondary>
40448 </indexterm>
40449 <indexterm role="concept">
40450 <primary>file</primary>
40451 <secondary>MBX format</secondary>
40452 </indexterm>
40453 <indexterm role="concept">
40454 <primary>MBX format, specifying</primary>
40455 </indexterm>
40456 This option is available only if Exim has been compiled with SUPPORT_MBX
40457 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
40458 the message is appended to the mailbox file in MBX format instead of
40459 traditional Unix format. This format is supported by Pine4 and its associated
40460 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
40461 </para>
40462 <para>
40463 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
40464 automatically changed by the use of <option>mbx_format</option>. They should normally be set
40465 empty when using MBX format, so this option almost always appears in this
40466 combination:
40467 </para>
40468 <literallayout class="monospaced">
40469 mbx_format = true
40470 message_prefix =
40471 message_suffix =
40472 </literallayout>
40473 <para>
40474 If none of the locking options are mentioned in the configuration,
40475 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
40476 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
40477 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
40478 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
40479 should not be used if any program that does not use this form of locking is
40480 going to access the mailbox, nor should it be used if the mailbox file is NFS
40481 mounted, because it works only when the mailbox is accessed from a single host.
40482 </para>
40483 <para>
40484 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
40485 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
40486 (this means for the whole of a Pine or IMAP session), Exim will not be able to
40487 append messages to it.
40488 </para>
40489 <para>
40490 <indexterm role="option">
40491 <primary><option>message_prefix</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>message_prefix</option></entry>
40503 <entry>Use: <emphasis>appendfile</emphasis></entry>
40504 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40505 <entry>Default: <emphasis>see below</emphasis></entry>
40506 </row>
40507 </tbody>
40508 </tgroup>
40509 </informaltable>
40510 <para>
40511 <indexterm role="concept">
40512 <primary><quote>From</quote> line</primary>
40513 </indexterm>
40514 The string specified here is expanded and output at the start of every message.
40515 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40516 in which case it is:
40517 </para>
40518 <literallayout class="monospaced">
40519 message_prefix = "From ${if def:return_path{$return_path}\
40520   {MAILER-DAEMON}} $tod_bsdinbox\n"
40521 </literallayout>
40522 <para>
40523 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40524 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40525 </para>
40526 <para>
40527 <indexterm role="option">
40528 <primary><option>message_suffix</option></primary>
40529 </indexterm>
40530 </para>
40531 <informaltable frame="all">
40532 <tgroup cols="4" colsep="0" rowsep="0">
40533 <colspec colwidth="8*" align="left"/>
40534 <colspec colwidth="6*" align="center"/>
40535 <colspec colwidth="6*" align="center"/>
40536 <colspec colwidth="6*" align="right"/>
40537 <tbody>
40538 <row>
40539 <entry><option>message_suffix</option></entry>
40540 <entry>Use: <emphasis>appendfile</emphasis></entry>
40541 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40542 <entry>Default: <emphasis>see below</emphasis></entry>
40543 </row>
40544 </tbody>
40545 </tgroup>
40546 </informaltable>
40547 <para>
40548 The string specified here is expanded and output at the end of every message.
40549 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
40550 in which case it is a single newline character. The suffix can be suppressed by
40551 setting
40552 </para>
40553 <literallayout class="monospaced">
40554 message_suffix =
40555 </literallayout>
40556 <para>
40557 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40558 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
40559 </para>
40560 <para>
40561 <indexterm role="option">
40562 <primary><option>mode</option></primary>
40563 </indexterm>
40564 </para>
40565 <informaltable frame="all">
40566 <tgroup cols="4" colsep="0" rowsep="0">
40567 <colspec colwidth="8*" align="left"/>
40568 <colspec colwidth="6*" align="center"/>
40569 <colspec colwidth="6*" align="center"/>
40570 <colspec colwidth="6*" align="right"/>
40571 <tbody>
40572 <row>
40573 <entry><option>mode</option></entry>
40574 <entry>Use: <emphasis>appendfile</emphasis></entry>
40575 <entry>Type: <emphasis>octal integer</emphasis></entry>
40576 <entry>Default: <emphasis>0600</emphasis></entry>
40577 </row>
40578 </tbody>
40579 </tgroup>
40580 </informaltable>
40581 <para>
40582 If the output file is created, it is given this mode. If it already exists and
40583 has wider permissions, they are reduced to this mode. If it has narrower
40584 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
40585 if the delivery is the result of a <option>save</option> command in a filter file specifying
40586 a particular mode, the mode of the output file is always forced to take that
40587 value, and this option is ignored.
40588 </para>
40589 <para>
40590 <indexterm role="option">
40591 <primary><option>mode_fail_narrower</option></primary>
40592 </indexterm>
40593 </para>
40594 <informaltable frame="all">
40595 <tgroup cols="4" colsep="0" rowsep="0">
40596 <colspec colwidth="8*" align="left"/>
40597 <colspec colwidth="6*" align="center"/>
40598 <colspec colwidth="6*" align="center"/>
40599 <colspec colwidth="6*" align="right"/>
40600 <tbody>
40601 <row>
40602 <entry><option>mode_fail_narrower</option></entry>
40603 <entry>Use: <emphasis>appendfile</emphasis></entry>
40604 <entry>Type: <emphasis>boolean</emphasis></entry>
40605 <entry>Default: <emphasis>true</emphasis></entry>
40606 </row>
40607 </tbody>
40608 </tgroup>
40609 </informaltable>
40610 <para>
40611 This option applies in the case when an existing mailbox file has a narrower
40612 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
40613 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
40614 continues with the delivery attempt, using the existing mode of the file.
40615 </para>
40616 <para>
40617 <indexterm role="option">
40618 <primary><option>notify_comsat</option></primary>
40619 </indexterm>
40620 </para>
40621 <informaltable frame="all">
40622 <tgroup cols="4" colsep="0" rowsep="0">
40623 <colspec colwidth="8*" align="left"/>
40624 <colspec colwidth="6*" align="center"/>
40625 <colspec colwidth="6*" align="center"/>
40626 <colspec colwidth="6*" align="right"/>
40627 <tbody>
40628 <row>
40629 <entry><option>notify_comsat</option></entry>
40630 <entry>Use: <emphasis>appendfile</emphasis></entry>
40631 <entry>Type: <emphasis>boolean</emphasis></entry>
40632 <entry>Default: <emphasis>false</emphasis></entry>
40633 </row>
40634 </tbody>
40635 </tgroup>
40636 </informaltable>
40637 <para>
40638 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
40639 successful delivery to a user mailbox. This is the daemon that notifies logged
40640 on users about incoming mail.
40641 </para>
40642 <para>
40643 <indexterm role="option">
40644 <primary><option>quota</option></primary>
40645 </indexterm>
40646 </para>
40647 <informaltable frame="all">
40648 <tgroup cols="4" colsep="0" rowsep="0">
40649 <colspec colwidth="8*" align="left"/>
40650 <colspec colwidth="6*" align="center"/>
40651 <colspec colwidth="6*" align="center"/>
40652 <colspec colwidth="6*" align="right"/>
40653 <tbody>
40654 <row>
40655 <entry><option>quota</option></entry>
40656 <entry>Use: <emphasis>appendfile</emphasis></entry>
40657 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40658 <entry>Default: <emphasis>unset</emphasis></entry>
40659 </row>
40660 </tbody>
40661 </tgroup>
40662 </informaltable>
40663 <para>
40664 <indexterm role="concept">
40665 <primary>quota</primary>
40666 <secondary>imposed by Exim</secondary>
40667 </indexterm>
40668 This option imposes a limit on the size of the file to which Exim is appending,
40669 or to the total space used in the directory tree when the <option>directory</option> option
40670 is set. In the latter case, computation of the space used is expensive, because
40671 all the files in the directory (and any sub-directories) have to be
40672 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
40673 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
40674 have no shell access to their mailboxes).
40675 </para>
40676 <para>
40677 As there is no interlock against two simultaneous deliveries into a
40678 multi-file mailbox, it is possible for the quota to be overrun in this case.
40679 For single-file mailboxes, of course, an interlock is a necessity.
40680 </para>
40681 <para>
40682 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
40683 may be a lot less than the actual amount of disk space allocated to the file.
40684 If the sizes of a number of files are being added up, the rounding effect can
40685 become quite noticeable, especially on systems that have large block sizes.
40686 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
40687 the obvious value which users understand most easily.
40688 </para>
40689 <para>
40690 The value of the option is expanded, and must then be a numerical value
40691 (decimal point allowed), optionally followed by one of the letters K, M, or G,
40692 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
40693 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
40694 be handled.
40695 </para>
40696 <para>
40697 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
40698 </para>
40699 <para>
40700 The expansion happens while Exim is running as root, before it changes uid for
40701 the delivery. This means that files that are inaccessible to the end user can
40702 be used to hold quota values that are looked up in the expansion. When delivery
40703 fails because this quota is exceeded, the handling of the error is as for
40704 system quota failures.
40705 </para>
40706 <para>
40707 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
40708 mailbox to the specified maximum size, though the value is not accurate to the
40709 last byte, owing to separator lines and additional headers that may get added
40710 during message delivery. When a mailbox is nearly full, large messages may get
40711 refused even though small ones are accepted, because the size of the current
40712 message is added to the quota when the check is made. This behaviour can be
40713 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
40714 for exceeding the quota does not include the current message. Thus, deliveries
40715 continue until the quota has been exceeded; thereafter, no further messages are
40716 delivered. See also <option>quota_warn_threshold</option>.
40717 </para>
40718 <para>
40719 <indexterm role="option">
40720 <primary><option>quota_directory</option></primary>
40721 </indexterm>
40722 </para>
40723 <informaltable frame="all">
40724 <tgroup cols="4" colsep="0" rowsep="0">
40725 <colspec colwidth="8*" align="left"/>
40726 <colspec colwidth="6*" align="center"/>
40727 <colspec colwidth="6*" align="center"/>
40728 <colspec colwidth="6*" align="right"/>
40729 <tbody>
40730 <row>
40731 <entry><option>quota_directory</option></entry>
40732 <entry>Use: <emphasis>appendfile</emphasis></entry>
40733 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40734 <entry>Default: <emphasis>unset</emphasis></entry>
40735 </row>
40736 </tbody>
40737 </tgroup>
40738 </informaltable>
40739 <para>
40740 This option defines the directory to check for quota purposes when delivering
40741 into individual files. The default is the delivery directory, or, if a file
40742 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
40743 delivery directory.
40744 </para>
40745 <para>
40746 <indexterm role="option">
40747 <primary><option>quota_filecount</option></primary>
40748 </indexterm>
40749 </para>
40750 <informaltable frame="all">
40751 <tgroup cols="4" colsep="0" rowsep="0">
40752 <colspec colwidth="8*" align="left"/>
40753 <colspec colwidth="6*" align="center"/>
40754 <colspec colwidth="6*" align="center"/>
40755 <colspec colwidth="6*" align="right"/>
40756 <tbody>
40757 <row>
40758 <entry><option>quota_filecount</option></entry>
40759 <entry>Use: <emphasis>appendfile</emphasis></entry>
40760 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40761 <entry>Default: <emphasis>0</emphasis></entry>
40762 </row>
40763 </tbody>
40764 </tgroup>
40765 </informaltable>
40766 <para>
40767 This option applies when the <option>directory</option> option is set. It limits the total
40768 number of files in the directory (compare the inode limit in system quotas). It
40769 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
40770 failure causes delivery to be deferred. A value of zero is interpreted as
40771 <quote>no quota</quote>.
40772 </para>
40773 <para>
40774 <indexterm role="option">
40775 <primary><option>quota_is_inclusive</option></primary>
40776 </indexterm>
40777 </para>
40778 <informaltable frame="all">
40779 <tgroup cols="4" colsep="0" rowsep="0">
40780 <colspec colwidth="8*" align="left"/>
40781 <colspec colwidth="6*" align="center"/>
40782 <colspec colwidth="6*" align="center"/>
40783 <colspec colwidth="6*" align="right"/>
40784 <tbody>
40785 <row>
40786 <entry><option>quota_is_inclusive</option></entry>
40787 <entry>Use: <emphasis>appendfile</emphasis></entry>
40788 <entry>Type: <emphasis>boolean</emphasis></entry>
40789 <entry>Default: <emphasis>true</emphasis></entry>
40790 </row>
40791 </tbody>
40792 </tgroup>
40793 </informaltable>
40794 <para>
40795 See <option>quota</option> above.
40796 </para>
40797 <para>
40798 <indexterm role="option">
40799 <primary><option>quota_size_regex</option></primary>
40800 </indexterm>
40801 </para>
40802 <informaltable frame="all">
40803 <tgroup cols="4" colsep="0" rowsep="0">
40804 <colspec colwidth="8*" align="left"/>
40805 <colspec colwidth="6*" align="center"/>
40806 <colspec colwidth="6*" align="center"/>
40807 <colspec colwidth="6*" align="right"/>
40808 <tbody>
40809 <row>
40810 <entry><option>quota_size_regex</option></entry>
40811 <entry>Use: <emphasis>appendfile</emphasis></entry>
40812 <entry>Type: <emphasis>string</emphasis></entry>
40813 <entry>Default: <emphasis>unset</emphasis></entry>
40814 </row>
40815 </tbody>
40816 </tgroup>
40817 </informaltable>
40818 <para>
40819 This option applies when one of the delivery modes that writes a separate file
40820 for each message is being used. When Exim wants to find the size of one of
40821 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
40822 If this is set to a regular expression that matches the file name, and it
40823 captures one string, that string is interpreted as a representation of the
40824 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
40825 </para>
40826 <para>
40827 This feature is useful only when users have no shell access to their mailboxes
40828 &ndash; otherwise they could defeat the quota simply by renaming the files. This
40829 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
40830 the file length to the file name. For example:
40831 </para>
40832 <literallayout class="monospaced">
40833 maildir_tag = ,S=$message_size
40834 quota_size_regex = ,S=(\d+)
40835 </literallayout>
40836 <para>
40837 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
40838 number of lines in the message.
40839 </para>
40840 <para>
40841 The regular expression should not assume that the length is at the end of the
40842 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
40843 sometimes add other information onto the ends of message file names.
40844 </para>
40845 <para>
40846 Section <xref linkend="SECID136"/> contains further information.
40847 </para>
40848 <para>
40849 <indexterm role="option">
40850 <primary><option>quota_warn_message</option></primary>
40851 </indexterm>
40852 </para>
40853 <informaltable frame="all">
40854 <tgroup cols="4" colsep="0" rowsep="0">
40855 <colspec colwidth="8*" align="left"/>
40856 <colspec colwidth="6*" align="center"/>
40857 <colspec colwidth="6*" align="center"/>
40858 <colspec colwidth="6*" align="right"/>
40859 <tbody>
40860 <row>
40861 <entry><option>quota_warn_message</option></entry>
40862 <entry>Use: <emphasis>appendfile</emphasis></entry>
40863 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40864 <entry>Default: <emphasis>see below</emphasis></entry>
40865 </row>
40866 </tbody>
40867 </tgroup>
40868 </informaltable>
40869 <para>
40870 See below for the use of this option. If it is not set when
40871 <option>quota_warn_threshold</option> is set, it defaults to
40872 </para>
40873 <literallayout class="monospaced">
40874 quota_warn_message = "\
40875   To: $local_part@$domain\n\
40876   Subject: Your mailbox\n\n\
40877   This message is automatically created \
40878   by mail delivery software.\n\n\
40879   The size of your mailbox has exceeded \
40880   a warning threshold that is\n\
40881   set by the system administrator.\n"
40882 </literallayout>
40883 <para>
40884 <indexterm role="option">
40885 <primary><option>quota_warn_threshold</option></primary>
40886 </indexterm>
40887 </para>
40888 <informaltable frame="all">
40889 <tgroup cols="4" colsep="0" rowsep="0">
40890 <colspec colwidth="8*" align="left"/>
40891 <colspec colwidth="6*" align="center"/>
40892 <colspec colwidth="6*" align="center"/>
40893 <colspec colwidth="6*" align="right"/>
40894 <tbody>
40895 <row>
40896 <entry><option>quota_warn_threshold</option></entry>
40897 <entry>Use: <emphasis>appendfile</emphasis></entry>
40898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40899 <entry>Default: <emphasis>0</emphasis></entry>
40900 </row>
40901 </tbody>
40902 </tgroup>
40903 </informaltable>
40904 <para>
40905 <indexterm role="concept">
40906 <primary>quota</primary>
40907 <secondary>warning threshold</secondary>
40908 </indexterm>
40909 <indexterm role="concept">
40910 <primary>mailbox</primary>
40911 <secondary>size warning</secondary>
40912 </indexterm>
40913 <indexterm role="concept">
40914 <primary>size</primary>
40915 <secondary>of mailbox</secondary>
40916 </indexterm>
40917 This option is expanded in the same way as <option>quota</option> (see above). If the
40918 resulting value is greater than zero, and delivery of the message causes the
40919 size of the file or total space in the directory tree to cross the given
40920 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
40921 may be specified as a percentage of it by following the value with a percent
40922 sign. For example:
40923 </para>
40924 <literallayout class="monospaced">
40925 quota = 10M
40926 quota_warn_threshold = 75%
40927 </literallayout>
40928 <para>
40929 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
40930 percent sign is ignored.
40931 </para>
40932 <para>
40933 The warning message itself is specified by the <option>quota_warn_message</option> option,
40934 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
40935 warning message. These do not necessarily have to include the recipient(s) of
40936 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
40937 can include any other header lines that you want. If you do not include a
40938 <emphasis>From:</emphasis> line, the default is:
40939 </para>
40940 <literallayout class="monospaced">
40941 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
40942 </literallayout>
40943 <para>
40944 <indexterm role="option">
40945 <primary><option>errors_reply_to</option></primary>
40946 </indexterm>
40947 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
40948 option.
40949 </para>
40950 <para>
40951 The <option>quota</option> option does not have to be set in order to use this option; they
40952 are independent of one another except when the threshold is specified as a
40953 percentage.
40954 </para>
40955 <para>
40956 <indexterm role="option">
40957 <primary><option>use_bsmtp</option></primary>
40958 </indexterm>
40959 </para>
40960 <informaltable frame="all">
40961 <tgroup cols="4" colsep="0" rowsep="0">
40962 <colspec colwidth="8*" align="left"/>
40963 <colspec colwidth="6*" align="center"/>
40964 <colspec colwidth="6*" align="center"/>
40965 <colspec colwidth="6*" align="right"/>
40966 <tbody>
40967 <row>
40968 <entry><option>use_bsmtp</option></entry>
40969 <entry>Use: <emphasis>appendfile</emphasis></entry>
40970 <entry>Type: <emphasis>boolean</emphasis></entry>
40971 <entry>Default: <emphasis>false</emphasis></entry>
40972 </row>
40973 </tbody>
40974 </tgroup>
40975 </informaltable>
40976 <para>
40977 <indexterm role="concept">
40978 <primary>envelope sender</primary>
40979 </indexterm>
40980 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
40981 format, with the envelope sender and recipient(s) included as SMTP commands. If
40982 you want to include a leading HELO command with such messages, you can do
40983 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
40984 for details of batch SMTP.
40985 </para>
40986 <para>
40987 <indexterm role="option">
40988 <primary><option>use_crlf</option></primary>
40989 </indexterm>
40990 </para>
40991 <informaltable frame="all">
40992 <tgroup cols="4" colsep="0" rowsep="0">
40993 <colspec colwidth="8*" align="left"/>
40994 <colspec colwidth="6*" align="center"/>
40995 <colspec colwidth="6*" align="center"/>
40996 <colspec colwidth="6*" align="right"/>
40997 <tbody>
40998 <row>
40999 <entry><option>use_crlf</option></entry>
41000 <entry>Use: <emphasis>appendfile</emphasis></entry>
41001 <entry>Type: <emphasis>boolean</emphasis></entry>
41002 <entry>Default: <emphasis>false</emphasis></entry>
41003 </row>
41004 </tbody>
41005 </tgroup>
41006 </informaltable>
41007 <para>
41008 <indexterm role="concept">
41009 <primary>carriage return</primary>
41010 </indexterm>
41011 <indexterm role="concept">
41012 <primary>linefeed</primary>
41013 </indexterm>
41014 This option causes lines to be terminated with the two-character CRLF sequence
41015 (carriage return, linefeed) instead of just a linefeed character. In the case
41016 of batched SMTP, the byte sequence written to the file is then an exact image
41017 of what would be sent down a real SMTP connection.
41018 </para>
41019 <para>
41020 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
41021 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
41022 in Berkeley-style mailboxes) are written verbatim, so must contain their own
41023 carriage return characters if these are needed. In cases where these options
41024 have non-empty defaults, the values end with a single linefeed, so they must be
41025 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41026 </para>
41027 <para>
41028 <indexterm role="option">
41029 <primary><option>use_fcntl_lock</option></primary>
41030 </indexterm>
41031 </para>
41032 <informaltable frame="all">
41033 <tgroup cols="4" colsep="0" rowsep="0">
41034 <colspec colwidth="8*" align="left"/>
41035 <colspec colwidth="6*" align="center"/>
41036 <colspec colwidth="6*" align="center"/>
41037 <colspec colwidth="6*" align="right"/>
41038 <tbody>
41039 <row>
41040 <entry><option>use_fcntl_lock</option></entry>
41041 <entry>Use: <emphasis>appendfile</emphasis></entry>
41042 <entry>Type: <emphasis>boolean</emphasis></entry>
41043 <entry>Default: <emphasis>see below</emphasis></entry>
41044 </row>
41045 </tbody>
41046 </tgroup>
41047 </informaltable>
41048 <para>
41049 This option controls the use of the <function>fcntl()</function> function to lock a file for
41050 exclusive use when a message is being appended. It is set by default unless
41051 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
41052 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
41053 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
41054 </para>
41055 <para>
41056 <indexterm role="option">
41057 <primary><option>use_flock_lock</option></primary>
41058 </indexterm>
41059 </para>
41060 <informaltable frame="all">
41061 <tgroup cols="4" colsep="0" rowsep="0">
41062 <colspec colwidth="8*" align="left"/>
41063 <colspec colwidth="6*" align="center"/>
41064 <colspec colwidth="6*" align="center"/>
41065 <colspec colwidth="6*" align="right"/>
41066 <tbody>
41067 <row>
41068 <entry><option>use_flock_lock</option></entry>
41069 <entry>Use: <emphasis>appendfile</emphasis></entry>
41070 <entry>Type: <emphasis>boolean</emphasis></entry>
41071 <entry>Default: <emphasis>false</emphasis></entry>
41072 </row>
41073 </tbody>
41074 </tgroup>
41075 </informaltable>
41076 <para>
41077 This option is provided to support the use of <function>flock()</function> for file locking, for
41078 the few situations where it is needed. Most modern operating systems support
41079 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
41080 each other. Exim uses <function>fcntl()</function> locking by default.
41081 </para>
41082 <para>
41083 This option is required only if you are using an operating system where
41084 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
41085 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
41086 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
41087 </para>
41088 <para>
41089 <indexterm role="concept">
41090 <primary>Solaris</primary>
41091 <secondary><function>flock()</function> support</secondary>
41092 </indexterm>
41093 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
41094 have it (and some, I think, provide a not quite right version built on top of
41095 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
41096 the ability to use it, and any attempt to do so will cause a configuration
41097 error.
41098 </para>
41099 <para>
41100 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
41101 is just being mapped onto <function>fcntl()</function> by the OS).
41102 </para>
41103 <para>
41104 <indexterm role="option">
41105 <primary><option>use_lockfile</option></primary>
41106 </indexterm>
41107 </para>
41108 <informaltable frame="all">
41109 <tgroup cols="4" colsep="0" rowsep="0">
41110 <colspec colwidth="8*" align="left"/>
41111 <colspec colwidth="6*" align="center"/>
41112 <colspec colwidth="6*" align="center"/>
41113 <colspec colwidth="6*" align="right"/>
41114 <tbody>
41115 <row>
41116 <entry><option>use_lockfile</option></entry>
41117 <entry>Use: <emphasis>appendfile</emphasis></entry>
41118 <entry>Type: <emphasis>boolean</emphasis></entry>
41119 <entry>Default: <emphasis>see below</emphasis></entry>
41120 </row>
41121 </tbody>
41122 </tgroup>
41123 </informaltable>
41124 <para>
41125 If this option is turned off, Exim does not attempt to create a lock file when
41126 appending to a mailbox file. In this situation, the only locking is by
41127 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
41128 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
41129 <function>fcntl()</function> rather than a lock file, and even then only when you are not
41130 delivering over NFS from more than one host.
41131 </para>
41132 <para>
41133 <indexterm role="concept">
41134 <primary>NFS</primary>
41135 <secondary>lock file</secondary>
41136 </indexterm>
41137 In order to append to an NFS file safely from more than one host, it is
41138 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
41139 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
41140 file corruption.
41141 </para>
41142 <para>
41143 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
41144 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
41145 except when <option>mbx_format</option> is set.
41146 </para>
41147 <para>
41148 <indexterm role="option">
41149 <primary><option>use_mbx_lock</option></primary>
41150 </indexterm>
41151 </para>
41152 <informaltable frame="all">
41153 <tgroup cols="4" colsep="0" rowsep="0">
41154 <colspec colwidth="8*" align="left"/>
41155 <colspec colwidth="6*" align="center"/>
41156 <colspec colwidth="6*" align="center"/>
41157 <colspec colwidth="6*" align="right"/>
41158 <tbody>
41159 <row>
41160 <entry><option>use_mbx_lock</option></entry>
41161 <entry>Use: <emphasis>appendfile</emphasis></entry>
41162 <entry>Type: <emphasis>boolean</emphasis></entry>
41163 <entry>Default: <emphasis>see below</emphasis></entry>
41164 </row>
41165 </tbody>
41166 </tgroup>
41167 </informaltable>
41168 <para>
41169 This option is available only if Exim has been compiled with SUPPORT_MBX
41170 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
41171 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
41172 of the locking options are mentioned in the configuration. The locking rules
41173 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
41174 the IMAP4 and POP daemons that come with it (see the discussion below). The
41175 rules allow for shared access to the mailbox. However, this kind of locking
41176 does not work when the mailbox is NFS mounted.
41177 </para>
41178 <para>
41179 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
41180 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
41181 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
41182 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
41183 </para>
41184 </section>
41185 <section id="SECTopappend">
41186 <title>Operational details for appending</title>
41187 <para>
41188 <indexterm role="concept">
41189 <primary>appending to a file</primary>
41190 </indexterm>
41191 <indexterm role="concept">
41192 <primary>file</primary>
41193 <secondary>appending</secondary>
41194 </indexterm>
41195 Before appending to a file, the following preparations are made:
41196 </para>
41197 <itemizedlist>
41198 <listitem>
41199 <para>
41200 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
41201 return is given.
41202 </para>
41203 </listitem>
41204 <listitem>
41205 <para>
41206 <indexterm role="concept">
41207 <primary>directory creation</primary>
41208 </indexterm>
41209 If any directories on the file&#x2019;s path are missing, Exim creates them if the
41210 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
41211 <option>directory_mode</option> option.
41212 </para>
41213 </listitem>
41214 <listitem>
41215 <para>
41216 If <option>file_format</option> is set, the format of an existing file is checked. If this
41217 indicates that a different transport should be used, control is passed to that
41218 transport.
41219 </para>
41220 </listitem>
41221 <listitem>
41222 <para>
41223 <indexterm role="concept">
41224 <primary>file</primary>
41225 <secondary>locking</secondary>
41226 </indexterm>
41227 <indexterm role="concept">
41228 <primary>locking files</primary>
41229 </indexterm>
41230 <indexterm role="concept">
41231 <primary>NFS</primary>
41232 <secondary>lock file</secondary>
41233 </indexterm>
41234 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
41235 reliably over NFS, as follows:
41236 </para>
41237 <orderedlist numeration="arabic">
41238 <listitem>
41239 <para>
41240 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
41241 current time, primary host name, and process id added, by opening for writing
41242 as a new file. If this fails with an access error, delivery is deferred.
41243 </para>
41244 </listitem>
41245 <listitem>
41246 <para>
41247 Close the hitching post file, and hard link it to the lock file name.
41248 </para>
41249 </listitem>
41250 <listitem>
41251 <para>
41252 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
41253 Unlink the hitching post name.
41254 </para>
41255 </listitem>
41256 <listitem>
41257 <para>
41258 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
41259 then unlink hitching post name. If the number of links is exactly two, creation
41260 of the lock file succeeded but something (for example, an NFS server crash and
41261 restart) caused this fact not to be communicated to the <function>link()</function> call.
41262 </para>
41263 </listitem>
41264 <listitem>
41265 <para>
41266 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
41267 up to <option>lock_retries</option> times. However, since any program that writes to a
41268 mailbox should complete its task very quickly, it is reasonable to time out old
41269 lock files that are normally the result of user agent and system crashes. If an
41270 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
41271 it before trying again.
41272 </para>
41273 </listitem>
41274 </orderedlist>
41275 </listitem>
41276 <listitem>
41277 <para>
41278 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
41279 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
41280 than non-existence, delivery is deferred.
41281 </para>
41282 </listitem>
41283 <listitem>
41284 <para>
41285 <indexterm role="concept">
41286 <primary>symbolic link</primary>
41287 <secondary>to mailbox</secondary>
41288 </indexterm>
41289 <indexterm role="concept">
41290 <primary>mailbox</primary>
41291 <secondary>symbolic link</secondary>
41292 </indexterm>
41293 If the file does exist and is a symbolic link, delivery is deferred, unless the
41294 <option>allow_symlink</option> option is set, in which case the ownership of the link is
41295 checked, and then <function>stat()</function> is called to find out about the real file, which
41296 is then subjected to the checks below. The check on the top-level link
41297 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
41298 directory, though allowing symbolic links in this case is definitely not a good
41299 idea. If there is a chain of symbolic links, the intermediate ones are not
41300 checked.
41301 </para>
41302 </listitem>
41303 <listitem>
41304 <para>
41305 If the file already exists but is not a regular file, or if the file&#x2019;s owner
41306 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
41307 different from the user and group under which the delivery is running,
41308 delivery is deferred.
41309 </para>
41310 </listitem>
41311 <listitem>
41312 <para>
41313 If the file&#x2019;s permissions are more generous than specified, they are reduced.
41314 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
41315 is set false, in which case the delivery is tried using the existing
41316 permissions.
41317 </para>
41318 </listitem>
41319 <listitem>
41320 <para>
41321 The file&#x2019;s inode number is saved, and the file is then opened for appending.
41322 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
41323 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
41324 </para>
41325 </listitem>
41326 <listitem>
41327 <para>
41328 If the file is opened successfully, check that the inode number hasn&#x2019;t
41329 changed, that it is still a regular file, and that the owner and permissions
41330 have not changed. If anything is wrong, defer delivery and freeze the message.
41331 </para>
41332 </listitem>
41333 <listitem>
41334 <para>
41335 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
41336 option is set. Otherwise, check that the file is being created in a permitted
41337 directory if the <option>create_file</option> option is set (deferring on failure), and then
41338 open for writing as a new file, with the O_EXCL and O_CREAT options,
41339 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
41340 set). In this case, which can happen if the link points to a non-existent file,
41341 the file is opened for writing using O_CREAT but not O_EXCL, because
41342 that prevents link following.
41343 </para>
41344 </listitem>
41345 <listitem>
41346 <para>
41347 <indexterm role="concept">
41348 <primary>loop</primary>
41349 <secondary>while file testing</secondary>
41350 </indexterm>
41351 If opening fails because the file exists, obey the tests given above for
41352 existing files. However, to avoid looping in a situation where the file is
41353 being continuously created and destroyed, the exists/not-exists loop is broken
41354 after 10 repetitions, and the message is then frozen.
41355 </para>
41356 </listitem>
41357 <listitem>
41358 <para>
41359 If opening fails with any other error, defer delivery.
41360 </para>
41361 </listitem>
41362 <listitem>
41363 <para>
41364 <indexterm role="concept">
41365 <primary>file</primary>
41366 <secondary>locking</secondary>
41367 </indexterm>
41368 <indexterm role="concept">
41369 <primary>locking files</primary>
41370 </indexterm>
41371 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
41372 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
41373 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
41374 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
41375 file, and an exclusive lock on the file whose name is
41376 </para>
41377 <literallayout class="monospaced">
41378 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
41379 </literallayout>
41380 <para>
41381 using the device and inode numbers of the open mailbox file, in accordance with
41382 the MBX locking rules. This file is created with a mode that is specified by
41383 the <option>lockfile_mode</option> option.
41384 </para>
41385 <para>
41386 If Exim fails to lock the file, there are two possible courses of action,
41387 depending on the value of the locking timeout. This is obtained from
41388 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
41389 </para>
41390 <para>
41391 If the timeout value is zero, the file is closed, Exim waits for
41392 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
41393 to lock it again. This happens up to <option>lock_retries</option> times, after which the
41394 delivery is deferred.
41395 </para>
41396 <para>
41397 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
41398 <function>flock()</function> are used (with the given timeout), so there has already been some
41399 waiting involved by the time locking fails. Nevertheless, Exim does not give up
41400 immediately. It retries up to
41401 </para>
41402 <literallayout class="monospaced">
41403 (lock_retries * lock_interval) / &lt;timeout&gt;
41404 </literallayout>
41405 <para>
41406 times (rounded up).
41407 </para>
41408 </listitem>
41409 </itemizedlist>
41410 <para>
41411 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
41412 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
41413 </para>
41414 </section>
41415 <section id="SECTopdir">
41416 <title>Operational details for delivery to a new file</title>
41417 <para>
41418 <indexterm role="concept">
41419 <primary>delivery</primary>
41420 <secondary>to single file</secondary>
41421 </indexterm>
41422 <indexterm role="concept">
41423 <primary><quote>From</quote> line</primary>
41424 </indexterm>
41425 When the <option>directory</option> option is set instead of <option>file</option>, each message is
41426 delivered into a newly-created file or set of files. When <command>appendfile</command> is
41427 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
41428 <option>directory</option> is normally set, because the path for delivery is supplied by the
41429 router. (See for example, the <command>address_file</command> transport in the default
41430 configuration.) In this case, delivery is to a new file if either the path name
41431 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
41432 </para>
41433 <para>
41434 No locking is required while writing the message to a new file, so the various
41435 locking options of the transport are ignored. The <quote>From</quote> line that by default
41436 separates messages in a single file is not normally needed, nor is the escaping
41437 of message lines that start with <quote>From</quote>, and there is no need to ensure a
41438 newline at the end of each message. Consequently, the default values for
41439 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
41440 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
41441 </para>
41442 <para>
41443 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
41444 the files in the delivery directory by default. However, you can specify a
41445 different directory by setting <option>quota_directory</option>. Also, for maildir
41446 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
41447 </para>
41448 <para>
41449 <indexterm role="concept">
41450 <primary>maildir format</primary>
41451 </indexterm>
41452 <indexterm role="concept">
41453 <primary>mailstore format</primary>
41454 </indexterm>
41455 There are three different ways in which delivery to individual files can be
41456 done, controlled by the settings of the <option>maildir_format</option> and
41457 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
41458 formats is not included in the binary unless SUPPORT_MAILDIR or
41459 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
41460 </para>
41461 <para>
41462 <indexterm role="concept">
41463 <primary>directory creation</primary>
41464 </indexterm>
41465 In all three cases an attempt is made to create the directory and any necessary
41466 sub-directories if they do not exist, provided that the <option>create_directory</option>
41467 option is set (the default). The location of a created directory can be
41468 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
41469 the <option>directory_mode</option> option. If creation fails, or if the
41470 <option>create_directory</option> option is not set when creation is required, delivery is
41471 deferred.
41472 </para>
41473 </section>
41474 <section id="SECTmaildirdelivery">
41475 <title>Maildir delivery</title>
41476 <para>
41477 <indexterm role="concept">
41478 <primary>maildir format</primary>
41479 <secondary>description of</secondary>
41480 </indexterm>
41481 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
41482 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
41483 directory that is defined by the <option>directory</option> option (the <quote>delivery
41484 directory</quote>). If the delivery is successful, the file is renamed into the
41485 <filename>new</filename> subdirectory.
41486 </para>
41487 <para>
41488 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
41489 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
41490 Exim checks that the time-of-day clock has moved on by at least one microsecond
41491 before terminating the delivery process. This guarantees uniqueness for the
41492 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
41493 opening it. If any response other than ENOENT (does not exist) is given,
41494 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
41495 </para>
41496 <para>
41497 Before Exim carries out a maildir delivery, it ensures that subdirectories
41498 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
41499 do not exist, Exim tries to create them and any superior directories in their
41500 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
41501 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
41502 contains matches the delivery directory, Exim also ensures that a file called
41503 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
41504 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
41505 </para>
41506 <para>
41507 These features make it possible to use Exim to create all the necessary files
41508 and directories in a maildir mailbox, including subdirectories for maildir++
41509 folders. Consider this example:
41510 </para>
41511 <literallayout class="monospaced">
41512 maildir_format = true
41513 directory = /var/mail/$local_part\
41514            ${if eq{$local_part_suffix}{}{}\
41515            {/.${substr_1:$local_part_suffix}}}
41516 maildirfolder_create_regex = /\.[^/]+$
41517 </literallayout>
41518 <para>
41519 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
41520 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
41521 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
41522 not match this name, so Exim will not look for or create the file
41523 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
41524 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
41525 </para>
41526 <para>
41527 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
41528 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
41529 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
41530 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
41531 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
41532 </para>
41533 <para>
41534 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
41535 not inadvertently match the toplevel maildir directory, because a
41536 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
41537 </para>
41538 <para>
41539 <indexterm role="concept">
41540 <primary>quota</primary>
41541 <secondary>in maildir delivery</secondary>
41542 </indexterm>
41543 <indexterm role="concept">
41544 <primary>maildir++</primary>
41545 </indexterm>
41546 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
41547 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
41548 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
41549 Exim assumes the directory is a maildir++ folder directory, which is one level
41550 down from the user&#x2019;s top level mailbox directory. This causes it to start at
41551 the parent directory instead of the current directory when calculating the
41552 amount of space used.
41553 </para>
41554 <para>
41555 One problem with delivering into a multi-file mailbox is that it is
41556 computationally expensive to compute the size of the mailbox for quota
41557 checking. Various approaches have been taken to reduce the amount of work
41558 needed. The next two sections describe two of them. A third alternative is to
41559 use some external process for maintaining the size data, and use the expansion
41560 of the <option>mailbox_size</option> option as a way of importing it into Exim.
41561 </para>
41562 </section>
41563 <section id="SECID135">
41564 <title>Using tags to record message sizes</title>
41565 <para>
41566 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
41567 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
41568 tag is added to its name. However, if adding the tag takes the length of the
41569 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
41570 the tag is dropped and the maildir file is created with no tag.
41571 </para>
41572 <para>
41573 <indexterm role="variable">
41574 <primary><varname>$message_size</varname></primary>
41575 </indexterm>
41576 Tags can be used to encode the size of files in their names; see
41577 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
41578 happens after the message has been written. The value of the <varname>$message_size</varname>
41579 variable is set to the number of bytes actually written. If the expansion is
41580 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
41581 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
41582 Non-printing characters in the string are ignored; if the resulting string is
41583 empty, it is ignored. If it starts with an alphanumeric character, a leading
41584 colon is inserted; this default has not proven to be the path that popular
41585 maildir implementations have chosen (but changing it in Exim would break
41586 backwards compatibility).
41587 </para>
41588 <para>
41589 For one common implementation, you might set:
41590 </para>
41591 <literallayout class="monospaced">
41592 maildir_tag = ,S=${message_size}
41593 </literallayout>
41594 <para>
41595 but you should check the documentation of the other software to be sure.
41596 </para>
41597 <para>
41598 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
41599 as this allows Exim to extract the size from your tag, instead of having to
41600 <function>stat()</function> each message file.
41601 </para>
41602 </section>
41603 <section id="SECID136">
41604 <title>Using a maildirsize file</title>
41605 <para>
41606 <indexterm role="concept">
41607 <primary>quota</primary>
41608 <secondary>in maildir delivery</secondary>
41609 </indexterm>
41610 <indexterm role="concept">
41611 <primary>maildir format</primary>
41612 <secondary><filename>maildirsize</filename> file</secondary>
41613 </indexterm>
41614 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
41615 storing quota and message size information in a file called <filename>maildirsize</filename>
41616 within the toplevel maildir directory. If this file does not exist, Exim
41617 creates it, setting the quota from the <option>quota</option> option of the transport. If
41618 the maildir directory itself does not exist, it is created before any attempt
41619 to write a <filename>maildirsize</filename> file.
41620 </para>
41621 <para>
41622 The <filename>maildirsize</filename> file is used to hold information about the sizes of
41623 messages in the maildir, thus speeding up quota calculations. The quota value
41624 in the file is just a cache; if the quota is changed in the transport, the new
41625 value overrides the cached value when the next message is delivered. The cache
41626 is maintained for the benefit of other programs that access the maildir and
41627 need to know the quota.
41628 </para>
41629 <para>
41630 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
41631 file is maintained (with a zero quota setting), but no quota is imposed.
41632 </para>
41633 <para>
41634 A regular expression is available for controlling which directories in the
41635 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
41636 See the description of the <option>maildir_quota_directory_regex</option> option above for
41637 details.
41638 </para>
41639 </section>
41640 <section id="SECID137">
41641 <title>Mailstore delivery</title>
41642 <para>
41643 <indexterm role="concept">
41644 <primary>mailstore format</primary>
41645 <secondary>description of</secondary>
41646 </indexterm>
41647 If the <option>mailstore_format</option> option is true, each message is written as two
41648 files in the given directory. A unique base name is constructed from the
41649 message id and the current delivery process, and the files that are written use
41650 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
41651 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
41652 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
41653 </para>
41654 <para>
41655 During delivery, the envelope is first written to a file with the suffix
41656 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
41657 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
41658 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
41659 file before accessing either of them. An alternative approach is to wait for
41660 the absence of a <filename>.tmp</filename> file.
41661 </para>
41662 <para>
41663 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
41664 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
41665 the sender address on one line, then all the recipient addresses, one per line.
41666 There can be more than one recipient only if the <option>batch_max</option> option is set
41667 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
41668 appended to the file, followed by a newline if it does not end with one.
41669 </para>
41670 <para>
41671 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
41672 failure, it is ignored. Other expansion errors are treated as serious
41673 configuration errors, and delivery is deferred. The variable
41674 <varname>$mailstore_basename</varname> is available for use during these expansions.
41675 </para>
41676 </section>
41677 <section id="SECID138">
41678 <title>Non-special new file delivery</title>
41679 <para>
41680 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
41681 file is created directly in the named directory. For example, when delivering
41682 messages into files in batched SMTP format for later delivery to some host (see
41683 section <xref linkend="SECTbatchSMTP"/>), a setting such as
41684 </para>
41685 <literallayout class="monospaced">
41686 directory = /var/bsmtp/$host
41687 </literallayout>
41688 <para>
41689 might be used. A message is written to a file with a temporary name, which is
41690 then renamed when the delivery is complete. The final name is obtained by
41691 expanding the contents of the <option>directory_file</option> option.
41692 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
41693 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
41694 </para>
41695 </section>
41696 </chapter>
41697
41698 <chapter id="CHID8">
41699 <title>The autoreply transport</title>
41700 <para>
41701 <indexterm role="concept" id="IIDauttra1" class="startofrange">
41702 <primary>transports</primary>
41703 <secondary><command>autoreply</command></secondary>
41704 </indexterm>
41705 <indexterm role="concept" id="IIDauttra2" class="startofrange">
41706 <primary><command>autoreply</command> transport</primary>
41707 </indexterm>
41708 The <command>autoreply</command> transport is not a true transport in that it does not cause
41709 the message to be transmitted. Instead, it generates a new mail message as an
41710 automatic reply to the incoming message. <emphasis>References:</emphasis> and
41711 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
41712 to the rules in RFCs 2822 and 3834, respectively.
41713 </para>
41714 <para>
41715 If the router that passes the message to this transport does not have the
41716 <option>unseen</option> option set, the original message (for the current recipient) is not
41717 delivered anywhere. However, when the <option>unseen</option> option is set on the router
41718 that passes the message to this transport, routing of the address continues, so
41719 another router can set up a normal message delivery.
41720 </para>
41721 <para>
41722 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
41723 <quote>vacation</quote> message being the standard example. However, it can also be run
41724 directly from a router like any other transport. To reduce the possibility of
41725 message cascades, messages created by the <command>autoreply</command> transport always have
41726 empty envelope sender addresses, like bounce messages.
41727 </para>
41728 <para>
41729 The parameters of the message to be sent can be specified in the configuration
41730 by options described below. However, these are used only when the address
41731 passed to the transport does not contain its own reply information. When the
41732 transport is run as a consequence of a
41733 <option>mail</option>
41734 or <option>vacation</option> command in a filter file, the parameters of the message are
41735 supplied by the filter, and passed with the address. The transport&#x2019;s options
41736 that define the message are then ignored (so they are not usually set in this
41737 case). The message is specified entirely by the filter or by the transport; it
41738 is never built from a mixture of options. However, the <option>file_optional</option>,
41739 <option>mode</option>, and <option>return_message</option> options apply in all cases.
41740 </para>
41741 <para>
41742 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
41743 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
41744 gid of the user, and with appropriate current and home directories (see chapter
41745 <xref linkend="CHAPenvironment"/>).
41746 </para>
41747 <para>
41748 There is a subtle difference between routing a message to a <command>pipe</command> transport
41749 that generates some text to be returned to the sender, and routing it to an
41750 <command>autoreply</command> transport. This difference is noticeable only if more than one
41751 address from the same message is so handled. In the case of a pipe, the
41752 separate outputs from the different addresses are gathered up and returned to
41753 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
41754 message is generated for each address that is passed to it.
41755 </para>
41756 <para>
41757 Non-printing characters are not permitted in the header lines generated for the
41758 message that <command>autoreply</command> creates, with the exception of newlines that are
41759 immediately followed by white space. If any non-printing characters are found,
41760 the transport defers.
41761 Whether characters with the top bit set count as printing characters or not is
41762 controlled by the <option>print_topbitchars</option> global option.
41763 </para>
41764 <para>
41765 If any of the generic options for manipulating headers (for example,
41766 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
41767 of the original message that is included in the generated message when
41768 <option>return_message</option> is set. They do not apply to the generated message itself.
41769 </para>
41770 <para>
41771 <indexterm role="variable">
41772 <primary><varname>$sender_address</varname></primary>
41773 </indexterm>
41774 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
41775 the message, indicating that there were no recipients, it does not treat this
41776 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
41777 is empty (because the incoming message is a bounce message) do not cause
41778 problems. They are just discarded.
41779 </para>
41780 <section id="SECID139">
41781 <title>Private options for autoreply</title>
41782 <para>
41783 <indexterm role="concept">
41784 <primary>options</primary>
41785 <secondary><command>autoreply</command> transport</secondary>
41786 </indexterm>
41787 </para>
41788 <para>
41789 <indexterm role="option">
41790 <primary><option>bcc</option></primary>
41791 </indexterm>
41792 </para>
41793 <informaltable frame="all">
41794 <tgroup cols="4" colsep="0" rowsep="0">
41795 <colspec colwidth="8*" align="left"/>
41796 <colspec colwidth="6*" align="center"/>
41797 <colspec colwidth="6*" align="center"/>
41798 <colspec colwidth="6*" align="right"/>
41799 <tbody>
41800 <row>
41801 <entry><option>bcc</option></entry>
41802 <entry>Use: <emphasis>autoreply</emphasis></entry>
41803 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41804 <entry>Default: <emphasis>unset</emphasis></entry>
41805 </row>
41806 </tbody>
41807 </tgroup>
41808 </informaltable>
41809 <para>
41810 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
41811 message when the message is specified by the transport.
41812 </para>
41813 <para>
41814 <indexterm role="option">
41815 <primary><option>cc</option></primary>
41816 </indexterm>
41817 </para>
41818 <informaltable frame="all">
41819 <tgroup cols="4" colsep="0" rowsep="0">
41820 <colspec colwidth="8*" align="left"/>
41821 <colspec colwidth="6*" align="center"/>
41822 <colspec colwidth="6*" align="center"/>
41823 <colspec colwidth="6*" align="right"/>
41824 <tbody>
41825 <row>
41826 <entry><option>cc</option></entry>
41827 <entry>Use: <emphasis>autoreply</emphasis></entry>
41828 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41829 <entry>Default: <emphasis>unset</emphasis></entry>
41830 </row>
41831 </tbody>
41832 </tgroup>
41833 </informaltable>
41834 <para>
41835 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
41836 when the message is specified by the transport.
41837 </para>
41838 <para>
41839 <indexterm role="option">
41840 <primary><option>file</option></primary>
41841 </indexterm>
41842 </para>
41843 <informaltable frame="all">
41844 <tgroup cols="4" colsep="0" rowsep="0">
41845 <colspec colwidth="8*" align="left"/>
41846 <colspec colwidth="6*" align="center"/>
41847 <colspec colwidth="6*" align="center"/>
41848 <colspec colwidth="6*" align="right"/>
41849 <tbody>
41850 <row>
41851 <entry><option>file</option></entry>
41852 <entry>Use: <emphasis>autoreply</emphasis></entry>
41853 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41854 <entry>Default: <emphasis>unset</emphasis></entry>
41855 </row>
41856 </tbody>
41857 </tgroup>
41858 </informaltable>
41859 <para>
41860 The contents of the file are sent as the body of the message when the message
41861 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
41862 string comes first.
41863 </para>
41864 <para>
41865 <indexterm role="option">
41866 <primary><option>file_expand</option></primary>
41867 </indexterm>
41868 </para>
41869 <informaltable frame="all">
41870 <tgroup cols="4" colsep="0" rowsep="0">
41871 <colspec colwidth="8*" align="left"/>
41872 <colspec colwidth="6*" align="center"/>
41873 <colspec colwidth="6*" align="center"/>
41874 <colspec colwidth="6*" align="right"/>
41875 <tbody>
41876 <row>
41877 <entry><option>file_expand</option></entry>
41878 <entry>Use: <emphasis>autoreply</emphasis></entry>
41879 <entry>Type: <emphasis>boolean</emphasis></entry>
41880 <entry>Default: <emphasis>false</emphasis></entry>
41881 </row>
41882 </tbody>
41883 </tgroup>
41884 </informaltable>
41885 <para>
41886 If this is set, the contents of the file named by the <option>file</option> option are
41887 subjected to string expansion as they are added to the message.
41888 </para>
41889 <para>
41890 <indexterm role="option">
41891 <primary><option>file_optional</option></primary>
41892 </indexterm>
41893 </para>
41894 <informaltable frame="all">
41895 <tgroup cols="4" colsep="0" rowsep="0">
41896 <colspec colwidth="8*" align="left"/>
41897 <colspec colwidth="6*" align="center"/>
41898 <colspec colwidth="6*" align="center"/>
41899 <colspec colwidth="6*" align="right"/>
41900 <tbody>
41901 <row>
41902 <entry><option>file_optional</option></entry>
41903 <entry>Use: <emphasis>autoreply</emphasis></entry>
41904 <entry>Type: <emphasis>boolean</emphasis></entry>
41905 <entry>Default: <emphasis>false</emphasis></entry>
41906 </row>
41907 </tbody>
41908 </tgroup>
41909 </informaltable>
41910 <para>
41911 If this option is true, no error is generated if the file named by the <option>file</option>
41912 option or passed with the address does not exist or cannot be read.
41913 </para>
41914 <para>
41915 <indexterm role="option">
41916 <primary><option>from</option></primary>
41917 </indexterm>
41918 </para>
41919 <informaltable frame="all">
41920 <tgroup cols="4" colsep="0" rowsep="0">
41921 <colspec colwidth="8*" align="left"/>
41922 <colspec colwidth="6*" align="center"/>
41923 <colspec colwidth="6*" align="center"/>
41924 <colspec colwidth="6*" align="right"/>
41925 <tbody>
41926 <row>
41927 <entry><option>from</option></entry>
41928 <entry>Use: <emphasis>autoreply</emphasis></entry>
41929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41930 <entry>Default: <emphasis>unset</emphasis></entry>
41931 </row>
41932 </tbody>
41933 </tgroup>
41934 </informaltable>
41935 <para>
41936 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
41937 specified by the transport.
41938 </para>
41939 <para>
41940 <indexterm role="option">
41941 <primary><option>headers</option></primary>
41942 </indexterm>
41943 </para>
41944 <informaltable frame="all">
41945 <tgroup cols="4" colsep="0" rowsep="0">
41946 <colspec colwidth="8*" align="left"/>
41947 <colspec colwidth="6*" align="center"/>
41948 <colspec colwidth="6*" align="center"/>
41949 <colspec colwidth="6*" align="right"/>
41950 <tbody>
41951 <row>
41952 <entry><option>headers</option></entry>
41953 <entry>Use: <emphasis>autoreply</emphasis></entry>
41954 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41955 <entry>Default: <emphasis>unset</emphasis></entry>
41956 </row>
41957 </tbody>
41958 </tgroup>
41959 </informaltable>
41960 <para>
41961 This specifies additional RFC 2822 headers that are to be added to the message
41962 when the message is specified by the transport. Several can be given by using
41963 <quote>\n</quote> to separate them. There is no check on the format.
41964 </para>
41965 <para>
41966 <indexterm role="option">
41967 <primary><option>log</option></primary>
41968 </indexterm>
41969 </para>
41970 <informaltable frame="all">
41971 <tgroup cols="4" colsep="0" rowsep="0">
41972 <colspec colwidth="8*" align="left"/>
41973 <colspec colwidth="6*" align="center"/>
41974 <colspec colwidth="6*" align="center"/>
41975 <colspec colwidth="6*" align="right"/>
41976 <tbody>
41977 <row>
41978 <entry><option>log</option></entry>
41979 <entry>Use: <emphasis>autoreply</emphasis></entry>
41980 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41981 <entry>Default: <emphasis>unset</emphasis></entry>
41982 </row>
41983 </tbody>
41984 </tgroup>
41985 </informaltable>
41986 <para>
41987 This option names a file in which a record of every message sent is logged when
41988 the message is specified by the transport.
41989 </para>
41990 <para>
41991 <indexterm role="option">
41992 <primary><option>mode</option></primary>
41993 </indexterm>
41994 </para>
41995 <informaltable frame="all">
41996 <tgroup cols="4" colsep="0" rowsep="0">
41997 <colspec colwidth="8*" align="left"/>
41998 <colspec colwidth="6*" align="center"/>
41999 <colspec colwidth="6*" align="center"/>
42000 <colspec colwidth="6*" align="right"/>
42001 <tbody>
42002 <row>
42003 <entry><option>mode</option></entry>
42004 <entry>Use: <emphasis>autoreply</emphasis></entry>
42005 <entry>Type: <emphasis>octal integer</emphasis></entry>
42006 <entry>Default: <emphasis>0600</emphasis></entry>
42007 </row>
42008 </tbody>
42009 </tgroup>
42010 </informaltable>
42011 <para>
42012 If either the log file or the <quote>once</quote> file has to be created, this mode is
42013 used.
42014 </para>
42015 <para>
42016 <indexterm role="option">
42017 <primary><option>never_mail</option></primary>
42018 </indexterm>
42019 </para>
42020 <informaltable frame="all">
42021 <tgroup cols="4" colsep="0" rowsep="0">
42022 <colspec colwidth="8*" align="left"/>
42023 <colspec colwidth="6*" align="center"/>
42024 <colspec colwidth="6*" align="center"/>
42025 <colspec colwidth="6*" align="right"/>
42026 <tbody>
42027 <row>
42028 <entry><option>never_mail</option></entry>
42029 <entry>Use: <emphasis>autoreply</emphasis></entry>
42030 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
42031 <entry>Default: <emphasis>unset</emphasis></entry>
42032 </row>
42033 </tbody>
42034 </tgroup>
42035 </informaltable>
42036 <para>
42037 If any run of the transport creates a message with a recipient that matches any
42038 item in the list, that recipient is quietly discarded. If all recipients are
42039 discarded, no message is created. This applies both when the recipients are
42040 generated by a filter and when they are specified in the transport.
42041 </para>
42042 <para>
42043 <indexterm role="option">
42044 <primary><option>once</option></primary>
42045 </indexterm>
42046 </para>
42047 <informaltable frame="all">
42048 <tgroup cols="4" colsep="0" rowsep="0">
42049 <colspec colwidth="8*" align="left"/>
42050 <colspec colwidth="6*" align="center"/>
42051 <colspec colwidth="6*" align="center"/>
42052 <colspec colwidth="6*" align="right"/>
42053 <tbody>
42054 <row>
42055 <entry><option>once</option></entry>
42056 <entry>Use: <emphasis>autoreply</emphasis></entry>
42057 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42058 <entry>Default: <emphasis>unset</emphasis></entry>
42059 </row>
42060 </tbody>
42061 </tgroup>
42062 </informaltable>
42063 <para>
42064 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
42065 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
42066 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
42067 </para>
42068 <para>
42069 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
42070 By default, if <option>once</option> is set to a non-empty file name, the message
42071 is not sent if a potential recipient is already listed in the database.
42072 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
42073 message is sent if that much time has elapsed since a message was last sent to
42074 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
42075 prevents a message from being sent a second time &ndash; in this case, zero means
42076 infinity.
42077 </para>
42078 <para>
42079 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
42080 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
42081 greater than zero, it changes the way Exim implements the <option>once</option> option.
42082 Instead of using a DBM file to record every recipient it sends to, it uses a
42083 regular file, whose size will never get larger than the given value.
42084 </para>
42085 <para>
42086 In the file, Exim keeps a linear list of recipient addresses and the times at
42087 which they were sent messages. If the file is full when a new address needs to
42088 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
42089 means that a given recipient may receive multiple messages, but at
42090 unpredictable intervals that depend on the rate of turnover of addresses in the
42091 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
42092 </para>
42093 <para>
42094 <indexterm role="option">
42095 <primary><option>once_file_size</option></primary>
42096 </indexterm>
42097 </para>
42098 <informaltable frame="all">
42099 <tgroup cols="4" colsep="0" rowsep="0">
42100 <colspec colwidth="8*" align="left"/>
42101 <colspec colwidth="6*" align="center"/>
42102 <colspec colwidth="6*" align="center"/>
42103 <colspec colwidth="6*" align="right"/>
42104 <tbody>
42105 <row>
42106 <entry><option>once_file_size</option></entry>
42107 <entry>Use: <emphasis>autoreply</emphasis></entry>
42108 <entry>Type: <emphasis>integer</emphasis></entry>
42109 <entry>Default: <emphasis>0</emphasis></entry>
42110 </row>
42111 </tbody>
42112 </tgroup>
42113 </informaltable>
42114 <para>
42115 See <option>once</option> above.
42116 </para>
42117 <para>
42118 <indexterm role="option">
42119 <primary><option>once_repeat</option></primary>
42120 </indexterm>
42121 </para>
42122 <informaltable frame="all">
42123 <tgroup cols="4" colsep="0" rowsep="0">
42124 <colspec colwidth="8*" align="left"/>
42125 <colspec colwidth="6*" align="center"/>
42126 <colspec colwidth="6*" align="center"/>
42127 <colspec colwidth="6*" align="right"/>
42128 <tbody>
42129 <row>
42130 <entry><option>once_repeat</option></entry>
42131 <entry>Use: <emphasis>autoreply</emphasis></entry>
42132 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
42133 <entry>Default: <emphasis>0s</emphasis></entry>
42134 </row>
42135 </tbody>
42136 </tgroup>
42137 </informaltable>
42138 <para>
42139 See <option>once</option> above.
42140 After expansion, the value of this option must be a valid time value.
42141 </para>
42142 <para>
42143 <indexterm role="option">
42144 <primary><option>reply_to</option></primary>
42145 </indexterm>
42146 </para>
42147 <informaltable frame="all">
42148 <tgroup cols="4" colsep="0" rowsep="0">
42149 <colspec colwidth="8*" align="left"/>
42150 <colspec colwidth="6*" align="center"/>
42151 <colspec colwidth="6*" align="center"/>
42152 <colspec colwidth="6*" align="right"/>
42153 <tbody>
42154 <row>
42155 <entry><option>reply_to</option></entry>
42156 <entry>Use: <emphasis>autoreply</emphasis></entry>
42157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42158 <entry>Default: <emphasis>unset</emphasis></entry>
42159 </row>
42160 </tbody>
42161 </tgroup>
42162 </informaltable>
42163 <para>
42164 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
42165 specified by the transport.
42166 </para>
42167 <para>
42168 <indexterm role="option">
42169 <primary><option>return_message</option></primary>
42170 </indexterm>
42171 </para>
42172 <informaltable frame="all">
42173 <tgroup cols="4" colsep="0" rowsep="0">
42174 <colspec colwidth="8*" align="left"/>
42175 <colspec colwidth="6*" align="center"/>
42176 <colspec colwidth="6*" align="center"/>
42177 <colspec colwidth="6*" align="right"/>
42178 <tbody>
42179 <row>
42180 <entry><option>return_message</option></entry>
42181 <entry>Use: <emphasis>autoreply</emphasis></entry>
42182 <entry>Type: <emphasis>boolean</emphasis></entry>
42183 <entry>Default: <emphasis>false</emphasis></entry>
42184 </row>
42185 </tbody>
42186 </tgroup>
42187 </informaltable>
42188 <para>
42189 If this is set, a copy of the original message is returned with the new
42190 message, subject to the maximum size set in the <option>return_size_limit</option> global
42191 configuration option.
42192 </para>
42193 <para>
42194 <indexterm role="option">
42195 <primary><option>subject</option></primary>
42196 </indexterm>
42197 </para>
42198 <informaltable frame="all">
42199 <tgroup cols="4" colsep="0" rowsep="0">
42200 <colspec colwidth="8*" align="left"/>
42201 <colspec colwidth="6*" align="center"/>
42202 <colspec colwidth="6*" align="center"/>
42203 <colspec colwidth="6*" align="right"/>
42204 <tbody>
42205 <row>
42206 <entry><option>subject</option></entry>
42207 <entry>Use: <emphasis>autoreply</emphasis></entry>
42208 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42209 <entry>Default: <emphasis>unset</emphasis></entry>
42210 </row>
42211 </tbody>
42212 </tgroup>
42213 </informaltable>
42214 <para>
42215 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
42216 specified by the transport. It is tempting to quote the original subject in
42217 automatic responses. For example:
42218 </para>
42219 <literallayout class="monospaced">
42220 subject = Re: $h_subject:
42221 </literallayout>
42222 <para>
42223 There is a danger in doing this, however. It may allow a third party to
42224 subscribe your users to an opt-in mailing list, provided that the list accepts
42225 bounce messages as subscription confirmations. Well-managed lists require a
42226 non-bounce message to confirm a subscription, so the danger is relatively
42227 small.
42228 </para>
42229 <para>
42230 <indexterm role="option">
42231 <primary><option>text</option></primary>
42232 </indexterm>
42233 </para>
42234 <informaltable frame="all">
42235 <tgroup cols="4" colsep="0" rowsep="0">
42236 <colspec colwidth="8*" align="left"/>
42237 <colspec colwidth="6*" align="center"/>
42238 <colspec colwidth="6*" align="center"/>
42239 <colspec colwidth="6*" align="right"/>
42240 <tbody>
42241 <row>
42242 <entry><option>text</option></entry>
42243 <entry>Use: <emphasis>autoreply</emphasis></entry>
42244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42245 <entry>Default: <emphasis>unset</emphasis></entry>
42246 </row>
42247 </tbody>
42248 </tgroup>
42249 </informaltable>
42250 <para>
42251 This specifies a single string to be used as the body of the message when the
42252 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
42253 the text comes first.
42254 </para>
42255 <para>
42256 <indexterm role="option">
42257 <primary><option>to</option></primary>
42258 </indexterm>
42259 </para>
42260 <informaltable frame="all">
42261 <tgroup cols="4" colsep="0" rowsep="0">
42262 <colspec colwidth="8*" align="left"/>
42263 <colspec colwidth="6*" align="center"/>
42264 <colspec colwidth="6*" align="center"/>
42265 <colspec colwidth="6*" align="right"/>
42266 <tbody>
42267 <row>
42268 <entry><option>to</option></entry>
42269 <entry>Use: <emphasis>autoreply</emphasis></entry>
42270 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42271 <entry>Default: <emphasis>unset</emphasis></entry>
42272 </row>
42273 </tbody>
42274 </tgroup>
42275 </informaltable>
42276 <para>
42277 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
42278 when the message is specified by the transport.
42279 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
42280 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
42281 </para>
42282 </section>
42283 </chapter>
42284
42285 <chapter id="CHAPLMTP">
42286 <title>The lmtp transport</title>
42287 <para>
42288 <indexterm role="concept">
42289 <primary>transports</primary>
42290 <secondary><command>lmtp</command></secondary>
42291 </indexterm>
42292 <indexterm role="concept">
42293 <primary><command>lmtp</command> transport</primary>
42294 </indexterm>
42295 <indexterm role="concept">
42296 <primary>LMTP</primary>
42297 <secondary>over a pipe</secondary>
42298 </indexterm>
42299 <indexterm role="concept">
42300 <primary>LMTP</primary>
42301 <secondary>over a socket</secondary>
42302 </indexterm>
42303 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
42304 specified command
42305 or by interacting with a Unix domain socket.
42306 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
42307 transports. Exim also has support for using LMTP over TCP/IP; this is
42308 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
42309 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
42310 has it commented out. You need to ensure that
42311 </para>
42312 <literallayout class="monospaced">
42313 TRANSPORT_LMTP=yes
42314 </literallayout>
42315 <para>
42316 <indexterm role="concept">
42317 <primary>options</primary>
42318 <secondary><command>lmtp</command> transport</secondary>
42319 </indexterm>
42320 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
42321 included in the Exim binary. The private options of the <command>lmtp</command> transport are
42322 as follows:
42323 </para>
42324 <para>
42325 <indexterm role="option">
42326 <primary><option>batch_id</option></primary>
42327 </indexterm>
42328 </para>
42329 <informaltable frame="all">
42330 <tgroup cols="4" colsep="0" rowsep="0">
42331 <colspec colwidth="8*" align="left"/>
42332 <colspec colwidth="6*" align="center"/>
42333 <colspec colwidth="6*" align="center"/>
42334 <colspec colwidth="6*" align="right"/>
42335 <tbody>
42336 <row>
42337 <entry><option>batch_id</option></entry>
42338 <entry>Use: <emphasis>lmtp</emphasis></entry>
42339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42340 <entry>Default: <emphasis>unset</emphasis></entry>
42341 </row>
42342 </tbody>
42343 </tgroup>
42344 </informaltable>
42345 <para>
42346 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42347 </para>
42348 <para>
42349 <indexterm role="option">
42350 <primary><option>batch_max</option></primary>
42351 </indexterm>
42352 </para>
42353 <informaltable frame="all">
42354 <tgroup cols="4" colsep="0" rowsep="0">
42355 <colspec colwidth="8*" align="left"/>
42356 <colspec colwidth="6*" align="center"/>
42357 <colspec colwidth="6*" align="center"/>
42358 <colspec colwidth="6*" align="right"/>
42359 <tbody>
42360 <row>
42361 <entry><option>batch_max</option></entry>
42362 <entry>Use: <emphasis>lmtp</emphasis></entry>
42363 <entry>Type: <emphasis>integer</emphasis></entry>
42364 <entry>Default: <emphasis>1</emphasis></entry>
42365 </row>
42366 </tbody>
42367 </tgroup>
42368 </informaltable>
42369 <para>
42370 This limits the number of addresses that can be handled in a single delivery.
42371 Most LMTP servers can handle several addresses at once, so it is normally a
42372 good idea to increase this value. See the description of local delivery
42373 batching in chapter <xref linkend="CHAPbatching"/>.
42374 </para>
42375 <para>
42376 <indexterm role="option">
42377 <primary><option>command</option></primary>
42378 </indexterm>
42379 </para>
42380 <informaltable frame="all">
42381 <tgroup cols="4" colsep="0" rowsep="0">
42382 <colspec colwidth="8*" align="left"/>
42383 <colspec colwidth="6*" align="center"/>
42384 <colspec colwidth="6*" align="center"/>
42385 <colspec colwidth="6*" align="right"/>
42386 <tbody>
42387 <row>
42388 <entry><option>command</option></entry>
42389 <entry>Use: <emphasis>lmtp</emphasis></entry>
42390 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42391 <entry>Default: <emphasis>unset</emphasis></entry>
42392 </row>
42393 </tbody>
42394 </tgroup>
42395 </informaltable>
42396 <para>
42397 This option must be set if <option>socket</option> is not set. The string is a command which
42398 is run in a separate process. It is split up into a command name and list of
42399 arguments, each of which is separately expanded (so expansion cannot change the
42400 number of arguments). The command is run directly, not via a shell. The message
42401 is passed to the new process using the standard input and output to operate the
42402 LMTP protocol.
42403 </para>
42404 <para>
42405 <indexterm role="option">
42406 <primary><option>ignore_quota</option></primary>
42407 </indexterm>
42408 </para>
42409 <informaltable frame="all">
42410 <tgroup cols="4" colsep="0" rowsep="0">
42411 <colspec colwidth="8*" align="left"/>
42412 <colspec colwidth="6*" align="center"/>
42413 <colspec colwidth="6*" align="center"/>
42414 <colspec colwidth="6*" align="right"/>
42415 <tbody>
42416 <row>
42417 <entry><option>ignore_quota</option></entry>
42418 <entry>Use: <emphasis>lmtp</emphasis></entry>
42419 <entry>Type: <emphasis>boolean</emphasis></entry>
42420 <entry>Default: <emphasis>false</emphasis></entry>
42421 </row>
42422 </tbody>
42423 </tgroup>
42424 </informaltable>
42425 <para>
42426 <indexterm role="concept">
42427 <primary>LMTP</primary>
42428 <secondary>ignoring quota errors</secondary>
42429 </indexterm>
42430 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
42431 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
42432 in its response to the LHLO command.
42433 </para>
42434 <para>
42435 <indexterm role="option">
42436 <primary><option>socket</option></primary>
42437 </indexterm>
42438 </para>
42439 <informaltable frame="all">
42440 <tgroup cols="4" colsep="0" rowsep="0">
42441 <colspec colwidth="8*" align="left"/>
42442 <colspec colwidth="6*" align="center"/>
42443 <colspec colwidth="6*" align="center"/>
42444 <colspec colwidth="6*" align="right"/>
42445 <tbody>
42446 <row>
42447 <entry><option>socket</option></entry>
42448 <entry>Use: <emphasis>lmtp</emphasis></entry>
42449 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42450 <entry>Default: <emphasis>unset</emphasis></entry>
42451 </row>
42452 </tbody>
42453 </tgroup>
42454 </informaltable>
42455 <para>
42456 This option must be set if <option>command</option> is not set. The result of expansion must
42457 be the name of a Unix domain socket. The transport connects to the socket and
42458 delivers the message to it using the LMTP protocol.
42459 </para>
42460 <para>
42461 <indexterm role="option">
42462 <primary><option>timeout</option></primary>
42463 </indexterm>
42464 </para>
42465 <informaltable frame="all">
42466 <tgroup cols="4" colsep="0" rowsep="0">
42467 <colspec colwidth="8*" align="left"/>
42468 <colspec colwidth="6*" align="center"/>
42469 <colspec colwidth="6*" align="center"/>
42470 <colspec colwidth="6*" align="right"/>
42471 <tbody>
42472 <row>
42473 <entry><option>timeout</option></entry>
42474 <entry>Use: <emphasis>lmtp</emphasis></entry>
42475 <entry>Type: <emphasis>time</emphasis></entry>
42476 <entry>Default: <emphasis>5m</emphasis></entry>
42477 </row>
42478 </tbody>
42479 </tgroup>
42480 </informaltable>
42481 <para>
42482 The transport is aborted if the created process or Unix domain socket does not
42483 respond to LMTP commands or message input within this timeout. Delivery
42484 is deferred, and will be tried again later. Here is an example of a typical
42485 LMTP transport:
42486 </para>
42487 <literallayout class="monospaced">
42488 lmtp:
42489   driver = lmtp
42490   command = /some/local/lmtp/delivery/program
42491   batch_max = 20
42492   user = exim
42493 </literallayout>
42494 <para>
42495 This delivers up to 20 addresses at a time, in a mixture of domains if
42496 necessary, running as the user <emphasis>exim</emphasis>.
42497 </para>
42498 </chapter>
42499
42500 <chapter id="CHAPpipetransport">
42501 <title>The pipe transport</title>
42502 <para>
42503 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
42504 <primary>transports</primary>
42505 <secondary><command>pipe</command></secondary>
42506 </indexterm>
42507 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
42508 <primary><command>pipe</command> transport</primary>
42509 </indexterm>
42510 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
42511 running in another process. One example is the use of <command>pipe</command> as a
42512 pseudo-remote transport for passing messages to some other delivery mechanism
42513 (such as UUCP). Another is the use by individual users to automatically process
42514 their incoming messages. The <command>pipe</command> transport can be used in one of the
42515 following ways:
42516 </para>
42517 <itemizedlist>
42518 <listitem>
42519 <para>
42520 <indexterm role="variable">
42521 <primary><varname>$local_part</varname></primary>
42522 </indexterm>
42523 A router routes one address to a transport in the normal way, and the
42524 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
42525 contains the local part of the address (as usual), and the command that is run
42526 is specified by the <option>command</option> option on the transport.
42527 </para>
42528 </listitem>
42529 <listitem>
42530 <para>
42531 <indexterm role="variable">
42532 <primary><varname>$pipe_addresses</varname></primary>
42533 </indexterm>
42534 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
42535 transport can handle more than one address in a single run. In this case, when
42536 more than one address is routed to the transport, <varname>$local_part</varname> is not set
42537 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
42538 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
42539 that are routed to the transport.
42540 </para>
42541 </listitem>
42542 <listitem>
42543 <para>
42544 <indexterm role="variable">
42545 <primary><varname>$address_pipe</varname></primary>
42546 </indexterm>
42547 A router redirects an address directly to a pipe command (for example, from an
42548 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
42549 pipe command, and the <option>command</option> option on the transport is ignored unless
42550 <option>force_command</option> is set. If only one address is being transported
42551 (<option>batch_max</option> is not greater than one, or only one address was redirected to
42552 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
42553 </para>
42554 </listitem>
42555 </itemizedlist>
42556 <para>
42557 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
42558 deliver messages over pipes using the LMTP interactive protocol. This is
42559 implemented by the <command>lmtp</command> transport.
42560 </para>
42561 <para>
42562 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
42563 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
42564 other cases, the uid and gid have to be specified explicitly, either on the
42565 transport or on the router that handles the address. Current and <quote>home</quote>
42566 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
42567 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
42568 for a discussion of local delivery batching.
42569 </para>
42570 <section id="SECID140">
42571 <title>Concurrent delivery</title>
42572 <para>
42573 If two messages arrive at almost the same time, and both are routed to a pipe
42574 delivery, the two pipe transports may be run concurrently. You must ensure that
42575 any pipe commands you set up are robust against this happening. If the commands
42576 write to a file, the <option>exim_lock</option> utility might be of use.
42577 </para>
42578 </section>
42579 <section id="SECID141">
42580 <title>Returned status and data</title>
42581 <para>
42582 <indexterm role="concept">
42583 <primary><command>pipe</command> transport</primary>
42584 <secondary>returned data</secondary>
42585 </indexterm>
42586 If the command exits with a non-zero return code, the delivery is deemed to
42587 have failed, unless either the <option>ignore_status</option> option is set (in which case
42588 the return code is treated as zero), or the return code is one of those listed
42589 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
42590 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
42591 logged, but are not included in the bounce message, which merely contains
42592 <quote>local delivery failed</quote>.
42593 </para>
42594 <para>
42595 If the command exits on a signal and the <option>freeze_signal</option> option is set then
42596 the message will be frozen in the queue. If that option is not set, a bounce
42597 will be sent as normal.
42598 </para>
42599 <para>
42600 If the return code is greater than 128 and the command being run is a shell
42601 script, it normally means that the script was terminated by a signal whose
42602 value is the return code minus 128. The <option>freeze_signal</option> option does not
42603 apply in this case.
42604 </para>
42605 <para>
42606 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
42607 return code is set to 127. This is the value that a shell returns if it is
42608 asked to run a non-existent command. The wording for the log line suggests that
42609 a non-existent command may be the problem.
42610 </para>
42611 <para>
42612 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
42613 set and the command produces any output on its standard output or standard
42614 error streams, the command is considered to have failed, even if it gave a zero
42615 return code or if <option>ignore_status</option> is set. The output from the command is
42616 included as part of the bounce message. The <option>return_fail_output</option> option is
42617 similar, except that output is returned only when the command exits with a
42618 failure return code, that is, a value other than zero or a code that matches
42619 <option>temp_errors</option>.
42620 </para>
42621 </section>
42622 <section id="SECThowcommandrun">
42623 <title>How the command is run</title>
42624 <para>
42625 <indexterm role="concept">
42626 <primary><command>pipe</command> transport</primary>
42627 <secondary>path for command</secondary>
42628 </indexterm>
42629 The command line is (by default) broken down into a command name and arguments
42630 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
42631 <option>restrict_to_path</option> options can be used to restrict the commands that may be
42632 run.
42633 </para>
42634 <para>
42635 <indexterm role="concept">
42636 <primary>quoting</primary>
42637 <secondary>in pipe command</secondary>
42638 </indexterm>
42639 Unquoted arguments are delimited by white space. If an argument appears in
42640 double quotes, backslash is interpreted as an escape character in the usual
42641 way. If an argument appears in single quotes, no escaping is done.
42642 </para>
42643 <para>
42644 String expansion is applied to the command line except when it comes from a
42645 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
42646 expansion is applied to each argument in turn rather than to the whole line.
42647 For this reason, any string expansion item that contains white space must be
42648 quoted so as to be contained within a single argument. A setting such as
42649 </para>
42650 <literallayout class="monospaced">
42651 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
42652 </literallayout>
42653 <para>
42654 will not work, because the expansion item gets split between several
42655 arguments. You have to write
42656 </para>
42657 <literallayout class="monospaced">
42658 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
42659 </literallayout>
42660 <para>
42661 to ensure that it is all in one argument. The expansion is done in this way,
42662 argument by argument, so that the number of arguments cannot be changed as a
42663 result of expansion, and quotes or backslashes in inserted variables do not
42664 interact with external quoting. However, this leads to problems if you want to
42665 generate multiple arguments (or the command name plus arguments) from a single
42666 expansion. In this situation, the simplest solution is to use a shell. For
42667 example:
42668 </para>
42669 <literallayout class="monospaced">
42670 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
42671 </literallayout>
42672 <para>
42673 <indexterm role="concept">
42674 <primary>transport</primary>
42675 <secondary>filter</secondary>
42676 </indexterm>
42677 <indexterm role="concept">
42678 <primary>filter</primary>
42679 <secondary>transport filter</secondary>
42680 </indexterm>
42681 <indexterm role="variable">
42682 <primary><varname>$pipe_addresses</varname></primary>
42683 </indexterm>
42684 Special handling takes place when an argument consists of precisely the text
42685 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
42686 place this string is recognized is when it appears as an argument for a pipe or
42687 transport filter command. It causes each address that is being handled to be
42688 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
42689 avoids any problems with spaces or shell metacharacters, and is of use when a
42690 <command>pipe</command> transport is handling groups of addresses in a batch.
42691 </para>
42692 <para>
42693 If <option>force_command</option> is enabled on the transport, Special handling takes place
42694 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
42695 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
42696 argument is inserted in the argument list at that point
42697 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
42698 the only item in the argument; in fact, if it were then <option>force_command</option>
42699 should behave as a no-op.  Rather, it should be used to adjust the command
42700 run while preserving the argument vector separation.
42701 </para>
42702 <para>
42703 After splitting up into arguments and expansion, the resulting command is run
42704 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
42705 message that is being delivered is supplied on the standard input, and the
42706 standard output and standard error are both connected to a single pipe that is
42707 read by Exim. The <option>max_output</option> option controls how much output the command
42708 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
42709 control what is done with it.
42710 </para>
42711 <para>
42712 Not running the command under a shell (by default) lessens the security risks
42713 in cases when a command from a user&#x2019;s filter file is built out of data that was
42714 taken from an incoming message. If a shell is required, it can of course be
42715 explicitly specified as the command to be run. However, there are circumstances
42716 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
42717 under a shell and cannot easily be modified. To allow for these cases, there is
42718 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
42719 works. Instead of breaking up the command line as just described, it expands it
42720 as a single string and passes the result to <filename>/bin/sh</filename>. The
42721 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
42722 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
42723 </para>
42724 </section>
42725 <section id="SECTpipeenv">
42726 <title>Environment variables</title>
42727 <para>
42728 <indexterm role="concept">
42729 <primary><command>pipe</command> transport</primary>
42730 <secondary>environment for command</secondary>
42731 </indexterm>
42732 <indexterm role="concept">
42733 <primary>environment for pipe transport</primary>
42734 </indexterm>
42735 The environment variables listed below are set up when the command is invoked.
42736 This list is a compromise for maximum compatibility with other MTAs. Note that
42737 the <option>environment</option> option can be used to add additional variables to this
42738 environment.
42739 </para>
42740 <literallayout>
42741 <literal>DOMAIN            </literal>   the domain of the address
42742 <literal>HOME              </literal>   the home directory, if set
42743 <literal>HOST              </literal>   the host name when called from a router (see below)
42744 <literal>LOCAL_PART        </literal>   see below
42745 <literal>LOCAL_PART_PREFIX </literal>   see below
42746 <literal>LOCAL_PART_SUFFIX </literal>   see below
42747 <literal>LOGNAME           </literal>   see below
42748 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
42749 <literal>PATH              </literal>   as specified by the <option>path</option> option below
42750 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
42751 <literal>RECIPIENT         </literal>   the complete recipient address
42752 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
42753 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
42754 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
42755 <literal>USER              </literal>   see below
42756 </literallayout>
42757 <para>
42758 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
42759 router, LOCAL_PART is set to the local part of the address. When it is
42760 called as a result of a forward or alias expansion, LOCAL_PART is set to
42761 the local part of the address that was expanded. In both cases, any affixes are
42762 removed from the local part, and made available in LOCAL_PART_PREFIX and
42763 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
42764 same value as LOCAL_PART for compatibility with other MTAs.
42765 </para>
42766 <para>
42767 <indexterm role="concept">
42768 <primary>HOST</primary>
42769 </indexterm>
42770 HOST is set only when a <command>pipe</command> transport is called from a router that
42771 associates hosts with an address, typically when using <command>pipe</command> as a
42772 pseudo-remote transport. HOST is set to the first host name specified by
42773 the router.
42774 </para>
42775 <para>
42776 <indexterm role="concept">
42777 <primary>HOME</primary>
42778 </indexterm>
42779 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
42780 for the HOME environment variable. Otherwise, a home directory may be set
42781 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
42782 user&#x2019;s home directory if <option>check_local_user</option> is set.
42783 </para>
42784 </section>
42785 <section id="SECID142">
42786 <title>Private options for pipe</title>
42787 <para>
42788 <indexterm role="concept">
42789 <primary>options</primary>
42790 <secondary><command>pipe</command> transport</secondary>
42791 </indexterm>
42792 </para>
42793 <para>
42794 <indexterm role="option">
42795 <primary><option>allow_commands</option></primary>
42796 </indexterm>
42797 </para>
42798 <informaltable frame="all">
42799 <tgroup cols="4" colsep="0" rowsep="0">
42800 <colspec colwidth="8*" align="left"/>
42801 <colspec colwidth="6*" align="center"/>
42802 <colspec colwidth="6*" align="center"/>
42803 <colspec colwidth="6*" align="right"/>
42804 <tbody>
42805 <row>
42806 <entry><option>allow_commands</option></entry>
42807 <entry>Use: <emphasis>pipe</emphasis></entry>
42808 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42809 <entry>Default: <emphasis>unset</emphasis></entry>
42810 </row>
42811 </tbody>
42812 </tgroup>
42813 </informaltable>
42814 <para>
42815 <indexterm role="concept">
42816 <primary><command>pipe</command> transport</primary>
42817 <secondary>permitted commands</secondary>
42818 </indexterm>
42819 The string is expanded, and is then interpreted as a colon-separated list of
42820 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
42821 permitted are those in the <option>allow_commands</option> list. They need not be absolute
42822 paths; the <option>path</option> option is still used for relative paths. If
42823 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
42824 in the <option>allow_commands</option> list, or a name without any slashes that is found on
42825 the path. In other words, if neither <option>allow_commands</option> nor
42826 <option>restrict_to_path</option> is set, there is no restriction on the command, but
42827 otherwise only commands that are permitted by one or the other are allowed. For
42828 example, if
42829 </para>
42830 <literallayout class="monospaced">
42831 allow_commands = /usr/bin/vacation
42832 </literallayout>
42833 <para>
42834 and <option>restrict_to_path</option> is not set, the only permitted command is
42835 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
42836 <option>use_shell</option> is set.
42837 </para>
42838 <para>
42839 <indexterm role="option">
42840 <primary><option>batch_id</option></primary>
42841 </indexterm>
42842 </para>
42843 <informaltable frame="all">
42844 <tgroup cols="4" colsep="0" rowsep="0">
42845 <colspec colwidth="8*" align="left"/>
42846 <colspec colwidth="6*" align="center"/>
42847 <colspec colwidth="6*" align="center"/>
42848 <colspec colwidth="6*" align="right"/>
42849 <tbody>
42850 <row>
42851 <entry><option>batch_id</option></entry>
42852 <entry>Use: <emphasis>pipe</emphasis></entry>
42853 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42854 <entry>Default: <emphasis>unset</emphasis></entry>
42855 </row>
42856 </tbody>
42857 </tgroup>
42858 </informaltable>
42859 <para>
42860 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42861 </para>
42862 <para>
42863 <indexterm role="option">
42864 <primary><option>batch_max</option></primary>
42865 </indexterm>
42866 </para>
42867 <informaltable frame="all">
42868 <tgroup cols="4" colsep="0" rowsep="0">
42869 <colspec colwidth="8*" align="left"/>
42870 <colspec colwidth="6*" align="center"/>
42871 <colspec colwidth="6*" align="center"/>
42872 <colspec colwidth="6*" align="right"/>
42873 <tbody>
42874 <row>
42875 <entry><option>batch_max</option></entry>
42876 <entry>Use: <emphasis>pipe</emphasis></entry>
42877 <entry>Type: <emphasis>integer</emphasis></entry>
42878 <entry>Default: <emphasis>1</emphasis></entry>
42879 </row>
42880 </tbody>
42881 </tgroup>
42882 </informaltable>
42883 <para>
42884 This limits the number of addresses that can be handled in a single delivery.
42885 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42886 </para>
42887 <para>
42888 <indexterm role="option">
42889 <primary><option>check_string</option></primary>
42890 </indexterm>
42891 </para>
42892 <informaltable frame="all">
42893 <tgroup cols="4" colsep="0" rowsep="0">
42894 <colspec colwidth="8*" align="left"/>
42895 <colspec colwidth="6*" align="center"/>
42896 <colspec colwidth="6*" align="center"/>
42897 <colspec colwidth="6*" align="right"/>
42898 <tbody>
42899 <row>
42900 <entry><option>check_string</option></entry>
42901 <entry>Use: <emphasis>pipe</emphasis></entry>
42902 <entry>Type: <emphasis>string</emphasis></entry>
42903 <entry>Default: <emphasis>unset</emphasis></entry>
42904 </row>
42905 </tbody>
42906 </tgroup>
42907 </informaltable>
42908 <para>
42909 As <command>pipe</command> writes the message, the start of each line is tested for matching
42910 <option>check_string</option>, and if it does, the initial matching characters are replaced
42911 by the contents of <option>escape_string</option>, provided both are set. The value of
42912 <option>check_string</option> is a literal string, not a regular expression, and the case of
42913 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
42914 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
42915 the SMTP escaping protocol. Any settings made in the configuration file are
42916 ignored.
42917 </para>
42918 <para>
42919 <indexterm role="option">
42920 <primary><option>command</option></primary>
42921 </indexterm>
42922 </para>
42923 <informaltable frame="all">
42924 <tgroup cols="4" colsep="0" rowsep="0">
42925 <colspec colwidth="8*" align="left"/>
42926 <colspec colwidth="6*" align="center"/>
42927 <colspec colwidth="6*" align="center"/>
42928 <colspec colwidth="6*" align="right"/>
42929 <tbody>
42930 <row>
42931 <entry><option>command</option></entry>
42932 <entry>Use: <emphasis>pipe</emphasis></entry>
42933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42934 <entry>Default: <emphasis>unset</emphasis></entry>
42935 </row>
42936 </tbody>
42937 </tgroup>
42938 </informaltable>
42939 <para>
42940 This option need not be set when <command>pipe</command> is being used to deliver to pipes
42941 obtained directly from address redirections. In other cases, the option must be
42942 set, to provide a command to be run. It need not yield an absolute path (see
42943 the <option>path</option> option below). The command is split up into separate arguments by
42944 Exim, and each argument is separately expanded, as described in section
42945 <xref linkend="SECThowcommandrun"/> above.
42946 </para>
42947 <para>
42948 <indexterm role="option">
42949 <primary><option>environment</option></primary>
42950 </indexterm>
42951 </para>
42952 <informaltable frame="all">
42953 <tgroup cols="4" colsep="0" rowsep="0">
42954 <colspec colwidth="8*" align="left"/>
42955 <colspec colwidth="6*" align="center"/>
42956 <colspec colwidth="6*" align="center"/>
42957 <colspec colwidth="6*" align="right"/>
42958 <tbody>
42959 <row>
42960 <entry><option>environment</option></entry>
42961 <entry>Use: <emphasis>pipe</emphasis></entry>
42962 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42963 <entry>Default: <emphasis>unset</emphasis></entry>
42964 </row>
42965 </tbody>
42966 </tgroup>
42967 </informaltable>
42968 <para>
42969 <indexterm role="concept">
42970 <primary><command>pipe</command> transport</primary>
42971 <secondary>environment for command</secondary>
42972 </indexterm>
42973 <indexterm role="concept">
42974 <primary>environment for <command>pipe</command> transport</primary>
42975 </indexterm>
42976 This option is used to add additional variables to the environment in which the
42977 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
42978 a string which is expanded, and then interpreted as a colon-separated list of
42979 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
42980 </para>
42981 <para>
42982 <indexterm role="option">
42983 <primary><option>escape_string</option></primary>
42984 </indexterm>
42985 </para>
42986 <informaltable frame="all">
42987 <tgroup cols="4" colsep="0" rowsep="0">
42988 <colspec colwidth="8*" align="left"/>
42989 <colspec colwidth="6*" align="center"/>
42990 <colspec colwidth="6*" align="center"/>
42991 <colspec colwidth="6*" align="right"/>
42992 <tbody>
42993 <row>
42994 <entry><option>escape_string</option></entry>
42995 <entry>Use: <emphasis>pipe</emphasis></entry>
42996 <entry>Type: <emphasis>string</emphasis></entry>
42997 <entry>Default: <emphasis>unset</emphasis></entry>
42998 </row>
42999 </tbody>
43000 </tgroup>
43001 </informaltable>
43002 <para>
43003 See <option>check_string</option> above.
43004 </para>
43005 <para>
43006 <indexterm role="option">
43007 <primary><option>freeze_exec_fail</option></primary>
43008 </indexterm>
43009 </para>
43010 <informaltable frame="all">
43011 <tgroup cols="4" colsep="0" rowsep="0">
43012 <colspec colwidth="8*" align="left"/>
43013 <colspec colwidth="6*" align="center"/>
43014 <colspec colwidth="6*" align="center"/>
43015 <colspec colwidth="6*" align="right"/>
43016 <tbody>
43017 <row>
43018 <entry><option>freeze_exec_fail</option></entry>
43019 <entry>Use: <emphasis>pipe</emphasis></entry>
43020 <entry>Type: <emphasis>boolean</emphasis></entry>
43021 <entry>Default: <emphasis>false</emphasis></entry>
43022 </row>
43023 </tbody>
43024 </tgroup>
43025 </informaltable>
43026 <para>
43027 <indexterm role="concept">
43028 <primary>exec failure</primary>
43029 </indexterm>
43030 <indexterm role="concept">
43031 <primary>failure of exec</primary>
43032 </indexterm>
43033 <indexterm role="concept">
43034 <primary><command>pipe</command> transport</primary>
43035 <secondary>failure of exec</secondary>
43036 </indexterm>
43037 Failure to exec the command in a pipe transport is by default treated like
43038 any other failure while running the command. However, if <option>freeze_exec_fail</option>
43039 is set, failure to exec is treated specially, and causes the message to be
43040 frozen, whatever the setting of <option>ignore_status</option>.
43041 </para>
43042 <para>
43043 <indexterm role="option">
43044 <primary><option>freeze_signal</option></primary>
43045 </indexterm>
43046 </para>
43047 <informaltable frame="all">
43048 <tgroup cols="4" colsep="0" rowsep="0">
43049 <colspec colwidth="8*" align="left"/>
43050 <colspec colwidth="6*" align="center"/>
43051 <colspec colwidth="6*" align="center"/>
43052 <colspec colwidth="6*" align="right"/>
43053 <tbody>
43054 <row>
43055 <entry><option>freeze_signal</option></entry>
43056 <entry>Use: <emphasis>pipe</emphasis></entry>
43057 <entry>Type: <emphasis>boolean</emphasis></entry>
43058 <entry>Default: <emphasis>false</emphasis></entry>
43059 </row>
43060 </tbody>
43061 </tgroup>
43062 </informaltable>
43063 <para>
43064 <indexterm role="concept">
43065 <primary>signal exit</primary>
43066 </indexterm>
43067 <indexterm role="concept">
43068 <primary><command>pipe</command> transport</primary>
43069 <secondary>,</secondary>
43070 </indexterm>
43071 Normally if the process run by a command in a pipe transport exits on a signal,
43072 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
43073 frozen in Exim&#x2019;s queue instead.
43074 </para>
43075 <para>
43076 <indexterm role="option">
43077 <primary><option>force_command</option></primary>
43078 </indexterm>
43079 </para>
43080 <informaltable frame="all">
43081 <tgroup cols="4" colsep="0" rowsep="0">
43082 <colspec colwidth="8*" align="left"/>
43083 <colspec colwidth="6*" align="center"/>
43084 <colspec colwidth="6*" align="center"/>
43085 <colspec colwidth="6*" align="right"/>
43086 <tbody>
43087 <row>
43088 <entry><option>force_command</option></entry>
43089 <entry>Use: <emphasis>pipe</emphasis></entry>
43090 <entry>Type: <emphasis>boolean</emphasis></entry>
43091 <entry>Default: <emphasis>false</emphasis></entry>
43092 </row>
43093 </tbody>
43094 </tgroup>
43095 </informaltable>
43096 <para>
43097 <indexterm role="concept">
43098 <primary>force command</primary>
43099 </indexterm>
43100 <indexterm role="concept">
43101 <primary><command>pipe</command> transport</primary>
43102 <secondary>,</secondary>
43103 </indexterm>
43104 Normally when a router redirects an address directly to a pipe command
43105 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
43106 is set, the <option>command</option> option will used. This is especially
43107 useful for forcing a wrapper or additional argument to be added to the
43108 command. For example:
43109 </para>
43110 <literallayout class="monospaced">
43111 command = /usr/bin/remote_exec myhost -- $address_pipe
43112 force_command
43113 </literallayout>
43114 <para>
43115 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
43116 <option>force_command</option> is set, expanding out to the original argument vector as
43117 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
43118 </para>
43119 <para>
43120 <indexterm role="option">
43121 <primary><option>ignore_status</option></primary>
43122 </indexterm>
43123 </para>
43124 <informaltable frame="all">
43125 <tgroup cols="4" colsep="0" rowsep="0">
43126 <colspec colwidth="8*" align="left"/>
43127 <colspec colwidth="6*" align="center"/>
43128 <colspec colwidth="6*" align="center"/>
43129 <colspec colwidth="6*" align="right"/>
43130 <tbody>
43131 <row>
43132 <entry><option>ignore_status</option></entry>
43133 <entry>Use: <emphasis>pipe</emphasis></entry>
43134 <entry>Type: <emphasis>boolean</emphasis></entry>
43135 <entry>Default: <emphasis>false</emphasis></entry>
43136 </row>
43137 </tbody>
43138 </tgroup>
43139 </informaltable>
43140 <para>
43141 If this option is true, the status returned by the subprocess that is set up to
43142 run the command is ignored, and Exim behaves as if zero had been returned.
43143 Otherwise, a non-zero status or termination by signal causes an error return
43144 from the transport unless the status value is one of those listed in
43145 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
43146 </para>
43147 <para>
43148 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
43149 See the <option>timeout_defer</option> option for how timeouts are handled.
43150 </para>
43151 <para>
43152 <indexterm role="option">
43153 <primary><option>log_defer_output</option></primary>
43154 </indexterm>
43155 </para>
43156 <informaltable frame="all">
43157 <tgroup cols="4" colsep="0" rowsep="0">
43158 <colspec colwidth="8*" align="left"/>
43159 <colspec colwidth="6*" align="center"/>
43160 <colspec colwidth="6*" align="center"/>
43161 <colspec colwidth="6*" align="right"/>
43162 <tbody>
43163 <row>
43164 <entry><option>log_defer_output</option></entry>
43165 <entry>Use: <emphasis>pipe</emphasis></entry>
43166 <entry>Type: <emphasis>boolean</emphasis></entry>
43167 <entry>Default: <emphasis>false</emphasis></entry>
43168 </row>
43169 </tbody>
43170 </tgroup>
43171 </informaltable>
43172 <para>
43173 <indexterm role="concept">
43174 <primary><command>pipe</command> transport</primary>
43175 <secondary>logging output</secondary>
43176 </indexterm>
43177 If this option is set, and the status returned by the command is
43178 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
43179 and any output was produced, the first line of it is written to the main log.
43180 </para>
43181 <para>
43182 <indexterm role="option">
43183 <primary><option>log_fail_output</option></primary>
43184 </indexterm>
43185 </para>
43186 <informaltable frame="all">
43187 <tgroup cols="4" colsep="0" rowsep="0">
43188 <colspec colwidth="8*" align="left"/>
43189 <colspec colwidth="6*" align="center"/>
43190 <colspec colwidth="6*" align="center"/>
43191 <colspec colwidth="6*" align="right"/>
43192 <tbody>
43193 <row>
43194 <entry><option>log_fail_output</option></entry>
43195 <entry>Use: <emphasis>pipe</emphasis></entry>
43196 <entry>Type: <emphasis>boolean</emphasis></entry>
43197 <entry>Default: <emphasis>false</emphasis></entry>
43198 </row>
43199 </tbody>
43200 </tgroup>
43201 </informaltable>
43202 <para>
43203 If this option is set, and the command returns any output, and also ends with a
43204 return code that is neither zero nor one of the return codes listed in
43205 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
43206 written to the main log. This option and <option>log_output</option> are mutually exclusive.
43207 Only one of them may be set.
43208 </para>
43209 <para>
43210 <indexterm role="option">
43211 <primary><option>log_output</option></primary>
43212 </indexterm>
43213 </para>
43214 <informaltable frame="all">
43215 <tgroup cols="4" colsep="0" rowsep="0">
43216 <colspec colwidth="8*" align="left"/>
43217 <colspec colwidth="6*" align="center"/>
43218 <colspec colwidth="6*" align="center"/>
43219 <colspec colwidth="6*" align="right"/>
43220 <tbody>
43221 <row>
43222 <entry><option>log_output</option></entry>
43223 <entry>Use: <emphasis>pipe</emphasis></entry>
43224 <entry>Type: <emphasis>boolean</emphasis></entry>
43225 <entry>Default: <emphasis>false</emphasis></entry>
43226 </row>
43227 </tbody>
43228 </tgroup>
43229 </informaltable>
43230 <para>
43231 If this option is set and the command returns any output, the first line of
43232 output is written to the main log, whatever the return code. This option and
43233 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
43234 </para>
43235 <para>
43236 <indexterm role="option">
43237 <primary><option>max_output</option></primary>
43238 </indexterm>
43239 </para>
43240 <informaltable frame="all">
43241 <tgroup cols="4" colsep="0" rowsep="0">
43242 <colspec colwidth="8*" align="left"/>
43243 <colspec colwidth="6*" align="center"/>
43244 <colspec colwidth="6*" align="center"/>
43245 <colspec colwidth="6*" align="right"/>
43246 <tbody>
43247 <row>
43248 <entry><option>max_output</option></entry>
43249 <entry>Use: <emphasis>pipe</emphasis></entry>
43250 <entry>Type: <emphasis>integer</emphasis></entry>
43251 <entry>Default: <emphasis>20K</emphasis></entry>
43252 </row>
43253 </tbody>
43254 </tgroup>
43255 </informaltable>
43256 <para>
43257 This specifies the maximum amount of output that the command may produce on its
43258 standard output and standard error file combined. If the limit is exceeded, the
43259 process running the command is killed. This is intended as a safety measure to
43260 catch runaway processes. The limit is applied independently of the settings of
43261 the options that control what is done with such output (for example,
43262 <option>return_output</option>). Because of buffering effects, the amount of output may
43263 exceed the limit by a small amount before Exim notices.
43264 </para>
43265 <para>
43266 <indexterm role="option">
43267 <primary><option>message_prefix</option></primary>
43268 </indexterm>
43269 </para>
43270 <informaltable frame="all">
43271 <tgroup cols="4" colsep="0" rowsep="0">
43272 <colspec colwidth="8*" align="left"/>
43273 <colspec colwidth="6*" align="center"/>
43274 <colspec colwidth="6*" align="center"/>
43275 <colspec colwidth="6*" align="right"/>
43276 <tbody>
43277 <row>
43278 <entry><option>message_prefix</option></entry>
43279 <entry>Use: <emphasis>pipe</emphasis></entry>
43280 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43281 <entry>Default: <emphasis>see below</emphasis></entry>
43282 </row>
43283 </tbody>
43284 </tgroup>
43285 </informaltable>
43286 <para>
43287 The string specified here is expanded and output at the start of every message.
43288 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
43289 </para>
43290 <literallayout class="monospaced">
43291 message_prefix = \
43292   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
43293   ${tod_bsdinbox}\n
43294 </literallayout>
43295 <para>
43296 <indexterm role="concept">
43297 <primary>Cyrus</primary>
43298 </indexterm>
43299 <indexterm role="concept">
43300 <primary><option>tmail</option></primary>
43301 </indexterm>
43302 <indexterm role="concept">
43303 <primary><quote>From</quote> line</primary>
43304 </indexterm>
43305 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
43306 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
43307 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
43308 setting
43309 </para>
43310 <literallayout class="monospaced">
43311 message_prefix =
43312 </literallayout>
43313 <para>
43314 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43315 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
43316 </para>
43317 <para>
43318 <indexterm role="option">
43319 <primary><option>message_suffix</option></primary>
43320 </indexterm>
43321 </para>
43322 <informaltable frame="all">
43323 <tgroup cols="4" colsep="0" rowsep="0">
43324 <colspec colwidth="8*" align="left"/>
43325 <colspec colwidth="6*" align="center"/>
43326 <colspec colwidth="6*" align="center"/>
43327 <colspec colwidth="6*" align="right"/>
43328 <tbody>
43329 <row>
43330 <entry><option>message_suffix</option></entry>
43331 <entry>Use: <emphasis>pipe</emphasis></entry>
43332 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43333 <entry>Default: <emphasis>see below</emphasis></entry>
43334 </row>
43335 </tbody>
43336 </tgroup>
43337 </informaltable>
43338 <para>
43339 The string specified here is expanded and output at the end of every message.
43340 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
43341 The suffix can be suppressed by setting
43342 </para>
43343 <literallayout class="monospaced">
43344 message_suffix =
43345 </literallayout>
43346 <para>
43347 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
43348 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
43349 </para>
43350 <para>
43351 <indexterm role="option">
43352 <primary><option>path</option></primary>
43353 </indexterm>
43354 </para>
43355 <informaltable frame="all">
43356 <tgroup cols="4" colsep="0" rowsep="0">
43357 <colspec colwidth="8*" align="left"/>
43358 <colspec colwidth="6*" align="center"/>
43359 <colspec colwidth="6*" align="center"/>
43360 <colspec colwidth="6*" align="right"/>
43361 <tbody>
43362 <row>
43363 <entry><option>path</option></entry>
43364 <entry>Use: <emphasis>pipe</emphasis></entry>
43365 <entry>Type: <emphasis>string</emphasis></entry>
43366 <entry>Default: <emphasis>see below</emphasis></entry>
43367 </row>
43368 </tbody>
43369 </tgroup>
43370 </informaltable>
43371 <para>
43372 This option specifies the string that is set up in the PATH environment
43373 variable of the subprocess. The default is:
43374 </para>
43375 <literallayout class="monospaced">
43376 /bin:/usr/bin
43377 </literallayout>
43378 <para>
43379 If the <option>command</option> option does not yield an absolute path name, the command is
43380 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
43381 apply to a command specified as a transport filter.
43382 </para>
43383 <para>
43384 <indexterm role="option">
43385 <primary><option>permit_coredump</option></primary>
43386 </indexterm>
43387 </para>
43388 <informaltable frame="all">
43389 <tgroup cols="4" colsep="0" rowsep="0">
43390 <colspec colwidth="8*" align="left"/>
43391 <colspec colwidth="6*" align="center"/>
43392 <colspec colwidth="6*" align="center"/>
43393 <colspec colwidth="6*" align="right"/>
43394 <tbody>
43395 <row>
43396 <entry><option>permit_coredump</option></entry>
43397 <entry>Use: <emphasis>pipe</emphasis></entry>
43398 <entry>Type: <emphasis>boolean</emphasis></entry>
43399 <entry>Default: <emphasis>false</emphasis></entry>
43400 </row>
43401 </tbody>
43402 </tgroup>
43403 </informaltable>
43404 <para>
43405 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
43406 a core-dump of a pipe command, enable this command.  This enables core-dumps
43407 during delivery and affects both the Exim binary and the pipe command run.
43408 It is recommended that this option remain off unless and until you have a need
43409 for it and that this only be enabled when needed, as the risk of excessive
43410 resource consumption can be quite high.  Note also that Exim is typically
43411 installed as a setuid binary and most operating systems will inhibit coredumps
43412 of these by default, so further OS-specific action may be required.
43413 </para>
43414 <para>
43415 <indexterm role="option">
43416 <primary><option>pipe_as_creator</option></primary>
43417 </indexterm>
43418 </para>
43419 <informaltable frame="all">
43420 <tgroup cols="4" colsep="0" rowsep="0">
43421 <colspec colwidth="8*" align="left"/>
43422 <colspec colwidth="6*" align="center"/>
43423 <colspec colwidth="6*" align="center"/>
43424 <colspec colwidth="6*" align="right"/>
43425 <tbody>
43426 <row>
43427 <entry><option>pipe_as_creator</option></entry>
43428 <entry>Use: <emphasis>pipe</emphasis></entry>
43429 <entry>Type: <emphasis>boolean</emphasis></entry>
43430 <entry>Default: <emphasis>false</emphasis></entry>
43431 </row>
43432 </tbody>
43433 </tgroup>
43434 </informaltable>
43435 <para>
43436 <indexterm role="concept">
43437 <primary>uid (user id)</primary>
43438 <secondary>local delivery</secondary>
43439 </indexterm>
43440 If the generic <option>user</option> option is not set and this option is true, the delivery
43441 process is run under the uid that was in force when Exim was originally called
43442 to accept the message. If the group id is not otherwise set (via the generic
43443 <option>group</option> option), the gid that was in force when Exim was originally called to
43444 accept the message is used.
43445 </para>
43446 <para>
43447 <indexterm role="option">
43448 <primary><option>restrict_to_path</option></primary>
43449 </indexterm>
43450 </para>
43451 <informaltable frame="all">
43452 <tgroup cols="4" colsep="0" rowsep="0">
43453 <colspec colwidth="8*" align="left"/>
43454 <colspec colwidth="6*" align="center"/>
43455 <colspec colwidth="6*" align="center"/>
43456 <colspec colwidth="6*" align="right"/>
43457 <tbody>
43458 <row>
43459 <entry><option>restrict_to_path</option></entry>
43460 <entry>Use: <emphasis>pipe</emphasis></entry>
43461 <entry>Type: <emphasis>boolean</emphasis></entry>
43462 <entry>Default: <emphasis>false</emphasis></entry>
43463 </row>
43464 </tbody>
43465 </tgroup>
43466 </informaltable>
43467 <para>
43468 When this option is set, any command name not listed in <option>allow_commands</option> must
43469 contain no slashes. The command is searched for only in the directories listed
43470 in the <option>path</option> option. This option is intended for use in the case when a pipe
43471 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
43472 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
43473 </para>
43474 <para>
43475 <indexterm role="option">
43476 <primary><option>return_fail_output</option></primary>
43477 </indexterm>
43478 </para>
43479 <informaltable frame="all">
43480 <tgroup cols="4" colsep="0" rowsep="0">
43481 <colspec colwidth="8*" align="left"/>
43482 <colspec colwidth="6*" align="center"/>
43483 <colspec colwidth="6*" align="center"/>
43484 <colspec colwidth="6*" align="right"/>
43485 <tbody>
43486 <row>
43487 <entry><option>return_fail_output</option></entry>
43488 <entry>Use: <emphasis>pipe</emphasis></entry>
43489 <entry>Type: <emphasis>boolean</emphasis></entry>
43490 <entry>Default: <emphasis>false</emphasis></entry>
43491 </row>
43492 </tbody>
43493 </tgroup>
43494 </informaltable>
43495 <para>
43496 If this option is true, and the command produced any output and ended with a
43497 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
43498 is, the delivery failed), the output is returned in the bounce message.
43499 However, if the message has a null sender (that is, it is itself a bounce
43500 message), output from the command is discarded. This option and
43501 <option>return_output</option> are mutually exclusive. Only one of them may be set.
43502 </para>
43503 <para>
43504 <indexterm role="option">
43505 <primary><option>return_output</option></primary>
43506 </indexterm>
43507 </para>
43508 <informaltable frame="all">
43509 <tgroup cols="4" colsep="0" rowsep="0">
43510 <colspec colwidth="8*" align="left"/>
43511 <colspec colwidth="6*" align="center"/>
43512 <colspec colwidth="6*" align="center"/>
43513 <colspec colwidth="6*" align="right"/>
43514 <tbody>
43515 <row>
43516 <entry><option>return_output</option></entry>
43517 <entry>Use: <emphasis>pipe</emphasis></entry>
43518 <entry>Type: <emphasis>boolean</emphasis></entry>
43519 <entry>Default: <emphasis>false</emphasis></entry>
43520 </row>
43521 </tbody>
43522 </tgroup>
43523 </informaltable>
43524 <para>
43525 If this option is true, and the command produced any output, the delivery is
43526 deemed to have failed whatever the return code from the command, and the output
43527 is returned in the bounce message. Otherwise, the output is just discarded.
43528 However, if the message has a null sender (that is, it is a bounce message),
43529 output from the command is always discarded, whatever the setting of this
43530 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
43531 of them may be set.
43532 </para>
43533 <para>
43534 <indexterm role="option">
43535 <primary><option>temp_errors</option></primary>
43536 </indexterm>
43537 </para>
43538 <informaltable frame="all">
43539 <tgroup cols="4" colsep="0" rowsep="0">
43540 <colspec colwidth="8*" align="left"/>
43541 <colspec colwidth="6*" align="center"/>
43542 <colspec colwidth="6*" align="center"/>
43543 <colspec colwidth="6*" align="right"/>
43544 <tbody>
43545 <row>
43546 <entry><option>temp_errors</option></entry>
43547 <entry>Use: <emphasis>pipe</emphasis></entry>
43548 <entry>Type: <emphasis>string list</emphasis></entry>
43549 <entry>Default: <emphasis>see below</emphasis></entry>
43550 </row>
43551 </tbody>
43552 </tgroup>
43553 </informaltable>
43554 <para>
43555 <indexterm role="concept">
43556 <primary><command>pipe</command> transport</primary>
43557 <secondary>temporary failure</secondary>
43558 </indexterm>
43559 This option contains either a colon-separated list of numbers, or a single
43560 asterisk. If <option>ignore_status</option> is false
43561 and <option>return_output</option> is not set,
43562 and the command exits with a non-zero return code, the failure is treated as
43563 temporary and the delivery is deferred if the return code matches one of the
43564 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
43565 codes are treated as permanent errors. The default setting contains the codes
43566 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
43567 compiled on a system that does not define these macros, it assumes values of 75
43568 and 73, respectively.
43569 </para>
43570 <para>
43571 <indexterm role="option">
43572 <primary><option>timeout</option></primary>
43573 </indexterm>
43574 </para>
43575 <informaltable frame="all">
43576 <tgroup cols="4" colsep="0" rowsep="0">
43577 <colspec colwidth="8*" align="left"/>
43578 <colspec colwidth="6*" align="center"/>
43579 <colspec colwidth="6*" align="center"/>
43580 <colspec colwidth="6*" align="right"/>
43581 <tbody>
43582 <row>
43583 <entry><option>timeout</option></entry>
43584 <entry>Use: <emphasis>pipe</emphasis></entry>
43585 <entry>Type: <emphasis>time</emphasis></entry>
43586 <entry>Default: <emphasis>1h</emphasis></entry>
43587 </row>
43588 </tbody>
43589 </tgroup>
43590 </informaltable>
43591 <para>
43592 If the command fails to complete within this time, it is killed. This normally
43593 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
43594 specifies no timeout. In order to ensure that any subprocesses created by the
43595 command are also killed, Exim makes the initial process a process group leader,
43596 and kills the whole process group on a timeout. However, this can be defeated
43597 if one of the processes starts a new process group.
43598 </para>
43599 <para>
43600 <indexterm role="option">
43601 <primary><option>timeout_defer</option></primary>
43602 </indexterm>
43603 </para>
43604 <informaltable frame="all">
43605 <tgroup cols="4" colsep="0" rowsep="0">
43606 <colspec colwidth="8*" align="left"/>
43607 <colspec colwidth="6*" align="center"/>
43608 <colspec colwidth="6*" align="center"/>
43609 <colspec colwidth="6*" align="right"/>
43610 <tbody>
43611 <row>
43612 <entry><option>timeout_defer</option></entry>
43613 <entry>Use: <emphasis>pipe</emphasis></entry>
43614 <entry>Type: <emphasis>boolean</emphasis></entry>
43615 <entry>Default: <emphasis>false</emphasis></entry>
43616 </row>
43617 </tbody>
43618 </tgroup>
43619 </informaltable>
43620 <para>
43621 A timeout in a <command>pipe</command> transport, either in the command that the transport
43622 runs, or in a transport filter that is associated with it, is by default
43623 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
43624 is set true, both kinds of timeout become temporary errors, causing the
43625 delivery to be deferred.
43626 </para>
43627 <para>
43628 <indexterm role="option">
43629 <primary><option>umask</option></primary>
43630 </indexterm>
43631 </para>
43632 <informaltable frame="all">
43633 <tgroup cols="4" colsep="0" rowsep="0">
43634 <colspec colwidth="8*" align="left"/>
43635 <colspec colwidth="6*" align="center"/>
43636 <colspec colwidth="6*" align="center"/>
43637 <colspec colwidth="6*" align="right"/>
43638 <tbody>
43639 <row>
43640 <entry><option>umask</option></entry>
43641 <entry>Use: <emphasis>pipe</emphasis></entry>
43642 <entry>Type: <emphasis>octal integer</emphasis></entry>
43643 <entry>Default: <emphasis>022</emphasis></entry>
43644 </row>
43645 </tbody>
43646 </tgroup>
43647 </informaltable>
43648 <para>
43649 This specifies the umask setting for the subprocess that runs the command.
43650 </para>
43651 <para>
43652 <indexterm role="option">
43653 <primary><option>use_bsmtp</option></primary>
43654 </indexterm>
43655 </para>
43656 <informaltable frame="all">
43657 <tgroup cols="4" colsep="0" rowsep="0">
43658 <colspec colwidth="8*" align="left"/>
43659 <colspec colwidth="6*" align="center"/>
43660 <colspec colwidth="6*" align="center"/>
43661 <colspec colwidth="6*" align="right"/>
43662 <tbody>
43663 <row>
43664 <entry><option>use_bsmtp</option></entry>
43665 <entry>Use: <emphasis>pipe</emphasis></entry>
43666 <entry>Type: <emphasis>boolean</emphasis></entry>
43667 <entry>Default: <emphasis>false</emphasis></entry>
43668 </row>
43669 </tbody>
43670 </tgroup>
43671 </informaltable>
43672 <para>
43673 <indexterm role="concept">
43674 <primary>envelope sender</primary>
43675 </indexterm>
43676 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
43677 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
43678 commands. If you want to include a leading HELO command with such messages,
43679 you can do so by setting the <option>message_prefix</option> option. See section
43680 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
43681 </para>
43682 <para>
43683 <indexterm role="option">
43684 <primary><option>use_classresources</option></primary>
43685 </indexterm>
43686 </para>
43687 <informaltable frame="all">
43688 <tgroup cols="4" colsep="0" rowsep="0">
43689 <colspec colwidth="8*" align="left"/>
43690 <colspec colwidth="6*" align="center"/>
43691 <colspec colwidth="6*" align="center"/>
43692 <colspec colwidth="6*" align="right"/>
43693 <tbody>
43694 <row>
43695 <entry><option>use_classresources</option></entry>
43696 <entry>Use: <emphasis>pipe</emphasis></entry>
43697 <entry>Type: <emphasis>boolean</emphasis></entry>
43698 <entry>Default: <emphasis>false</emphasis></entry>
43699 </row>
43700 </tbody>
43701 </tgroup>
43702 </informaltable>
43703 <para>
43704 <indexterm role="concept">
43705 <primary>class resources (BSD)</primary>
43706 </indexterm>
43707 This option is available only when Exim is running on FreeBSD, NetBSD, or
43708 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
43709 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
43710 limits for the uid under which the pipe is to run are obtained from the login
43711 class database.
43712 </para>
43713 <para>
43714 <indexterm role="option">
43715 <primary><option>use_crlf</option></primary>
43716 </indexterm>
43717 </para>
43718 <informaltable frame="all">
43719 <tgroup cols="4" colsep="0" rowsep="0">
43720 <colspec colwidth="8*" align="left"/>
43721 <colspec colwidth="6*" align="center"/>
43722 <colspec colwidth="6*" align="center"/>
43723 <colspec colwidth="6*" align="right"/>
43724 <tbody>
43725 <row>
43726 <entry><option>use_crlf</option></entry>
43727 <entry>Use: <emphasis>pipe</emphasis></entry>
43728 <entry>Type: <emphasis>boolean</emphasis></entry>
43729 <entry>Default: <emphasis>false</emphasis></entry>
43730 </row>
43731 </tbody>
43732 </tgroup>
43733 </informaltable>
43734 <para>
43735 <indexterm role="concept">
43736 <primary>carriage return</primary>
43737 </indexterm>
43738 <indexterm role="concept">
43739 <primary>linefeed</primary>
43740 </indexterm>
43741 This option causes lines to be terminated with the two-character CRLF sequence
43742 (carriage return, linefeed) instead of just a linefeed character. In the case
43743 of batched SMTP, the byte sequence written to the pipe is then an exact image
43744 of what would be sent down a real SMTP connection.
43745 </para>
43746 <para>
43747 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
43748 written verbatim, so must contain their own carriage return characters if these
43749 are needed. When <option>use_bsmtp</option> is not set, the default values for both
43750 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
43751 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
43752 </para>
43753 <para>
43754 <indexterm role="option">
43755 <primary><option>use_shell</option></primary>
43756 </indexterm>
43757 </para>
43758 <informaltable frame="all">
43759 <tgroup cols="4" colsep="0" rowsep="0">
43760 <colspec colwidth="8*" align="left"/>
43761 <colspec colwidth="6*" align="center"/>
43762 <colspec colwidth="6*" align="center"/>
43763 <colspec colwidth="6*" align="right"/>
43764 <tbody>
43765 <row>
43766 <entry><option>use_shell</option></entry>
43767 <entry>Use: <emphasis>pipe</emphasis></entry>
43768 <entry>Type: <emphasis>boolean</emphasis></entry>
43769 <entry>Default: <emphasis>false</emphasis></entry>
43770 </row>
43771 </tbody>
43772 </tgroup>
43773 </informaltable>
43774 <para>
43775 <indexterm role="variable">
43776 <primary><varname>$pipe_addresses</varname></primary>
43777 </indexterm>
43778 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
43779 instead of being run directly from the transport, as described in section
43780 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
43781 where the command is expected to be run under a shell and cannot easily be
43782 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
43783 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
43784 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
43785 its <option>-c</option> option.
43786 </para>
43787 </section>
43788 <section id="SECID143">
43789 <title>Using an external local delivery agent</title>
43790 <para>
43791 <indexterm role="concept">
43792 <primary>local delivery</primary>
43793 <secondary>using an external agent</secondary>
43794 </indexterm>
43795 <indexterm role="concept">
43796 <primary><emphasis>procmail</emphasis></primary>
43797 </indexterm>
43798 <indexterm role="concept">
43799 <primary>external local delivery</primary>
43800 </indexterm>
43801 <indexterm role="concept">
43802 <primary>delivery</primary>
43803 <secondary><emphasis>procmail</emphasis></secondary>
43804 </indexterm>
43805 <indexterm role="concept">
43806 <primary>delivery</primary>
43807 <secondary>by external agent</secondary>
43808 </indexterm>
43809 The <command>pipe</command> transport can be used to pass all messages that require local
43810 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
43811 this, care must be taken to ensure that the pipe is run under an appropriate
43812 uid and gid. In some configurations one wants this to be a uid that is trusted
43813 by the delivery agent to supply the correct sender of the message. It may be
43814 necessary to recompile or reconfigure the delivery agent so that it trusts an
43815 appropriate user. The following is an example transport and router
43816 configuration for <option>procmail</option>:
43817 </para>
43818 <literallayout class="monospaced">
43819 # transport
43820 procmail_pipe:
43821   driver = pipe
43822   command = /usr/local/bin/procmail -d $local_part
43823   return_path_add
43824   delivery_date_add
43825   envelope_to_add
43826   check_string = "From "
43827   escape_string = "&gt;From "
43828   umask = 077
43829   user = $local_part
43830   group = mail
43831
43832 # router
43833 procmail:
43834   driver = accept
43835   check_local_user
43836   transport = procmail_pipe
43837 </literallayout>
43838 <para>
43839 In this example, the pipe is run as the local user, but with the group set to
43840 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
43841 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
43842 user to supply a correct sender address. If you do not specify either a
43843 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
43844 home directory is the user&#x2019;s home directory by default.
43845 </para>
43846 <para>
43847 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
43848 </para>
43849 <literallayout class="monospaced">
43850 IFS=" "
43851 </literallayout>
43852 <para>
43853 as shown in some <option>procmail</option> documentation, because Exim does not by default
43854 use a shell to run pipe commands.
43855 </para>
43856 <para>
43857 <indexterm role="concept">
43858 <primary>Cyrus</primary>
43859 </indexterm>
43860 The next example shows a transport and a router for a system where local
43861 deliveries are handled by the Cyrus IMAP server.
43862 </para>
43863 <literallayout class="monospaced">
43864 # transport
43865 local_delivery_cyrus:
43866   driver = pipe
43867   command = /usr/cyrus/bin/deliver \
43868             -m ${substr_1:$local_part_suffix} -- $local_part
43869   user = cyrus
43870   group = mail
43871   return_output
43872   log_output
43873   message_prefix =
43874   message_suffix =
43875
43876 # router
43877 local_user_cyrus:
43878   driver = accept
43879   check_local_user
43880   local_part_suffix = .*
43881   transport = local_delivery_cyrus
43882 </literallayout>
43883 <para>
43884 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
43885 <option>return_output</option> to cause any text written by Cyrus to be returned to the
43886 sender.
43887 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
43888 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
43889 </para>
43890 </section>
43891 </chapter>
43892
43893 <chapter id="CHAPsmtptrans">
43894 <title>The smtp transport</title>
43895 <para>
43896 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
43897 <primary>transports</primary>
43898 <secondary><command>smtp</command></secondary>
43899 </indexterm>
43900 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
43901 <primary><command>smtp</command> transport</primary>
43902 </indexterm>
43903 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
43904 or LMTP protocol. The list of hosts to try can either be taken from the address
43905 that is being processed (having been set up by the router), or specified
43906 explicitly for the transport. Timeout and retry processing (see chapter
43907 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
43908 </para>
43909 <section id="SECID144">
43910 <title>Multiple messages on a single connection</title>
43911 <para>
43912 The sending of multiple messages over a single TCP/IP connection can arise in
43913 two ways:
43914 </para>
43915 <itemizedlist>
43916 <listitem>
43917 <para>
43918 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
43919 routed to the same host, more than one copy of the message has to be sent to
43920 that host. In this situation, multiple copies may be sent in a single run of
43921 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
43922 does when it has too many addresses to send in one message also depends on the
43923 value of the global <option>remote_max_parallel</option> option. Details are given in
43924 section <xref linkend="SECToutSMTPTCP"/>.)
43925 </para>
43926 </listitem>
43927 <listitem>
43928 <para>
43929 <indexterm role="concept">
43930 <primary>hints database</primary>
43931 <secondary>remembering routing</secondary>
43932 </indexterm>
43933 When a message has been successfully delivered over a TCP/IP connection, Exim
43934 looks in its hints database to see if there are any other messages awaiting a
43935 connection to the same host. If there are, a new delivery process is started
43936 for one of them, and the current TCP/IP connection is passed on to it. The new
43937 process may in turn send multiple copies and possibly create yet another
43938 process.
43939 </para>
43940 </listitem>
43941 </itemizedlist>
43942 <para>
43943 For each copy sent over the same TCP/IP connection, a sequence counter is
43944 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
43945 no further messages are sent over that connection.
43946 </para>
43947 </section>
43948 <section id="SECID145">
43949 <title>Use of the $host and $host_address variables</title>
43950 <para>
43951 <indexterm role="variable">
43952 <primary><varname>$host</varname></primary>
43953 </indexterm>
43954 <indexterm role="variable">
43955 <primary><varname>$host_address</varname></primary>
43956 </indexterm>
43957 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
43958 <varname>$host_address</varname> are the name and IP address of the first host on the host list
43959 passed by the router. However, when the transport is about to connect to a
43960 specific host, and while it is connected to that host, <varname>$host</varname> and
43961 <varname>$host_address</varname> are set to the values for that host. These are the values
43962 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
43963 <option>serialize_hosts</option>, and the various TLS options are expanded.
43964 </para>
43965 </section>
43966 <section id="usecippeer">
43967 <title>Use of $tls_cipher and $tls_peerdn</title>
43968 <para>
43969 <indexterm role="variable">
43970 <primary><varname>$tls_bits</varname></primary>
43971 </indexterm>
43972 <indexterm role="variable">
43973 <primary><varname>$tls_cipher</varname></primary>
43974 </indexterm>
43975 <indexterm role="variable">
43976 <primary><varname>$tls_peerdn</varname></primary>
43977 </indexterm>
43978 <indexterm role="variable">
43979 <primary><varname>$tls_sni</varname></primary>
43980 </indexterm>
43981 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
43982 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
43983 are the values that were set when the message was received.
43984 These are the values that are used for options that are expanded before any
43985 SMTP connections are made. Just before each connection is made, these four
43986 variables are emptied. If TLS is subsequently started, they are set to the
43987 appropriate values for the outgoing connection, and these are the values that
43988 are in force when any authenticators are run and when the
43989 <option>authenticated_sender</option> option is expanded.
43990 </para>
43991 <para>
43992 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
43993 and will be removed in a future release.
43994 </para>
43995 </section>
43996 <section id="SECID146">
43997 <title>Private options for smtp</title>
43998 <para>
43999 <indexterm role="concept">
44000 <primary>options</primary>
44001 <secondary><command>smtp</command> transport</secondary>
44002 </indexterm>
44003 The private options of the <command>smtp</command> transport are as follows:
44004 </para>
44005 <para>
44006 <indexterm role="option">
44007 <primary><option>address_retry_include_sender</option></primary>
44008 </indexterm>
44009 </para>
44010 <informaltable frame="all">
44011 <tgroup cols="4" colsep="0" rowsep="0">
44012 <colspec colwidth="8*" align="left"/>
44013 <colspec colwidth="6*" align="center"/>
44014 <colspec colwidth="6*" align="center"/>
44015 <colspec colwidth="6*" align="right"/>
44016 <tbody>
44017 <row>
44018 <entry><option>address_retry_include_sender</option></entry>
44019 <entry>Use: <emphasis>smtp</emphasis></entry>
44020 <entry>Type: <emphasis>boolean</emphasis></entry>
44021 <entry>Default: <emphasis>true</emphasis></entry>
44022 </row>
44023 </tbody>
44024 </tgroup>
44025 </informaltable>
44026 <para>
44027 <indexterm role="concept">
44028 <primary>4<emphasis>xx</emphasis> responses</primary>
44029 <secondary>retrying after</secondary>
44030 </indexterm>
44031 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
44032 is the combination of sender and recipient that is delayed in subsequent queue
44033 runs until the retry time is reached. You can delay the recipient without
44034 reference to the sender (which is what earlier versions of Exim did), by
44035 setting <option>address_retry_include_sender</option> false. However, this can lead to
44036 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
44037 </para>
44038 <para>
44039 <indexterm role="option">
44040 <primary><option>allow_localhost</option></primary>
44041 </indexterm>
44042 </para>
44043 <informaltable frame="all">
44044 <tgroup cols="4" colsep="0" rowsep="0">
44045 <colspec colwidth="8*" align="left"/>
44046 <colspec colwidth="6*" align="center"/>
44047 <colspec colwidth="6*" align="center"/>
44048 <colspec colwidth="6*" align="right"/>
44049 <tbody>
44050 <row>
44051 <entry><option>allow_localhost</option></entry>
44052 <entry>Use: <emphasis>smtp</emphasis></entry>
44053 <entry>Type: <emphasis>boolean</emphasis></entry>
44054 <entry>Default: <emphasis>false</emphasis></entry>
44055 </row>
44056 </tbody>
44057 </tgroup>
44058 </informaltable>
44059 <para>
44060 <indexterm role="concept">
44061 <primary>local host</primary>
44062 <secondary>sending to</secondary>
44063 </indexterm>
44064 <indexterm role="concept">
44065 <primary>fallback</primary>
44066 <secondary>hosts specified on transport</secondary>
44067 </indexterm>
44068 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
44069 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
44070 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
44071 the delivery anyway. This should be used only in special cases when the
44072 configuration ensures that no looping will result (for example, a differently
44073 configured Exim is listening on the port to which the message is sent).
44074 </para>
44075 <para>
44076 <indexterm role="option">
44077 <primary><option>authenticated_sender</option></primary>
44078 </indexterm>
44079 </para>
44080 <informaltable frame="all">
44081 <tgroup cols="4" colsep="0" rowsep="0">
44082 <colspec colwidth="8*" align="left"/>
44083 <colspec colwidth="6*" align="center"/>
44084 <colspec colwidth="6*" align="center"/>
44085 <colspec colwidth="6*" align="right"/>
44086 <tbody>
44087 <row>
44088 <entry><option>authenticated_sender</option></entry>
44089 <entry>Use: <emphasis>smtp</emphasis></entry>
44090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44091 <entry>Default: <emphasis>unset</emphasis></entry>
44092 </row>
44093 </tbody>
44094 </tgroup>
44095 </informaltable>
44096 <para>
44097 <indexterm role="concept">
44098 <primary>Cyrus</primary>
44099 </indexterm>
44100 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
44101 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
44102 overriding any existing authenticated sender value. If the string expansion is
44103 forced to fail, the option is ignored. Other expansion failures cause delivery
44104 to be deferred. If the result of expansion is an empty string, that is also
44105 ignored.
44106 </para>
44107 <para>
44108 The expansion happens after the outgoing connection has been made and TLS
44109 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
44110 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
44111 particular connection.
44112 </para>
44113 <para>
44114 If the SMTP session is not authenticated, the expansion of
44115 <option>authenticated_sender</option> still happens (and can cause the delivery to be
44116 deferred if it fails), but no AUTH= item is added to MAIL commands
44117 unless <option>authenticated_sender_force</option> is true.
44118 </para>
44119 <para>
44120 This option allows you to use the <command>smtp</command> transport in LMTP mode to
44121 deliver mail to Cyrus IMAP and provide the proper local part as the
44122 <quote>authenticated sender</quote>, via a setting such as:
44123 </para>
44124 <literallayout class="monospaced">
44125 authenticated_sender = $local_part
44126 </literallayout>
44127 <para>
44128 This removes the need for IMAP subfolders to be assigned special ACLs to
44129 allow direct delivery to those subfolders.
44130 </para>
44131 <para>
44132 Because of expected uses such as that just described for Cyrus (when no
44133 domain is involved), there is no checking on the syntax of the provided
44134 value.
44135 </para>
44136 <para>
44137 <indexterm role="option">
44138 <primary><option>authenticated_sender_force</option></primary>
44139 </indexterm>
44140 </para>
44141 <informaltable frame="all">
44142 <tgroup cols="4" colsep="0" rowsep="0">
44143 <colspec colwidth="8*" align="left"/>
44144 <colspec colwidth="6*" align="center"/>
44145 <colspec colwidth="6*" align="center"/>
44146 <colspec colwidth="6*" align="right"/>
44147 <tbody>
44148 <row>
44149 <entry><option>authenticated_sender_force</option></entry>
44150 <entry>Use: <emphasis>smtp</emphasis></entry>
44151 <entry>Type: <emphasis>boolean</emphasis></entry>
44152 <entry>Default: <emphasis>false</emphasis></entry>
44153 </row>
44154 </tbody>
44155 </tgroup>
44156 </informaltable>
44157 <para>
44158 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
44159 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
44160 authenticated as a client.
44161 </para>
44162 <para>
44163 <indexterm role="option">
44164 <primary><option>command_timeout</option></primary>
44165 </indexterm>
44166 </para>
44167 <informaltable frame="all">
44168 <tgroup cols="4" colsep="0" rowsep="0">
44169 <colspec colwidth="8*" align="left"/>
44170 <colspec colwidth="6*" align="center"/>
44171 <colspec colwidth="6*" align="center"/>
44172 <colspec colwidth="6*" align="right"/>
44173 <tbody>
44174 <row>
44175 <entry><option>command_timeout</option></entry>
44176 <entry>Use: <emphasis>smtp</emphasis></entry>
44177 <entry>Type: <emphasis>time</emphasis></entry>
44178 <entry>Default: <emphasis>5m</emphasis></entry>
44179 </row>
44180 </tbody>
44181 </tgroup>
44182 </informaltable>
44183 <para>
44184 This sets a timeout for receiving a response to an SMTP command that has been
44185 sent out. It is also used when waiting for the initial banner line from the
44186 remote host. Its value must not be zero.
44187 </para>
44188 <para>
44189 <indexterm role="option">
44190 <primary><option>connect_timeout</option></primary>
44191 </indexterm>
44192 </para>
44193 <informaltable frame="all">
44194 <tgroup cols="4" colsep="0" rowsep="0">
44195 <colspec colwidth="8*" align="left"/>
44196 <colspec colwidth="6*" align="center"/>
44197 <colspec colwidth="6*" align="center"/>
44198 <colspec colwidth="6*" align="right"/>
44199 <tbody>
44200 <row>
44201 <entry><option>connect_timeout</option></entry>
44202 <entry>Use: <emphasis>smtp</emphasis></entry>
44203 <entry>Type: <emphasis>time</emphasis></entry>
44204 <entry>Default: <emphasis>5m</emphasis></entry>
44205 </row>
44206 </tbody>
44207 </tgroup>
44208 </informaltable>
44209 <para>
44210 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
44211 to a remote host. A setting of zero allows the system timeout (typically
44212 several minutes) to act. To have any effect, the value of this option must be
44213 less than the system timeout. However, it has been observed that on some
44214 systems there is no system timeout, which is why the default value for this
44215 option is 5 minutes, a value recommended by RFC 1123.
44216 </para>
44217 <para>
44218 <indexterm role="option">
44219 <primary><option>connection_max_messages</option></primary>
44220 </indexterm>
44221 </para>
44222 <informaltable frame="all">
44223 <tgroup cols="4" colsep="0" rowsep="0">
44224 <colspec colwidth="8*" align="left"/>
44225 <colspec colwidth="6*" align="center"/>
44226 <colspec colwidth="6*" align="center"/>
44227 <colspec colwidth="6*" align="right"/>
44228 <tbody>
44229 <row>
44230 <entry><option>connection_max_messages</option></entry>
44231 <entry>Use: <emphasis>smtp</emphasis></entry>
44232 <entry>Type: <emphasis>integer</emphasis></entry>
44233 <entry>Default: <emphasis>500</emphasis></entry>
44234 </row>
44235 </tbody>
44236 </tgroup>
44237 </informaltable>
44238 <para>
44239 <indexterm role="concept">
44240 <primary>SMTP</primary>
44241 <secondary>passed connection</secondary>
44242 </indexterm>
44243 <indexterm role="concept">
44244 <primary>SMTP</primary>
44245 <secondary>multiple deliveries</secondary>
44246 </indexterm>
44247 <indexterm role="concept">
44248 <primary>multiple SMTP deliveries</primary>
44249 </indexterm>
44250 This controls the maximum number of separate message deliveries that are sent
44251 over a single TCP/IP connection. If the value is zero, there is no limit.
44252 For testing purposes, this value can be overridden by the <option>-oB</option> command line
44253 option.
44254 </para>
44255 <para>
44256 <indexterm role="option">
44257 <primary><option>data_timeout</option></primary>
44258 </indexterm>
44259 </para>
44260 <informaltable frame="all">
44261 <tgroup cols="4" colsep="0" rowsep="0">
44262 <colspec colwidth="8*" align="left"/>
44263 <colspec colwidth="6*" align="center"/>
44264 <colspec colwidth="6*" align="center"/>
44265 <colspec colwidth="6*" align="right"/>
44266 <tbody>
44267 <row>
44268 <entry><option>data_timeout</option></entry>
44269 <entry>Use: <emphasis>smtp</emphasis></entry>
44270 <entry>Type: <emphasis>time</emphasis></entry>
44271 <entry>Default: <emphasis>5m</emphasis></entry>
44272 </row>
44273 </tbody>
44274 </tgroup>
44275 </informaltable>
44276 <para>
44277 This sets a timeout for the transmission of each block in the data portion of
44278 the message. As a result, the overall timeout for a message depends on the size
44279 of the message. Its value must not be zero. See also <option>final_timeout</option>.
44280 </para>
44281 <para>
44282 <indexterm role="option">
44283 <primary><option>delay_after_cutoff</option></primary>
44284 </indexterm>
44285 </para>
44286 <informaltable frame="all">
44287 <tgroup cols="4" colsep="0" rowsep="0">
44288 <colspec colwidth="8*" align="left"/>
44289 <colspec colwidth="6*" align="center"/>
44290 <colspec colwidth="6*" align="center"/>
44291 <colspec colwidth="6*" align="right"/>
44292 <tbody>
44293 <row>
44294 <entry><option>delay_after_cutoff</option></entry>
44295 <entry>Use: <emphasis>smtp</emphasis></entry>
44296 <entry>Type: <emphasis>boolean</emphasis></entry>
44297 <entry>Default: <emphasis>true</emphasis></entry>
44298 </row>
44299 </tbody>
44300 </tgroup>
44301 </informaltable>
44302 <para>
44303 This option controls what happens when all remote IP addresses for a given
44304 domain have been inaccessible for so long that they have passed their retry
44305 cutoff times.
44306 </para>
44307 <para>
44308 In the default state, if the next retry time has not been reached for any of
44309 them, the address is bounced without trying any deliveries. In other words,
44310 Exim delays retrying an IP address after the final cutoff time until a new
44311 retry time is reached, and can therefore bounce an address without ever trying
44312 a delivery, when machines have been down for a long time. Some people are
44313 unhappy at this prospect, so...
44314 </para>
44315 <para>
44316 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44317 addresses are past their final cutoff time, Exim tries to deliver to those
44318 IP addresses that have not been tried since the message arrived. If there are
44319 none, of if they all fail, the address is bounced. In other words, it does not
44320 delay when a new message arrives, but immediately tries those expired IP
44321 addresses that haven&#x2019;t been tried since the message arrived. If there is a
44322 continuous stream of messages for the dead hosts, unsetting
44323 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
44324 to them.
44325 </para>
44326 <para>
44327 <indexterm role="option">
44328 <primary><option>dns_qualify_single</option></primary>
44329 </indexterm>
44330 </para>
44331 <informaltable frame="all">
44332 <tgroup cols="4" colsep="0" rowsep="0">
44333 <colspec colwidth="8*" align="left"/>
44334 <colspec colwidth="6*" align="center"/>
44335 <colspec colwidth="6*" align="center"/>
44336 <colspec colwidth="6*" align="right"/>
44337 <tbody>
44338 <row>
44339 <entry><option>dns_qualify_single</option></entry>
44340 <entry>Use: <emphasis>smtp</emphasis></entry>
44341 <entry>Type: <emphasis>boolean</emphasis></entry>
44342 <entry>Default: <emphasis>true</emphasis></entry>
44343 </row>
44344 </tbody>
44345 </tgroup>
44346 </informaltable>
44347 <para>
44348 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
44349 and the <option>gethostbyname</option> option is false,
44350 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
44351 in chapter <xref linkend="CHAPdnslookup"/> for more details.
44352 </para>
44353 <para>
44354 <indexterm role="option">
44355 <primary><option>dns_search_parents</option></primary>
44356 </indexterm>
44357 </para>
44358 <informaltable frame="all">
44359 <tgroup cols="4" colsep="0" rowsep="0">
44360 <colspec colwidth="8*" align="left"/>
44361 <colspec colwidth="6*" align="center"/>
44362 <colspec colwidth="6*" align="center"/>
44363 <colspec colwidth="6*" align="right"/>
44364 <tbody>
44365 <row>
44366 <entry><option>dns_search_parents</option></entry>
44367 <entry>Use: <emphasis>smtp</emphasis></entry>
44368 <entry>Type: <emphasis>boolean</emphasis></entry>
44369 <entry>Default: <emphasis>false</emphasis></entry>
44370 </row>
44371 </tbody>
44372 </tgroup>
44373 </informaltable>
44374 <para>
44375 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
44376 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
44377 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
44378 details.
44379 </para>
44380 <para>
44381 <indexterm role="option">
44382 <primary><option>dnssec_request_domains</option></primary>
44383 </indexterm>
44384 </para>
44385 <informaltable frame="all">
44386 <tgroup cols="4" colsep="0" rowsep="0">
44387 <colspec colwidth="8*" align="left"/>
44388 <colspec colwidth="6*" align="center"/>
44389 <colspec colwidth="6*" align="center"/>
44390 <colspec colwidth="6*" align="right"/>
44391 <tbody>
44392 <row>
44393 <entry><option>dnssec_request_domains</option></entry>
44394 <entry>Use: <emphasis>smtp</emphasis></entry>
44395 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44396 <entry>Default: <emphasis>unset</emphasis></entry>
44397 </row>
44398 </tbody>
44399 </tgroup>
44400 </informaltable>
44401 <para>
44402 <indexterm role="concept">
44403 <primary>MX record</primary>
44404 <secondary>security</secondary>
44405 </indexterm>
44406 <indexterm role="concept">
44407 <primary>DNSSEC</primary>
44408 <secondary>MX lookup</secondary>
44409 </indexterm>
44410 <indexterm role="concept">
44411 <primary>security</primary>
44412 <secondary>MX lookup</secondary>
44413 </indexterm>
44414 <indexterm role="concept">
44415 <primary>DNS</primary>
44416 <secondary>DNSSEC</secondary>
44417 </indexterm>
44418 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44419 the dnssec request bit set.
44420 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44421 </para>
44422 <para>
44423 <indexterm role="option">
44424 <primary><option>dnssec_require_domains</option></primary>
44425 </indexterm>
44426 </para>
44427 <informaltable frame="all">
44428 <tgroup cols="4" colsep="0" rowsep="0">
44429 <colspec colwidth="8*" align="left"/>
44430 <colspec colwidth="6*" align="center"/>
44431 <colspec colwidth="6*" align="center"/>
44432 <colspec colwidth="6*" align="right"/>
44433 <tbody>
44434 <row>
44435 <entry><option>dnssec_require_domains</option></entry>
44436 <entry>Use: <emphasis>smtp</emphasis></entry>
44437 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
44438 <entry>Default: <emphasis>unset</emphasis></entry>
44439 </row>
44440 </tbody>
44441 </tgroup>
44442 </informaltable>
44443 <para>
44444 <indexterm role="concept">
44445 <primary>MX record</primary>
44446 <secondary>security</secondary>
44447 </indexterm>
44448 <indexterm role="concept">
44449 <primary>DNSSEC</primary>
44450 <secondary>MX lookup</secondary>
44451 </indexterm>
44452 <indexterm role="concept">
44453 <primary>security</primary>
44454 <secondary>MX lookup</secondary>
44455 </indexterm>
44456 <indexterm role="concept">
44457 <primary>DNS</primary>
44458 <secondary>DNSSEC</secondary>
44459 </indexterm>
44460 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
44461 the dnssec request bit set.  Any returns not having the Authenticated Data bit
44462 (AD bit) set wil be ignored and logged as a host-lookup failure.
44463 This applies to all of the SRV, MX A6, AAAA, A lookup sequence.
44464 </para>
44465 <para>
44466 <indexterm role="option">
44467 <primary><option>dscp</option></primary>
44468 </indexterm>
44469 </para>
44470 <informaltable frame="all">
44471 <tgroup cols="4" colsep="0" rowsep="0">
44472 <colspec colwidth="8*" align="left"/>
44473 <colspec colwidth="6*" align="center"/>
44474 <colspec colwidth="6*" align="center"/>
44475 <colspec colwidth="6*" align="right"/>
44476 <tbody>
44477 <row>
44478 <entry><option>dscp</option></entry>
44479 <entry>Use: <emphasis>smtp</emphasis></entry>
44480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44481 <entry>Default: <emphasis>unset</emphasis></entry>
44482 </row>
44483 </tbody>
44484 </tgroup>
44485 </informaltable>
44486 <para>
44487 <indexterm role="concept">
44488 <primary>DCSP</primary>
44489 <secondary>outbound</secondary>
44490 </indexterm>
44491 This option causes the DSCP value associated with a socket to be set to one
44492 of a number of fixed strings or to numeric value.
44493 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
44494 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
44495 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
44496 </para>
44497 <para>
44498 The outbound packets from Exim will be marked with this value in the header
44499 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
44500 that these values will have any effect, not be stripped by networking
44501 equipment, or do much of anything without cooperation with your Network
44502 Engineer and those of all network operators between the source and destination.
44503 </para>
44504 <para>
44505 <indexterm role="option">
44506 <primary><option>fallback_hosts</option></primary>
44507 </indexterm>
44508 </para>
44509 <informaltable frame="all">
44510 <tgroup cols="4" colsep="0" rowsep="0">
44511 <colspec colwidth="8*" align="left"/>
44512 <colspec colwidth="6*" align="center"/>
44513 <colspec colwidth="6*" align="center"/>
44514 <colspec colwidth="6*" align="right"/>
44515 <tbody>
44516 <row>
44517 <entry><option>fallback_hosts</option></entry>
44518 <entry>Use: <emphasis>smtp</emphasis></entry>
44519 <entry>Type: <emphasis>string list</emphasis></entry>
44520 <entry>Default: <emphasis>unset</emphasis></entry>
44521 </row>
44522 </tbody>
44523 </tgroup>
44524 </informaltable>
44525 <para>
44526 <indexterm role="concept">
44527 <primary>fallback</primary>
44528 <secondary>hosts specified on transport</secondary>
44529 </indexterm>
44530 String expansion is not applied to this option. The argument must be a
44531 colon-separated list of host names or IP addresses, optionally also including
44532 port numbers, though the separator can be changed, as described in section
44533 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44534 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44535 in section <xref linkend="SECTformatonehostitem"/>.
44536 </para>
44537 <para>
44538 Fallback hosts can also be specified on routers, which associate them with the
44539 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
44540 <option>fallback_hosts</option> specified on the transport is used only if the address does
44541 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
44542 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
44543 However, <option>hosts_randomize</option> does apply to fallback host lists.
44544 </para>
44545 <para>
44546 If Exim is unable to deliver to any of the hosts for a particular address, and
44547 the errors are not permanent rejections, the address is put on a separate
44548 transport queue with its host list replaced by the fallback hosts, unless the
44549 address was routed via MX records and the current host was in the original MX
44550 list. In that situation, the fallback host list is not used.
44551 </para>
44552 <para>
44553 Once normal deliveries are complete, the fallback queue is delivered by
44554 re-running the same transports with the new host lists. If several failing
44555 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
44556 copy of the message is sent.
44557 </para>
44558 <para>
44559 The resolution of the host names on the fallback list is controlled by the
44560 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
44561 both to cases when the host list comes with the address and when it is taken
44562 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
44563 fails</quote> facility.
44564 </para>
44565 <para>
44566 <indexterm role="option">
44567 <primary><option>final_timeout</option></primary>
44568 </indexterm>
44569 </para>
44570 <informaltable frame="all">
44571 <tgroup cols="4" colsep="0" rowsep="0">
44572 <colspec colwidth="8*" align="left"/>
44573 <colspec colwidth="6*" align="center"/>
44574 <colspec colwidth="6*" align="center"/>
44575 <colspec colwidth="6*" align="right"/>
44576 <tbody>
44577 <row>
44578 <entry><option>final_timeout</option></entry>
44579 <entry>Use: <emphasis>smtp</emphasis></entry>
44580 <entry>Type: <emphasis>time</emphasis></entry>
44581 <entry>Default: <emphasis>10m</emphasis></entry>
44582 </row>
44583 </tbody>
44584 </tgroup>
44585 </informaltable>
44586 <para>
44587 This is the timeout that applies while waiting for the response to the final
44588 line containing just <quote>.</quote> that terminates a message. Its value must not be
44589 zero.
44590 </para>
44591 <para>
44592 <indexterm role="option">
44593 <primary><option>gethostbyname</option></primary>
44594 </indexterm>
44595 </para>
44596 <informaltable frame="all">
44597 <tgroup cols="4" colsep="0" rowsep="0">
44598 <colspec colwidth="8*" align="left"/>
44599 <colspec colwidth="6*" align="center"/>
44600 <colspec colwidth="6*" align="center"/>
44601 <colspec colwidth="6*" align="right"/>
44602 <tbody>
44603 <row>
44604 <entry><option>gethostbyname</option></entry>
44605 <entry>Use: <emphasis>smtp</emphasis></entry>
44606 <entry>Type: <emphasis>boolean</emphasis></entry>
44607 <entry>Default: <emphasis>false</emphasis></entry>
44608 </row>
44609 </tbody>
44610 </tgroup>
44611 </informaltable>
44612 <para>
44613 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
44614 being used, names are looked up using <function>gethostbyname()</function>
44615 (or <function>getipnodebyname()</function> when available)
44616 instead of using the DNS. Of course, that function may in fact use the DNS, but
44617 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
44618 </para>
44619 <para>
44620 <indexterm role="option">
44621 <primary><option>gnutls_compat_mode</option></primary>
44622 </indexterm>
44623 </para>
44624 <informaltable frame="all">
44625 <tgroup cols="4" colsep="0" rowsep="0">
44626 <colspec colwidth="8*" align="left"/>
44627 <colspec colwidth="6*" align="center"/>
44628 <colspec colwidth="6*" align="center"/>
44629 <colspec colwidth="6*" align="right"/>
44630 <tbody>
44631 <row>
44632 <entry><option>gnutls_compat_mode</option></entry>
44633 <entry>Use: <emphasis>smtp</emphasis></entry>
44634 <entry>Type: <emphasis>boolean</emphasis></entry>
44635 <entry>Default: <emphasis>unset</emphasis></entry>
44636 </row>
44637 </tbody>
44638 </tgroup>
44639 </informaltable>
44640 <para>
44641 This option controls whether GnuTLS is used in compatibility mode in an Exim
44642 server. This reduces security slightly, but improves interworking with older
44643 implementations of TLS.
44644 </para>
44645 <para>
44646 <indexterm role="option">
44647 <primary><option>helo_data</option></primary>
44648 </indexterm>
44649 </para>
44650 <informaltable frame="all">
44651 <tgroup cols="4" colsep="0" rowsep="0">
44652 <colspec colwidth="8*" align="left"/>
44653 <colspec colwidth="6*" align="center"/>
44654 <colspec colwidth="6*" align="center"/>
44655 <colspec colwidth="6*" align="right"/>
44656 <tbody>
44657 <row>
44658 <entry><option>helo_data</option></entry>
44659 <entry>Use: <emphasis>smtp</emphasis></entry>
44660 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44661 <entry>Default: <emphasis>see below</emphasis></entry>
44662 </row>
44663 </tbody>
44664 </tgroup>
44665 </informaltable>
44666 <para>
44667 <indexterm role="concept">
44668 <primary>HELO</primary>
44669 <secondary>argument, setting</secondary>
44670 </indexterm>
44671 <indexterm role="concept">
44672 <primary>EHLO</primary>
44673 <secondary>argument, setting</secondary>
44674 </indexterm>
44675 <indexterm role="concept">
44676 <primary>LHLO argument setting</primary>
44677 </indexterm>
44678 The value of this option is expanded after a connection to a another host has
44679 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
44680 command that starts the outgoing SMTP or LMTP session. The default value of the
44681 option is:
44682 </para>
44683 <literallayout class="monospaced">
44684 $primary_hostname
44685 </literallayout>
44686 <para>
44687 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
44688 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
44689 <varname>$sending_port</varname> are set to the local IP address and port number that are being
44690 used. These variables can be used to generate different values for different
44691 servers or different local IP addresses. For example, if you want the string
44692 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
44693 interface address, you could use this:
44694 </para>
44695 <literallayout class="monospaced">
44696 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
44697   {$primary_hostname}}
44698 </literallayout>
44699 <para>
44700 The use of <option>helo_data</option> applies both to sending messages and when doing
44701 callouts.
44702 </para>
44703 <para>
44704 <indexterm role="option">
44705 <primary><option>hosts</option></primary>
44706 </indexterm>
44707 </para>
44708 <informaltable frame="all">
44709 <tgroup cols="4" colsep="0" rowsep="0">
44710 <colspec colwidth="8*" align="left"/>
44711 <colspec colwidth="6*" align="center"/>
44712 <colspec colwidth="6*" align="center"/>
44713 <colspec colwidth="6*" align="right"/>
44714 <tbody>
44715 <row>
44716 <entry><option>hosts</option></entry>
44717 <entry>Use: <emphasis>smtp</emphasis></entry>
44718 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44719 <entry>Default: <emphasis>unset</emphasis></entry>
44720 </row>
44721 </tbody>
44722 </tgroup>
44723 </informaltable>
44724 <para>
44725 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
44726 finds the hosts by looking up the address domain in the DNS, or by
44727 <command>manualroute</command>, which has lists of hosts in its configuration. However,
44728 email addresses can be passed to the <command>smtp</command> transport by any router, and not
44729 all of them can provide an associated list of hosts.
44730 </para>
44731 <para>
44732 The <option>hosts</option> option specifies a list of hosts to be used if the address being
44733 processed does not have any hosts associated with it. The hosts specified by
44734 <option>hosts</option> are also used, whether or not the address has its own hosts, if
44735 <option>hosts_override</option> is set.
44736 </para>
44737 <para>
44738 The string is first expanded, before being interpreted as a colon-separated
44739 list of host names or IP addresses, possibly including port numbers. The
44740 separator may be changed to something other than colon, as described in section
44741 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
44742 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
44743 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
44744 of the <command>manualroute</command> router is not available here.
44745 </para>
44746 <para>
44747 If the expansion fails, delivery is deferred. Unless the failure was caused by
44748 the inability to complete a lookup, the error is logged to the panic log as
44749 well as the main log. Host names are looked up either by searching directly for
44750 address records in the DNS or by calling <function>gethostbyname()</function> (or
44751 <function>getipnodebyname()</function> when available), depending on the setting of the
44752 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
44753 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
44754 address are used.
44755 </para>
44756 <para>
44757 During delivery, the hosts are tried in order, subject to their retry status,
44758 unless <option>hosts_randomize</option> is set.
44759 </para>
44760 <para>
44761 <indexterm role="option">
44762 <primary><option>hosts_avoid_esmtp</option></primary>
44763 </indexterm>
44764 </para>
44765 <informaltable frame="all">
44766 <tgroup cols="4" colsep="0" rowsep="0">
44767 <colspec colwidth="8*" align="left"/>
44768 <colspec colwidth="6*" align="center"/>
44769 <colspec colwidth="6*" align="center"/>
44770 <colspec colwidth="6*" align="right"/>
44771 <tbody>
44772 <row>
44773 <entry><option>hosts_avoid_esmtp</option></entry>
44774 <entry>Use: <emphasis>smtp</emphasis></entry>
44775 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44776 <entry>Default: <emphasis>unset</emphasis></entry>
44777 </row>
44778 </tbody>
44779 </tgroup>
44780 </informaltable>
44781 <para>
44782 <indexterm role="concept">
44783 <primary>ESMTP, avoiding use of</primary>
44784 </indexterm>
44785 <indexterm role="concept">
44786 <primary>HELO</primary>
44787 <secondary>forcing use of</secondary>
44788 </indexterm>
44789 <indexterm role="concept">
44790 <primary>EHLO</primary>
44791 <secondary>avoiding use of</secondary>
44792 </indexterm>
44793 <indexterm role="concept">
44794 <primary>PIPELINING</primary>
44795 <secondary>avoiding the use of</secondary>
44796 </indexterm>
44797 This option is for use with broken hosts that announce ESMTP facilities (for
44798 example, PIPELINING) and then fail to implement them properly. When a host
44799 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
44800 start of the SMTP session. This means that it cannot use any of the ESMTP
44801 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
44802 </para>
44803 <para>
44804 <indexterm role="option">
44805 <primary><option>hosts_avoid_pipelining</option></primary>
44806 </indexterm>
44807 </para>
44808 <informaltable frame="all">
44809 <tgroup cols="4" colsep="0" rowsep="0">
44810 <colspec colwidth="8*" align="left"/>
44811 <colspec colwidth="6*" align="center"/>
44812 <colspec colwidth="6*" align="center"/>
44813 <colspec colwidth="6*" align="right"/>
44814 <tbody>
44815 <row>
44816 <entry><option>hosts_avoid_pipelining</option></entry>
44817 <entry>Use: <emphasis>smtp</emphasis></entry>
44818 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44819 <entry>Default: <emphasis>unset</emphasis></entry>
44820 </row>
44821 </tbody>
44822 </tgroup>
44823 </informaltable>
44824 <para>
44825 <indexterm role="concept">
44826 <primary>PIPELINING</primary>
44827 <secondary>avoiding the use of</secondary>
44828 </indexterm>
44829 Exim will not use the SMTP PIPELINING extension when delivering to any host
44830 that matches this list, even if the server host advertises PIPELINING support.
44831 </para>
44832 <para>
44833 <indexterm role="option">
44834 <primary><option>hosts_avoid_tls</option></primary>
44835 </indexterm>
44836 </para>
44837 <informaltable frame="all">
44838 <tgroup cols="4" colsep="0" rowsep="0">
44839 <colspec colwidth="8*" align="left"/>
44840 <colspec colwidth="6*" align="center"/>
44841 <colspec colwidth="6*" align="center"/>
44842 <colspec colwidth="6*" align="right"/>
44843 <tbody>
44844 <row>
44845 <entry><option>hosts_avoid_tls</option></entry>
44846 <entry>Use: <emphasis>smtp</emphasis></entry>
44847 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44848 <entry>Default: <emphasis>unset</emphasis></entry>
44849 </row>
44850 </tbody>
44851 </tgroup>
44852 </informaltable>
44853 <para>
44854 <indexterm role="concept">
44855 <primary>TLS</primary>
44856 <secondary>avoiding for certain hosts</secondary>
44857 </indexterm>
44858 Exim will not try to start a TLS session when delivering to any host that
44859 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44860 </para>
44861 <para>
44862 <indexterm role="option">
44863 <primary><option>hosts_verify_avoid_tls</option></primary>
44864 </indexterm>
44865 </para>
44866 <informaltable frame="all">
44867 <tgroup cols="4" colsep="0" rowsep="0">
44868 <colspec colwidth="8*" align="left"/>
44869 <colspec colwidth="6*" align="center"/>
44870 <colspec colwidth="6*" align="center"/>
44871 <colspec colwidth="6*" align="right"/>
44872 <tbody>
44873 <row>
44874 <entry><option>hosts_verify_avoid_tls</option></entry>
44875 <entry>Use: <emphasis>smtp</emphasis></entry>
44876 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44877 <entry>Default: <emphasis>*</emphasis></entry>
44878 </row>
44879 </tbody>
44880 </tgroup>
44881 </informaltable>
44882 <para>
44883 <indexterm role="concept">
44884 <primary>TLS</primary>
44885 <secondary>avoiding for certain hosts</secondary>
44886 </indexterm>
44887 Exim will not try to start a TLS session for a verify callout,
44888 or when delivering in cutthrough mode,
44889 to any host that matches this list.
44890 Note that the default is to not use TLS.
44891 </para>
44892 <para>
44893 <indexterm role="option">
44894 <primary><option>hosts_max_try</option></primary>
44895 </indexterm>
44896 </para>
44897 <informaltable frame="all">
44898 <tgroup cols="4" colsep="0" rowsep="0">
44899 <colspec colwidth="8*" align="left"/>
44900 <colspec colwidth="6*" align="center"/>
44901 <colspec colwidth="6*" align="center"/>
44902 <colspec colwidth="6*" align="right"/>
44903 <tbody>
44904 <row>
44905 <entry><option>hosts_max_try</option></entry>
44906 <entry>Use: <emphasis>smtp</emphasis></entry>
44907 <entry>Type: <emphasis>integer</emphasis></entry>
44908 <entry>Default: <emphasis>5</emphasis></entry>
44909 </row>
44910 </tbody>
44911 </tgroup>
44912 </informaltable>
44913 <para>
44914 <indexterm role="concept">
44915 <primary>host</primary>
44916 <secondary>maximum number to try</secondary>
44917 </indexterm>
44918 <indexterm role="concept">
44919 <primary>limit</primary>
44920 <secondary>number of hosts tried</secondary>
44921 </indexterm>
44922 <indexterm role="concept">
44923 <primary>limit</primary>
44924 <secondary>number of MX tried</secondary>
44925 </indexterm>
44926 <indexterm role="concept">
44927 <primary>MX record</primary>
44928 <secondary>maximum tried</secondary>
44929 </indexterm>
44930 This option limits the number of IP addresses that are tried for any one
44931 delivery in cases where there are temporary delivery errors. Section
44932 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
44933 </para>
44934 <para>
44935 <indexterm role="option">
44936 <primary><option>hosts_max_try_hardlimit</option></primary>
44937 </indexterm>
44938 </para>
44939 <informaltable frame="all">
44940 <tgroup cols="4" colsep="0" rowsep="0">
44941 <colspec colwidth="8*" align="left"/>
44942 <colspec colwidth="6*" align="center"/>
44943 <colspec colwidth="6*" align="center"/>
44944 <colspec colwidth="6*" align="right"/>
44945 <tbody>
44946 <row>
44947 <entry><option>hosts_max_try_hardlimit</option></entry>
44948 <entry>Use: <emphasis>smtp</emphasis></entry>
44949 <entry>Type: <emphasis>integer</emphasis></entry>
44950 <entry>Default: <emphasis>50</emphasis></entry>
44951 </row>
44952 </tbody>
44953 </tgroup>
44954 </informaltable>
44955 <para>
44956 This is an additional check on the maximum number of IP addresses that Exim
44957 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
44958 why it exists.
44959 </para>
44960 <para>
44961 <indexterm role="option">
44962 <primary><option>hosts_nopass_tls</option></primary>
44963 </indexterm>
44964 </para>
44965 <informaltable frame="all">
44966 <tgroup cols="4" colsep="0" rowsep="0">
44967 <colspec colwidth="8*" align="left"/>
44968 <colspec colwidth="6*" align="center"/>
44969 <colspec colwidth="6*" align="center"/>
44970 <colspec colwidth="6*" align="right"/>
44971 <tbody>
44972 <row>
44973 <entry><option>hosts_nopass_tls</option></entry>
44974 <entry>Use: <emphasis>smtp</emphasis></entry>
44975 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44976 <entry>Default: <emphasis>unset</emphasis></entry>
44977 </row>
44978 </tbody>
44979 </tgroup>
44980 </informaltable>
44981 <para>
44982 <indexterm role="concept">
44983 <primary>TLS</primary>
44984 <secondary>passing connection</secondary>
44985 </indexterm>
44986 <indexterm role="concept">
44987 <primary>multiple SMTP deliveries</primary>
44988 </indexterm>
44989 <indexterm role="concept">
44990 <primary>TLS</primary>
44991 <secondary>multiple message deliveries</secondary>
44992 </indexterm>
44993 For any host that matches this list, a connection on which a TLS session has
44994 been started will not be passed to a new delivery process for sending another
44995 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
44996 explanation of when this might be needed.
44997 </para>
44998 <para>
44999 <indexterm role="option">
45000 <primary><option>hosts_override</option></primary>
45001 </indexterm>
45002 </para>
45003 <informaltable frame="all">
45004 <tgroup cols="4" colsep="0" rowsep="0">
45005 <colspec colwidth="8*" align="left"/>
45006 <colspec colwidth="6*" align="center"/>
45007 <colspec colwidth="6*" align="center"/>
45008 <colspec colwidth="6*" align="right"/>
45009 <tbody>
45010 <row>
45011 <entry><option>hosts_override</option></entry>
45012 <entry>Use: <emphasis>smtp</emphasis></entry>
45013 <entry>Type: <emphasis>boolean</emphasis></entry>
45014 <entry>Default: <emphasis>false</emphasis></entry>
45015 </row>
45016 </tbody>
45017 </tgroup>
45018 </informaltable>
45019 <para>
45020 If this option is set and the <option>hosts</option> option is also set, any hosts that are
45021 attached to the address are ignored, and instead the hosts specified by the
45022 <option>hosts</option> option are always used. This option does not apply to
45023 <option>fallback_hosts</option>.
45024 </para>
45025 <para>
45026 <indexterm role="option">
45027 <primary><option>hosts_randomize</option></primary>
45028 </indexterm>
45029 </para>
45030 <informaltable frame="all">
45031 <tgroup cols="4" colsep="0" rowsep="0">
45032 <colspec colwidth="8*" align="left"/>
45033 <colspec colwidth="6*" align="center"/>
45034 <colspec colwidth="6*" align="center"/>
45035 <colspec colwidth="6*" align="right"/>
45036 <tbody>
45037 <row>
45038 <entry><option>hosts_randomize</option></entry>
45039 <entry>Use: <emphasis>smtp</emphasis></entry>
45040 <entry>Type: <emphasis>boolean</emphasis></entry>
45041 <entry>Default: <emphasis>false</emphasis></entry>
45042 </row>
45043 </tbody>
45044 </tgroup>
45045 </informaltable>
45046 <para>
45047 <indexterm role="concept">
45048 <primary>randomized host list</primary>
45049 </indexterm>
45050 <indexterm role="concept">
45051 <primary>host</primary>
45052 <secondary>list of; randomized</secondary>
45053 </indexterm>
45054 <indexterm role="concept">
45055 <primary>fallback</primary>
45056 <secondary>randomized hosts</secondary>
45057 </indexterm>
45058 If this option is set, and either the list of hosts is taken from the
45059 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
45060 were not obtained from MX records (this includes fallback hosts from the
45061 router), and were not randomized by the router, the order of trying the hosts
45062 is randomized each time the transport runs. Randomizing the order of a host
45063 list can be used to do crude load sharing.
45064 </para>
45065 <para>
45066 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
45067 order is separately randomized. This makes it possible to set up MX-like
45068 behaviour. The boundaries between groups are indicated by an item that is just
45069 <literal>+</literal> in the host list. For example:
45070 </para>
45071 <literallayout class="monospaced">
45072 hosts = host1:host2:host3:+:host4:host5
45073 </literallayout>
45074 <para>
45075 The order of the first three hosts and the order of the last two hosts is
45076 randomized for each use, but the first three always end up before the last two.
45077 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
45078 </para>
45079 <para>
45080 <indexterm role="option">
45081 <primary><option>hosts_require_auth</option></primary>
45082 </indexterm>
45083 </para>
45084 <informaltable frame="all">
45085 <tgroup cols="4" colsep="0" rowsep="0">
45086 <colspec colwidth="8*" align="left"/>
45087 <colspec colwidth="6*" align="center"/>
45088 <colspec colwidth="6*" align="center"/>
45089 <colspec colwidth="6*" align="right"/>
45090 <tbody>
45091 <row>
45092 <entry><option>hosts_require_auth</option></entry>
45093 <entry>Use: <emphasis>smtp</emphasis></entry>
45094 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45095 <entry>Default: <emphasis>unset</emphasis></entry>
45096 </row>
45097 </tbody>
45098 </tgroup>
45099 </informaltable>
45100 <para>
45101 <indexterm role="concept">
45102 <primary>authentication</primary>
45103 <secondary>required by client</secondary>
45104 </indexterm>
45105 This option provides a list of servers for which authentication must succeed
45106 before Exim will try to transfer a message. If authentication fails for
45107 servers which are not in this list, Exim tries to send unauthenticated. If
45108 authentication fails for one of these servers, delivery is deferred. This
45109 temporary error is detectable in the retry rules, so it can be turned into a
45110 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
45111 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45112 </para>
45113 <para>
45114 <indexterm role="option">
45115 <primary><option>hosts_request_ocsp</option></primary>
45116 </indexterm>
45117 </para>
45118 <informaltable frame="all">
45119 <tgroup cols="4" colsep="0" rowsep="0">
45120 <colspec colwidth="8*" align="left"/>
45121 <colspec colwidth="6*" align="center"/>
45122 <colspec colwidth="6*" align="center"/>
45123 <colspec colwidth="6*" align="right"/>
45124 <tbody>
45125 <row>
45126 <entry><option>hosts_request_ocsp</option></entry>
45127 <entry>Use: <emphasis>smtp</emphasis></entry>
45128 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45129 <entry>Default: <emphasis>*</emphasis></entry>
45130 </row>
45131 </tbody>
45132 </tgroup>
45133 </informaltable>
45134 <para>
45135 <indexterm role="concept">
45136 <primary>TLS</primary>
45137 <secondary>requiring for certain servers</secondary>
45138 </indexterm>
45139 Exim will request a Certificate Status on a
45140 TLS session for any host that matches this list.
45141 <option>tls_verify_certificates</option> should also be set for the transport.
45142 </para>
45143 <para>
45144 <indexterm role="option">
45145 <primary><option>hosts_require_ocsp</option></primary>
45146 </indexterm>
45147 </para>
45148 <informaltable frame="all">
45149 <tgroup cols="4" colsep="0" rowsep="0">
45150 <colspec colwidth="8*" align="left"/>
45151 <colspec colwidth="6*" align="center"/>
45152 <colspec colwidth="6*" align="center"/>
45153 <colspec colwidth="6*" align="right"/>
45154 <tbody>
45155 <row>
45156 <entry><option>hosts_require_ocsp</option></entry>
45157 <entry>Use: <emphasis>smtp</emphasis></entry>
45158 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45159 <entry>Default: <emphasis>unset</emphasis></entry>
45160 </row>
45161 </tbody>
45162 </tgroup>
45163 </informaltable>
45164 <para>
45165 <indexterm role="concept">
45166 <primary>TLS</primary>
45167 <secondary>requiring for certain servers</secondary>
45168 </indexterm>
45169 Exim will request, and check for a valid Certificate Status being given, on a
45170 TLS session for any host that matches this list.
45171 <option>tls_verify_certificates</option> should also be set for the transport.
45172 </para>
45173 <para>
45174 <indexterm role="option">
45175 <primary><option>hosts_require_tls</option></primary>
45176 </indexterm>
45177 </para>
45178 <informaltable frame="all">
45179 <tgroup cols="4" colsep="0" rowsep="0">
45180 <colspec colwidth="8*" align="left"/>
45181 <colspec colwidth="6*" align="center"/>
45182 <colspec colwidth="6*" align="center"/>
45183 <colspec colwidth="6*" align="right"/>
45184 <tbody>
45185 <row>
45186 <entry><option>hosts_require_tls</option></entry>
45187 <entry>Use: <emphasis>smtp</emphasis></entry>
45188 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45189 <entry>Default: <emphasis>unset</emphasis></entry>
45190 </row>
45191 </tbody>
45192 </tgroup>
45193 </informaltable>
45194 <para>
45195 <indexterm role="concept">
45196 <primary>TLS</primary>
45197 <secondary>requiring for certain servers</secondary>
45198 </indexterm>
45199 Exim will insist on using a TLS session when delivering to any host that
45200 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45201 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
45202 incoming messages, use an appropriate ACL.
45203 </para>
45204 <para>
45205 <indexterm role="option">
45206 <primary><option>hosts_try_auth</option></primary>
45207 </indexterm>
45208 </para>
45209 <informaltable frame="all">
45210 <tgroup cols="4" colsep="0" rowsep="0">
45211 <colspec colwidth="8*" align="left"/>
45212 <colspec colwidth="6*" align="center"/>
45213 <colspec colwidth="6*" align="center"/>
45214 <colspec colwidth="6*" align="right"/>
45215 <tbody>
45216 <row>
45217 <entry><option>hosts_try_auth</option></entry>
45218 <entry>Use: <emphasis>smtp</emphasis></entry>
45219 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45220 <entry>Default: <emphasis>unset</emphasis></entry>
45221 </row>
45222 </tbody>
45223 </tgroup>
45224 </informaltable>
45225 <para>
45226 <indexterm role="concept">
45227 <primary>authentication</primary>
45228 <secondary>optional in client</secondary>
45229 </indexterm>
45230 This option provides a list of servers to which, provided they announce
45231 authentication support, Exim will attempt to authenticate as a client when it
45232 connects. If authentication fails, Exim will try to transfer the message
45233 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
45234 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
45235 </para>
45236 <para>
45237 <indexterm role="option">
45238 <primary><option>hosts_try_prdr</option></primary>
45239 </indexterm>
45240 </para>
45241 <informaltable frame="all">
45242 <tgroup cols="4" colsep="0" rowsep="0">
45243 <colspec colwidth="8*" align="left"/>
45244 <colspec colwidth="6*" align="center"/>
45245 <colspec colwidth="6*" align="center"/>
45246 <colspec colwidth="6*" align="right"/>
45247 <tbody>
45248 <row>
45249 <entry><option>hosts_try_prdr</option></entry>
45250 <entry>Use: <emphasis>smtp</emphasis></entry>
45251 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45252 <entry>Default: <emphasis>unset</emphasis></entry>
45253 </row>
45254 </tbody>
45255 </tgroup>
45256 </informaltable>
45257 <para>
45258 <indexterm role="concept">
45259 <primary>PRDR</primary>
45260 <secondary>enabling, optional in client</secondary>
45261 </indexterm>
45262 This option provides a list of servers to which, provided they announce
45263 PRDR support, Exim will attempt to negotiate PRDR
45264 for multi-recipient messages.
45265 </para>
45266 <para>
45267 <indexterm role="option">
45268 <primary><option>interface</option></primary>
45269 </indexterm>
45270 </para>
45271 <informaltable frame="all">
45272 <tgroup cols="4" colsep="0" rowsep="0">
45273 <colspec colwidth="8*" align="left"/>
45274 <colspec colwidth="6*" align="center"/>
45275 <colspec colwidth="6*" align="center"/>
45276 <colspec colwidth="6*" align="right"/>
45277 <tbody>
45278 <row>
45279 <entry><option>interface</option></entry>
45280 <entry>Use: <emphasis>smtp</emphasis></entry>
45281 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
45282 <entry>Default: <emphasis>unset</emphasis></entry>
45283 </row>
45284 </tbody>
45285 </tgroup>
45286 </informaltable>
45287 <para>
45288 <indexterm role="concept">
45289 <primary>bind IP address</primary>
45290 </indexterm>
45291 <indexterm role="concept">
45292 <primary>IP address</primary>
45293 <secondary>binding</secondary>
45294 </indexterm>
45295 <indexterm role="variable">
45296 <primary><varname>$host</varname></primary>
45297 </indexterm>
45298 <indexterm role="variable">
45299 <primary><varname>$host_address</varname></primary>
45300 </indexterm>
45301 This option specifies which interface to bind to when making an outgoing SMTP
45302 call. The value is an IP address, not an interface name such as
45303 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
45304 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
45305 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
45306 outgoing interface address. There is no variable that contains an outgoing
45307 interface address because, unless it is set by this option, its value is
45308 unknown.
45309 </para>
45310 <para>
45311 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
45312 <varname>$host_address</varname> refer to the host to which a connection is about to be made
45313 during the expansion of the string. Forced expansion failure, or an empty
45314 string result causes the option to be ignored. Otherwise, after expansion, the
45315 string must be a list of IP addresses, colon-separated by default, but the
45316 separator can be changed in the usual way. For example:
45317 </para>
45318 <literallayout class="monospaced">
45319 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
45320 </literallayout>
45321 <para>
45322 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
45323 connection. If none of them are the correct type, the option is ignored. If
45324 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
45325 interface to use if the host has more than one.
45326 </para>
45327 <para>
45328 <indexterm role="option">
45329 <primary><option>keepalive</option></primary>
45330 </indexterm>
45331 </para>
45332 <informaltable frame="all">
45333 <tgroup cols="4" colsep="0" rowsep="0">
45334 <colspec colwidth="8*" align="left"/>
45335 <colspec colwidth="6*" align="center"/>
45336 <colspec colwidth="6*" align="center"/>
45337 <colspec colwidth="6*" align="right"/>
45338 <tbody>
45339 <row>
45340 <entry><option>keepalive</option></entry>
45341 <entry>Use: <emphasis>smtp</emphasis></entry>
45342 <entry>Type: <emphasis>boolean</emphasis></entry>
45343 <entry>Default: <emphasis>true</emphasis></entry>
45344 </row>
45345 </tbody>
45346 </tgroup>
45347 </informaltable>
45348 <para>
45349 <indexterm role="concept">
45350 <primary>keepalive</primary>
45351 <secondary>on outgoing connection</secondary>
45352 </indexterm>
45353 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
45354 connections. When set, it causes the kernel to probe idle connections
45355 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
45356 of the connection should send a acknowledgment if the connection is still okay
45357 or a reset if the connection has been aborted. The reason for doing this is
45358 that it has the beneficial effect of freeing up certain types of connection
45359 that can get stuck when the remote host is disconnected without tidying up the
45360 TCP/IP call properly. The keepalive mechanism takes several hours to detect
45361 unreachable hosts.
45362 </para>
45363 <para>
45364 <indexterm role="option">
45365 <primary><option>lmtp_ignore_quota</option></primary>
45366 </indexterm>
45367 </para>
45368 <informaltable frame="all">
45369 <tgroup cols="4" colsep="0" rowsep="0">
45370 <colspec colwidth="8*" align="left"/>
45371 <colspec colwidth="6*" align="center"/>
45372 <colspec colwidth="6*" align="center"/>
45373 <colspec colwidth="6*" align="right"/>
45374 <tbody>
45375 <row>
45376 <entry><option>lmtp_ignore_quota</option></entry>
45377 <entry>Use: <emphasis>smtp</emphasis></entry>
45378 <entry>Type: <emphasis>boolean</emphasis></entry>
45379 <entry>Default: <emphasis>false</emphasis></entry>
45380 </row>
45381 </tbody>
45382 </tgroup>
45383 </informaltable>
45384 <para>
45385 <indexterm role="concept">
45386 <primary>LMTP</primary>
45387 <secondary>ignoring quota errors</secondary>
45388 </indexterm>
45389 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
45390 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
45391 has advertised support for IGNOREQUOTA in its response to the LHLO command.
45392 </para>
45393 <para>
45394 <indexterm role="option">
45395 <primary><option>max_rcpt</option></primary>
45396 </indexterm>
45397 </para>
45398 <informaltable frame="all">
45399 <tgroup cols="4" colsep="0" rowsep="0">
45400 <colspec colwidth="8*" align="left"/>
45401 <colspec colwidth="6*" align="center"/>
45402 <colspec colwidth="6*" align="center"/>
45403 <colspec colwidth="6*" align="right"/>
45404 <tbody>
45405 <row>
45406 <entry><option>max_rcpt</option></entry>
45407 <entry>Use: <emphasis>smtp</emphasis></entry>
45408 <entry>Type: <emphasis>integer</emphasis></entry>
45409 <entry>Default: <emphasis>100</emphasis></entry>
45410 </row>
45411 </tbody>
45412 </tgroup>
45413 </informaltable>
45414 <para>
45415 <indexterm role="concept">
45416 <primary>RCPT</primary>
45417 <secondary>maximum number of outgoing</secondary>
45418 </indexterm>
45419 This option limits the number of RCPT commands that are sent in a single
45420 SMTP message transaction. Each set of addresses is treated independently, and
45421 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
45422 permits this.
45423 </para>
45424 <para>
45425 <indexterm role="option">
45426 <primary><option>multi_domain</option></primary>
45427 </indexterm>
45428 </para>
45429 <informaltable frame="all">
45430 <tgroup cols="4" colsep="0" rowsep="0">
45431 <colspec colwidth="8*" align="left"/>
45432 <colspec colwidth="6*" align="center"/>
45433 <colspec colwidth="6*" align="center"/>
45434 <colspec colwidth="6*" align="right"/>
45435 <tbody>
45436 <row>
45437 <entry><option>multi_domain</option></entry>
45438 <entry>Use: <emphasis>smtp</emphasis></entry>
45439 <entry>Type: <emphasis>boolean</emphasis></entry>
45440 <entry>Default: <emphasis>true</emphasis></entry>
45441 </row>
45442 </tbody>
45443 </tgroup>
45444 </informaltable>
45445 <para>
45446 <indexterm role="variable">
45447 <primary><varname>$domain</varname></primary>
45448 </indexterm>
45449 When this option is set, the <command>smtp</command> transport can handle a number of
45450 addresses containing a mixture of different domains provided they all resolve
45451 to the same list of hosts. Turning the option off restricts the transport to
45452 handling only one domain at a time. This is useful if you want to use
45453 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
45454 is a single domain involved in a remote delivery.
45455 </para>
45456 <para>
45457 <indexterm role="option">
45458 <primary><option>port</option></primary>
45459 </indexterm>
45460 </para>
45461 <informaltable frame="all">
45462 <tgroup cols="4" colsep="0" rowsep="0">
45463 <colspec colwidth="8*" align="left"/>
45464 <colspec colwidth="6*" align="center"/>
45465 <colspec colwidth="6*" align="center"/>
45466 <colspec colwidth="6*" align="right"/>
45467 <tbody>
45468 <row>
45469 <entry><option>port</option></entry>
45470 <entry>Use: <emphasis>smtp</emphasis></entry>
45471 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45472 <entry>Default: <emphasis>see below</emphasis></entry>
45473 </row>
45474 </tbody>
45475 </tgroup>
45476 </informaltable>
45477 <para>
45478 <indexterm role="concept">
45479 <primary>port</primary>
45480 <secondary>sending TCP/IP</secondary>
45481 </indexterm>
45482 <indexterm role="concept">
45483 <primary>TCP/IP</primary>
45484 <secondary>setting outgoing port</secondary>
45485 </indexterm>
45486 This option specifies the TCP/IP port on the server to which Exim connects.
45487 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
45488 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
45489 The name was changed to minimize confusion with the outgoing port. There is no
45490 variable that contains an outgoing port.
45491 </para>
45492 <para>
45493 If the value of this option begins with a digit it is taken as a port number;
45494 otherwise it is looked up using <function>getservbyname()</function>. The default value is
45495 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
45496 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
45497 is deferred.
45498 </para>
45499 <para>
45500 <indexterm role="option">
45501 <primary><option>protocol</option></primary>
45502 </indexterm>
45503 </para>
45504 <informaltable frame="all">
45505 <tgroup cols="4" colsep="0" rowsep="0">
45506 <colspec colwidth="8*" align="left"/>
45507 <colspec colwidth="6*" align="center"/>
45508 <colspec colwidth="6*" align="center"/>
45509 <colspec colwidth="6*" align="right"/>
45510 <tbody>
45511 <row>
45512 <entry><option>protocol</option></entry>
45513 <entry>Use: <emphasis>smtp</emphasis></entry>
45514 <entry>Type: <emphasis>string</emphasis></entry>
45515 <entry>Default: <emphasis>smtp</emphasis></entry>
45516 </row>
45517 </tbody>
45518 </tgroup>
45519 </informaltable>
45520 <para>
45521 <indexterm role="concept">
45522 <primary>LMTP</primary>
45523 <secondary>over TCP/IP</secondary>
45524 </indexterm>
45525 <indexterm role="concept">
45526 <primary>ssmtp protocol</primary>
45527 <secondary>outbound</secondary>
45528 </indexterm>
45529 <indexterm role="concept">
45530 <primary>TLS</primary>
45531 <secondary>SSL-on-connect outbound</secondary>
45532 </indexterm>
45533 <indexterm role="variable">
45534 <primary><varname>$port</varname></primary>
45535 </indexterm>
45536 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
45537 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
45538 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
45539 deliveries into closed message stores. Exim also has support for running LMTP
45540 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
45541 </para>
45542 <para>
45543 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
45544 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
45545 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
45546 The Internet standards bodies strongly discourage use of this mode.
45547 </para>
45548 <para>
45549 <indexterm role="option">
45550 <primary><option>retry_include_ip_address</option></primary>
45551 </indexterm>
45552 </para>
45553 <informaltable frame="all">
45554 <tgroup cols="4" colsep="0" rowsep="0">
45555 <colspec colwidth="8*" align="left"/>
45556 <colspec colwidth="6*" align="center"/>
45557 <colspec colwidth="6*" align="center"/>
45558 <colspec colwidth="6*" align="right"/>
45559 <tbody>
45560 <row>
45561 <entry><option>retry_include_ip_address</option></entry>
45562 <entry>Use: <emphasis>smtp</emphasis></entry>
45563 <entry>Type: <emphasis>boolean</emphasis></entry>
45564 <entry>Default: <emphasis>true</emphasis></entry>
45565 </row>
45566 </tbody>
45567 </tgroup>
45568 </informaltable>
45569 <para>
45570 Exim normally includes both the host name and the IP address in the key it
45571 constructs for indexing retry data after a temporary delivery failure. This
45572 means that when one of several IP addresses for a host is failing, it gets
45573 tried periodically (controlled by the retry rules), but use of the other IP
45574 addresses is not affected.
45575 </para>
45576 <para>
45577 However, in some dialup environments hosts are assigned a different IP address
45578 each time they connect. In this situation the use of the IP address as part of
45579 the retry key leads to undesirable behaviour. Setting this option false causes
45580 Exim to use only the host name. This should normally be done on a separate
45581 instance of the <command>smtp</command> transport, set up specially to handle the dialup
45582 hosts.
45583 </para>
45584 <para>
45585 <indexterm role="option">
45586 <primary><option>serialize_hosts</option></primary>
45587 </indexterm>
45588 </para>
45589 <informaltable frame="all">
45590 <tgroup cols="4" colsep="0" rowsep="0">
45591 <colspec colwidth="8*" align="left"/>
45592 <colspec colwidth="6*" align="center"/>
45593 <colspec colwidth="6*" align="center"/>
45594 <colspec colwidth="6*" align="right"/>
45595 <tbody>
45596 <row>
45597 <entry><option>serialize_hosts</option></entry>
45598 <entry>Use: <emphasis>smtp</emphasis></entry>
45599 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45600 <entry>Default: <emphasis>unset</emphasis></entry>
45601 </row>
45602 </tbody>
45603 </tgroup>
45604 </informaltable>
45605 <para>
45606 <indexterm role="concept">
45607 <primary>serializing connections</primary>
45608 </indexterm>
45609 <indexterm role="concept">
45610 <primary>host</primary>
45611 <secondary>serializing connections</secondary>
45612 </indexterm>
45613 Because Exim operates in a distributed manner, if several messages for the same
45614 host arrive at around the same time, more than one simultaneous connection to
45615 the remote host can occur. This is not usually a problem except when there is a
45616 slow link between the hosts. In that situation it may be helpful to restrict
45617 Exim to one connection at a time. This can be done by setting
45618 <option>serialize_hosts</option> to match the relevant hosts.
45619 </para>
45620 <para>
45621 <indexterm role="concept">
45622 <primary>hints database</primary>
45623 <secondary>serializing deliveries to a host</secondary>
45624 </indexterm>
45625 Exim implements serialization by means of a hints database in which a record is
45626 written whenever a process connects to one of the restricted hosts. The record
45627 is deleted when the connection is completed. Obviously there is scope for
45628 records to get left lying around if there is a system or program crash. To
45629 guard against this, Exim ignores any records that are more than six hours old.
45630 </para>
45631 <para>
45632 If you set up this kind of serialization, you should also arrange to delete the
45633 relevant hints database whenever your system reboots. The names of the files
45634 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
45635 may be one or two files, depending on the type of DBM in use. The same files
45636 are used for ETRN serialization.
45637 </para>
45638 <para>
45639 <indexterm role="option">
45640 <primary><option>size_addition</option></primary>
45641 </indexterm>
45642 </para>
45643 <informaltable frame="all">
45644 <tgroup cols="4" colsep="0" rowsep="0">
45645 <colspec colwidth="8*" align="left"/>
45646 <colspec colwidth="6*" align="center"/>
45647 <colspec colwidth="6*" align="center"/>
45648 <colspec colwidth="6*" align="right"/>
45649 <tbody>
45650 <row>
45651 <entry><option>size_addition</option></entry>
45652 <entry>Use: <emphasis>smtp</emphasis></entry>
45653 <entry>Type: <emphasis>integer</emphasis></entry>
45654 <entry>Default: <emphasis>1024</emphasis></entry>
45655 </row>
45656 </tbody>
45657 </tgroup>
45658 </informaltable>
45659 <para>
45660 <indexterm role="concept">
45661 <primary>SMTP</primary>
45662 <secondary>SIZE</secondary>
45663 </indexterm>
45664 <indexterm role="concept">
45665 <primary>message</primary>
45666 <secondary>size issue for transport filter</secondary>
45667 </indexterm>
45668 <indexterm role="concept">
45669 <primary>size</primary>
45670 <secondary>of message</secondary>
45671 </indexterm>
45672 <indexterm role="concept">
45673 <primary>transport</primary>
45674 <secondary>filter</secondary>
45675 </indexterm>
45676 <indexterm role="concept">
45677 <primary>filter</primary>
45678 <secondary>transport filter</secondary>
45679 </indexterm>
45680 If a remote SMTP server indicates that it supports the SIZE option of the
45681 MAIL command, Exim uses this to pass over the message size at the start of
45682 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
45683 sends, to allow for headers and other text that may be added during delivery by
45684 configuration options or in a transport filter. It may be necessary to increase
45685 this if a lot of text is added to messages.
45686 </para>
45687 <para>
45688 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
45689 the use of the SIZE option altogether.
45690 </para>
45691 <para>
45692 <indexterm role="option">
45693 <primary><option>tls_certificate</option></primary>
45694 </indexterm>
45695 </para>
45696 <informaltable frame="all">
45697 <tgroup cols="4" colsep="0" rowsep="0">
45698 <colspec colwidth="8*" align="left"/>
45699 <colspec colwidth="6*" align="center"/>
45700 <colspec colwidth="6*" align="center"/>
45701 <colspec colwidth="6*" align="right"/>
45702 <tbody>
45703 <row>
45704 <entry><option>tls_certificate</option></entry>
45705 <entry>Use: <emphasis>smtp</emphasis></entry>
45706 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45707 <entry>Default: <emphasis>unset</emphasis></entry>
45708 </row>
45709 </tbody>
45710 </tgroup>
45711 </informaltable>
45712 <para>
45713 <indexterm role="concept">
45714 <primary>TLS</primary>
45715 <secondary>client certificate, location of</secondary>
45716 </indexterm>
45717 <indexterm role="concept">
45718 <primary>certificate</primary>
45719 <secondary>client, location of</secondary>
45720 </indexterm>
45721 <indexterm role="variable">
45722 <primary><varname>$host</varname></primary>
45723 </indexterm>
45724 <indexterm role="variable">
45725 <primary><varname>$host_address</varname></primary>
45726 </indexterm>
45727 The value of this option must be the absolute path to a file which contains the
45728 client&#x2019;s certificate, for possible use when sending a message over an encrypted
45729 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
45730 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
45731 details of TLS.
45732 </para>
45733 <para>
45734 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
45735 certificate when sending messages as a client. The global option of the same
45736 name specifies the certificate for Exim as a server; it is not automatically
45737 assumed that the same certificate should be used when Exim is operating as a
45738 client.
45739 </para>
45740 <para>
45741 <indexterm role="option">
45742 <primary><option>tls_crl</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>tls_crl</option></entry>
45754 <entry>Use: <emphasis>smtp</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>TLS</primary>
45764 <secondary>client certificate revocation list</secondary>
45765 </indexterm>
45766 <indexterm role="concept">
45767 <primary>certificate</primary>
45768 <secondary>revocation list for client</secondary>
45769 </indexterm>
45770 This option specifies a certificate revocation list. The expanded value must
45771 be the name of a file that contains a CRL in PEM format.
45772 </para>
45773 <para>
45774 <indexterm role="option">
45775 <primary><option>tls_dh_min_bits</option></primary>
45776 </indexterm>
45777 </para>
45778 <informaltable frame="all">
45779 <tgroup cols="4" colsep="0" rowsep="0">
45780 <colspec colwidth="8*" align="left"/>
45781 <colspec colwidth="6*" align="center"/>
45782 <colspec colwidth="6*" align="center"/>
45783 <colspec colwidth="6*" align="right"/>
45784 <tbody>
45785 <row>
45786 <entry><option>tls_dh_min_bits</option></entry>
45787 <entry>Use: <emphasis>smtp</emphasis></entry>
45788 <entry>Type: <emphasis>integer</emphasis></entry>
45789 <entry>Default: <emphasis>1024</emphasis></entry>
45790 </row>
45791 </tbody>
45792 </tgroup>
45793 </informaltable>
45794 <para>
45795 <indexterm role="concept">
45796 <primary>TLS</primary>
45797 <secondary>Diffie-Hellman minimum acceptable size</secondary>
45798 </indexterm>
45799 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
45800 key agreement is negotiated, the server will provide a large prime number
45801 for use.  This option establishes the minimum acceptable size of that number.
45802 If the parameter offered by the server is too small, then the TLS handshake
45803 will fail.
45804 </para>
45805 <para>
45806 Only supported when using GnuTLS.
45807 </para>
45808 <para>
45809 <indexterm role="option">
45810 <primary><option>tls_privatekey</option></primary>
45811 </indexterm>
45812 </para>
45813 <informaltable frame="all">
45814 <tgroup cols="4" colsep="0" rowsep="0">
45815 <colspec colwidth="8*" align="left"/>
45816 <colspec colwidth="6*" align="center"/>
45817 <colspec colwidth="6*" align="center"/>
45818 <colspec colwidth="6*" align="right"/>
45819 <tbody>
45820 <row>
45821 <entry><option>tls_privatekey</option></entry>
45822 <entry>Use: <emphasis>smtp</emphasis></entry>
45823 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45824 <entry>Default: <emphasis>unset</emphasis></entry>
45825 </row>
45826 </tbody>
45827 </tgroup>
45828 </informaltable>
45829 <para>
45830 <indexterm role="concept">
45831 <primary>TLS</primary>
45832 <secondary>client private key, location of</secondary>
45833 </indexterm>
45834 <indexterm role="variable">
45835 <primary><varname>$host</varname></primary>
45836 </indexterm>
45837 <indexterm role="variable">
45838 <primary><varname>$host_address</varname></primary>
45839 </indexterm>
45840 The value of this option must be the absolute path to a file which contains the
45841 client&#x2019;s private key. This is used when sending a message over an encrypted
45842 connection using a client certificate. The values of <varname>$host</varname> and
45843 <varname>$host_address</varname> are set to the name and address of the server during the
45844 expansion. If this option is unset, or the expansion is forced to fail, or the
45845 result is an empty string, the private key is assumed to be in the same file as
45846 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45847 </para>
45848 <para>
45849 <indexterm role="option">
45850 <primary><option>tls_require_ciphers</option></primary>
45851 </indexterm>
45852 </para>
45853 <informaltable frame="all">
45854 <tgroup cols="4" colsep="0" rowsep="0">
45855 <colspec colwidth="8*" align="left"/>
45856 <colspec colwidth="6*" align="center"/>
45857 <colspec colwidth="6*" align="center"/>
45858 <colspec colwidth="6*" align="right"/>
45859 <tbody>
45860 <row>
45861 <entry><option>tls_require_ciphers</option></entry>
45862 <entry>Use: <emphasis>smtp</emphasis></entry>
45863 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45864 <entry>Default: <emphasis>unset</emphasis></entry>
45865 </row>
45866 </tbody>
45867 </tgroup>
45868 </informaltable>
45869 <para>
45870 <indexterm role="concept">
45871 <primary>TLS</primary>
45872 <secondary>requiring specific ciphers</secondary>
45873 </indexterm>
45874 <indexterm role="concept">
45875 <primary>cipher</primary>
45876 <secondary>requiring specific</secondary>
45877 </indexterm>
45878 <indexterm role="variable">
45879 <primary><varname>$host</varname></primary>
45880 </indexterm>
45881 <indexterm role="variable">
45882 <primary><varname>$host_address</varname></primary>
45883 </indexterm>
45884 The value of this option must be a list of permitted cipher suites, for use
45885 when setting up an outgoing encrypted connection. (There is a global option of
45886 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
45887 <varname>$host_address</varname> are set to the name and address of the server during the
45888 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
45889 is used in different ways by OpenSSL and GnuTLS (see sections
45890 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
45891 ciphers is a preference order.
45892 </para>
45893 <para>
45894 <indexterm role="option">
45895 <primary><option>tls_sni</option></primary>
45896 </indexterm>
45897 </para>
45898 <informaltable frame="all">
45899 <tgroup cols="4" colsep="0" rowsep="0">
45900 <colspec colwidth="8*" align="left"/>
45901 <colspec colwidth="6*" align="center"/>
45902 <colspec colwidth="6*" align="center"/>
45903 <colspec colwidth="6*" align="right"/>
45904 <tbody>
45905 <row>
45906 <entry><option>tls_sni</option></entry>
45907 <entry>Use: <emphasis>smtp</emphasis></entry>
45908 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45909 <entry>Default: <emphasis>unset</emphasis></entry>
45910 </row>
45911 </tbody>
45912 </tgroup>
45913 </informaltable>
45914 <para>
45915 <indexterm role="concept">
45916 <primary>TLS</primary>
45917 <secondary>Server Name Indication</secondary>
45918 </indexterm>
45919 <indexterm role="variable">
45920 <primary><varname>$tls_sni</varname></primary>
45921 </indexterm>
45922 If this option is set then it sets the $tls_out_sni variable and causes any
45923 TLS session to pass this value as the Server Name Indication extension to
45924 the remote side, which can be used by the remote side to select an appropriate
45925 certificate and private key for the session.
45926 </para>
45927 <para>
45928 See <xref linkend="SECTtlssni"/> for more information.
45929 </para>
45930 <para>
45931 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
45932 TLS extensions.
45933 </para>
45934 <para>
45935 <indexterm role="option">
45936 <primary><option>tls_tempfail_tryclear</option></primary>
45937 </indexterm>
45938 </para>
45939 <informaltable frame="all">
45940 <tgroup cols="4" colsep="0" rowsep="0">
45941 <colspec colwidth="8*" align="left"/>
45942 <colspec colwidth="6*" align="center"/>
45943 <colspec colwidth="6*" align="center"/>
45944 <colspec colwidth="6*" align="right"/>
45945 <tbody>
45946 <row>
45947 <entry><option>tls_tempfail_tryclear</option></entry>
45948 <entry>Use: <emphasis>smtp</emphasis></entry>
45949 <entry>Type: <emphasis>boolean</emphasis></entry>
45950 <entry>Default: <emphasis>true</emphasis></entry>
45951 </row>
45952 </tbody>
45953 </tgroup>
45954 </informaltable>
45955 <para>
45956 <indexterm role="concept">
45957 <primary>4<emphasis>xx</emphasis> responses</primary>
45958 <secondary>to STARTTLS</secondary>
45959 </indexterm>
45960 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
45961 setting up a TLS session, this option determines whether or not Exim should try
45962 to deliver the message unencrypted. If it is set false, delivery to the
45963 current host is deferred; if there are other hosts, they are tried. If this
45964 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
45965 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
45966 TLS negotiation fails, Exim closes the current connection (because it is in an
45967 unknown state), opens a new one to the same host, and then tries the delivery
45968 in clear.
45969 </para>
45970 <para>
45971 <indexterm role="option">
45972 <primary><option>tls_try_verify_hosts</option></primary>
45973 </indexterm>
45974 </para>
45975 <informaltable frame="all">
45976 <tgroup cols="4" colsep="0" rowsep="0">
45977 <colspec colwidth="8*" align="left"/>
45978 <colspec colwidth="6*" align="center"/>
45979 <colspec colwidth="6*" align="center"/>
45980 <colspec colwidth="6*" align="right"/>
45981 <tbody>
45982 <row>
45983 <entry><option>tls_try_verify_hosts</option></entry>
45984 <entry>Use: <emphasis>smtp</emphasis></entry>
45985 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
45986 <entry>Default: <emphasis>unset</emphasis></entry>
45987 </row>
45988 </tbody>
45989 </tgroup>
45990 </informaltable>
45991 <para>
45992 <indexterm role="concept">
45993 <primary>TLS</primary>
45994 <secondary>server certificate verification</secondary>
45995 </indexterm>
45996 <indexterm role="concept">
45997 <primary>certificate</primary>
45998 <secondary>verification of server</secondary>
45999 </indexterm>
46000 This option gives a list of hosts for which, on encrypted connections,
46001 certificate verification will be tried but need not succeed.
46002 The <option>tls_verify_certificates</option> option must also be set.
46003 Note that unless the host is in this list
46004 TLS connections will be denied to hosts using self-signed certificates
46005 when <option>tls_verify_certificates</option> is matched.
46006 The <varname>$tls_out_certificate_verified</varname> variable is set when
46007 certificate verification succeeds.
46008 </para>
46009 <para>
46010 <indexterm role="option">
46011 <primary><option>tls_verify_certificates</option></primary>
46012 </indexterm>
46013 </para>
46014 <informaltable frame="all">
46015 <tgroup cols="4" colsep="0" rowsep="0">
46016 <colspec colwidth="8*" align="left"/>
46017 <colspec colwidth="6*" align="center"/>
46018 <colspec colwidth="6*" align="center"/>
46019 <colspec colwidth="6*" align="right"/>
46020 <tbody>
46021 <row>
46022 <entry><option>tls_verify_certificates</option></entry>
46023 <entry>Use: <emphasis>smtp</emphasis></entry>
46024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46025 <entry>Default: <emphasis>unset</emphasis></entry>
46026 </row>
46027 </tbody>
46028 </tgroup>
46029 </informaltable>
46030 <para>
46031 <indexterm role="concept">
46032 <primary>TLS</primary>
46033 <secondary>server certificate verification</secondary>
46034 </indexterm>
46035 <indexterm role="concept">
46036 <primary>certificate</primary>
46037 <secondary>verification of server</secondary>
46038 </indexterm>
46039 <indexterm role="variable">
46040 <primary><varname>$host</varname></primary>
46041 </indexterm>
46042 <indexterm role="variable">
46043 <primary><varname>$host_address</varname></primary>
46044 </indexterm>
46045 The value of this option must be the absolute path to a file containing
46046 permitted server certificates, for use when setting up an encrypted connection.
46047 Alternatively,
46048 if you are using either GnuTLS version 3.3.6 (or later) or OpenSSL,
46049 you can set
46050 <option>tls_verify_certificates</option> to the name of a directory containing certificate
46051 files.
46052 For earlier versions of GnuTLS the option must be set to the name of a
46053 single file.
46054 </para>
46055 <para>
46056 With OpenSSL the certificates specified
46057 explicitly
46058 either by file or directory
46059 are added to those given by the system default location.
46060 </para>
46061 <para>
46062 The values of <varname>$host</varname> and
46063 <varname>$host_address</varname> are set to the name and address of the server during the
46064 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46065 </para>
46066 <para>
46067 For back-compatability,
46068 if neither tls_verify_hosts nor tls_try_verify_hosts are set
46069 and certificate verification fails the TLS connection is closed.
46070 </para>
46071 <para>
46072 <indexterm role="option">
46073 <primary><option>tls_verify_hosts</option></primary>
46074 </indexterm>
46075 </para>
46076 <informaltable frame="all">
46077 <tgroup cols="4" colsep="0" rowsep="0">
46078 <colspec colwidth="8*" align="left"/>
46079 <colspec colwidth="6*" align="center"/>
46080 <colspec colwidth="6*" align="center"/>
46081 <colspec colwidth="6*" align="right"/>
46082 <tbody>
46083 <row>
46084 <entry><option>tls_verify_hosts</option></entry>
46085 <entry>Use: <emphasis>smtp</emphasis></entry>
46086 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46087 <entry>Default: <emphasis>unset</emphasis></entry>
46088 </row>
46089 </tbody>
46090 </tgroup>
46091 </informaltable>
46092 <para>
46093 <indexterm role="concept">
46094 <primary>TLS</primary>
46095 <secondary>server certificate verification</secondary>
46096 </indexterm>
46097 <indexterm role="concept">
46098 <primary>certificate</primary>
46099 <secondary>verification of server</secondary>
46100 </indexterm>
46101 This option gives a list of hosts for which. on encrypted connections,
46102 certificate verification must succeed.
46103 The <option>tls_verify_certificates</option> option must also be set.
46104 If both this option and <option>tls_try_verify_hosts</option> are unset
46105 operation is as if this option selected all hosts.
46106 </para>
46107 </section>
46108 <section id="SECTvalhosmax">
46109 <title>How the limits for the number of hosts to try are used</title>
46110 <para>
46111 <indexterm role="concept">
46112 <primary>host</primary>
46113 <secondary>maximum number to try</secondary>
46114 </indexterm>
46115 <indexterm role="concept">
46116 <primary>limit</primary>
46117 <secondary>hosts; maximum number tried</secondary>
46118 </indexterm>
46119 There are two options that are concerned with the number of hosts that are
46120 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
46121 <option>hosts_max_try_hardlimit</option>.
46122 </para>
46123 <para>
46124 The <option>hosts_max_try</option> option limits the number of hosts that are tried
46125 for a single delivery. However, despite the term <quote>host</quote> in its name, the
46126 option actually applies to each IP address independently. In other words, a
46127 multihomed host is treated as several independent hosts, just as it is for
46128 retrying.
46129 </para>
46130 <para>
46131 Many of the larger ISPs have multiple MX records which often point to
46132 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
46133 created as a result of routing one of these domains.
46134 </para>
46135 <para>
46136 Trying every single IP address on such a long list does not seem sensible; if
46137 several at the top of the list fail, it is reasonable to assume there is some
46138 problem that is likely to affect all of them. Roughly speaking, the value of
46139 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
46140 delivery. However, the logic cannot be quite that simple.
46141 </para>
46142 <para>
46143 Firstly, IP addresses that are skipped because their retry times have not
46144 arrived do not count, and in addition, addresses that are past their retry
46145 limits are also not counted, even when they are tried. This means that when
46146 some IP addresses are past their retry limits, more than the value of
46147 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
46148 that all IP addresses are considered before timing out an email address (but
46149 see below for an exception).
46150 </para>
46151 <para>
46152 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
46153 list to see if there is a subsequent host with a different (higher valued) MX.
46154 If there is, that host is considered next, and the current IP address is used
46155 but not counted. This behaviour helps in the case of a domain with a retry rule
46156 that hardly ever delays any hosts, as is now explained:
46157 </para>
46158 <para>
46159 Consider the case of a long list of hosts with one MX value, and a few with a
46160 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
46161 hosts at the top of the list are tried at first. With the default retry rule,
46162 which specifies increasing retry times, the higher MX hosts are eventually
46163 tried when those at the top of the list are skipped because they have not
46164 reached their retry times.
46165 </para>
46166 <para>
46167 However, it is common practice to put a fixed short retry time on domains for
46168 large ISPs, on the grounds that their servers are rarely down for very long.
46169 Unfortunately, these are exactly the domains that tend to resolve to long lists
46170 of hosts. The short retry time means that the lowest MX hosts are tried every
46171 time. The attempts may be in a different order because of random sorting, but
46172 without the special MX check, the higher MX hosts would never be tried until
46173 all the lower MX hosts had timed out (which might be several days), because
46174 there are always some lower MX hosts that have reached their retry times. With
46175 the special check, Exim considers at least one IP address from each MX value at
46176 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
46177 reached.
46178 </para>
46179 <para>
46180 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
46181 particular, Exim normally eventually tries all the IP addresses before timing
46182 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
46183 reasonable thing to do. Recently, however, some lunatic DNS configurations have
46184 been set up with hundreds of IP addresses for some domains. It can
46185 take a very long time indeed for an address to time out in these cases.
46186 </para>
46187 <para>
46188 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
46189 Exim never tries more than this number of IP addresses; if it hits this limit
46190 and they are all timed out, the email address is bounced, even though not all
46191 possible IP addresses have been tried.
46192 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
46193 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
46194 </para>
46195 </section>
46196 </chapter>
46197
46198 <chapter id="CHAPrewrite">
46199 <title>Address rewriting</title>
46200 <para>
46201 <indexterm role="concept" id="IIDaddrew" class="startofrange">
46202 <primary>rewriting</primary>
46203 <secondary>addresses</secondary>
46204 </indexterm>
46205 There are some circumstances in which Exim automatically rewrites domains in
46206 addresses. The two most common are when an address is given without a domain
46207 (referred to as an <quote>unqualified address</quote>) or when an address contains an
46208 abbreviated domain that is expanded by DNS lookup.
46209 </para>
46210 <para>
46211 Unqualified envelope addresses are accepted only for locally submitted
46212 messages, or for messages that are received from hosts matching
46213 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
46214 appropriate. Unqualified addresses in header lines are qualified if they are in
46215 locally submitted messages, or messages from hosts that are permitted to send
46216 unqualified envelope addresses. Otherwise, unqualified addresses in header
46217 lines are neither qualified nor rewritten.
46218 </para>
46219 <para>
46220 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
46221 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
46222 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
46223 do this. The new RFCs do not contain this suggestion.
46224 </para>
46225 <section id="SECID147">
46226 <title>Explicitly configured address rewriting</title>
46227 <para>
46228 This chapter describes the rewriting rules that can be used in the
46229 main rewrite section of the configuration file, and also in the generic
46230 <option>headers_rewrite</option> option that can be set on any transport.
46231 </para>
46232 <para>
46233 Some people believe that configured address rewriting is a Mortal Sin.
46234 Others believe that life is not possible without it. Exim provides the
46235 facility; you do not have to use it.
46236 </para>
46237 <para>
46238 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
46239 configuration file are applied to addresses in incoming messages, both envelope
46240 addresses and addresses in header lines. Each rule specifies the types of
46241 address to which it applies.
46242 </para>
46243 <para>
46244 Whether or not addresses in header lines are rewritten depends on the origin of
46245 the headers and the type of rewriting. Global rewriting, that is, rewriting
46246 rules from the rewrite section of the configuration file, is applied only to
46247 those headers that were received with the message. Header lines that are added
46248 by ACLs or by a system filter or by individual routers or transports (which
46249 are specific to individual recipient addresses) are not rewritten by the global
46250 rules.
46251 </para>
46252 <para>
46253 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
46254 applies all headers except those added by routers and transports. That is, as
46255 well as the headers that were received with the message, it also applies to
46256 headers that were added by an ACL or a system filter.
46257 </para>
46258 <para>
46259 In general, rewriting addresses from your own system or domain has some
46260 legitimacy. Rewriting other addresses should be done only with great care and
46261 in special circumstances. The author of Exim believes that rewriting should be
46262 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
46263 Although it can sometimes be used as a routing tool, this is very strongly
46264 discouraged.
46265 </para>
46266 <para>
46267 There are two commonly encountered circumstances where rewriting is used, as
46268 illustrated by these examples:
46269 </para>
46270 <itemizedlist>
46271 <listitem>
46272 <para>
46273 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
46274 exchange mail with each other behind a firewall, but there is only a single
46275 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
46276 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
46277 </para>
46278 </listitem>
46279 <listitem>
46280 <para>
46281 A host rewrites the local parts of its own users so that, for example,
46282 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
46283 </para>
46284 </listitem>
46285 </itemizedlist>
46286 </section>
46287 <section id="SECID148">
46288 <title>When does rewriting happen?</title>
46289 <para>
46290 <indexterm role="concept">
46291 <primary>rewriting</primary>
46292 <secondary>timing of</secondary>
46293 </indexterm>
46294 <indexterm role="concept">
46295 <primary>access control lists (ACLs)</primary>
46296 <secondary>rewriting addresses in</secondary>
46297 </indexterm>
46298 Configured address rewriting can take place at several different stages of a
46299 message&#x2019;s processing.
46300 </para>
46301 <para>
46302 <indexterm role="variable">
46303 <primary><varname>$sender_address</varname></primary>
46304 </indexterm>
46305 At the start of an ACL for MAIL, the sender address may have been rewritten
46306 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
46307 ordinary rewrite rules have yet been applied. If, however, the sender address
46308 is verified in the ACL, it is rewritten before verification, and remains
46309 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
46310 rewritten address. This also applies if sender verification happens in a
46311 RCPT ACL. Otherwise, when the sender address is not verified, it is
46312 rewritten as soon as a message&#x2019;s header lines have been received.
46313 </para>
46314 <para>
46315 <indexterm role="variable">
46316 <primary><varname>$domain</varname></primary>
46317 </indexterm>
46318 <indexterm role="variable">
46319 <primary><varname>$local_part</varname></primary>
46320 </indexterm>
46321 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
46322 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
46323 rewrite rules have yet been applied to it. However, the behaviour is different
46324 from the sender address when a recipient is verified. The address is rewritten
46325 for the verification, but the rewriting is not remembered at this stage. The
46326 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
46327 as they were before (that is, they contain the unrewritten &ndash; except for
46328 SMTP-time rewriting &ndash; address).
46329 </para>
46330 <para>
46331 As soon as a message&#x2019;s header lines have been received, all the envelope
46332 recipient addresses are permanently rewritten, and rewriting is also applied to
46333 the addresses in the header lines (if configured). This happens before adding
46334 any header lines that were specified in MAIL or RCPT ACLs, and
46335 <indexterm role="concept">
46336 <primary><function>local_scan()</function> function</primary>
46337 <secondary>address rewriting; timing of</secondary>
46338 </indexterm>
46339 before the DATA ACL and <function>local_scan()</function> functions are run.
46340 </para>
46341 <para>
46342 When an address is being routed, either for delivery or for verification,
46343 rewriting is applied immediately to child addresses that are generated by
46344 redirection, unless <option>no_rewrite</option> is set on the router.
46345 </para>
46346 <para>
46347 <indexterm role="concept">
46348 <primary>envelope sender</primary>
46349 <secondary>rewriting at transport time</secondary>
46350 </indexterm>
46351 <indexterm role="concept">
46352 <primary>rewriting</primary>
46353 <secondary>at transport time</secondary>
46354 </indexterm>
46355 <indexterm role="concept">
46356 <primary>header lines</primary>
46357 <secondary>rewriting at transport time</secondary>
46358 </indexterm>
46359 At transport time, additional rewriting of addresses in header lines can be
46360 specified by setting the generic <option>headers_rewrite</option> option on a transport.
46361 This option contains rules that are identical in form to those in the rewrite
46362 section of the configuration file. They are applied to the original message
46363 header lines and any that were added by ACLs or a system filter. They are not
46364 applied to header lines that are added by routers or the transport.
46365 </para>
46366 <para>
46367 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
46368 transport option. However, it is not possible to rewrite envelope recipients at
46369 transport time.
46370 </para>
46371 </section>
46372 <section id="SECID149">
46373 <title>Testing the rewriting rules that apply on input</title>
46374 <para>
46375 <indexterm role="concept">
46376 <primary>rewriting</primary>
46377 <secondary>testing</secondary>
46378 </indexterm>
46379 <indexterm role="concept">
46380 <primary>testing</primary>
46381 <secondary>rewriting</secondary>
46382 </indexterm>
46383 Exim&#x2019;s input rewriting configuration appears in a part of the run time
46384 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
46385 <option>-brw</option> command line option. This takes an address (which can be a full RFC
46386 2822 address) as its argument. The output is a list of how the address would be
46387 transformed by the rewriting rules for each of the different places it might
46388 appear in an incoming message, that is, for each different header and for the
46389 envelope sender and recipient fields. For example,
46390 </para>
46391 <literallayout class="monospaced">
46392 exim -brw ph10@exim.workshop.example
46393 </literallayout>
46394 <para>
46395 might produce the output
46396 </para>
46397 <literallayout class="monospaced">
46398 sender: Philip.Hazel@exim.workshop.example
46399 from: Philip.Hazel@exim.workshop.example
46400 to: ph10@exim.workshop.example
46401 cc: ph10@exim.workshop.example
46402 bcc: ph10@exim.workshop.example
46403 reply-to: Philip.Hazel@exim.workshop.example
46404 env-from: Philip.Hazel@exim.workshop.example
46405 env-to: ph10@exim.workshop.example
46406 </literallayout>
46407 <para>
46408 which shows that rewriting has been set up for that address when used in any of
46409 the source fields, but not when it appears as a recipient address. At the
46410 present time, there is no equivalent way of testing rewriting rules that are
46411 set for a particular transport.
46412 </para>
46413 </section>
46414 <section id="SECID150">
46415 <title>Rewriting rules</title>
46416 <para>
46417 <indexterm role="concept">
46418 <primary>rewriting</primary>
46419 <secondary>rules</secondary>
46420 </indexterm>
46421 The rewrite section of the configuration file consists of lines of rewriting
46422 rules in the form
46423 </para>
46424 <literallayout>
46425 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
46426 </literallayout>
46427 <para>
46428 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
46429 transport option are given as a colon-separated list. Each item in the list
46430 takes the same form as a line in the main rewriting configuration (except that
46431 any colons must be doubled, of course).
46432 </para>
46433 <para>
46434 The formats of source patterns and replacement strings are described below.
46435 Each is terminated by white space, unless enclosed in double quotes, in which
46436 case normal quoting conventions apply inside the quotes. The flags are single
46437 characters which may appear in any order. Spaces and tabs between them are
46438 ignored.
46439 </para>
46440 <para>
46441 For each address that could potentially be rewritten, the rules are scanned in
46442 order, and replacements for the address from earlier rules can themselves be
46443 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
46444 </para>
46445 <para>
46446 The order in which addresses are rewritten is undefined, may change between
46447 releases, and must not be relied on, with one exception: when a message is
46448 received, the envelope sender is always rewritten first, before any header
46449 lines are rewritten. For example, the replacement string for a rewrite of an
46450 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
46451 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
46452 that the envelope sender has already been rewritten.
46453 </para>
46454 <para>
46455 <indexterm role="variable">
46456 <primary><varname>$domain</varname></primary>
46457 </indexterm>
46458 <indexterm role="variable">
46459 <primary><varname>$local_part</varname></primary>
46460 </indexterm>
46461 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
46462 string to refer to the address that is being rewritten. Note that lookup-driven
46463 rewriting can be done by a rule of the form
46464 </para>
46465 <literallayout class="monospaced">
46466 *@*   ${lookup ...
46467 </literallayout>
46468 <para>
46469 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
46470 refer to the address that is being rewritten.
46471 </para>
46472 </section>
46473 <section id="SECID151">
46474 <title>Rewriting patterns</title>
46475 <para>
46476 <indexterm role="concept">
46477 <primary>rewriting</primary>
46478 <secondary>patterns</secondary>
46479 </indexterm>
46480 <indexterm role="concept">
46481 <primary>address list</primary>
46482 <secondary>in a rewriting pattern</secondary>
46483 </indexterm>
46484 The source pattern in a rewriting rule is any item which may appear in an
46485 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
46486 single-item address list, which means that it is expanded before being tested
46487 against the address. As always, if you use a regular expression as a pattern,
46488 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
46489 facility to suppress string expansion within the regular expression.
46490 </para>
46491 <para>
46492 Domains in patterns should be given in lower case. Local parts in patterns are
46493 case-sensitive. If you want to do case-insensitive matching of local parts, you
46494 can use a regular expression that starts with <literal>^(?i)</literal>.
46495 </para>
46496 <para>
46497 <indexterm role="concept">
46498 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46499 <secondary>in rewriting rules</secondary>
46500 </indexterm>
46501 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
46502 depending on the type of match which occurred. These can be used in the
46503 replacement string to insert portions of the incoming address. <varname>$0</varname> always
46504 refers to the complete incoming address. When a regular expression is used, the
46505 numerical variables are set from its capturing subexpressions. For other types
46506 of pattern they are set as follows:
46507 </para>
46508 <itemizedlist>
46509 <listitem>
46510 <para>
46511 If a local part or domain starts with an asterisk, the numerical variables
46512 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
46513 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
46514 pattern
46515 </para>
46516 <literallayout class="monospaced">
46517 *queen@*.fict.example
46518 </literallayout>
46519 <para>
46520 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
46521 </para>
46522 <literallayout class="monospaced">
46523 $0 = hearts-queen@wonderland.fict.example
46524 $1 = hearts-
46525 $2 = wonderland
46526 </literallayout>
46527 <para>
46528 Note that if the local part does not start with an asterisk, but the domain
46529 does, it is <varname>$1</varname> that contains the wild part of the domain.
46530 </para>
46531 </listitem>
46532 <listitem>
46533 <para>
46534 If the domain part of the pattern is a partial lookup, the wild and fixed parts
46535 of the domain are placed in the next available numerical variables. Suppose,
46536 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
46537 rewriting rule of the form
46538 </para>
46539 <literallayout>
46540 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
46541 </literallayout>
46542 <para>
46543 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
46544 </para>
46545 <literallayout class="monospaced">
46546 $1 = foo
46547 $2 = bar
46548 $3 = baz.example
46549 </literallayout>
46550 <para>
46551 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
46552 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
46553 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
46554 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
46555 whole domain. For non-partial domain lookups, no numerical variables are set.
46556 </para>
46557 </listitem>
46558 </itemizedlist>
46559 </section>
46560 <section id="SECID152">
46561 <title>Rewriting replacements</title>
46562 <para>
46563 <indexterm role="concept">
46564 <primary>rewriting</primary>
46565 <secondary>replacements</secondary>
46566 </indexterm>
46567 If the replacement string for a rule is a single asterisk, addresses that
46568 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
46569 rewriting rules are scanned. For example,
46570 </para>
46571 <literallayout class="monospaced">
46572 hatta@lookingglass.fict.example  *  f
46573 </literallayout>
46574 <para>
46575 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
46576 <emphasis>From:</emphasis> headers.
46577 </para>
46578 <para>
46579 <indexterm role="variable">
46580 <primary><varname>$domain</varname></primary>
46581 </indexterm>
46582 <indexterm role="variable">
46583 <primary><varname>$local_part</varname></primary>
46584 </indexterm>
46585 If the replacement string is not a single asterisk, it is expanded, and must
46586 yield a fully qualified address. Within the expansion, the variables
46587 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
46588 Any letters they contain retain their original case &ndash; they are not lower
46589 cased. The numerical variables are set up according to the type of pattern that
46590 matched the address, as described above. If the expansion is forced to fail by
46591 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
46592 current rule is abandoned, but subsequent rules may take effect. Any other
46593 expansion failure causes the entire rewriting operation to be abandoned, and an
46594 entry written to the panic log.
46595 </para>
46596 </section>
46597 <section id="SECID153">
46598 <title>Rewriting flags</title>
46599 <para>
46600 There are three different kinds of flag that may appear on rewriting rules:
46601 </para>
46602 <itemizedlist>
46603 <listitem>
46604 <para>
46605 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
46606 c, f, h, r, s, t.
46607 </para>
46608 </listitem>
46609 <listitem>
46610 <para>
46611 A flag that specifies rewriting at SMTP time: S.
46612 </para>
46613 </listitem>
46614 <listitem>
46615 <para>
46616 Flags that control the rewriting process: Q, q, R, w.
46617 </para>
46618 </listitem>
46619 </itemizedlist>
46620 <para>
46621 For rules that are part of the <option>headers_rewrite</option> generic transport option,
46622 E, F, T, and S are not permitted.
46623 </para>
46624 </section>
46625 <section id="SECID154">
46626 <title>Flags specifying which headers and envelope addresses to rewrite</title>
46627 <para>
46628 <indexterm role="concept">
46629 <primary>rewriting</primary>
46630 <secondary>flags</secondary>
46631 </indexterm>
46632 If none of the following flag letters, nor the <quote>S</quote> flag (see section
46633 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
46634 and to both the sender and recipient fields of the envelope, whereas a
46635 transport-time rewriting rule just applies to all headers. Otherwise, the
46636 rewriting rule is skipped unless the relevant addresses are being processed.
46637 </para>
46638 <literallayout>
46639 <literal>E</literal>       rewrite all envelope fields
46640 <literal>F</literal>       rewrite the envelope From field
46641 <literal>T</literal>       rewrite the envelope To field
46642 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
46643 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
46644 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
46645 <literal>h</literal>       rewrite all headers
46646 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
46647 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
46648 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
46649 </literallayout>
46650 <para>
46651 "All headers" means all of the headers listed above that can be selected
46652 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
46653 other headers such as <emphasis>Subject:</emphasis> etc.
46654 </para>
46655 <para>
46656 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
46657 restrict this to special known cases in your own domains.
46658 </para>
46659 </section>
46660 <section id="SECTrewriteS">
46661 <title>The SMTP-time rewriting flag</title>
46662 <para>
46663 <indexterm role="concept">
46664 <primary>SMTP</primary>
46665 <secondary>rewriting malformed addresses</secondary>
46666 </indexterm>
46667 <indexterm role="concept">
46668 <primary>RCPT</primary>
46669 <secondary>rewriting argument of</secondary>
46670 </indexterm>
46671 <indexterm role="concept">
46672 <primary>MAIL</primary>
46673 <secondary>rewriting argument of</secondary>
46674 </indexterm>
46675 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
46676 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
46677 before any other processing; even before syntax checking. The pattern is
46678 required to be a regular expression, and it is matched against the whole of the
46679 data for the command, including any surrounding angle brackets.
46680 </para>
46681 <para>
46682 <indexterm role="variable">
46683 <primary><varname>$domain</varname></primary>
46684 </indexterm>
46685 <indexterm role="variable">
46686 <primary><varname>$local_part</varname></primary>
46687 </indexterm>
46688 This form of rewrite rule allows for the handling of addresses that are not
46689 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
46690 input). Because the input is not required to be a syntactically valid address,
46691 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
46692 expansion of the replacement string. The result of rewriting replaces the
46693 original address in the MAIL or RCPT command.
46694 </para>
46695 </section>
46696 <section id="SECID155">
46697 <title>Flags controlling the rewriting process</title>
46698 <para>
46699 There are four flags which control the way the rewriting process works. These
46700 take effect only when a rule is invoked, that is, when the address is of the
46701 correct type (matches the flags) and matches the pattern:
46702 </para>
46703 <itemizedlist>
46704 <listitem>
46705 <para>
46706 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
46707 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
46708 absence of <quote>Q</quote> the rewritten address must always include a domain.
46709 </para>
46710 </listitem>
46711 <listitem>
46712 <para>
46713 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
46714 even if no rewriting actually takes place because of a <quote>fail</quote> in the
46715 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
46716 (does not match the flags) or does not match the pattern.
46717 </para>
46718 </listitem>
46719 <listitem>
46720 <para>
46721 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
46722 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
46723 rewriting once it fails to match (after at least one successful rewrite).
46724 </para>
46725 </listitem>
46726 <listitem>
46727 <para>
46728 <indexterm role="concept">
46729 <primary>rewriting</primary>
46730 <secondary>whole addresses</secondary>
46731 </indexterm>
46732 When an address in a header is rewritten, the rewriting normally applies only
46733 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
46734 left unchanged. For example, rewriting might change
46735 </para>
46736 <literallayout class="monospaced">
46737 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
46738 </literallayout>
46739 <para>
46740 into
46741 </para>
46742 <literallayout class="monospaced">
46743 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
46744 </literallayout>
46745 <para>
46746 <indexterm role="concept">
46747 <primary>RFC 2047</primary>
46748 </indexterm>
46749 Sometimes there is a need to replace the whole address item, and this can be
46750 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
46751 causes an address in a header line to be rewritten, the entire address is
46752 replaced, not just the working part. The replacement must be a complete RFC
46753 2822 address, including the angle brackets if necessary. If text outside angle
46754 brackets contains a character whose value is greater than 126 or less than 32
46755 (except for tab), the text is encoded according to RFC 2047. The character set
46756 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
46757 </para>
46758 <para>
46759 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
46760 rewritten, all but the working part of the replacement address is discarded.
46761 </para>
46762 </listitem>
46763 </itemizedlist>
46764 </section>
46765 <section id="SECID156">
46766 <title>Rewriting examples</title>
46767 <para>
46768 Here is an example of the two common rewriting paradigms:
46769 </para>
46770 <literallayout class="monospaced">
46771 *@*.hitch.fict.example  $1@hitch.fict.example
46772 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
46773                      {$value}fail}@hitch.fict.example bctfrF
46774 </literallayout>
46775 <para>
46776 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
46777 the string expansion to fail if the lookup does not succeed. In this context it
46778 has the effect of leaving the original address unchanged, but Exim goes on to
46779 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
46780 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
46781 explicitly, which would cause the rewritten address to be the same as before,
46782 at the cost of a small bit of processing. Not supplying either of these is an
46783 error, since the rewritten address would then contain no local part.
46784 </para>
46785 <para>
46786 The first example above replaces the domain with a superior, more general
46787 domain. This may not be desirable for certain local parts. If the rule
46788 </para>
46789 <literallayout class="monospaced">
46790 root@*.hitch.fict.example  *
46791 </literallayout>
46792 <para>
46793 were inserted before the first rule, rewriting would be suppressed for the
46794 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
46795 </para>
46796 <para>
46797 Rewriting can be made conditional on a number of tests, by making use of
46798 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
46799 messages that originate outside the local host:
46800 </para>
46801 <literallayout class="monospaced">
46802 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
46803                          {$1@hitch.fict.example}fail}"
46804 </literallayout>
46805 <para>
46806 The replacement string is quoted in this example because it contains white
46807 space.
46808 </para>
46809 <para>
46810 <indexterm role="concept">
46811 <primary>rewriting</primary>
46812 <secondary>bang paths</secondary>
46813 </indexterm>
46814 <indexterm role="concept">
46815 <primary>bang paths</primary>
46816 <secondary>rewriting</secondary>
46817 </indexterm>
46818 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
46819 an address it treats it as an unqualified local part which it qualifies with
46820 the local qualification domain (if the source of the message is local or if the
46821 remote host is permitted to send unqualified addresses). Rewriting can
46822 sometimes be used to handle simple bang paths with a fixed number of
46823 components. For example, the rule
46824 </para>
46825 <literallayout class="monospaced">
46826 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
46827 </literallayout>
46828 <para>
46829 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
46830 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
46831 a global rewriting rule for envelope addresses. It can provide a backdoor
46832 method for using your system as a relay, because the incoming addresses appear
46833 to be local. If the bang path addresses are received via SMTP, it is safer to
46834 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
46835 can be done on the rewritten addresses.
46836 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
46837 </para>
46838 </section>
46839 </chapter>
46840
46841 <chapter id="CHAPretry">
46842 <title>Retry configuration</title>
46843 <para>
46844 <indexterm role="concept" id="IIDretconf1" class="startofrange">
46845 <primary>retry</primary>
46846 <secondary>configuration, description of</secondary>
46847 </indexterm>
46848 <indexterm role="concept" id="IIDregconf2" class="startofrange">
46849 <primary>configuration file</primary>
46850 <secondary>retry section</secondary>
46851 </indexterm>
46852 The <quote>retry</quote> section of the runtime configuration file contains a list of
46853 retry rules that control how often Exim tries to deliver messages that cannot
46854 be delivered at the first attempt. If there are no retry rules (the section is
46855 empty or not present), there are no retries. In this situation, temporary
46856 errors are treated as permanent. The default configuration contains a single,
46857 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
46858 line option can be used to test which retry rule will be used for a given
46859 address, domain and error.
46860 </para>
46861 <para>
46862 The most common cause of retries is temporary failure to deliver to a remote
46863 host because the host is down, or inaccessible because of a network problem.
46864 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
46865 address) basis, not on a per-message basis. Thus, if one message has recently
46866 been delayed, delivery of a new message to the same host is not immediately
46867 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
46868 log selector is set, the message
46869 <indexterm role="concept">
46870 <primary>retry</primary>
46871 <secondary>time not reached</secondary>
46872 </indexterm>
46873 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
46874 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
46875 the handling of errors during remote deliveries.
46876 </para>
46877 <para>
46878 Retry processing applies to routing as well as to delivering, except as covered
46879 in the next paragraph. The retry rules do not distinguish between these
46880 actions. It is not possible, for example, to specify different behaviour for
46881 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
46882 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
46883 added complication, so did not implement it. However, although they share the
46884 same retry rule, the actual retry times for routing and transporting a given
46885 domain are maintained independently.
46886 </para>
46887 <para>
46888 When a delivery is not part of a queue run (typically an immediate delivery on
46889 receipt of a message), the routers are always run, and local deliveries are
46890 always attempted, even if retry times are set for them. This makes for better
46891 behaviour if one particular message is causing problems (for example, causing
46892 quota overflow, or provoking an error in a filter file). If such a delivery
46893 suffers a temporary failure, the retry data is updated as normal, and
46894 subsequent delivery attempts from queue runs occur only when the retry time for
46895 the local address is reached.
46896 </para>
46897 <section id="SECID157">
46898 <title>Changing retry rules</title>
46899 <para>
46900 If you change the retry rules in your configuration, you should consider
46901 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
46902 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
46903 always safe; that is why they are called <quote>hints</quote>.
46904 </para>
46905 <para>
46906 The hints retry data contains suggested retry times based on the previous
46907 rules. In the case of a long-running problem with a remote host, it might
46908 record the fact that the host has timed out. If your new rules increase the
46909 timeout time for such a host, you should definitely remove the old retry data
46910 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
46911 messages that it should now be retaining.
46912 </para>
46913 </section>
46914 <section id="SECID158">
46915 <title>Format of retry rules</title>
46916 <para>
46917 <indexterm role="concept">
46918 <primary>retry</primary>
46919 <secondary>rules</secondary>
46920 </indexterm>
46921 Each retry rule occupies one line and consists of three or four parts,
46922 separated by white space: a pattern, an error name, an optional list of sender
46923 addresses, and a list of retry parameters. The pattern and sender lists must be
46924 enclosed in double quotes if they contain white space. The rules are searched
46925 in order until one is found where the pattern, error name, and sender list (if
46926 present) match the failing host or address, the error that occurred, and the
46927 message&#x2019;s sender, respectively.
46928 </para>
46929 <para>
46930 The pattern is any single item that may appear in an address list (see section
46931 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
46932 which means that it is expanded before being tested against the address that
46933 has been delayed. A negated address list item is permitted. Address
46934 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
46935 which makes it possible for many retry rules to start with just a domain. For
46936 example,
46937 </para>
46938 <literallayout class="monospaced">
46939 lookingglass.fict.example        *  F,24h,30m;
46940 </literallayout>
46941 <para>
46942 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
46943 whereas
46944 </para>
46945 <literallayout class="monospaced">
46946 alice@lookingglass.fict.example  *  F,24h,30m;
46947 </literallayout>
46948 <para>
46949 applies only to temporary failures involving the local part <option>alice</option>.
46950 In practice, almost all rules start with a domain name pattern without a local
46951 part.
46952 </para>
46953 <para>
46954 <indexterm role="concept">
46955 <primary>regular expressions</primary>
46956 <secondary>in retry rules</secondary>
46957 </indexterm>
46958 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
46959 must match a complete address, not just a domain, because that is how regular
46960 expressions work in address lists.
46961 </para>
46962 <literallayout>
46963 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
46964 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
46965 </literallayout>
46966 </section>
46967 <section id="SECID159">
46968 <title>Choosing which retry rule to use for address errors</title>
46969 <para>
46970 When Exim is looking for a retry rule after a routing attempt has failed (for
46971 example, after a DNS timeout), each line in the retry configuration is tested
46972 against the complete address only if <option>retry_use_local_part</option> is set for the
46973 router. Otherwise, only the domain is used, except when matching against a
46974 regular expression, when the local part of the address is replaced with <quote>*</quote>.
46975 A domain on its own can match a domain pattern, or a pattern that starts with
46976 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
46977 <option>check_local_user</option> is true, and false for other routers.
46978 </para>
46979 <para>
46980 Similarly, when Exim is looking for a retry rule after a local delivery has
46981 failed (for example, after a mailbox full error), each line in the retry
46982 configuration is tested against the complete address only if
46983 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
46984 local transports).
46985 </para>
46986 <para>
46987 <indexterm role="concept">
46988 <primary>4<emphasis>xx</emphasis> responses</primary>
46989 <secondary>retry rules for</secondary>
46990 </indexterm>
46991 However, when Exim is looking for a retry rule after a remote delivery attempt
46992 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
46993 whole address is always used as the key when searching the retry rules. The
46994 rule that is found is used to create a retry time for the combination of the
46995 failing address and the message&#x2019;s sender. It is the combination of sender and
46996 recipient that is delayed in subsequent queue runs until its retry time is
46997 reached. You can delay the recipient without regard to the sender by setting
46998 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
46999 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
47000 commands.
47001 </para>
47002 </section>
47003 <section id="SECID160">
47004 <title>Choosing which retry rule to use for host and message errors</title>
47005 <para>
47006 For a temporary error that is not related to an individual address (for
47007 example, a connection timeout), each line in the retry configuration is checked
47008 twice. First, the name of the remote host is used as a domain name (preceded by
47009 <quote>*@</quote> when matching a regular expression). If this does not match the line,
47010 the domain from the email address is tried in a similar fashion. For example,
47011 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
47012 </para>
47013 <literallayout class="monospaced">
47014 a.b.c.example  MX  5  x.y.z.example
47015                MX  6  p.q.r.example
47016                MX  7  m.n.o.example
47017 </literallayout>
47018 <para>
47019 and the retry rules are
47020 </para>
47021 <literallayout class="monospaced">
47022 p.q.r.example    *      F,24h,30m;
47023 a.b.c.example    *      F,4d,45m;
47024 </literallayout>
47025 <para>
47026 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
47027 first rule matches neither the host nor the domain, so Exim looks at the second
47028 rule. This does not match the host, but it does match the domain, so it is used
47029 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
47030 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
47031 first retry rule is used, because it matches the host.
47032 </para>
47033 <para>
47034 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
47035 first rule to determine retry times, but for all the other hosts for the domain
47036 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
47037 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
47038 </para>
47039 <para>
47040 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
47041 However, if a message is routed directly to an IP address without the use of a
47042 host name, for example, if a <command>manualroute</command> router contains a setting such as:
47043 </para>
47044 <literallayout class="monospaced">
47045 route_list = *.a.example  192.168.34.23
47046 </literallayout>
47047 <para>
47048 then the <quote>host name</quote> that is used when searching for a retry rule is the
47049 textual form of the IP address.
47050 </para>
47051 </section>
47052 <section id="SECID161">
47053 <title>Retry rules for specific errors</title>
47054 <para>
47055 <indexterm role="concept">
47056 <primary>retry</primary>
47057 <secondary>specific errors; specifying</secondary>
47058 </indexterm>
47059 The second field in a retry rule is the name of a particular error, or an
47060 asterisk, which matches any error. The errors that can be tested for are:
47061 </para>
47062 <variablelist>
47063 <varlistentry>
47064 <term><option>auth_failed</option></term>
47065 <listitem>
47066 <para>
47067 Authentication failed when trying to send to a host in the
47068 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
47069 </para>
47070 </listitem></varlistentry>
47071 <varlistentry>
47072 <term><option>data_4xx</option></term>
47073 <listitem>
47074 <para>
47075 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
47076 after the command, or after sending the message&#x2019;s data.
47077 </para>
47078 </listitem></varlistentry>
47079 <varlistentry>
47080 <term><option>mail_4xx</option></term>
47081 <listitem>
47082 <para>
47083 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
47084 </para>
47085 </listitem></varlistentry>
47086 <varlistentry>
47087 <term><option>rcpt_4xx</option></term>
47088 <listitem>
47089 <para>
47090 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
47091 </para>
47092 </listitem></varlistentry>
47093 </variablelist>
47094 <para>
47095 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
47096 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
47097 recognize 452 errors given to RCPT commands for addresses in a certain domain,
47098 and have retries every ten minutes with a one-hour timeout, you could set up a
47099 retry rule of this form:
47100 </para>
47101 <literallayout class="monospaced">
47102 the.domain.name  rcpt_452   F,1h,10m
47103 </literallayout>
47104 <para>
47105 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
47106 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
47107 </para>
47108 <variablelist>
47109 <varlistentry>
47110 <term><option>lost_connection</option></term>
47111 <listitem>
47112 <para>
47113 A server unexpectedly closed the SMTP connection. There may, of course,
47114 legitimate reasons for this (host died, network died), but if it repeats a lot
47115 for the same host, it indicates something odd.
47116 </para>
47117 </listitem></varlistentry>
47118 <varlistentry>
47119 <term><option>refused_MX</option></term>
47120 <listitem>
47121 <para>
47122 A connection to a host obtained from an MX record was refused.
47123 </para>
47124 </listitem></varlistentry>
47125 <varlistentry>
47126 <term><option>refused_A</option></term>
47127 <listitem>
47128 <para>
47129 A connection to a host not obtained from an MX record was refused.
47130 </para>
47131 </listitem></varlistentry>
47132 <varlistentry>
47133 <term><option>refused</option></term>
47134 <listitem>
47135 <para>
47136 A connection was refused.
47137 </para>
47138 </listitem></varlistentry>
47139 <varlistentry>
47140 <term><option>timeout_connect_MX</option></term>
47141 <listitem>
47142 <para>
47143 A connection attempt to a host obtained from an MX record timed out.
47144 </para>
47145 </listitem></varlistentry>
47146 <varlistentry>
47147 <term><option>timeout_connect_A</option></term>
47148 <listitem>
47149 <para>
47150 A connection attempt to a host not obtained from an MX record timed out.
47151 </para>
47152 </listitem></varlistentry>
47153 <varlistentry>
47154 <term><option>timeout_connect</option></term>
47155 <listitem>
47156 <para>
47157 A connection attempt timed out.
47158 </para>
47159 </listitem></varlistentry>
47160 <varlistentry>
47161 <term><option>timeout_MX</option></term>
47162 <listitem>
47163 <para>
47164 There was a timeout while connecting or during an SMTP session with a host
47165 obtained from an MX record.
47166 </para>
47167 </listitem></varlistentry>
47168 <varlistentry>
47169 <term><option>timeout_A</option></term>
47170 <listitem>
47171 <para>
47172 There was a timeout while connecting or during an SMTP session with a host not
47173 obtained from an MX record.
47174 </para>
47175 </listitem></varlistentry>
47176 <varlistentry>
47177 <term><option>timeout</option></term>
47178 <listitem>
47179 <para>
47180 There was a timeout while connecting or during an SMTP session.
47181 </para>
47182 </listitem></varlistentry>
47183 <varlistentry>
47184 <term><option>tls_required</option></term>
47185 <listitem>
47186 <para>
47187 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
47188 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
47189 to STARTTLS, or there was a problem setting up the TLS connection.
47190 </para>
47191 </listitem></varlistentry>
47192 <varlistentry>
47193 <term><option>quota</option></term>
47194 <listitem>
47195 <para>
47196 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47197 transport.
47198 </para>
47199 </listitem></varlistentry>
47200 <varlistentry>
47201 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
47202 <listitem>
47203 <para>
47204 <indexterm role="concept">
47205 <primary>quota</primary>
47206 <secondary>error testing in retry rule</secondary>
47207 </indexterm>
47208 <indexterm role="concept">
47209 <primary>retry</primary>
47210 <secondary>quota error testing</secondary>
47211 </indexterm>
47212 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
47213 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
47214 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
47215 for four days.
47216 </para>
47217 </listitem></varlistentry>
47218 </variablelist>
47219 <para>
47220 <indexterm role="concept">
47221 <primary>mailbox</primary>
47222 <secondary>time of last read</secondary>
47223 </indexterm>
47224 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
47225 timeouts when the mailbox is full and is not being read by its owner. Ideally,
47226 it should be based on the last time that the user accessed the mailbox.
47227 However, it is not always possible to determine this. Exim uses the following
47228 heuristic rules:
47229 </para>
47230 <itemizedlist>
47231 <listitem>
47232 <para>
47233 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
47234 used. As no new messages are being delivered (because the mailbox is over
47235 quota), Exim does not access the file, so this is the time of last user access.
47236 </para>
47237 </listitem>
47238 <listitem>
47239 <para>
47240 <indexterm role="concept">
47241 <primary>maildir format</primary>
47242 <secondary>time of last read</secondary>
47243 </indexterm>
47244 For a maildir delivery, the time of last modification of the <filename>new</filename>
47245 subdirectory is used. As the mailbox is over quota, no new files are created in
47246 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
47247 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
47248 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
47249 time that is used is therefore the last time that the user read a new message.
47250 </para>
47251 </listitem>
47252 <listitem>
47253 <para>
47254 For other kinds of multi-file mailbox, the time of last access cannot be
47255 obtained, so a retry rule that uses this type of error field is never matched.
47256 </para>
47257 </listitem>
47258 </itemizedlist>
47259 <para>
47260 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
47261 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
47262 when a local delivery is deferred because a partition is full (the ENOSPC
47263 error).
47264 </para>
47265 </section>
47266 <section id="SECID162">
47267 <title>Retry rules for specified senders</title>
47268 <para>
47269 <indexterm role="concept">
47270 <primary>retry</primary>
47271 <secondary>rules; sender-specific</secondary>
47272 </indexterm>
47273 You can specify retry rules that apply only when the failing message has a
47274 specific sender. In particular, this can be used to define retry rules that
47275 apply only to bounce messages. The third item in a retry rule can be of this
47276 form:
47277 </para>
47278 <literallayout>
47279 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
47280 </literallayout>
47281 <para>
47282 The retry timings themselves are then the fourth item. For example:
47283 </para>
47284 <literallayout class="monospaced">
47285 *   rcpt_4xx   senders=:   F,1h,30m
47286 </literallayout>
47287 <para>
47288 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
47289 host. If the address list contains white space, it must be enclosed in quotes.
47290 For example:
47291 </para>
47292 <literallayout class="monospaced">
47293 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
47294 </literallayout>
47295 <para>
47296 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
47297 (which do not depend on the recipient). The reason is that the sender is used
47298 only to match the retry rule. Once the rule has been found for a host error,
47299 its contents are used to set a retry time for the host, and this will apply to
47300 all messages, not just those with specific senders.
47301 </para>
47302 <para>
47303 When testing retry rules using <option>-brt</option>, you can supply a sender using the
47304 <option>-f</option> command line option, like this:
47305 </para>
47306 <literallayout class="monospaced">
47307 exim -f "" -brt user@dom.ain
47308 </literallayout>
47309 <para>
47310 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
47311 list is never matched.
47312 </para>
47313 </section>
47314 <section id="SECID163">
47315 <title>Retry parameters</title>
47316 <para>
47317 <indexterm role="concept">
47318 <primary>retry</primary>
47319 <secondary>parameters in rules</secondary>
47320 </indexterm>
47321 The third (or fourth, if a senders list is present) field in a retry rule is a
47322 sequence of retry parameter sets, separated by semicolons. Each set consists of
47323 </para>
47324 <literallayout>
47325 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
47326 </literallayout>
47327 <para>
47328 The letter identifies the algorithm for computing a new retry time; the cutoff
47329 time is the time beyond which this algorithm no longer applies, and the
47330 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
47331 time that the first failure for the domain (combined with the local part if
47332 relevant) was detected, not from the time the message was received.
47333 </para>
47334 <para>
47335 <indexterm role="concept">
47336 <primary>retry</primary>
47337 <secondary>algorithms</secondary>
47338 </indexterm>
47339 <indexterm role="concept">
47340 <primary>retry</primary>
47341 <secondary>fixed intervals</secondary>
47342 </indexterm>
47343 <indexterm role="concept">
47344 <primary>retry</primary>
47345 <secondary>increasing intervals</secondary>
47346 </indexterm>
47347 <indexterm role="concept">
47348 <primary>retry</primary>
47349 <secondary>random intervals</secondary>
47350 </indexterm>
47351 The available algorithms are:
47352 </para>
47353 <itemizedlist>
47354 <listitem>
47355 <para>
47356 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
47357 the interval.
47358 </para>
47359 </listitem>
47360 <listitem>
47361 <para>
47362 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
47363 specifies a starting value for the interval, and the second a multiplier, which
47364 is used to increase the size of the interval at each retry.
47365 </para>
47366 </listitem>
47367 <listitem>
47368 <para>
47369 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
47370 retry, the previous interval is multiplied by the factor in order to get a
47371 maximum for the next interval. The minimum interval is the first argument of
47372 the parameter, and an actual interval is chosen randomly between them. Such a
47373 rule has been found to be helpful in cluster configurations when all the
47374 members of the cluster restart at once, and may therefore synchronize their
47375 queue processing times.
47376 </para>
47377 </listitem>
47378 </itemizedlist>
47379 <para>
47380 When computing the next retry time, the algorithm definitions are scanned in
47381 order until one whose cutoff time has not yet passed is reached. This is then
47382 used to compute a new retry time that is later than the current time. In the
47383 case of fixed interval retries, this simply means adding the interval to the
47384 current time. For geometrically increasing intervals, retry intervals are
47385 computed from the rule&#x2019;s parameters until one that is greater than the previous
47386 interval is found. The main configuration variable
47387 <indexterm role="concept">
47388 <primary>limit</primary>
47389 <secondary>retry interval</secondary>
47390 </indexterm>
47391 <indexterm role="concept">
47392 <primary>retry</primary>
47393 <secondary>interval, maximum</secondary>
47394 </indexterm>
47395 <indexterm role="option">
47396 <primary><option>retry_interval_max</option></primary>
47397 </indexterm>
47398 <option>retry_interval_max</option> limits the maximum interval between retries. It
47399 cannot be set greater than <literal>24h</literal>, which is its default value.
47400 </para>
47401 <para>
47402 A single remote domain may have a number of hosts associated with it, and each
47403 host may have more than one IP address. Retry algorithms are selected on the
47404 basis of the domain name, but are applied to each IP address independently. If,
47405 for example, a host has two IP addresses and one is unusable, Exim will
47406 generate retry times for it and will not try to use it until its next retry
47407 time comes. Thus the good IP address is likely to be tried first most of the
47408 time.
47409 </para>
47410 <para>
47411 <indexterm role="concept">
47412 <primary>hints database</primary>
47413 <secondary>use for retrying</secondary>
47414 </indexterm>
47415 Retry times are hints rather than promises. Exim does not make any attempt to
47416 run deliveries exactly at the computed times. Instead, a queue runner process
47417 starts delivery processes for delayed messages periodically, and these attempt
47418 new deliveries only for those addresses that have passed their next retry time.
47419 If a new message arrives for a deferred address, an immediate delivery attempt
47420 occurs only if the address has passed its retry time. In the absence of new
47421 messages, the minimum time between retries is the interval between queue runner
47422 processes. There is not much point in setting retry times of five minutes if
47423 your queue runners happen only once an hour, unless there are a significant
47424 number of incoming messages (which might be the case on a system that is
47425 sending everything to a smart host, for example).
47426 </para>
47427 <para>
47428 The data in the retry hints database can be inspected by using the
47429 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
47430 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
47431 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
47432 are for the hosts associated with a particular mail domain, and also for local
47433 deliveries that have been deferred.
47434 </para>
47435 </section>
47436 <section id="SECID164">
47437 <title>Retry rule examples</title>
47438 <para>
47439 Here are some example retry rules:
47440 </para>
47441 <literallayout class="monospaced">
47442 alice@wonderland.fict.example quota_5d  F,7d,3h
47443 wonderland.fict.example       quota_5d
47444 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
47445 lookingglass.fict.example     *         F,24h,30m;
47446 *                 refused_A   F,2h,20m;
47447 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
47448 </literallayout>
47449 <para>
47450 The first rule sets up special handling for mail to
47451 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
47452 mailbox has not been read for at least 5 days. Retries continue every three
47453 hours for 7 days. The second rule handles over-quota errors for all other local
47454 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
47455 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
47456 fail are bounced immediately if the mailbox has not been read for at least 5
47457 days.
47458 </para>
47459 <para>
47460 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
47461 happen every 15 minutes for an hour, then with geometrically increasing
47462 intervals until two days have passed since a delivery first failed. After the
47463 first hour there is a delay of one hour, then two hours, then four hours, and
47464 so on (this is a rather extreme example).
47465 </para>
47466 <para>
47467 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
47468 They happen every 30 minutes for 24 hours only. The remaining two rules handle
47469 all other domains, with special action for connection refusal from hosts that
47470 were not obtained from an MX record.
47471 </para>
47472 <para>
47473 The final rule in a retry configuration should always have asterisks in the
47474 first two fields so as to provide a general catch-all for any addresses that do
47475 not have their own special handling. This example tries every 15 minutes for 2
47476 hours, then with intervals starting at one hour and increasing by a factor of
47477 1.5 up to 16 hours, then every 8 hours up to 5 days.
47478 </para>
47479 </section>
47480 <section id="SECID165">
47481 <title>Timeout of retry data</title>
47482 <para>
47483 <indexterm role="concept">
47484 <primary>timeout</primary>
47485 <secondary>of retry data</secondary>
47486 </indexterm>
47487 <indexterm role="option">
47488 <primary><option>retry_data_expire</option></primary>
47489 </indexterm>
47490 <indexterm role="concept">
47491 <primary>hints database</primary>
47492 <secondary>data expiry</secondary>
47493 </indexterm>
47494 <indexterm role="concept">
47495 <primary>retry</primary>
47496 <secondary>timeout of data</secondary>
47497 </indexterm>
47498 Exim timestamps the data that it writes to its retry hints database. When it
47499 consults the data during a delivery it ignores any that is older than the value
47500 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
47501 been tried for 7 days, Exim will try to deliver to it immediately a message
47502 arrives, and if that fails, it will calculate a retry time as if it were
47503 failing for the first time.
47504 </para>
47505 <para>
47506 This improves the behaviour for messages routed to rarely-used hosts such as MX
47507 backups. If such a host was down at one time, and happens to be down again when
47508 Exim tries a month later, using the old retry data would imply that it had been
47509 down all the time, which is not a justified assumption.
47510 </para>
47511 <para>
47512 If a host really is permanently dead, this behaviour causes a burst of retries
47513 every now and again, but only if messages routed to it are rare. If there is a
47514 message at least once every 7 days the retry data never expires.
47515 </para>
47516 </section>
47517 <section id="SECID166">
47518 <title>Long-term failures</title>
47519 <para>
47520 <indexterm role="concept">
47521 <primary>delivery failure, long-term</primary>
47522 </indexterm>
47523 <indexterm role="concept">
47524 <primary>retry</primary>
47525 <secondary>after long-term failure</secondary>
47526 </indexterm>
47527 Special processing happens when an email address has been failing for so long
47528 that the cutoff time for the last algorithm is reached. For example, using the
47529 default retry rule:
47530 </para>
47531 <literallayout class="monospaced">
47532 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
47533 </literallayout>
47534 <para>
47535 the cutoff time is four days. Reaching the retry cutoff is independent of how
47536 long any specific message has been failing; it is the length of continuous
47537 failure for the recipient address that counts.
47538 </para>
47539 <para>
47540 When the cutoff time is reached for a local delivery, or for all the IP
47541 addresses associated with a remote delivery, a subsequent delivery failure
47542 causes Exim to give up on the address, and a bounce message is generated.
47543 In order to cater for new messages that use the failing address, a next retry
47544 time is still computed from the final algorithm, and is used as follows:
47545 </para>
47546 <para>
47547 For local deliveries, one delivery attempt is always made for any subsequent
47548 messages. If this delivery fails, the address fails immediately. The
47549 post-cutoff retry time is not used.
47550 </para>
47551 <para>
47552 If the delivery is remote, there are two possibilities, controlled by the
47553 <indexterm role="option">
47554 <primary><option>delay_after_cutoff</option></primary>
47555 </indexterm>
47556 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
47557 default. Until the post-cutoff retry time for one of the IP addresses is
47558 reached, the failing email address is bounced immediately, without a delivery
47559 attempt taking place. After that time, one new delivery attempt is made to
47560 those IP addresses that are past their retry times, and if that still fails,
47561 the address is bounced and new retry times are computed.
47562 </para>
47563 <para>
47564 In other words, when all the hosts for a given email address have been failing
47565 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
47566 times is reached. Then it tries once, and bounces if that attempt fails. This
47567 behaviour ensures that few resources are wasted in repeatedly trying to deliver
47568 to a broken destination, but if the host does recover, Exim will eventually
47569 notice.
47570 </para>
47571 <para>
47572 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
47573 addresses are past their final cutoff time, Exim tries to deliver to those IP
47574 addresses that have not been tried since the message arrived. If there are
47575 no suitable IP addresses, or if they all fail, the address is bounced. In other
47576 words, it does not delay when a new message arrives, but tries the expired
47577 addresses immediately, unless they have been tried since the message arrived.
47578 If there is a continuous stream of messages for the failing domains, setting
47579 <option>delay_after_cutoff</option> false means that there will be many more attempts to
47580 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
47581 true.
47582 </para>
47583 </section>
47584 <section id="SECID167">
47585 <title>Deliveries that work intermittently</title>
47586 <para>
47587 <indexterm role="concept">
47588 <primary>retry</primary>
47589 <secondary>intermittently working deliveries</secondary>
47590 </indexterm>
47591 Some additional logic is needed to cope with cases where a host is
47592 intermittently available, or when a message has some attribute that prevents
47593 its delivery when others to the same address get through. In this situation,
47594 because some messages are successfully delivered, the <quote>retry clock</quote> for the
47595 host or address keeps getting reset by the successful deliveries, and so
47596 failing messages remain on the queue for ever because the cutoff time is never
47597 reached.
47598 </para>
47599 <para>
47600 Two exceptional actions are applied to prevent this happening. The first
47601 applies to errors that are related to a message rather than a remote host.
47602 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
47603 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
47604 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
47605 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
47606 is used when scanning the retry rules to decide when to try next and when to
47607 time out the address.
47608 </para>
47609 <para>
47610 The exceptional second action applies in all cases. If a message has been on
47611 the queue for longer than the cutoff time of any applicable retry rule for a
47612 given address, a delivery is attempted for that address, even if it is not yet
47613 time, and if this delivery fails, the address is timed out. A new retry time is
47614 not computed in this case, so that other messages for the same address are
47615 considered immediately.
47616 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
47617 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
47618 </para>
47619 </section>
47620 </chapter>
47621
47622 <chapter id="CHAPSMTPAUTH">
47623 <title>SMTP authentication</title>
47624 <para>
47625 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
47626 <primary>SMTP</primary>
47627 <secondary>authentication configuration</secondary>
47628 </indexterm>
47629 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
47630 <primary>authentication</primary>
47631 </indexterm>
47632 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
47633 with SMTP authentication. This facility is an extension to the SMTP protocol,
47634 described in RFC 2554, which allows a client SMTP host to authenticate itself
47635 to a server. This is a common way for a server to recognize clients that are
47636 permitted to use it as a relay. SMTP authentication is not of relevance to the
47637 transfer of mail between servers that have no managerial connection with each
47638 other.
47639 </para>
47640 <para>
47641 <indexterm role="concept">
47642 <primary>AUTH</primary>
47643 <secondary>description of</secondary>
47644 </indexterm>
47645 Very briefly, the way SMTP authentication works is as follows:
47646 </para>
47647 <itemizedlist>
47648 <listitem>
47649 <para>
47650 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
47651 the client&#x2019;s EHLO command.
47652 </para>
47653 </listitem>
47654 <listitem>
47655 <para>
47656 The client issues an AUTH command, naming a specific mechanism. The command
47657 may, optionally, contain some authentication data.
47658 </para>
47659 </listitem>
47660 <listitem>
47661 <para>
47662 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
47663 appropriate responses. In simple authentication mechanisms, the challenges are
47664 just prompts for user names and passwords. The server does not have to issue
47665 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
47666 with the AUTH command.
47667 </para>
47668 </listitem>
47669 <listitem>
47670 <para>
47671 The server either accepts or denies authentication.
47672 </para>
47673 </listitem>
47674 <listitem>
47675 <para>
47676 If authentication succeeds, the client may optionally make use of the AUTH
47677 option on the MAIL command to pass an authenticated sender in subsequent
47678 mail transactions. Authentication lasts for the remainder of the SMTP
47679 connection.
47680 </para>
47681 </listitem>
47682 <listitem>
47683 <para>
47684 If authentication fails, the client may give up, or it may try a different
47685 authentication mechanism, or it may try transferring mail over the
47686 unauthenticated connection.
47687 </para>
47688 </listitem>
47689 </itemizedlist>
47690 <para>
47691 If you are setting up a client, and want to know which authentication
47692 mechanisms the server supports, you can use Telnet to connect to port 25 (the
47693 SMTP port) on the server, and issue an EHLO command. The response to this
47694 includes the list of supported mechanisms. For example:
47695 </para>
47696 <literallayout>
47697 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
47698 <literal>Trying 192.168.34.25...</literal>
47699 <literal>Connected to server.example.</literal>
47700 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
47701 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
47702 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
47703 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
47704 <literal>250-SIZE 52428800</literal>
47705 <literal>250-PIPELINING</literal>
47706 <literal>250-AUTH PLAIN</literal>
47707 <literal>250 HELP</literal>
47708 </literallayout>
47709 <para>
47710 The second-last line of this example output shows that the server supports
47711 authentication using the PLAIN mechanism. In Exim, the different authentication
47712 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
47713 routers and transports, which authenticators are included in the binary is
47714 controlled by build-time definitions. The following are currently available,
47715 included by setting
47716 </para>
47717 <literallayout class="monospaced">
47718 AUTH_CRAM_MD5=yes
47719 AUTH_CYRUS_SASL=yes
47720 AUTH_DOVECOT=yes
47721 AUTH_GSASL=yes
47722 AUTH_HEIMDAL_GSSAPI=yes
47723 AUTH_PLAINTEXT=yes
47724 AUTH_SPA=yes
47725 </literallayout>
47726 <para>
47727 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
47728 authentication mechanism (RFC 2195), and the second provides an interface to
47729 the Cyrus SASL authentication library.
47730 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
47731 work via a socket interface.
47732 The fourth provides an interface to the GNU SASL authentication library, which
47733 provides mechanisms but typically not data sources.
47734 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
47735 supporting setting a server keytab.
47736 The sixth can be configured to support
47737 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
47738 not formally documented, but used by several MUAs. The seventh authenticator
47739 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
47740 </para>
47741 <para>
47742 The authenticators are configured using the same syntax as other drivers (see
47743 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
47744 authentication section need be present in the configuration file. Each
47745 authenticator can in principle have both server and client functions. When Exim
47746 is receiving SMTP mail, it is acting as a server; when it is sending out
47747 messages over SMTP, it is acting as a client. Authenticator configuration
47748 options are provided for use in both these circumstances.
47749 </para>
47750 <para>
47751 To make it clear which options apply to which situation, the prefixes
47752 <option>server_</option> and <option>client_</option> are used on option names that are specific to
47753 either the server or the client function, respectively. Server and client
47754 functions are disabled if none of their options are set. If an authenticator is
47755 to be used for both server and client functions, a single definition, using
47756 both sets of options, is required. For example:
47757 </para>
47758 <literallayout class="monospaced">
47759 cram:
47760   driver = cram_md5
47761   public_name = CRAM-MD5
47762   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
47763   client_name = ph10
47764   client_secret = secret2
47765 </literallayout>
47766 <para>
47767 The <option>server_</option> option is used when Exim is acting as a server, and the
47768 <option>client_</option> options when it is acting as a client.
47769 </para>
47770 <para>
47771 Descriptions of the individual authenticators are given in subsequent chapters.
47772 The remainder of this chapter covers the generic options for the
47773 authenticators, followed by general discussion of the way authentication works
47774 in Exim.
47775 </para>
47776 <para>
47777 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
47778 per-mechanism basis.  Please read carefully to determine which variables hold
47779 account labels such as usercodes and which hold passwords or other
47780 authenticating data.
47781 </para>
47782 <para>
47783 Note that some mechanisms support two different identifiers for accounts: the
47784 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
47785 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
47786 Conceptually, authentication data such as passwords are tied to the identifier
47787 used to authenticate; servers may have rules to permit one user to act as a
47788 second user, so that after login the session is treated as though that second
47789 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
47790 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
47791 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
47792 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
47793 choose to honour.
47794 </para>
47795 <para>
47796 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
47797 to a client to help it select an account and credentials to use.  In some
47798 mechanisms, the client and server provably agree on the realm, but clients
47799 typically can not treat the realm as secure data to be blindly trusted.
47800 </para>
47801 <section id="SECID168">
47802 <title>Generic options for authenticators</title>
47803 <para>
47804 <indexterm role="concept">
47805 <primary>authentication</primary>
47806 <secondary>generic options</secondary>
47807 </indexterm>
47808 <indexterm role="concept">
47809 <primary>options</primary>
47810 <secondary>generic; for authenticators</secondary>
47811 </indexterm>
47812 </para>
47813 <para>
47814 <indexterm role="option">
47815 <primary><option>client_condition</option></primary>
47816 </indexterm>
47817 </para>
47818 <informaltable frame="all">
47819 <tgroup cols="4" colsep="0" rowsep="0">
47820 <colspec colwidth="8*" align="left"/>
47821 <colspec colwidth="6*" align="center"/>
47822 <colspec colwidth="6*" align="center"/>
47823 <colspec colwidth="6*" align="right"/>
47824 <tbody>
47825 <row>
47826 <entry><option>client_condition</option></entry>
47827 <entry>Use: <emphasis>authenticators</emphasis></entry>
47828 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47829 <entry>Default: <emphasis>unset</emphasis></entry>
47830 </row>
47831 </tbody>
47832 </tgroup>
47833 </informaltable>
47834 <para>
47835 When Exim is authenticating as a client, it skips any authenticator whose
47836 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
47837 used, for example, to skip plain text authenticators when the connection is not
47838 encrypted by a setting such as:
47839 </para>
47840 <literallayout class="monospaced">
47841 client_condition = ${if !eq{$tls_out_cipher}{}}
47842 </literallayout>
47843 <para>
47844 <indexterm role="option">
47845 <primary><option>client_set_id</option></primary>
47846 </indexterm>
47847 </para>
47848 <informaltable frame="all">
47849 <tgroup cols="4" colsep="0" rowsep="0">
47850 <colspec colwidth="8*" align="left"/>
47851 <colspec colwidth="6*" align="center"/>
47852 <colspec colwidth="6*" align="center"/>
47853 <colspec colwidth="6*" align="right"/>
47854 <tbody>
47855 <row>
47856 <entry><option>client_set_id</option></entry>
47857 <entry>Use: <emphasis>authenticators</emphasis></entry>
47858 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47859 <entry>Default: <emphasis>unset</emphasis></entry>
47860 </row>
47861 </tbody>
47862 </tgroup>
47863 </informaltable>
47864 <para>
47865 When client authentication succeeds, this condition is expanded; the
47866 result is used in the log lines for outbound messasges.
47867 Typically it will be the user name used for authentication.
47868 </para>
47869 <para>
47870 <indexterm role="option">
47871 <primary><option>driver</option></primary>
47872 </indexterm>
47873 </para>
47874 <informaltable frame="all">
47875 <tgroup cols="4" colsep="0" rowsep="0">
47876 <colspec colwidth="8*" align="left"/>
47877 <colspec colwidth="6*" align="center"/>
47878 <colspec colwidth="6*" align="center"/>
47879 <colspec colwidth="6*" align="right"/>
47880 <tbody>
47881 <row>
47882 <entry><option>driver</option></entry>
47883 <entry>Use: <emphasis>authenticators</emphasis></entry>
47884 <entry>Type: <emphasis>string</emphasis></entry>
47885 <entry>Default: <emphasis>unset</emphasis></entry>
47886 </row>
47887 </tbody>
47888 </tgroup>
47889 </informaltable>
47890 <para>
47891 This option must always be set. It specifies which of the available
47892 authenticators is to be used.
47893 </para>
47894 <para>
47895 <indexterm role="option">
47896 <primary><option>public_name</option></primary>
47897 </indexterm>
47898 </para>
47899 <informaltable frame="all">
47900 <tgroup cols="4" colsep="0" rowsep="0">
47901 <colspec colwidth="8*" align="left"/>
47902 <colspec colwidth="6*" align="center"/>
47903 <colspec colwidth="6*" align="center"/>
47904 <colspec colwidth="6*" align="right"/>
47905 <tbody>
47906 <row>
47907 <entry><option>public_name</option></entry>
47908 <entry>Use: <emphasis>authenticators</emphasis></entry>
47909 <entry>Type: <emphasis>string</emphasis></entry>
47910 <entry>Default: <emphasis>unset</emphasis></entry>
47911 </row>
47912 </tbody>
47913 </tgroup>
47914 </informaltable>
47915 <para>
47916 This option specifies the name of the authentication mechanism that the driver
47917 implements, and by which it is known to the outside world. These names should
47918 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
47919 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
47920 defaults to the driver&#x2019;s instance name.
47921 </para>
47922 <para>
47923 <indexterm role="option">
47924 <primary><option>server_advertise_condition</option></primary>
47925 </indexterm>
47926 </para>
47927 <informaltable frame="all">
47928 <tgroup cols="4" colsep="0" rowsep="0">
47929 <colspec colwidth="8*" align="left"/>
47930 <colspec colwidth="6*" align="center"/>
47931 <colspec colwidth="6*" align="center"/>
47932 <colspec colwidth="6*" align="right"/>
47933 <tbody>
47934 <row>
47935 <entry><option>server_advertise_condition</option></entry>
47936 <entry>Use: <emphasis>authenticators</emphasis></entry>
47937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47938 <entry>Default: <emphasis>unset</emphasis></entry>
47939 </row>
47940 </tbody>
47941 </tgroup>
47942 </informaltable>
47943 <para>
47944 When a server is about to advertise an authentication mechanism, the condition
47945 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
47946 mechanism is not advertised.
47947 If the expansion fails, the mechanism is not advertised. If the failure was not
47948 forced, and was not caused by a lookup defer, the incident is logged.
47949 See section <xref linkend="SECTauthexiser"/> below for further discussion.
47950 </para>
47951 <para>
47952 <indexterm role="option">
47953 <primary><option>server_condition</option></primary>
47954 </indexterm>
47955 </para>
47956 <informaltable frame="all">
47957 <tgroup cols="4" colsep="0" rowsep="0">
47958 <colspec colwidth="8*" align="left"/>
47959 <colspec colwidth="6*" align="center"/>
47960 <colspec colwidth="6*" align="center"/>
47961 <colspec colwidth="6*" align="right"/>
47962 <tbody>
47963 <row>
47964 <entry><option>server_condition</option></entry>
47965 <entry>Use: <emphasis>authenticators</emphasis></entry>
47966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47967 <entry>Default: <emphasis>unset</emphasis></entry>
47968 </row>
47969 </tbody>
47970 </tgroup>
47971 </informaltable>
47972 <para>
47973 This option must be set for a <option>plaintext</option> server authenticator, where it
47974 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
47975 for details.
47976 </para>
47977 <para>
47978 For the <command>gsasl</command> authenticator, this option is required for various
47979 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
47980 </para>
47981 <para>
47982 For the other authenticators, <option>server_condition</option> can be used as an additional
47983 authentication or authorization mechanism that is applied after the other
47984 authenticator conditions succeed. If it is set, it is expanded when the
47985 authenticator would otherwise return a success code. If the expansion is forced
47986 to fail, authentication fails. Any other expansion failure causes a temporary
47987 error code to be returned. If the result of a successful expansion is an empty
47988 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
47989 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
47990 other result, a temporary error code is returned, with the expanded string as
47991 the error text.
47992 </para>
47993 <para>
47994 <indexterm role="option">
47995 <primary><option>server_debug_print</option></primary>
47996 </indexterm>
47997 </para>
47998 <informaltable frame="all">
47999 <tgroup cols="4" colsep="0" rowsep="0">
48000 <colspec colwidth="8*" align="left"/>
48001 <colspec colwidth="6*" align="center"/>
48002 <colspec colwidth="6*" align="center"/>
48003 <colspec colwidth="6*" align="right"/>
48004 <tbody>
48005 <row>
48006 <entry><option>server_debug_print</option></entry>
48007 <entry>Use: <emphasis>authenticators</emphasis></entry>
48008 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48009 <entry>Default: <emphasis>unset</emphasis></entry>
48010 </row>
48011 </tbody>
48012 </tgroup>
48013 </informaltable>
48014 <para>
48015 If this option is set and authentication debugging is enabled (see the <option>-d</option>
48016 command line option), the string is expanded and included in the debugging
48017 output when the authenticator is run as a server. This can help with checking
48018 out the values of variables.
48019 If expansion of the string fails, the error message is written to the debugging
48020 output, and Exim carries on processing.
48021 </para>
48022 <para>
48023 <indexterm role="option">
48024 <primary><option>server_set_id</option></primary>
48025 </indexterm>
48026 </para>
48027 <informaltable frame="all">
48028 <tgroup cols="4" colsep="0" rowsep="0">
48029 <colspec colwidth="8*" align="left"/>
48030 <colspec colwidth="6*" align="center"/>
48031 <colspec colwidth="6*" align="center"/>
48032 <colspec colwidth="6*" align="right"/>
48033 <tbody>
48034 <row>
48035 <entry><option>server_set_id</option></entry>
48036 <entry>Use: <emphasis>authenticators</emphasis></entry>
48037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48038 <entry>Default: <emphasis>unset</emphasis></entry>
48039 </row>
48040 </tbody>
48041 </tgroup>
48042 </informaltable>
48043 <para>
48044 <indexterm role="variable">
48045 <primary><varname>$authenticated_id</varname></primary>
48046 </indexterm>
48047 When an Exim server successfully authenticates a client, this string is
48048 expanded using data from the authentication, and preserved for any incoming
48049 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
48050 lines for incoming messages. For example, a user/password authenticator
48051 configuration might preserve the user name that was used to authenticate, and
48052 refer to it subsequently during delivery of the message.
48053 If expansion fails, the option is ignored.
48054 </para>
48055 <para>
48056 <indexterm role="option">
48057 <primary><option>server_mail_auth_condition</option></primary>
48058 </indexterm>
48059 </para>
48060 <informaltable frame="all">
48061 <tgroup cols="4" colsep="0" rowsep="0">
48062 <colspec colwidth="8*" align="left"/>
48063 <colspec colwidth="6*" align="center"/>
48064 <colspec colwidth="6*" align="center"/>
48065 <colspec colwidth="6*" align="right"/>
48066 <tbody>
48067 <row>
48068 <entry><option>server_mail_auth_condition</option></entry>
48069 <entry>Use: <emphasis>authenticators</emphasis></entry>
48070 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48071 <entry>Default: <emphasis>unset</emphasis></entry>
48072 </row>
48073 </tbody>
48074 </tgroup>
48075 </informaltable>
48076 <para>
48077 This option allows a server to discard authenticated sender addresses supplied
48078 as part of MAIL commands in SMTP connections that are authenticated by the
48079 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
48080 as part of the authentication process; instead its (unexpanded) value is
48081 remembered for later use.
48082 How it is used is described in the following section.
48083 </para>
48084 </section>
48085 <section id="SECTauthparamail">
48086 <title>The AUTH parameter on MAIL commands</title>
48087 <para>
48088 <indexterm role="concept">
48089 <primary>authentication</primary>
48090 <secondary>sender; authenticated</secondary>
48091 </indexterm>
48092 <indexterm role="concept">
48093 <primary>AUTH</primary>
48094 <secondary>on MAIL command</secondary>
48095 </indexterm>
48096 When a client supplied an AUTH= item on a MAIL command, Exim applies
48097 the following checks before accepting it as the authenticated sender of the
48098 message:
48099 </para>
48100 <itemizedlist>
48101 <listitem>
48102 <para>
48103 If the connection is not using extended SMTP (that is, HELO was used rather
48104 than EHLO), the use of AUTH= is a syntax error.
48105 </para>
48106 </listitem>
48107 <listitem>
48108 <para>
48109 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
48110 </para>
48111 </listitem>
48112 <listitem>
48113 <para>
48114 <indexterm role="variable">
48115 <primary><varname>$authenticated_sender</varname></primary>
48116 </indexterm>
48117 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
48118 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
48119 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
48120 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
48121 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
48122 given for the MAIL command.
48123 </para>
48124 </listitem>
48125 <listitem>
48126 <para>
48127 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
48128 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
48129 authenticated.
48130 </para>
48131 </listitem>
48132 <listitem>
48133 <para>
48134 If the AUTH= value was accepted by either of the two previous rules, and
48135 the client has authenticated, and the authenticator has a setting for the
48136 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
48137 valued that was saved from the authenticator is expanded. If the expansion
48138 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
48139 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
48140 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
48141 message.
48142 </para>
48143 </listitem>
48144 </itemizedlist>
48145 <para>
48146 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
48147 hosts to which Exim authenticates as a client. Do not confuse this value with
48148 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
48149 process, and which is not usually a complete email address.
48150 </para>
48151 <para>
48152 <indexterm role="variable">
48153 <primary><varname>$sender_address</varname></primary>
48154 </indexterm>
48155 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
48156 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
48157 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
48158 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
48159 ACL is run.
48160 </para>
48161 </section>
48162 <section id="SECTauthexiser">
48163 <title>Authentication on an Exim server</title>
48164 <para>
48165 <indexterm role="concept">
48166 <primary>authentication</primary>
48167 <secondary>on an Exim server</secondary>
48168 </indexterm>
48169 When Exim receives an EHLO command, it advertises the public names of those
48170 authenticators that are configured as servers, subject to the following
48171 conditions:
48172 </para>
48173 <itemizedlist>
48174 <listitem>
48175 <para>
48176 The client host must match <option>auth_advertise_hosts</option> (default *).
48177 </para>
48178 </listitem>
48179 <listitem>
48180 <para>
48181 It the <option>server_advertise_condition</option> option is set, its expansion must not
48182 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
48183 </para>
48184 </listitem>
48185 </itemizedlist>
48186 <para>
48187 The order in which the authenticators are defined controls the order in which
48188 the mechanisms are advertised.
48189 </para>
48190 <para>
48191 Some mail clients (for example, some versions of Netscape) require the user to
48192 provide a name and password for authentication whenever AUTH is advertised,
48193 even though authentication may not in fact be needed (for example, Exim may be
48194 set up to allow unconditional relaying from the client by an IP address check).
48195 You can make such clients more friendly by not advertising AUTH to them.
48196 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
48197 that runs for RCPT) to relay without authentication, you should set
48198 </para>
48199 <literallayout class="monospaced">
48200 auth_advertise_hosts = ! 10.9.8.0/24
48201 </literallayout>
48202 <para>
48203 so that no authentication mechanisms are advertised to them.
48204 </para>
48205 <para>
48206 The <option>server_advertise_condition</option> controls the advertisement of individual
48207 authentication mechanisms. For example, it can be used to restrict the
48208 advertisement of a particular mechanism to encrypted connections, by a setting
48209 such as:
48210 </para>
48211 <literallayout class="monospaced">
48212 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
48213 </literallayout>
48214 <para>
48215 <indexterm role="variable">
48216 <primary><varname>$tls_in_cipher</varname></primary>
48217 </indexterm>
48218 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
48219 yields <quote>yes</quote>, which allows the advertisement to happen.
48220 </para>
48221 <para>
48222 When an Exim server receives an AUTH command from a client, it rejects it
48223 immediately if AUTH was not advertised in response to an earlier EHLO
48224 command. This is the case if
48225 </para>
48226 <itemizedlist>
48227 <listitem>
48228 <para>
48229 The client host does not match <option>auth_advertise_hosts</option>; or
48230 </para>
48231 </listitem>
48232 <listitem>
48233 <para>
48234 No authenticators are configured with server options; or
48235 </para>
48236 </listitem>
48237 <listitem>
48238 <para>
48239 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
48240 server authenticators.
48241 </para>
48242 </listitem>
48243 </itemizedlist>
48244 <para>
48245 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
48246 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
48247 AUTH is accepted from any client host.
48248 </para>
48249 <para>
48250 If AUTH is not rejected by the ACL, Exim searches its configuration for a
48251 server authentication mechanism that was advertised in response to EHLO and
48252 that matches the one named in the AUTH command. If it finds one, it runs
48253 the appropriate authentication protocol, and authentication either succeeds or
48254 fails. If there is no matching advertised mechanism, the AUTH command is
48255 rejected with a 504 error.
48256 </para>
48257 <para>
48258 <indexterm role="variable">
48259 <primary><varname>$received_protocol</varname></primary>
48260 </indexterm>
48261 <indexterm role="variable">
48262 <primary><varname>$sender_host_authenticated</varname></primary>
48263 </indexterm>
48264 When a message is received from an authenticated host, the value of
48265 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
48266 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
48267 public name) of the authenticator driver that successfully authenticated the
48268 client from which the message was received. This variable is empty if there was
48269 no successful authentication.
48270 </para>
48271 </section>
48272 <section id="SECID169">
48273 <title>Testing server authentication</title>
48274 <para>
48275 <indexterm role="concept">
48276 <primary>authentication</primary>
48277 <secondary>testing a server</secondary>
48278 </indexterm>
48279 <indexterm role="concept">
48280 <primary>AUTH</primary>
48281 <secondary>testing a server</secondary>
48282 </indexterm>
48283 <indexterm role="concept">
48284 <primary>base64 encoding</primary>
48285 <secondary>creating authentication test data</secondary>
48286 </indexterm>
48287 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
48288 configurations. The data for the AUTH command has to be sent using base64
48289 encoding. A quick way to produce such data for testing is the following Perl
48290 script:
48291 </para>
48292 <literallayout class="monospaced">
48293 use MIME::Base64;
48294 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
48295 </literallayout>
48296 <para>
48297 <indexterm role="concept">
48298 <primary>binary zero</primary>
48299 <secondary>in authentication data</secondary>
48300 </indexterm>
48301 This interprets its argument as a Perl string, and then encodes it. The
48302 interpretation as a Perl string allows binary zeros, which are required for
48303 some kinds of authentication, to be included in the data. For example, a
48304 command line to run this script on such data might be
48305 </para>
48306 <literallayout class="monospaced">
48307 encode '\0user\0password'
48308 </literallayout>
48309 <para>
48310 Note the use of single quotes to prevent the shell interpreting the
48311 backslashes, so that they can be interpreted by Perl to specify characters
48312 whose code value is zero.
48313 </para>
48314 <para>
48315 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
48316 digit, you must use three zeros instead of one after the leading backslash. If
48317 you do not, the octal digit that starts your string will be incorrectly
48318 interpreted as part of the code for the first character.
48319 </para>
48320 <para>
48321 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
48322 specially, you must use a Perl escape to prevent them being misinterpreted. For
48323 example, a command such as
48324 </para>
48325 <literallayout class="monospaced">
48326 encode '\0user@domain.com\0pas$$word'
48327 </literallayout>
48328 <para>
48329 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
48330 </para>
48331 <para>
48332 If you have the <option>mimencode</option> command installed, another way to do produce
48333 base64-encoded strings is to run the command
48334 </para>
48335 <literallayout class="monospaced">
48336 echo -e -n `\0user\0password' | mimencode
48337 </literallayout>
48338 <para>
48339 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
48340 in the argument, and the <option>-n</option> option specifies no newline at the end of its
48341 output. However, not all versions of <option>echo</option> recognize these options, so you
48342 should check your version before relying on this suggestion.
48343 </para>
48344 </section>
48345 <section id="SECID170">
48346 <title>Authentication by an Exim client</title>
48347 <para>
48348 <indexterm role="concept">
48349 <primary>authentication</primary>
48350 <secondary>on an Exim client</secondary>
48351 </indexterm>
48352 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
48353 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
48354 announces support for authentication, and the host matches an entry in either
48355 of these options, Exim (as a client) tries to authenticate as follows:
48356 </para>
48357 <itemizedlist>
48358 <listitem>
48359 <para>
48360 For each authenticator that is configured as a client, in the order in which
48361 they are defined in the configuration, it searches the authentication
48362 mechanisms announced by the server for one whose name matches the public name
48363 of the authenticator.
48364 </para>
48365 </listitem>
48366 <listitem>
48367 <para>
48368 <indexterm role="variable">
48369 <primary><varname>$host</varname></primary>
48370 </indexterm>
48371 <indexterm role="variable">
48372 <primary><varname>$host_address</varname></primary>
48373 </indexterm>
48374 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
48375 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
48376 that the client might do. They are set to the server&#x2019;s name and IP address. If
48377 any expansion is forced to fail, the authentication attempt is abandoned, and
48378 Exim moves on to the next authenticator. Otherwise an expansion failure causes
48379 delivery to be deferred.
48380 </para>
48381 </listitem>
48382 <listitem>
48383 <para>
48384 If the result of the authentication attempt is a temporary error or a timeout,
48385 Exim abandons trying to send the message to the host for the moment. It will
48386 try again later. If there are any backup hosts available, they are tried in the
48387 usual way.
48388 </para>
48389 </listitem>
48390 <listitem>
48391 <para>
48392 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
48393 carries on searching the list of authenticators and tries another one if
48394 possible. If all authentication attempts give permanent errors, or if there are
48395 no attempts because no mechanisms match (or option expansions force failure),
48396 what happens depends on whether the host matches <option>hosts_require_auth</option> or
48397 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
48398 delivery is deferred. The error can be detected in the retry rules, and thereby
48399 turned into a permanent error if you wish. In the second case, Exim tries to
48400 deliver the message unauthenticated.
48401 </para>
48402 </listitem>
48403 </itemizedlist>
48404 <para>
48405 <indexterm role="concept">
48406 <primary>AUTH</primary>
48407 <secondary>on MAIL command</secondary>
48408 </indexterm>
48409 When Exim has authenticated itself to a remote server, it adds the AUTH
48410 parameter to the MAIL commands it sends, if it has an authenticated sender for
48411 the message. If the message came from a remote host, the authenticated sender
48412 is the one that was receiving on an incoming MAIL command, provided that the
48413 incoming connection was authenticated and the <option>server_mail_auth</option> condition
48414 allowed the authenticated sender to be retained. If a local process calls Exim
48415 to send a message, the sender address that is built from the login name and
48416 <option>qualify_domain</option> is treated as authenticated. However, if the
48417 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
48418 the authenticated sender that was received with the message.
48419 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
48420 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
48421 </para>
48422 </section>
48423 </chapter>
48424
48425 <chapter id="CHAPplaintext">
48426 <title>The plaintext authenticator</title>
48427 <para>
48428 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
48429 <primary><command>plaintext</command> authenticator</primary>
48430 </indexterm>
48431 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
48432 <primary>authenticators</primary>
48433 <secondary><command>plaintext</command></secondary>
48434 </indexterm>
48435 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
48436 LOGIN authentication mechanisms, both of which transfer authentication data as
48437 plain (unencrypted) text (though base64 encoded). The use of plain text is a
48438 security risk; you are strongly advised to insist on the use of SMTP encryption
48439 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
48440 use unencrypted plain text, you should not use the same passwords for SMTP
48441 connections as you do for login accounts.
48442 </para>
48443 <section id="SECID171">
48444 <title>Plaintext options</title>
48445 <para>
48446 <indexterm role="concept">
48447 <primary>options</primary>
48448 <secondary><command>plaintext</command> authenticator (server)</secondary>
48449 </indexterm>
48450 When configured as a server, <command>plaintext</command> uses the following options:
48451 </para>
48452 <para>
48453 <indexterm role="option">
48454 <primary><option>server_condition</option></primary>
48455 </indexterm>
48456 </para>
48457 <informaltable frame="all">
48458 <tgroup cols="4" colsep="0" rowsep="0">
48459 <colspec colwidth="8*" align="left"/>
48460 <colspec colwidth="6*" align="center"/>
48461 <colspec colwidth="6*" align="center"/>
48462 <colspec colwidth="6*" align="right"/>
48463 <tbody>
48464 <row>
48465 <entry><option>server_condition</option></entry>
48466 <entry>Use: <emphasis>authenticators</emphasis></entry>
48467 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48468 <entry>Default: <emphasis>unset</emphasis></entry>
48469 </row>
48470 </tbody>
48471 </tgroup>
48472 </informaltable>
48473 <para>
48474 This is actually a global authentication option, but it must be set in order to
48475 configure the <command>plaintext</command> driver as a server. Its use is described below.
48476 </para>
48477 <para>
48478 <indexterm role="option">
48479 <primary><option>server_prompts</option></primary>
48480 </indexterm>
48481 </para>
48482 <informaltable frame="all">
48483 <tgroup cols="4" colsep="0" rowsep="0">
48484 <colspec colwidth="8*" align="left"/>
48485 <colspec colwidth="6*" align="center"/>
48486 <colspec colwidth="6*" align="center"/>
48487 <colspec colwidth="6*" align="right"/>
48488 <tbody>
48489 <row>
48490 <entry><option>server_prompts</option></entry>
48491 <entry>Use: <emphasis>plaintext</emphasis></entry>
48492 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48493 <entry>Default: <emphasis>unset</emphasis></entry>
48494 </row>
48495 </tbody>
48496 </tgroup>
48497 </informaltable>
48498 <para>
48499 The contents of this option, after expansion, must be a colon-separated list of
48500 prompt strings. If expansion fails, a temporary authentication rejection is
48501 given.
48502 </para>
48503 </section>
48504 <section id="SECTplainserver">
48505 <title>Using plaintext in a server</title>
48506 <para>
48507 <indexterm role="concept">
48508 <primary>AUTH</primary>
48509 <secondary>in <command>plaintext</command> authenticator</secondary>
48510 </indexterm>
48511 <indexterm role="concept">
48512 <primary>binary zero</primary>
48513 <secondary>in <command>plaintext</command> authenticator</secondary>
48514 </indexterm>
48515 <indexterm role="concept">
48516 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48517 <secondary>in <command>plaintext</command> authenticator</secondary>
48518 </indexterm>
48519 <indexterm role="variable">
48520 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48521 </indexterm>
48522 <indexterm role="concept">
48523 <primary>base64 encoding</primary>
48524 <secondary>in <command>plaintext</command> authenticator</secondary>
48525 </indexterm>
48526 </para>
48527 <para>
48528 When running as a server, <command>plaintext</command> performs the authentication test by
48529 expanding a string. The data sent by the client with the AUTH command, or in
48530 response to subsequent prompts, is base64 encoded, and so may contain any byte
48531 values when decoded. If any data is supplied with the command, it is treated as
48532 a list of strings, separated by NULs (binary zeros), the first three of which
48533 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
48534 (neither LOGIN nor PLAIN uses more than three strings).
48535 </para>
48536 <para>
48537 For compatibility with previous releases of Exim, the values are also placed in
48538 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
48539 variables for this purpose is now deprecated, as it can lead to confusion in
48540 string expansions that also use them for other things.
48541 </para>
48542 <para>
48543 If there are more strings in <option>server_prompts</option> than the number of strings
48544 supplied with the AUTH command, the remaining prompts are used to obtain more
48545 data. Each response from the client may be a list of NUL-separated strings.
48546 </para>
48547 <para>
48548 <indexterm role="variable">
48549 <primary><varname>$authenticated_id</varname></primary>
48550 </indexterm>
48551 Once a sufficient number of data strings have been received,
48552 <option>server_condition</option> is expanded. If the expansion is forced to fail,
48553 authentication fails. Any other expansion failure causes a temporary error code
48554 to be returned. If the result of a successful expansion is an empty string,
48555 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
48556 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
48557 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
48558 For any other result, a temporary error code is returned, with the expanded
48559 string as the error text
48560 </para>
48561 <para>
48562 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
48563 password, be sure to make the authentication fail if the user is unknown.
48564 There are good and bad examples at the end of the next section.
48565 </para>
48566 </section>
48567 <section id="SECID172">
48568 <title>The PLAIN authentication mechanism</title>
48569 <para>
48570 <indexterm role="concept">
48571 <primary>PLAIN authentication mechanism</primary>
48572 </indexterm>
48573 <indexterm role="concept">
48574 <primary>authentication</primary>
48575 <secondary>PLAIN mechanism</secondary>
48576 </indexterm>
48577 <indexterm role="concept">
48578 <primary>binary zero</primary>
48579 <secondary>in <command>plaintext</command> authenticator</secondary>
48580 </indexterm>
48581 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
48582 sent as one item of data (that is, one combined string containing two NUL
48583 separators). The data is sent either as part of the AUTH command, or
48584 subsequently in response to an empty prompt from the server.
48585 </para>
48586 <para>
48587 The second and third strings are a user name and a corresponding password.
48588 Using a single fixed user name and password as an example, this could be
48589 configured as follows:
48590 </para>
48591 <literallayout class="monospaced">
48592 fixed_plain:
48593   driver = plaintext
48594   public_name = PLAIN
48595   server_prompts = :
48596   server_condition = \
48597     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
48598   server_set_id = $auth2
48599 </literallayout>
48600 <para>
48601 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
48602 are exactly what we want here, so they need not be specified. Obviously, if the
48603 password contains expansion-significant characters such as dollar, backslash,
48604 or closing brace, they have to be escaped.
48605 </para>
48606 <para>
48607 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
48608 the end of a string list are ignored). If all the data comes as part of the
48609 AUTH command, as is commonly the case, the prompt is not used. This
48610 authenticator is advertised in the response to EHLO as
48611 </para>
48612 <literallayout class="monospaced">
48613 250-AUTH PLAIN
48614 </literallayout>
48615 <para>
48616 and a client host can authenticate itself by sending the command
48617 </para>
48618 <literallayout class="monospaced">
48619 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
48620 </literallayout>
48621 <para>
48622 As this contains three strings (more than the number of prompts), no further
48623 data is required from the client. Alternatively, the client may just send
48624 </para>
48625 <literallayout class="monospaced">
48626 AUTH PLAIN
48627 </literallayout>
48628 <para>
48629 to initiate authentication, in which case the server replies with an empty
48630 prompt. The client must respond with the combined data string.
48631 </para>
48632 <para>
48633 The data string is base64 encoded, as required by the RFC. This example,
48634 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;
48635 represents a zero byte. This is split up into three strings, the first of which
48636 is empty. The <option>server_condition</option> option in the authenticator checks that the
48637 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
48638 </para>
48639 <para>
48640 Having just one fixed user name and password, as in this example, is not very
48641 realistic, though for a small organization with only a handful of
48642 authenticating clients it could make sense.
48643 </para>
48644 <para>
48645 A more sophisticated instance of this authenticator could use the user name in
48646 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
48647 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
48648 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
48649 This is an incorrect example:
48650 </para>
48651 <literallayout class="monospaced">
48652 server_condition = \
48653   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
48654 </literallayout>
48655 <para>
48656 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
48657 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
48658 incorrect? It works fine for existing users, but consider what happens if a
48659 non-existent user name is given. The lookup fails, but as no success/failure
48660 strings are given for the lookup, it yields an empty string. Thus, to defeat
48661 the authentication, all a client has to do is to supply a non-existent user
48662 name and an empty password. The correct way of writing this test is:
48663 </para>
48664 <literallayout class="monospaced">
48665 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
48666   {${if eq{$value}{$auth3}}} {false}}
48667 </literallayout>
48668 <para>
48669 In this case, if the lookup succeeds, the result is checked; if the lookup
48670 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
48671 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
48672 always fails if its second argument is empty. However, the second way of
48673 writing the test makes the logic clearer.
48674 </para>
48675 </section>
48676 <section id="SECID173">
48677 <title>The LOGIN authentication mechanism</title>
48678 <para>
48679 <indexterm role="concept">
48680 <primary>LOGIN authentication mechanism</primary>
48681 </indexterm>
48682 <indexterm role="concept">
48683 <primary>authentication</primary>
48684 <secondary>LOGIN mechanism</secondary>
48685 </indexterm>
48686 The LOGIN authentication mechanism is not documented in any RFC, but is in use
48687 in a number of programs. No data is sent with the AUTH command. Instead, a
48688 user name and password are supplied separately, in response to prompts. The
48689 plaintext authenticator can be configured to support this as in this example:
48690 </para>
48691 <literallayout class="monospaced">
48692 fixed_login:
48693   driver = plaintext
48694   public_name = LOGIN
48695   server_prompts = User Name : Password
48696   server_condition = \
48697     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
48698   server_set_id = $auth1
48699 </literallayout>
48700 <para>
48701 Because of the way plaintext operates, this authenticator accepts data supplied
48702 with the AUTH command (in contravention of the specification of LOGIN), but
48703 if the client does not supply it (as is the case for LOGIN clients), the prompt
48704 strings are used to obtain two data items.
48705 </para>
48706 <para>
48707 Some clients are very particular about the precise text of the prompts. For
48708 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
48709 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
48710 strings. It uses the <option>ldapauth</option> expansion condition to check the user
48711 name and password by binding to an LDAP server:
48712 </para>
48713 <literallayout class="monospaced">
48714 login:
48715   driver = plaintext
48716   public_name = LOGIN
48717   server_prompts = Username:: : Password::
48718   server_condition = ${if and{{ \
48719     !eq{}{$auth1} }{ \
48720     ldapauth{\
48721       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
48722       pass=${quote:$auth2} \
48723       ldap://ldap.example.org/} }} }
48724   server_set_id = uid=$auth1,ou=people,o=example.org
48725 </literallayout>
48726 <para>
48727 We have to check that the username is not empty before using it, because LDAP
48728 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
48729 operator to correctly quote the DN for authentication. However, the basic
48730 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
48731 correct one to use for the password, because quoting is needed only to make
48732 the password conform to the Exim syntax. At the LDAP level, the password is an
48733 uninterpreted string.
48734 </para>
48735 </section>
48736 <section id="SECID174">
48737 <title>Support for different kinds of authentication</title>
48738 <para>
48739 A number of string expansion features are provided for the purpose of
48740 interfacing to different ways of user authentication. These include checking
48741 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
48742 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
48743 <xref linkend="SECTexpcond"/>.
48744 </para>
48745 </section>
48746 <section id="SECID175">
48747 <title>Using plaintext in a client</title>
48748 <para>
48749 <indexterm role="concept">
48750 <primary>options</primary>
48751 <secondary><command>plaintext</command> authenticator (client)</secondary>
48752 </indexterm>
48753 The <command>plaintext</command> authenticator has two client options:
48754 </para>
48755 <para>
48756 <indexterm role="option">
48757 <primary><option>client_ignore_invalid_base64</option></primary>
48758 </indexterm>
48759 </para>
48760 <informaltable frame="all">
48761 <tgroup cols="4" colsep="0" rowsep="0">
48762 <colspec colwidth="8*" align="left"/>
48763 <colspec colwidth="6*" align="center"/>
48764 <colspec colwidth="6*" align="center"/>
48765 <colspec colwidth="6*" align="right"/>
48766 <tbody>
48767 <row>
48768 <entry><option>client_ignore_invalid_base64</option></entry>
48769 <entry>Use: <emphasis>plaintext</emphasis></entry>
48770 <entry>Type: <emphasis>boolean</emphasis></entry>
48771 <entry>Default: <emphasis>false</emphasis></entry>
48772 </row>
48773 </tbody>
48774 </tgroup>
48775 </informaltable>
48776 <para>
48777 If the client receives a server prompt that is not a valid base64 string,
48778 authentication is abandoned by default. However, if this option is set true,
48779 the error in the challenge is ignored and the client sends the response as
48780 usual.
48781 </para>
48782 <para>
48783 <indexterm role="option">
48784 <primary><option>client_send</option></primary>
48785 </indexterm>
48786 </para>
48787 <informaltable frame="all">
48788 <tgroup cols="4" colsep="0" rowsep="0">
48789 <colspec colwidth="8*" align="left"/>
48790 <colspec colwidth="6*" align="center"/>
48791 <colspec colwidth="6*" align="center"/>
48792 <colspec colwidth="6*" align="right"/>
48793 <tbody>
48794 <row>
48795 <entry><option>client_send</option></entry>
48796 <entry>Use: <emphasis>plaintext</emphasis></entry>
48797 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48798 <entry>Default: <emphasis>unset</emphasis></entry>
48799 </row>
48800 </tbody>
48801 </tgroup>
48802 </informaltable>
48803 <para>
48804 The string is a colon-separated list of authentication data strings. Each
48805 string is independently expanded before being sent to the server. The first
48806 string is sent with the AUTH command; any more strings are sent in response
48807 to prompts from the server. Before each string is expanded, the value of the
48808 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
48809 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
48810 way. Thus, the prompt that is received in response to sending the first string
48811 (with the AUTH command) can be used in the expansion of the second string, and
48812 so on. If an invalid base64 string is received when
48813 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
48814 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
48815 </para>
48816 <para>
48817 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
48818 splitting takes priority and happens first.
48819 </para>
48820 <para>
48821 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
48822 the data, further processing is applied to each string before it is sent. If
48823 there are any single circumflex characters in the string, they are converted to
48824 NULs. Should an actual circumflex be required as data, it must be doubled in
48825 the string.
48826 </para>
48827 <para>
48828 This is an example of a client configuration that implements the PLAIN
48829 authentication mechanism with a fixed user name and password:
48830 </para>
48831 <literallayout class="monospaced">
48832 fixed_plain:
48833   driver = plaintext
48834   public_name = PLAIN
48835   client_send = ^username^mysecret
48836 </literallayout>
48837 <para>
48838 The lack of colons means that the entire text is sent with the AUTH
48839 command, with the circumflex characters converted to NULs. A similar example
48840 that uses the LOGIN mechanism is:
48841 </para>
48842 <literallayout class="monospaced">
48843 fixed_login:
48844   driver = plaintext
48845   public_name = LOGIN
48846   client_send = : username : mysecret
48847 </literallayout>
48848 <para>
48849 The initial colon means that the first string is empty, so no data is sent with
48850 the AUTH command itself. The remaining strings are sent in response to
48851 prompts.
48852 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
48853 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
48854 </para>
48855 </section>
48856 </chapter>
48857
48858 <chapter id="CHID9">
48859 <title>The cram_md5 authenticator</title>
48860 <para>
48861 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
48862 <primary><command>cram_md5</command> authenticator</primary>
48863 </indexterm>
48864 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
48865 <primary>authenticators</primary>
48866 <secondary><command>cram_md5</command></secondary>
48867 </indexterm>
48868 <indexterm role="concept">
48869 <primary>CRAM-MD5 authentication mechanism</primary>
48870 </indexterm>
48871 <indexterm role="concept">
48872 <primary>authentication</primary>
48873 <secondary>CRAM-MD5 mechanism</secondary>
48874 </indexterm>
48875 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
48876 sends a challenge string to the client, and the response consists of a user
48877 name and the CRAM-MD5 digest of the challenge string combined with a secret
48878 string (password) which is known to both server and client. Thus, the secret
48879 is not sent over the network as plain text, which makes this authenticator more
48880 secure than <command>plaintext</command>. However, the downside is that the secret has to be
48881 available in plain text at either end.
48882 </para>
48883 <section id="SECID176">
48884 <title>Using cram_md5 as a server</title>
48885 <para>
48886 <indexterm role="concept">
48887 <primary>options</primary>
48888 <secondary><command>cram_md5</command> authenticator (server)</secondary>
48889 </indexterm>
48890 This authenticator has one server option, which must be set to configure the
48891 authenticator as a server:
48892 </para>
48893 <para>
48894 <indexterm role="option">
48895 <primary><option>server_secret</option></primary>
48896 </indexterm>
48897 </para>
48898 <informaltable frame="all">
48899 <tgroup cols="4" colsep="0" rowsep="0">
48900 <colspec colwidth="8*" align="left"/>
48901 <colspec colwidth="6*" align="center"/>
48902 <colspec colwidth="6*" align="center"/>
48903 <colspec colwidth="6*" align="right"/>
48904 <tbody>
48905 <row>
48906 <entry><option>server_secret</option></entry>
48907 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48908 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48909 <entry>Default: <emphasis>unset</emphasis></entry>
48910 </row>
48911 </tbody>
48912 </tgroup>
48913 </informaltable>
48914 <para>
48915 <indexterm role="concept">
48916 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48917 <secondary>in <command>cram_md5</command> authenticator</secondary>
48918 </indexterm>
48919 When the server receives the client&#x2019;s response, the user name is placed in
48920 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
48921 obtain the password for that user. The server then computes the CRAM-MD5 digest
48922 that the client should have sent, and checks that it received the correct
48923 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
48924 fails. If the expansion fails for some other reason, a temporary error code is
48925 returned to the client.
48926 </para>
48927 <para>
48928 For compatibility with previous releases of Exim, the user name is also placed
48929 in <varname>$1</varname>. However, the use of this variables for this purpose is now
48930 deprecated, as it can lead to confusion in string expansions that also use
48931 numeric variables for other things.
48932 </para>
48933 <para>
48934 For example, the following authenticator checks that the user name given by the
48935 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
48936 user name, authentication fails.
48937 </para>
48938 <literallayout class="monospaced">
48939 fixed_cram:
48940   driver = cram_md5
48941   public_name = CRAM-MD5
48942   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
48943   server_set_id = $auth1
48944 </literallayout>
48945 <para>
48946 <indexterm role="variable">
48947 <primary><varname>$authenticated_id</varname></primary>
48948 </indexterm>
48949 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
48950 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
48951 secret string in a file, using the user name as the key. For example:
48952 </para>
48953 <literallayout class="monospaced">
48954 lookup_cram:
48955   driver = cram_md5
48956   public_name = CRAM-MD5
48957   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
48958                   {$value}fail}
48959   server_set_id = $auth1
48960 </literallayout>
48961 <para>
48962 Note that this expansion explicitly forces failure if the lookup fails
48963 because <varname>$auth1</varname> contains an unknown user name.
48964 </para>
48965 <para>
48966 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
48967 using the relevant libraries, you need to know the realm to specify in the
48968 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
48969 realm, with:
48970 </para>
48971 <literallayout class="monospaced">
48972 cyrusless_crammd5:
48973   driver = cram_md5
48974   public_name = CRAM-MD5
48975   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
48976                   dbmjz{/etc/sasldb2}}
48977   server_set_id = $auth1
48978 </literallayout>
48979 </section>
48980 <section id="SECID177">
48981 <title>Using cram_md5 as a client</title>
48982 <para>
48983 <indexterm role="concept">
48984 <primary>options</primary>
48985 <secondary><command>cram_md5</command> authenticator (client)</secondary>
48986 </indexterm>
48987 When used as a client, the <command>cram_md5</command> authenticator has two options:
48988 </para>
48989 <para>
48990 <indexterm role="option">
48991 <primary><option>client_name</option></primary>
48992 </indexterm>
48993 </para>
48994 <informaltable frame="all">
48995 <tgroup cols="4" colsep="0" rowsep="0">
48996 <colspec colwidth="8*" align="left"/>
48997 <colspec colwidth="6*" align="center"/>
48998 <colspec colwidth="6*" align="center"/>
48999 <colspec colwidth="6*" align="right"/>
49000 <tbody>
49001 <row>
49002 <entry><option>client_name</option></entry>
49003 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49005 <entry>Default: <emphasis>the primary host name</emphasis></entry>
49006 </row>
49007 </tbody>
49008 </tgroup>
49009 </informaltable>
49010 <para>
49011 This string is expanded, and the result used as the user name data when
49012 computing the response to the server&#x2019;s challenge.
49013 </para>
49014 <para>
49015 <indexterm role="option">
49016 <primary><option>client_secret</option></primary>
49017 </indexterm>
49018 </para>
49019 <informaltable frame="all">
49020 <tgroup cols="4" colsep="0" rowsep="0">
49021 <colspec colwidth="8*" align="left"/>
49022 <colspec colwidth="6*" align="center"/>
49023 <colspec colwidth="6*" align="center"/>
49024 <colspec colwidth="6*" align="right"/>
49025 <tbody>
49026 <row>
49027 <entry><option>client_secret</option></entry>
49028 <entry>Use: <emphasis>cram_md5</emphasis></entry>
49029 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49030 <entry>Default: <emphasis>unset</emphasis></entry>
49031 </row>
49032 </tbody>
49033 </tgroup>
49034 </informaltable>
49035 <para>
49036 This option must be set for the authenticator to work as a client. Its value is
49037 expanded and the result used as the secret string when computing the response.
49038 </para>
49039 <para>
49040 <indexterm role="variable">
49041 <primary><varname>$host</varname></primary>
49042 </indexterm>
49043 <indexterm role="variable">
49044 <primary><varname>$host_address</varname></primary>
49045 </indexterm>
49046 Different user names and secrets can be used for different servers by referring
49047 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
49048 expansion string is treated as an indication that this authenticator is not
49049 prepared to handle this case. Exim moves on to the next configured client
49050 authenticator. Any other expansion failure causes Exim to give up trying to
49051 send the message to the current server.
49052 </para>
49053 <para>
49054 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
49055 strings, is:
49056 </para>
49057 <literallayout class="monospaced">
49058 fixed_cram:
49059   driver = cram_md5
49060   public_name = CRAM-MD5
49061   client_name = ph10
49062   client_secret = secret
49063 </literallayout>
49064 <para>
49065 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
49066 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
49067 </para>
49068 </section>
49069 </chapter>
49070
49071 <chapter id="CHID10">
49072 <title>The cyrus_sasl authenticator</title>
49073 <para>
49074 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
49075 <primary><command>cyrus_sasl</command> authenticator</primary>
49076 </indexterm>
49077 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
49078 <primary>authenticators</primary>
49079 <secondary><command>cyrus_sasl</command></secondary>
49080 </indexterm>
49081 <indexterm role="concept">
49082 <primary>Cyrus</primary>
49083 <secondary>SASL library</secondary>
49084 </indexterm>
49085 <indexterm role="concept">
49086 <primary>Kerberos</primary>
49087 </indexterm>
49088 The code for this authenticator was provided by Matthew Byng-Maddick of A L
49089 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
49090 </para>
49091 <para>
49092 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
49093 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
49094 Layer</quote>). This library supports a number of authentication mechanisms,
49095 including PLAIN and LOGIN, but also several others that Exim does not support
49096 directly. In particular, there is support for Kerberos authentication.
49097 </para>
49098 <para>
49099 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
49100 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
49101 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
49102 name of the driver to determine which mechanism to support.
49103 </para>
49104 <para>
49105 Where access to some kind of secret file is required, for example in GSSAPI
49106 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
49107 user, and that the Cyrus SASL library has no way of escalating privileges
49108 by default. You may also find you need to set environment variables,
49109 depending on the driver you are using.
49110 </para>
49111 <para>
49112 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
49113 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
49114 Kerberos, note that because of limitations in the GSSAPI interface,
49115 changing the server keytab might need to be communicated down to the Kerberos
49116 layer independently. The mechanism for doing so is dependent upon the Kerberos
49117 implementation.
49118 </para>
49119 <para>
49120 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
49121 may be set to point to an alternative keytab file. Exim will pass this
49122 variable through from its own inherited environment when started as root or the
49123 Exim user. The keytab file needs to be readable by the Exim user.
49124 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
49125 environment variable.  In practice, for those releases, the Cyrus authenticator
49126 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
49127 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
49128 </para>
49129 <section id="SECID178">
49130 <title>Using cyrus_sasl as a server</title>
49131 <para>
49132 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
49133 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
49134 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
49135 use of this variable for this purpose is now deprecated, as it can lead to
49136 confusion in string expansions that also use numeric variables for other
49137 things.
49138 </para>
49139 <para>
49140 <indexterm role="option">
49141 <primary><option>server_hostname</option></primary>
49142 </indexterm>
49143 </para>
49144 <informaltable frame="all">
49145 <tgroup cols="4" colsep="0" rowsep="0">
49146 <colspec colwidth="8*" align="left"/>
49147 <colspec colwidth="6*" align="center"/>
49148 <colspec colwidth="6*" align="center"/>
49149 <colspec colwidth="6*" align="right"/>
49150 <tbody>
49151 <row>
49152 <entry><option>server_hostname</option></entry>
49153 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49154 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49155 <entry>Default: <emphasis>see below</emphasis></entry>
49156 </row>
49157 </tbody>
49158 </tgroup>
49159 </informaltable>
49160 <para>
49161 This option selects the hostname that is used when communicating with the
49162 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
49163 SASL plug-in what it does with this data.
49164 </para>
49165 <para>
49166 <indexterm role="option">
49167 <primary><option>server_mech</option></primary>
49168 </indexterm>
49169 </para>
49170 <informaltable frame="all">
49171 <tgroup cols="4" colsep="0" rowsep="0">
49172 <colspec colwidth="8*" align="left"/>
49173 <colspec colwidth="6*" align="center"/>
49174 <colspec colwidth="6*" align="center"/>
49175 <colspec colwidth="6*" align="right"/>
49176 <tbody>
49177 <row>
49178 <entry><option>server_mech</option></entry>
49179 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49180 <entry>Type: <emphasis>string</emphasis></entry>
49181 <entry>Default: <emphasis>see below</emphasis></entry>
49182 </row>
49183 </tbody>
49184 </tgroup>
49185 </informaltable>
49186 <para>
49187 This option selects the authentication mechanism this driver should use. The
49188 default is the value of the generic <option>public_name</option> option. This option allows
49189 you to use a different underlying mechanism from the advertised name. For
49190 example:
49191 </para>
49192 <literallayout class="monospaced">
49193 sasl:
49194   driver = cyrus_sasl
49195   public_name = X-ANYTHING
49196   server_mech = CRAM-MD5
49197   server_set_id = $auth1
49198 </literallayout>
49199 <para>
49200 <indexterm role="option">
49201 <primary><option>server_realm</option></primary>
49202 </indexterm>
49203 </para>
49204 <informaltable frame="all">
49205 <tgroup cols="4" colsep="0" rowsep="0">
49206 <colspec colwidth="8*" align="left"/>
49207 <colspec colwidth="6*" align="center"/>
49208 <colspec colwidth="6*" align="center"/>
49209 <colspec colwidth="6*" align="right"/>
49210 <tbody>
49211 <row>
49212 <entry><option>server_realm</option></entry>
49213 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49214 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49215 <entry>Default: <emphasis>unset</emphasis></entry>
49216 </row>
49217 </tbody>
49218 </tgroup>
49219 </informaltable>
49220 <para>
49221 This specifies the SASL realm that the server claims to be in.
49222 </para>
49223 <para>
49224 <indexterm role="option">
49225 <primary><option>server_service</option></primary>
49226 </indexterm>
49227 </para>
49228 <informaltable frame="all">
49229 <tgroup cols="4" colsep="0" rowsep="0">
49230 <colspec colwidth="8*" align="left"/>
49231 <colspec colwidth="6*" align="center"/>
49232 <colspec colwidth="6*" align="center"/>
49233 <colspec colwidth="6*" align="right"/>
49234 <tbody>
49235 <row>
49236 <entry><option>server_service</option></entry>
49237 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
49238 <entry>Type: <emphasis>string</emphasis></entry>
49239 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49240 </row>
49241 </tbody>
49242 </tgroup>
49243 </informaltable>
49244 <para>
49245 This is the SASL service that the server claims to implement.
49246 </para>
49247 <para>
49248 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
49249 private options. All you need to do is to specify an appropriate mechanism as
49250 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
49251 PLAIN, you could have two authenticators as follows:
49252 </para>
49253 <literallayout class="monospaced">
49254 sasl_cram_md5:
49255   driver = cyrus_sasl
49256   public_name = CRAM-MD5
49257   server_set_id = $auth1
49258
49259 sasl_plain:
49260   driver = cyrus_sasl
49261   public_name = PLAIN
49262   server_set_id = $auth2
49263 </literallayout>
49264 <para>
49265 Cyrus SASL does implement the LOGIN authentication method, even though it is
49266 not a standard method. It is disabled by default in the source distribution,
49267 but it is present in many binary distributions.
49268 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
49269 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
49270 </para>
49271 </section>
49272 </chapter>
49273
49274 <chapter id="CHAPdovecot">
49275 <title>The dovecot authenticator</title>
49276 <para>
49277 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
49278 <primary><command>dovecot</command> authenticator</primary>
49279 </indexterm>
49280 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
49281 <primary>authenticators</primary>
49282 <secondary><command>dovecot</command></secondary>
49283 </indexterm>
49284 This authenticator is an interface to the authentication facility of the
49285 Dovecot POP/IMAP server, which can support a number of authentication methods.
49286 Note that Dovecot must be configured to use auth-client not auth-userdb.
49287 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
49288 to use the same mechanisms for SMTP authentication. This is a server
49289 authenticator only. There is only one option:
49290 </para>
49291 <para>
49292 <indexterm role="option">
49293 <primary><option>server_socket</option></primary>
49294 </indexterm>
49295 </para>
49296 <informaltable frame="all">
49297 <tgroup cols="4" colsep="0" rowsep="0">
49298 <colspec colwidth="8*" align="left"/>
49299 <colspec colwidth="6*" align="center"/>
49300 <colspec colwidth="6*" align="center"/>
49301 <colspec colwidth="6*" align="right"/>
49302 <tbody>
49303 <row>
49304 <entry><option>server_socket</option></entry>
49305 <entry>Use: <emphasis>dovecot</emphasis></entry>
49306 <entry>Type: <emphasis>string</emphasis></entry>
49307 <entry>Default: <emphasis>unset</emphasis></entry>
49308 </row>
49309 </tbody>
49310 </tgroup>
49311 </informaltable>
49312 <para>
49313 This option must specify the socket that is the interface to Dovecot
49314 authentication. The <option>public_name</option> option must specify an authentication
49315 mechanism that Dovecot is configured to support. You can have several
49316 authenticators for different mechanisms. For example:
49317 </para>
49318 <literallayout class="monospaced">
49319 dovecot_plain:
49320   driver = dovecot
49321   public_name = PLAIN
49322   server_socket = /var/run/dovecot/auth-client
49323   server_set_id = $auth1
49324
49325 dovecot_ntlm:
49326   driver = dovecot
49327   public_name = NTLM
49328   server_socket = /var/run/dovecot/auth-client
49329   server_set_id = $auth1
49330 </literallayout>
49331 <para>
49332 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
49333 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
49334 option is passed in the Dovecot authentication command. If, for a TLS
49335 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
49336 option is passed. When authentication succeeds, the identity of the user
49337 who authenticated is placed in <varname>$auth1</varname>.
49338 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
49339 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
49340 </para>
49341 </chapter>
49342
49343 <chapter id="CHAPgsasl">
49344 <title>The gsasl authenticator</title>
49345 <para>
49346 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
49347 <primary><command>gsasl</command> authenticator</primary>
49348 </indexterm>
49349 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
49350 <primary>authenticators</primary>
49351 <secondary><command>gsasl</command></secondary>
49352 </indexterm>
49353 <indexterm role="concept">
49354 <primary>authentication</primary>
49355 <secondary>GNU SASL</secondary>
49356 </indexterm>
49357 <indexterm role="concept">
49358 <primary>authentication</primary>
49359 <secondary>SASL</secondary>
49360 </indexterm>
49361 <indexterm role="concept">
49362 <primary>authentication</primary>
49363 <secondary>EXTERNAL</secondary>
49364 </indexterm>
49365 <indexterm role="concept">
49366 <primary>authentication</primary>
49367 <secondary>ANONYMOUS</secondary>
49368 </indexterm>
49369 <indexterm role="concept">
49370 <primary>authentication</primary>
49371 <secondary>PLAIN</secondary>
49372 </indexterm>
49373 <indexterm role="concept">
49374 <primary>authentication</primary>
49375 <secondary>LOGIN</secondary>
49376 </indexterm>
49377 <indexterm role="concept">
49378 <primary>authentication</primary>
49379 <secondary>DIGEST-MD5</secondary>
49380 </indexterm>
49381 <indexterm role="concept">
49382 <primary>authentication</primary>
49383 <secondary>CRAM-MD5</secondary>
49384 </indexterm>
49385 <indexterm role="concept">
49386 <primary>authentication</primary>
49387 <secondary>SCRAM-SHA-1</secondary>
49388 </indexterm>
49389 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
49390 library and the mechanisms it provides.  This is new as of the 4.80 release
49391 and there are a few areas where the library does not let Exim smoothly
49392 scale to handle future authentication mechanisms, so no guarantee can be
49393 made that any particular new authentication mechanism will be supported
49394 without code changes in Exim.
49395 </para>
49396 <para>
49397 <indexterm role="option">
49398 <primary><option>server_channelbinding</option></primary>
49399 </indexterm>
49400 </para>
49401 <informaltable frame="all">
49402 <tgroup cols="4" colsep="0" rowsep="0">
49403 <colspec colwidth="8*" align="left"/>
49404 <colspec colwidth="6*" align="center"/>
49405 <colspec colwidth="6*" align="center"/>
49406 <colspec colwidth="6*" align="right"/>
49407 <tbody>
49408 <row>
49409 <entry><option>server_channelbinding</option></entry>
49410 <entry>Use: <emphasis>gsasl</emphasis></entry>
49411 <entry>Type: <emphasis>boolean</emphasis></entry>
49412 <entry>Default: <emphasis>false</emphasis></entry>
49413 </row>
49414 </tbody>
49415 </tgroup>
49416 </informaltable>
49417 <para>
49418 Some authentication mechanisms are able to use external context at both ends
49419 of the session to bind the authentication to that context, and fail the
49420 authentication process if that context differs.  Specifically, some TLS
49421 ciphersuites can provide identifying information about the cryptographic
49422 context.
49423 </para>
49424 <para>
49425 This means that certificate identity and verification becomes a non-issue,
49426 as a man-in-the-middle attack will cause the correct client and server to
49427 see different identifiers and authentication will fail.
49428 </para>
49429 <para>
49430 This is currently only supported when using the GnuTLS library.  This is
49431 only usable by mechanisms which support "channel binding"; at time of
49432 writing, that&#x2019;s the SCRAM family.
49433 </para>
49434 <para>
49435 This defaults off to ensure smooth upgrade across Exim releases, in case
49436 this option causes some clients to start failing.  Some future release
49437 of Exim may switch the default to be true.
49438 </para>
49439 <para>
49440 <indexterm role="option">
49441 <primary><option>server_hostname</option></primary>
49442 </indexterm>
49443 </para>
49444 <informaltable frame="all">
49445 <tgroup cols="4" colsep="0" rowsep="0">
49446 <colspec colwidth="8*" align="left"/>
49447 <colspec colwidth="6*" align="center"/>
49448 <colspec colwidth="6*" align="center"/>
49449 <colspec colwidth="6*" align="right"/>
49450 <tbody>
49451 <row>
49452 <entry><option>server_hostname</option></entry>
49453 <entry>Use: <emphasis>gsasl</emphasis></entry>
49454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49455 <entry>Default: <emphasis>see below</emphasis></entry>
49456 </row>
49457 </tbody>
49458 </tgroup>
49459 </informaltable>
49460 <para>
49461 This option selects the hostname that is used when communicating with the
49462 library. The default value is <literal>$primary_hostname</literal>.
49463 Some mechanisms will use this data.
49464 </para>
49465 <para>
49466 <indexterm role="option">
49467 <primary><option>server_mech</option></primary>
49468 </indexterm>
49469 </para>
49470 <informaltable frame="all">
49471 <tgroup cols="4" colsep="0" rowsep="0">
49472 <colspec colwidth="8*" align="left"/>
49473 <colspec colwidth="6*" align="center"/>
49474 <colspec colwidth="6*" align="center"/>
49475 <colspec colwidth="6*" align="right"/>
49476 <tbody>
49477 <row>
49478 <entry><option>server_mech</option></entry>
49479 <entry>Use: <emphasis>gsasl</emphasis></entry>
49480 <entry>Type: <emphasis>string</emphasis></entry>
49481 <entry>Default: <emphasis>see below</emphasis></entry>
49482 </row>
49483 </tbody>
49484 </tgroup>
49485 </informaltable>
49486 <para>
49487 This option selects the authentication mechanism this driver should use. The
49488 default is the value of the generic <option>public_name</option> option. This option allows
49489 you to use a different underlying mechanism from the advertised name. For
49490 example:
49491 </para>
49492 <literallayout class="monospaced">
49493 sasl:
49494   driver = gsasl
49495   public_name = X-ANYTHING
49496   server_mech = CRAM-MD5
49497   server_set_id = $auth1
49498 </literallayout>
49499 <para>
49500 <indexterm role="option">
49501 <primary><option>server_password</option></primary>
49502 </indexterm>
49503 </para>
49504 <informaltable frame="all">
49505 <tgroup cols="4" colsep="0" rowsep="0">
49506 <colspec colwidth="8*" align="left"/>
49507 <colspec colwidth="6*" align="center"/>
49508 <colspec colwidth="6*" align="center"/>
49509 <colspec colwidth="6*" align="right"/>
49510 <tbody>
49511 <row>
49512 <entry><option>server_password</option></entry>
49513 <entry>Use: <emphasis>gsasl</emphasis></entry>
49514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49515 <entry>Default: <emphasis>unset</emphasis></entry>
49516 </row>
49517 </tbody>
49518 </tgroup>
49519 </informaltable>
49520 <para>
49521 Various mechanisms need access to the cleartext password on the server, so
49522 that proof-of-possession can be demonstrated on the wire, without sending
49523 the password itself.
49524 </para>
49525 <para>
49526 The data available for lookup varies per mechanism.
49527 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
49528 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
49529 if available, else the empty string.
49530 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
49531 else the empty string.
49532 </para>
49533 <para>
49534 A forced failure will cause authentication to defer.
49535 </para>
49536 <para>
49537 If using this option, it may make sense to set the <option>server_condition</option>
49538 option to be simply "true".
49539 </para>
49540 <para>
49541 <indexterm role="option">
49542 <primary><option>server_realm</option></primary>
49543 </indexterm>
49544 </para>
49545 <informaltable frame="all">
49546 <tgroup cols="4" colsep="0" rowsep="0">
49547 <colspec colwidth="8*" align="left"/>
49548 <colspec colwidth="6*" align="center"/>
49549 <colspec colwidth="6*" align="center"/>
49550 <colspec colwidth="6*" align="right"/>
49551 <tbody>
49552 <row>
49553 <entry><option>server_realm</option></entry>
49554 <entry>Use: <emphasis>gsasl</emphasis></entry>
49555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49556 <entry>Default: <emphasis>unset</emphasis></entry>
49557 </row>
49558 </tbody>
49559 </tgroup>
49560 </informaltable>
49561 <para>
49562 This specifies the SASL realm that the server claims to be in.
49563 Some mechanisms will use this data.
49564 </para>
49565 <para>
49566 <indexterm role="option">
49567 <primary><option>server_scram_iter</option></primary>
49568 </indexterm>
49569 </para>
49570 <informaltable frame="all">
49571 <tgroup cols="4" colsep="0" rowsep="0">
49572 <colspec colwidth="8*" align="left"/>
49573 <colspec colwidth="6*" align="center"/>
49574 <colspec colwidth="6*" align="center"/>
49575 <colspec colwidth="6*" align="right"/>
49576 <tbody>
49577 <row>
49578 <entry><option>server_scram_iter</option></entry>
49579 <entry>Use: <emphasis>gsasl</emphasis></entry>
49580 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49581 <entry>Default: <emphasis>unset</emphasis></entry>
49582 </row>
49583 </tbody>
49584 </tgroup>
49585 </informaltable>
49586 <para>
49587 This option provides data for the SCRAM family of mechanisms.
49588 <varname>$auth1</varname> is not available at evaluation time.
49589 (This may change, as we receive feedback on use)
49590 </para>
49591 <para>
49592 <indexterm role="option">
49593 <primary><option>server_scram_salt</option></primary>
49594 </indexterm>
49595 </para>
49596 <informaltable frame="all">
49597 <tgroup cols="4" colsep="0" rowsep="0">
49598 <colspec colwidth="8*" align="left"/>
49599 <colspec colwidth="6*" align="center"/>
49600 <colspec colwidth="6*" align="center"/>
49601 <colspec colwidth="6*" align="right"/>
49602 <tbody>
49603 <row>
49604 <entry><option>server_scram_salt</option></entry>
49605 <entry>Use: <emphasis>gsasl</emphasis></entry>
49606 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49607 <entry>Default: <emphasis>unset</emphasis></entry>
49608 </row>
49609 </tbody>
49610 </tgroup>
49611 </informaltable>
49612 <para>
49613 This option provides data for the SCRAM family of mechanisms.
49614 <varname>$auth1</varname> is not available at evaluation time.
49615 (This may change, as we receive feedback on use)
49616 </para>
49617 <para>
49618 <indexterm role="option">
49619 <primary><option>server_service</option></primary>
49620 </indexterm>
49621 </para>
49622 <informaltable frame="all">
49623 <tgroup cols="4" colsep="0" rowsep="0">
49624 <colspec colwidth="8*" align="left"/>
49625 <colspec colwidth="6*" align="center"/>
49626 <colspec colwidth="6*" align="center"/>
49627 <colspec colwidth="6*" align="right"/>
49628 <tbody>
49629 <row>
49630 <entry><option>server_service</option></entry>
49631 <entry>Use: <emphasis>gsasl</emphasis></entry>
49632 <entry>Type: <emphasis>string</emphasis></entry>
49633 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
49634 </row>
49635 </tbody>
49636 </tgroup>
49637 </informaltable>
49638 <para>
49639 This is the SASL service that the server claims to implement.
49640 Some mechanisms will use this data.
49641 </para>
49642 <section id="SECTgsaslauthvar">
49643 <title><command>gsasl</command> auth variables</title>
49644 <para>
49645 <indexterm role="variable">
49646 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49647 </indexterm>
49648 These may be set when evaluating specific options, as detailed above.
49649 They will also be set when evaluating <option>server_condition</option>.
49650 </para>
49651 <para>
49652 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
49653 meanings for these variables:
49654 </para>
49655 <itemizedlist>
49656 <listitem>
49657 <para>
49658 <indexterm role="variable">
49659 <primary><varname>$auth1</varname></primary>
49660 </indexterm>
49661 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
49662 </para>
49663 </listitem>
49664 <listitem>
49665 <para>
49666 <indexterm role="variable">
49667 <primary><varname>$auth2</varname></primary>
49668 </indexterm>
49669 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
49670 </para>
49671 </listitem>
49672 <listitem>
49673 <para>
49674 <indexterm role="variable">
49675 <primary><varname>$auth3</varname></primary>
49676 </indexterm>
49677 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
49678 </para>
49679 </listitem>
49680 </itemizedlist>
49681 <para>
49682 On a per-mechanism basis:
49683 </para>
49684 <itemizedlist>
49685 <listitem>
49686 <para>
49687 <indexterm role="concept">
49688 <primary>authentication</primary>
49689 <secondary>EXTERNAL</secondary>
49690 </indexterm>
49691 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
49692 the <option>server_condition</option> option must be present.
49693 </para>
49694 </listitem>
49695 <listitem>
49696 <para>
49697 <indexterm role="concept">
49698 <primary>authentication</primary>
49699 <secondary>ANONYMOUS</secondary>
49700 </indexterm>
49701 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
49702 the <option>server_condition</option> option must be present.
49703 </para>
49704 </listitem>
49705 <listitem>
49706 <para>
49707 <indexterm role="concept">
49708 <primary>authentication</primary>
49709 <secondary>GSSAPI</secondary>
49710 </indexterm>
49711 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
49712 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
49713 the <option>server_condition</option> option must be present.
49714 </para>
49715 </listitem>
49716 </itemizedlist>
49717 <para>
49718 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
49719 identifier; this is analogous to FTP anonymous authentication passing an
49720 email address, or software-identifier@, as the "password".
49721 </para>
49722 <para>
49723 An example showing the password having the realm specified in the callback
49724 and demonstrating a Cyrus SASL to GSASL migration approach is:
49725 </para>
49726 <literallayout class="monospaced">
49727 gsasl_cyrusless_crammd5:
49728   driver = gsasl
49729   public_name = CRAM-MD5
49730   server_realm = imap.example.org
49731   server_password = ${lookup{$auth1:$auth3:userPassword}\
49732                     dbmjz{/etc/sasldb2}{$value}fail}
49733   server_set_id = ${quote:$auth1}
49734   server_condition = yes
49735 </literallayout>
49736 </section>
49737 </chapter>
49738
49739 <chapter id="CHAPheimdalgss">
49740 <title>The heimdal_gssapi authenticator</title>
49741 <para>
49742 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
49743 <primary><command>heimdal_gssapi</command> authenticator</primary>
49744 </indexterm>
49745 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
49746 <primary>authenticators</primary>
49747 <secondary><command>heimdal_gssapi</command></secondary>
49748 </indexterm>
49749 <indexterm role="concept">
49750 <primary>authentication</primary>
49751 <secondary>GSSAPI</secondary>
49752 </indexterm>
49753 <indexterm role="concept">
49754 <primary>authentication</primary>
49755 <secondary>Kerberos</secondary>
49756 </indexterm>
49757 The <command>heimdal_gssapi</command> authenticator provides server integration for the
49758 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
49759 reliably.
49760 </para>
49761 <para>
49762 <indexterm role="option">
49763 <primary><option>server_hostname</option></primary>
49764 </indexterm>
49765 </para>
49766 <informaltable frame="all">
49767 <tgroup cols="4" colsep="0" rowsep="0">
49768 <colspec colwidth="8*" align="left"/>
49769 <colspec colwidth="6*" align="center"/>
49770 <colspec colwidth="6*" align="center"/>
49771 <colspec colwidth="6*" align="right"/>
49772 <tbody>
49773 <row>
49774 <entry><option>server_hostname</option></entry>
49775 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49777 <entry>Default: <emphasis>see below</emphasis></entry>
49778 </row>
49779 </tbody>
49780 </tgroup>
49781 </informaltable>
49782 <para>
49783 This option selects the hostname that is used, with <option>server_service</option>,
49784 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
49785 identifier.  The default value is <literal>$primary_hostname</literal>.
49786 </para>
49787 <para>
49788 <indexterm role="option">
49789 <primary><option>server_keytab</option></primary>
49790 </indexterm>
49791 </para>
49792 <informaltable frame="all">
49793 <tgroup cols="4" colsep="0" rowsep="0">
49794 <colspec colwidth="8*" align="left"/>
49795 <colspec colwidth="6*" align="center"/>
49796 <colspec colwidth="6*" align="center"/>
49797 <colspec colwidth="6*" align="right"/>
49798 <tbody>
49799 <row>
49800 <entry><option>server_keytab</option></entry>
49801 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49803 <entry>Default: <emphasis>unset</emphasis></entry>
49804 </row>
49805 </tbody>
49806 </tgroup>
49807 </informaltable>
49808 <para>
49809 If set, then Heimdal will not use the system default keytab (typically
49810 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
49811 The value should be a pathname, with no <quote>file:</quote> prefix.
49812 </para>
49813 <para>
49814 <indexterm role="option">
49815 <primary><option>server_service</option></primary>
49816 </indexterm>
49817 </para>
49818 <informaltable frame="all">
49819 <tgroup cols="4" colsep="0" rowsep="0">
49820 <colspec colwidth="8*" align="left"/>
49821 <colspec colwidth="6*" align="center"/>
49822 <colspec colwidth="6*" align="center"/>
49823 <colspec colwidth="6*" align="right"/>
49824 <tbody>
49825 <row>
49826 <entry><option>server_service</option></entry>
49827 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
49828 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49829 <entry>Default: <emphasis>smtp</emphasis></entry>
49830 </row>
49831 </tbody>
49832 </tgroup>
49833 </informaltable>
49834 <para>
49835 This option specifies the service identifier used, in conjunction with
49836 <option>server_hostname</option>, for building the identifer for finding credentials
49837 from the keytab.
49838 </para>
49839 <section id="SECTheimdalgssauthvar">
49840 <title><command>heimdal_gssapi</command> auth variables</title>
49841 <para>
49842 Beware that these variables will typically include a realm, thus will appear
49843 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
49844 not verified, so a malicious client can set it to anything.
49845 </para>
49846 <para>
49847 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
49848 Distribution Center.  Note that these are not quite email addresses.
49849 Each identifier is for a role, and so the left-hand-side may include a
49850 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
49851 </para>
49852 <para>
49853 <indexterm role="variable">
49854 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
49855 </indexterm>
49856 </para>
49857 <itemizedlist>
49858 <listitem>
49859 <para>
49860 <indexterm role="variable">
49861 <primary><varname>$auth1</varname></primary>
49862 </indexterm>
49863 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
49864 </para>
49865 </listitem>
49866 <listitem>
49867 <para>
49868 <indexterm role="variable">
49869 <primary><varname>$auth2</varname></primary>
49870 </indexterm>
49871 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
49872 authentication.  If that was empty, this will also be set to the
49873 GSS Display Name.
49874 </para>
49875 </listitem>
49876 </itemizedlist>
49877 </section>
49878 </chapter>
49879
49880 <chapter id="CHAPspa">
49881 <title>The spa authenticator</title>
49882 <para>
49883 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
49884 <primary><command>spa</command> authenticator</primary>
49885 </indexterm>
49886 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
49887 <primary>authenticators</primary>
49888 <secondary><command>spa</command></secondary>
49889 </indexterm>
49890 <indexterm role="concept">
49891 <primary>authentication</primary>
49892 <secondary>Microsoft Secure Password</secondary>
49893 </indexterm>
49894 <indexterm role="concept">
49895 <primary>authentication</primary>
49896 <secondary>NTLM</secondary>
49897 </indexterm>
49898 <indexterm role="concept">
49899 <primary>Microsoft Secure Password Authentication</primary>
49900 </indexterm>
49901 <indexterm role="concept">
49902 <primary>NTLM authentication</primary>
49903 </indexterm>
49904 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
49905 Password Authentication</emphasis> mechanism,
49906 which is also sometimes known as NTLM (NT LanMan). The code for client side of
49907 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
49908 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
49909 server side was subsequently contributed by Tom Kistner. The mechanism works as
49910 follows:
49911 </para>
49912 <itemizedlist>
49913 <listitem>
49914 <para>
49915 After the AUTH command has been accepted, the client sends an SPA
49916 authentication request based on the user name and optional domain.
49917 </para>
49918 </listitem>
49919 <listitem>
49920 <para>
49921 The server sends back a challenge.
49922 </para>
49923 </listitem>
49924 <listitem>
49925 <para>
49926 The client builds a challenge response which makes use of the user&#x2019;s password
49927 and sends it to the server, which then accepts or rejects it.
49928 </para>
49929 </listitem>
49930 </itemizedlist>
49931 <para>
49932 Encryption is used to protect the password in transit.
49933 </para>
49934 <section id="SECID179">
49935 <title>Using spa as a server</title>
49936 <para>
49937 <indexterm role="concept">
49938 <primary>options</primary>
49939 <secondary><command>spa</command> authenticator (server)</secondary>
49940 </indexterm>
49941 The <command>spa</command> authenticator has just one server option:
49942 </para>
49943 <para>
49944 <indexterm role="option">
49945 <primary><option>server_password</option></primary>
49946 </indexterm>
49947 </para>
49948 <informaltable frame="all">
49949 <tgroup cols="4" colsep="0" rowsep="0">
49950 <colspec colwidth="8*" align="left"/>
49951 <colspec colwidth="6*" align="center"/>
49952 <colspec colwidth="6*" align="center"/>
49953 <colspec colwidth="6*" align="right"/>
49954 <tbody>
49955 <row>
49956 <entry><option>server_password</option></entry>
49957 <entry>Use: <emphasis>spa</emphasis></entry>
49958 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49959 <entry>Default: <emphasis>unset</emphasis></entry>
49960 </row>
49961 </tbody>
49962 </tgroup>
49963 </informaltable>
49964 <para>
49965 <indexterm role="concept">
49966 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
49967 <secondary>in <command>spa</command> authenticator</secondary>
49968 </indexterm>
49969 This option is expanded, and the result must be the cleartext password for the
49970 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
49971 compatibility with previous releases of Exim, the user name is also placed in
49972 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
49973 it can lead to confusion in string expansions that also use numeric variables
49974 for other things. For example:
49975 </para>
49976 <literallayout class="monospaced">
49977 spa:
49978   driver = spa
49979   public_name = NTLM
49980   server_password = \
49981     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
49982 </literallayout>
49983 <para>
49984 If the expansion is forced to fail, authentication fails. Any other expansion
49985 failure causes a temporary error code to be returned.
49986 </para>
49987 </section>
49988 <section id="SECID180">
49989 <title>Using spa as a client</title>
49990 <para>
49991 <indexterm role="concept">
49992 <primary>options</primary>
49993 <secondary><command>spa</command> authenticator (client)</secondary>
49994 </indexterm>
49995 The <command>spa</command> authenticator has the following client options:
49996 </para>
49997 <para>
49998 <indexterm role="option">
49999 <primary><option>client_domain</option></primary>
50000 </indexterm>
50001 </para>
50002 <informaltable frame="all">
50003 <tgroup cols="4" colsep="0" rowsep="0">
50004 <colspec colwidth="8*" align="left"/>
50005 <colspec colwidth="6*" align="center"/>
50006 <colspec colwidth="6*" align="center"/>
50007 <colspec colwidth="6*" align="right"/>
50008 <tbody>
50009 <row>
50010 <entry><option>client_domain</option></entry>
50011 <entry>Use: <emphasis>spa</emphasis></entry>
50012 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50013 <entry>Default: <emphasis>unset</emphasis></entry>
50014 </row>
50015 </tbody>
50016 </tgroup>
50017 </informaltable>
50018 <para>
50019 This option specifies an optional domain for the authentication.
50020 </para>
50021 <para>
50022 <indexterm role="option">
50023 <primary><option>client_password</option></primary>
50024 </indexterm>
50025 </para>
50026 <informaltable frame="all">
50027 <tgroup cols="4" colsep="0" rowsep="0">
50028 <colspec colwidth="8*" align="left"/>
50029 <colspec colwidth="6*" align="center"/>
50030 <colspec colwidth="6*" align="center"/>
50031 <colspec colwidth="6*" align="right"/>
50032 <tbody>
50033 <row>
50034 <entry><option>client_password</option></entry>
50035 <entry>Use: <emphasis>spa</emphasis></entry>
50036 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50037 <entry>Default: <emphasis>unset</emphasis></entry>
50038 </row>
50039 </tbody>
50040 </tgroup>
50041 </informaltable>
50042 <para>
50043 This option specifies the user&#x2019;s password, and must be set.
50044 </para>
50045 <para>
50046 <indexterm role="option">
50047 <primary><option>client_username</option></primary>
50048 </indexterm>
50049 </para>
50050 <informaltable frame="all">
50051 <tgroup cols="4" colsep="0" rowsep="0">
50052 <colspec colwidth="8*" align="left"/>
50053 <colspec colwidth="6*" align="center"/>
50054 <colspec colwidth="6*" align="center"/>
50055 <colspec colwidth="6*" align="right"/>
50056 <tbody>
50057 <row>
50058 <entry><option>client_username</option></entry>
50059 <entry>Use: <emphasis>spa</emphasis></entry>
50060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50061 <entry>Default: <emphasis>unset</emphasis></entry>
50062 </row>
50063 </tbody>
50064 </tgroup>
50065 </informaltable>
50066 <para>
50067 This option specifies the user name, and must be set. Here is an example of a
50068 configuration of this authenticator for use with the mail servers at
50069 <emphasis>msn.com</emphasis>:
50070 </para>
50071 <literallayout class="monospaced">
50072 msn:
50073   driver = spa
50074   public_name = MSN
50075   client_username = msn/msn_username
50076   client_password = msn_plaintext_password
50077   client_domain = DOMAIN_OR_UNSET
50078 </literallayout>
50079 <para>
50080 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
50081 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
50082 </para>
50083 </section>
50084 </chapter>
50085
50086 <chapter id="CHAPTLS">
50087 <title>Encrypted SMTP connections using TLS/SSL</title>
50088 <titleabbrev>Encrypted SMTP connections</titleabbrev>
50089 <para>
50090 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
50091 <primary>encryption</primary>
50092 <secondary>on SMTP connection</secondary>
50093 </indexterm>
50094 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
50095 <primary>SMTP</primary>
50096 <secondary>encryption</secondary>
50097 </indexterm>
50098 <indexterm role="concept">
50099 <primary>TLS</primary>
50100 <secondary>on SMTP connection</secondary>
50101 </indexterm>
50102 <indexterm role="concept">
50103 <primary>OpenSSL</primary>
50104 </indexterm>
50105 <indexterm role="concept">
50106 <primary>GnuTLS</primary>
50107 </indexterm>
50108 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
50109 Sockets Layer), is implemented by making use of the OpenSSL library or the
50110 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
50111 cryptographic code in the Exim distribution itself for implementing TLS. In
50112 order to use this feature you must install OpenSSL or GnuTLS, and then build a
50113 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
50114 You also need to understand the basic concepts of encryption at a managerial
50115 level, and in particular, the way that public keys, private keys, and
50116 certificates are used.
50117 </para>
50118 <para>
50119 RFC 3207 defines how SMTP connections can make use of encryption. Once a
50120 connection is established, the client issues a STARTTLS command. If the
50121 server accepts this, the client and the server negotiate an encryption
50122 mechanism. If the negotiation succeeds, the data that subsequently passes
50123 between them is encrypted.
50124 </para>
50125 <para>
50126 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
50127 and if so, what cipher suite is in use, whether the client supplied a
50128 certificate, and whether or not that certificate was verified. This makes it
50129 possible for an Exim server to deny or accept certain commands based on the
50130 encryption state.
50131 </para>
50132 <para>
50133 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
50134 disrupt TLS connections. You need to turn off SMTP scanning for these products
50135 in order to get TLS to work.
50136 </para>
50137 <section id="SECID284">
50138 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
50139 <para>
50140 <indexterm role="concept">
50141 <primary>ssmtp protocol</primary>
50142 </indexterm>
50143 <indexterm role="concept">
50144 <primary>smtps protocol</primary>
50145 </indexterm>
50146 <indexterm role="concept">
50147 <primary>SMTP</primary>
50148 <secondary>ssmtp protocol</secondary>
50149 </indexterm>
50150 <indexterm role="concept">
50151 <primary>SMTP</primary>
50152 <secondary>smtps protocol</secondary>
50153 </indexterm>
50154 Early implementations of encrypted SMTP used a different TCP port from normal
50155 SMTP, and expected an encryption negotiation to start immediately, instead of
50156 waiting for a STARTTLS command from the client using the standard SMTP
50157 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
50158 allocated for this purpose.
50159 </para>
50160 <para>
50161 This approach was abandoned when encrypted SMTP was standardized, but there are
50162 still some legacy clients that use it. Exim supports these clients by means of
50163 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
50164 numbers; the most common use is expected to be:
50165 </para>
50166 <literallayout class="monospaced">
50167 tls_on_connect_ports = 465
50168 </literallayout>
50169 <para>
50170 The port numbers specified by this option apply to all SMTP connections, both
50171 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
50172 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
50173 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
50174 an extra port &ndash; rather, it specifies different behaviour on a port that is
50175 defined elsewhere.
50176 </para>
50177 <para>
50178 There is also a <option>-tls-on-connect</option> command line option. This overrides
50179 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
50180 </para>
50181 </section>
50182 <section id="SECTopenvsgnu">
50183 <title>OpenSSL vs GnuTLS</title>
50184 <para>
50185 <indexterm role="concept">
50186 <primary>TLS</primary>
50187 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
50188 </indexterm>
50189 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
50190 followed later, when the first versions of GnuTLS were released. To build Exim
50191 to use GnuTLS, you need to set
50192 </para>
50193 <literallayout class="monospaced">
50194 USE_GNUTLS=yes
50195 </literallayout>
50196 <para>
50197 in Local/Makefile, in addition to
50198 </para>
50199 <literallayout class="monospaced">
50200 SUPPORT_TLS=yes
50201 </literallayout>
50202 <para>
50203 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
50204 include files and libraries for GnuTLS can be found.
50205 </para>
50206 <para>
50207 There are some differences in usage when using GnuTLS instead of OpenSSL:
50208 </para>
50209 <itemizedlist>
50210 <listitem>
50211 <para>
50212 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
50213 name of a directory for GnuTLS versions before 3.3.6
50214 (for later versions, or OpenSSL, it can be either).
50215 </para>
50216 </listitem>
50217 <listitem>
50218 <para>
50219 The default value for <option>tls_dhparam</option> differs for historical reasons.
50220 </para>
50221 </listitem>
50222 <listitem>
50223 <para>
50224 <indexterm role="variable">
50225 <primary><varname>$tls_in_peerdn</varname></primary>
50226 </indexterm>
50227 <indexterm role="variable">
50228 <primary><varname>$tls_out_peerdn</varname></primary>
50229 </indexterm>
50230 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
50231 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
50232 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
50233 </para>
50234 </listitem>
50235 <listitem>
50236 <para>
50237 OpenSSL identifies cipher suites using hyphens as separators, for example:
50238 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
50239 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
50240 in a cipher list. To make life simpler, Exim changes underscores to hyphens
50241 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
50242 to handle its own older variants) when processing lists of cipher suites in the
50243 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
50244 option).
50245 </para>
50246 </listitem>
50247 <listitem>
50248 <para>
50249 The <option>tls_require_ciphers</option> options operate differently, as described in the
50250 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
50251 </para>
50252 </listitem>
50253 <listitem>
50254 <para>
50255 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
50256 When using OpenSSL, this option is ignored.
50257 (If an API is found to let OpenSSL be configured in this way,
50258 let the Exim Maintainers know and we&#x2019;ll likely use it).
50259 </para>
50260 </listitem>
50261 <listitem>
50262 <para>
50263 Some other recently added features may only be available in one or the other.
50264 This should be documented with the feature.  If the documentation does not
50265 explicitly state that the feature is infeasible in the other TLS
50266 implementation, then patches are welcome.
50267 </para>
50268 </listitem>
50269 </itemizedlist>
50270 </section>
50271 <section id="SECTgnutlsparam">
50272 <title>GnuTLS parameter computation</title>
50273 <para>
50274 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
50275 an explicit path; if the latter, then the text about generation still applies,
50276 but not the chosen filename.
50277 By default, as of Exim 4.80 a hard-coded D-H prime is used.
50278 See the documentation of <option>tls_dhparam</option> for more information.
50279 </para>
50280 <para>
50281 GnuTLS uses D-H parameters that may take a substantial amount of time
50282 to compute. It is unreasonable to re-compute them for every TLS session.
50283 Therefore, Exim keeps this data in a file in its spool directory, called
50284 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
50285 of bits requested.
50286 The file is owned by the Exim user and is readable only by
50287 its owner. Every Exim process that start up GnuTLS reads the D-H
50288 parameters from this file. If the file does not exist, the first Exim process
50289 that needs it computes the data and writes it to a temporary file which is
50290 renamed once it is complete. It does not matter if several Exim processes do
50291 this simultaneously (apart from wasting a few resources). Once a file is in
50292 place, new Exim processes immediately start using it.
50293 </para>
50294 <para>
50295 For maximum security, the parameters that are stored in this file should be
50296 recalculated periodically, the frequency depending on your paranoia level.
50297 If you are avoiding using the fixed D-H primes published in RFCs, then you
50298 are concerned about some advanced attacks and will wish to do this; if you do
50299 not regenerate then you might as well stick to the standard primes.
50300 </para>
50301 <para>
50302 Arranging this is easy in principle; just delete the file when you want new
50303 values to be computed. However, there may be a problem. The calculation of new
50304 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
50305 If the system is not very active, <filename>/dev/random</filename> may delay returning data
50306 until enough randomness (entropy) is available. This may cause Exim to hang for
50307 a substantial amount of time, causing timeouts on incoming connections.
50308 </para>
50309 <para>
50310 The solution is to generate the parameters externally to Exim. They are stored
50311 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
50312 generated externally using the <command>certtool</command> command that is part of GnuTLS.
50313 </para>
50314 <para>
50315 To replace the parameters with new ones, instead of deleting the file
50316 and letting Exim re-create it, you can generate new parameters using
50317 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
50318 renaming. The relevant commands are something like this:
50319 </para>
50320 <literallayout class="monospaced">
50321 # ls
50322 [ look for file; assume gnutls-params-2236 is the most recent ]
50323 # rm -f new-params
50324 # touch new-params
50325 # chown exim:exim new-params
50326 # chmod 0600 new-params
50327 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
50328 # openssl dhparam -noout -text -in new-params | head
50329 [ check the first line, make sure it's not more than 2236;
50330   if it is, then go back to the start ("rm") and repeat
50331   until the size generated is at most the size requested ]
50332 # chmod 0400 new-params
50333 # mv new-params gnutls-params-2236
50334 </literallayout>
50335 <para>
50336 If Exim never has to generate the parameters itself, the possibility of
50337 stalling is removed.
50338 </para>
50339 <para>
50340 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
50341 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
50342 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
50343 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
50344 and Exim does so.  This attempt to remove Exim from TLS policy decisions
50345 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
50346 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
50347 which applies to all D-H usage, client or server.  If the value returned by
50348 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
50349 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
50350 limit, which is still much higher than Exim historically used.
50351 </para>
50352 <para>
50353 The filename and bits used will change as the GnuTLS maintainers change the
50354 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
50355 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
50356 2432 bits, while NSS is limited to 2236 bits.
50357 </para>
50358 <para>
50359 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
50360 increase the chance of the generated prime actually being within acceptable
50361 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
50362 procedure above.  There is no sane procedure available to Exim to double-check
50363 the size of the generated prime, so it might still be too large.
50364 </para>
50365 </section>
50366 <section id="SECTreqciphssl">
50367 <title>Requiring specific ciphers in OpenSSL</title>
50368 <para>
50369 <indexterm role="concept">
50370 <primary>TLS</primary>
50371 <secondary>requiring specific ciphers (OpenSSL)</secondary>
50372 </indexterm>
50373 <indexterm role="option">
50374 <primary><option>tls_require_ciphers</option></primary>
50375 <secondary>OpenSSL</secondary>
50376 </indexterm>
50377 There is a function in the OpenSSL library that can be passed a list of cipher
50378 suites before the cipher negotiation takes place. This specifies which ciphers
50379 are acceptable. The list is colon separated and may contain names like
50380 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
50381 directly to this function call.
50382 Many systems will install the OpenSSL manual-pages, so you may have
50383 <emphasis>ciphers(1)</emphasis> available to you.
50384 The following quotation from the OpenSSL
50385 documentation specifies what forms of item are allowed in the cipher string:
50386 </para>
50387 <itemizedlist>
50388 <listitem>
50389 <para>
50390 It can consist of a single cipher suite such as RC4-SHA.
50391 </para>
50392 </listitem>
50393 <listitem>
50394 <para>
50395 It can represent a list of cipher suites containing a certain algorithm,
50396 or cipher suites of a certain type. For example SHA1 represents all
50397 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
50398 SSL v3 algorithms.
50399 </para>
50400 </listitem>
50401 <listitem>
50402 <para>
50403 Lists of cipher suites can be combined in a single cipher string using
50404 the + character. This is used as a logical and operation. For example
50405 SHA1+DES represents all cipher suites containing the SHA1 and the DES
50406 algorithms.
50407 </para>
50408 </listitem>
50409 </itemizedlist>
50410 <para>
50411 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
50412 <literal>-</literal> or <literal>+</literal>.
50413 </para>
50414 <itemizedlist>
50415 <listitem>
50416 <para>
50417 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
50418 ciphers deleted can never reappear in the list even if they are explicitly
50419 stated.
50420 </para>
50421 </listitem>
50422 <listitem>
50423 <para>
50424 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
50425 of the ciphers can be added again by later options.
50426 </para>
50427 </listitem>
50428 <listitem>
50429 <para>
50430 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
50431 option does not add any new ciphers; it just moves matching existing ones.
50432 </para>
50433 </listitem>
50434 </itemizedlist>
50435 <para>
50436 If none of these characters is present, the string is interpreted as
50437 a list of ciphers to be appended to the current preference list. If the list
50438 includes any ciphers already present they will be ignored: that is, they will
50439 not be moved to the end of the list.
50440 </para>
50441 <para>
50442 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
50443 string:
50444 </para>
50445 <literallayout class="monospaced">
50446 # note single-quotes to get ! past any shell history expansion
50447 $ openssl ciphers 'HIGH:!MD5:!SHA1'
50448 </literallayout>
50449 <para>
50450 This example will let the library defaults be permitted on the MX port, where
50451 there&#x2019;s probably no identity verification anyway, but ups the ante on the
50452 submission ports where the administrator might have some influence on the
50453 choice of clients used:
50454 </para>
50455 <literallayout class="monospaced">
50456 # OpenSSL variant; see man ciphers(1)
50457 tls_require_ciphers = ${if =={$received_port}{25}\
50458                            {DEFAULT}\
50459                            {HIGH:!MD5:!SHA1}}
50460 </literallayout>
50461 </section>
50462 <section id="SECTreqciphgnu">
50463 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
50464 <para>
50465 <indexterm role="concept">
50466 <primary>GnuTLS</primary>
50467 <secondary>specifying parameters for</secondary>
50468 </indexterm>
50469 <indexterm role="concept">
50470 <primary>TLS</primary>
50471 <secondary>specifying ciphers (GnuTLS)</secondary>
50472 </indexterm>
50473 <indexterm role="concept">
50474 <primary>TLS</primary>
50475 <secondary>specifying key exchange methods (GnuTLS)</secondary>
50476 </indexterm>
50477 <indexterm role="concept">
50478 <primary>TLS</primary>
50479 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
50480 </indexterm>
50481 <indexterm role="concept">
50482 <primary>TLS</primary>
50483 <secondary>specifying protocols (GnuTLS)</secondary>
50484 </indexterm>
50485 <indexterm role="concept">
50486 <primary>TLS</primary>
50487 <secondary>specifying priority string (GnuTLS)</secondary>
50488 </indexterm>
50489 <indexterm role="option">
50490 <primary><option>tls_require_ciphers</option></primary>
50491 <secondary>GnuTLS</secondary>
50492 </indexterm>
50493 The GnuTLS library allows the caller to provide a "priority string", documented
50494 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
50495 ciphersuite specification in OpenSSL.
50496 </para>
50497 <para>
50498 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
50499 and controls both protocols and ciphers.
50500 </para>
50501 <para>
50502 The <option>tls_require_ciphers</option> option is available both as an global option,
50503 controlling how Exim behaves as a server, and also as an option of the
50504 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
50505 the value is string expanded.  The resulting string is not an Exim list and
50506 the string is given to the GnuTLS library, so that Exim does not need to be
50507 aware of future feature enhancements of GnuTLS.
50508 </para>
50509 <para>
50510 Documentation of the strings accepted may be found in the GnuTLS manual, under
50511 "Priority strings".  This is online as
50512 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/html_node/Priority-Strings.html">http://www.gnutls.org/manual/html_node/Priority-Strings.html</ulink></emphasis>,
50513 but beware that this relates to GnuTLS 3, which may be newer than the version
50514 installed on your system.  If you are using GnuTLS 3,
50515 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">then the example code</ulink></emphasis>
50516 on that site can be used to test a given string.
50517 </para>
50518 <para>
50519 For example:
50520 </para>
50521 <literallayout class="monospaced">
50522 # Disable older versions of protocols
50523 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
50524 </literallayout>
50525 <para>
50526 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
50527 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
50528 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
50529 </para>
50530 <para>
50531 This example will let the library defaults be permitted on the MX port, where
50532 there&#x2019;s probably no identity verification anyway, and lowers security further
50533 by increasing compatibility; but this ups the ante on the submission ports
50534 where the administrator might have some influence on the choice of clients
50535 used:
50536 </para>
50537 <literallayout class="monospaced">
50538 # GnuTLS variant
50539 tls_require_ciphers = ${if =={$received_port}{25}\
50540                            {NORMAL:%COMPAT}\
50541                            {SECURE128}}
50542 </literallayout>
50543 </section>
50544 <section id="SECID182">
50545 <title>Configuring an Exim server to use TLS</title>
50546 <para>
50547 <indexterm role="concept">
50548 <primary>TLS</primary>
50549 <secondary>configuring an Exim server</secondary>
50550 </indexterm>
50551 When Exim has been built with TLS support, it advertises the availability of
50552 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
50553 but not to any others. The default value of this option is unset, which means
50554 that STARTTLS is not advertised at all. This default is chosen because you
50555 need to set some other options in order to make TLS available, and also it is
50556 sensible for systems that want to use TLS only as a client.
50557 </para>
50558 <para>
50559 If a client issues a STARTTLS command and there is some configuration
50560 problem in the server, the command is rejected with a 454 error. If the client
50561 persists in trying to issue SMTP commands, all except QUIT are rejected
50562 with the error
50563 </para>
50564 <literallayout class="monospaced">
50565 554 Security failure
50566 </literallayout>
50567 <para>
50568 If a STARTTLS command is issued within an existing TLS session, it is
50569 rejected with a 554 error code.
50570 </para>
50571 <para>
50572 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
50573 match some hosts. You can, of course, set it to * to match all hosts.
50574 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
50575 without some further configuration at the server end.
50576 </para>
50577 <para>
50578 It is rumoured that all existing clients that support TLS/SSL use RSA
50579 encryption. To make this work you need to set, in the server,
50580 </para>
50581 <literallayout class="monospaced">
50582 tls_certificate = /some/file/name
50583 tls_privatekey = /some/file/name
50584 </literallayout>
50585 <para>
50586 These options are, in fact, expanded strings, so you can make them depend on
50587 the identity of the client that is connected if you wish. The first file
50588 contains the server&#x2019;s X509 certificate, and the second contains the private key
50589 that goes with it. These files need to be
50590 PEM format and readable by the Exim user, and must
50591 always be given as full path names.
50592 The key must not be password-protected.
50593 They can be the same file if both the
50594 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
50595 set, or if its expansion is forced to fail or results in an empty string, this
50596 is assumed to be the case. The certificate file may also contain intermediate
50597 certificates that need to be sent to the client to enable it to authenticate
50598 the server&#x2019;s certificate.
50599 </para>
50600 <para>
50601 If you do not understand about certificates and keys, please try to find a
50602 source of this background information, which is not Exim-specific. (There are a
50603 few comments below in section <xref linkend="SECTcerandall"/>.)
50604 </para>
50605 <para>
50606 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
50607 they apply only in the case of a server. If you need to use a certificate in an
50608 Exim client, you must set the options of the same names in an <command>smtp</command>
50609 transport.
50610 </para>
50611 <para>
50612 With just these options, an Exim server will be able to use TLS. It does not
50613 require the client to have a certificate (but see below for how to insist on
50614 this). There is one other option that may be needed in other situations. If
50615 </para>
50616 <literallayout class="monospaced">
50617 tls_dhparam = /some/file/name
50618 </literallayout>
50619 <para>
50620 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
50621 with the parameters contained in the file.
50622 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
50623 available:
50624 </para>
50625 <literallayout class="monospaced">
50626 tls_dhparam = none
50627 </literallayout>
50628 <para>
50629 This may also be set to a string identifying a standard prime to be used for
50630 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
50631 used is <literal>ike23</literal>.  There are a few standard primes available, see the
50632 documentation for <option>tls_dhparam</option> for the complete list.
50633 </para>
50634 <para>
50635 See the command
50636 </para>
50637 <literallayout class="monospaced">
50638 openssl dhparam
50639 </literallayout>
50640 <para>
50641 for a way of generating file data.
50642 </para>
50643 <para>
50644 The strings supplied for these three options are expanded every time a client
50645 host connects. It is therefore possible to use different certificates and keys
50646 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
50647 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
50648 forced to fail, Exim behaves as if the option is not set.
50649 </para>
50650 <para>
50651 <indexterm role="concept">
50652 <primary>cipher</primary>
50653 <secondary>logging</secondary>
50654 </indexterm>
50655 <indexterm role="concept">
50656 <primary>log</primary>
50657 <secondary>TLS cipher</secondary>
50658 </indexterm>
50659 <indexterm role="variable">
50660 <primary><varname>$tls_in_cipher</varname></primary>
50661 </indexterm>
50662 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
50663 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
50664 incoming message (by default &ndash; you can, of course, change this), and it is
50665 also included in the log line that records a message&#x2019;s arrival, keyed by
50666 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
50667 condition can be used to test for specific cipher suites in ACLs.
50668 </para>
50669 <para>
50670 Once TLS has been established, the ACLs that run for subsequent SMTP commands
50671 can check the name of the cipher suite and vary their actions accordingly. The
50672 cipher suite names vary, depending on which TLS library is being used. For
50673 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
50674 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
50675 documentation for more details.
50676 </para>
50677 <para>
50678 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
50679 (again depending on the <option>tls_cipher</option> log selector).
50680 </para>
50681 </section>
50682 <section id="SECID183">
50683 <title>Requesting and verifying client certificates</title>
50684 <para>
50685 <indexterm role="concept">
50686 <primary>certificate</primary>
50687 <secondary>verification of client</secondary>
50688 </indexterm>
50689 <indexterm role="concept">
50690 <primary>TLS</primary>
50691 <secondary>client certificate verification</secondary>
50692 </indexterm>
50693 If you want an Exim server to request a certificate when negotiating a TLS
50694 session with a client, you must set either <option>tls_verify_hosts</option> or
50695 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
50696 apply to all TLS connections. For any host that matches one of these options,
50697 Exim requests a certificate as part of the setup of the TLS session. The
50698 contents of the certificate are verified by comparing it with a list of
50699 expected certificates. These must be available in a file or,
50700 for OpenSSL only (not GnuTLS), a directory, identified by
50701 <option>tls_verify_certificates</option>.
50702 </para>
50703 <para>
50704 A file can contain multiple certificates, concatenated end to end. If a
50705 directory is used
50706 (OpenSSL only),
50707 each certificate must be in a separate file, with a name (or a symbolic link)
50708 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
50709 certificate. You can compute the relevant hash by running the command
50710 </para>
50711 <literallayout class="monospaced">
50712 openssl x509 -hash -noout -in /cert/file
50713 </literallayout>
50714 <para>
50715 where <filename>/cert/file</filename> contains a single certificate.
50716 </para>
50717 <para>
50718 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
50719 what happens if the client does not supply a certificate, or if the certificate
50720 does not match any of the certificates in the collection named by
50721 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
50722 attempt to set up a TLS session is aborted, and the incoming connection is
50723 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
50724 session continues. ACLs that run for subsequent SMTP commands can detect the
50725 fact that no certificate was verified, and vary their actions accordingly. For
50726 example, you can insist on a certificate before accepting a message for
50727 relaying, but not when the message is destined for local delivery.
50728 </para>
50729 <para>
50730 <indexterm role="variable">
50731 <primary><varname>$tls_in_peerdn</varname></primary>
50732 </indexterm>
50733 When a client supplies a certificate (whether it verifies or not), the value of
50734 the Distinguished Name of the certificate is made available in the variable
50735 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
50736 </para>
50737 <para>
50738 <indexterm role="concept">
50739 <primary>log</primary>
50740 <secondary>distinguished name</secondary>
50741 </indexterm>
50742 Because it is often a long text string, it is not included in the log line or
50743 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
50744 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
50745 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
50746 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
50747 </para>
50748 </section>
50749 <section id="SECID184">
50750 <title>Revoked certificates</title>
50751 <para>
50752 <indexterm role="concept">
50753 <primary>TLS</primary>
50754 <secondary>revoked certificates</secondary>
50755 </indexterm>
50756 <indexterm role="concept">
50757 <primary>revocation list</primary>
50758 </indexterm>
50759 <indexterm role="concept">
50760 <primary>certificate</primary>
50761 <secondary>revocation list</secondary>
50762 </indexterm>
50763 <indexterm role="concept">
50764 <primary>OCSP</primary>
50765 <secondary>stapling</secondary>
50766 </indexterm>
50767 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
50768 certificates are revoked. If you have such a list, you can pass it to an Exim
50769 server using the global option called <option>tls_crl</option> and to an Exim client using
50770 an identically named option for the <command>smtp</command> transport. In each case, the value
50771 of the option is expanded and must then be the name of a file that contains a
50772 CRL in PEM format.
50773 The downside is that clients have to periodically re-download a potentially huge
50774 file from every certificate authority they know of.
50775 </para>
50776 <para>
50777 The way with most moving parts at query time is Online Certificate
50778 Status Protocol (OCSP), where the client verifies the certificate
50779 against an OCSP server run by the CA.  This lets the CA track all
50780 usage of the certs.  It requires running software with access to the
50781 private key of the CA, to sign the responses to the OCSP queries.  OCSP
50782 is based on HTTP and can be proxied accordingly.
50783 </para>
50784 <para>
50785 The only widespread OCSP server implementation (known to this writer)
50786 comes as part of OpenSSL and aborts on an invalid request, such as
50787 connecting to the port and then disconnecting.  This requires
50788 re-entering the passphrase each time some random client does this.
50789 </para>
50790 <para>
50791 The third way is OCSP Stapling; in this, the server using a certificate
50792 issued by the CA periodically requests an OCSP proof of validity from
50793 the OCSP server, then serves it up inline as part of the TLS
50794 negotiation.   This approach adds no extra round trips, does not let the
50795 CA track users, scales well with number of certs issued by the CA and is
50796 resilient to temporary OCSP server failures, as long as the server
50797 starts retrying to fetch an OCSP proof some time before its current
50798 proof expires.  The downside is that it requires server support.
50799 </para>
50800 <para>
50801 Unless Exim is built with the support disabled,
50802 or with GnuTLS earlier than version 3.1.3,
50803 support for OCSP stapling is included.
50804 </para>
50805 <para>
50806 There is a global option called <option>tls_ocsp_file</option>.
50807 The file specified therein is expected to be in DER format, and contain
50808 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
50809 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
50810 contains <literal>tls_in_sni</literal>, as per other TLS options.
50811 </para>
50812 <para>
50813 Exim does not at this time implement any support for fetching a new OCSP
50814 proof.  The burden is on the administrator to handle this, outside of
50815 Exim.  The file specified should be replaced atomically, so that the
50816 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
50817 on each connection, so a new file will be handled transparently on the
50818 next connection.
50819 </para>
50820 <para>
50821 When built with OpenSSL Exim will check for a valid next update timestamp
50822 in the OCSP proof; if not present, or if the proof has expired, it will be
50823 ignored.
50824 </para>
50825 <para>
50826 For the client to be able to verify the stapled OCSP the server must
50827 also supply, in its stapled information, any intermediate
50828 certificates for the chain leading to the OCSP proof from the signer
50829 of the server certificate.  There may be zero or one such. These
50830 intermediate certificates should be added to the server OCSP stapling
50831 file named by <option>tls_ocsp_file</option>.
50832 </para>
50833 <para>
50834 Note that the proof only covers the terminal server certificate,
50835 not any of the chain from CA to it.
50836 </para>
50837 <para>
50838 There is no current way to staple a proof for a client certificate.
50839 </para>
50840 <literallayout class="monospaced">
50841   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
50842   OCSP server is supplied.  The server URL may be included in the
50843   server certificate, if the CA is helpful.
50844
50845   One failure mode seen was the OCSP Signer cert expiring before the end
50846   of validity of the OCSP proof. The checking done by Exim/OpenSSL
50847   noted this as invalid overall, but the re-fetch script did not.
50848 </literallayout>
50849 </section>
50850 <section id="SECID185">
50851 <title>Configuring an Exim client to use TLS</title>
50852 <para>
50853 <indexterm role="concept">
50854 <primary>cipher</primary>
50855 <secondary>logging</secondary>
50856 </indexterm>
50857 <indexterm role="concept">
50858 <primary>log</primary>
50859 <secondary>TLS cipher</secondary>
50860 </indexterm>
50861 <indexterm role="concept">
50862 <primary>log</primary>
50863 <secondary>distinguished name</secondary>
50864 </indexterm>
50865 <indexterm role="concept">
50866 <primary>TLS</primary>
50867 <secondary>configuring an Exim client</secondary>
50868 </indexterm>
50869 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
50870 deliveries as well as to incoming, the latter one causing logging of the
50871 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
50872 within the <command>smtp</command> transport.
50873 </para>
50874 <para>
50875 It is not necessary to set any options to have TLS work in the <command>smtp</command>
50876 transport. If Exim is built with TLS support, and TLS is advertised by a
50877 server, the <command>smtp</command> transport always tries to start a TLS session. However,
50878 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
50879 transport) to a list of server hosts for which TLS should not be used.
50880 </para>
50881 <para>
50882 If you do not want Exim to attempt to send messages unencrypted when an attempt
50883 to set up an encrypted connection fails in any way, you can set
50884 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
50885 those hosts, delivery is always deferred if an encrypted connection cannot be
50886 set up. If there are any other hosts for the address, they are tried in the
50887 usual way.
50888 </para>
50889 <para>
50890 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
50891 the message unencrypted. It always does this if the response to STARTTLS is
50892 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
50893 session after a success response code, what happens is controlled by the
50894 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
50895 delivery to this host is deferred, and other hosts (if available) are tried. If
50896 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
50897 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
50898 negotiation fails, Exim closes the current connection (because it is in an
50899 unknown state), opens a new one to the same host, and then tries the delivery
50900 unencrypted.
50901 </para>
50902 <para>
50903 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
50904 transport provide the client with a certificate, which is passed to the server
50905 if it requests it. If the server is Exim, it will request a certificate only if
50906 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
50907 </para>
50908 <para>
50909 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
50910 must name a file or,
50911 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
50912 expected server certificates. The client verifies the server&#x2019;s certificate
50913 against this collection, taking into account any revoked certificates that are
50914 in the list defined by <option>tls_crl</option>.
50915 Failure to verify fails the TLS connection unless either of the
50916 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
50917 </para>
50918 <para>
50919 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
50920 certificate verification to the listed servers.  Verification either must
50921 or need not succeed respectively.
50922 </para>
50923 <para>
50924 The <command>smtp</command> transport has two OCSP-related options:
50925 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
50926 is requested and required for the connection to proceed.  The default
50927 value is empty.
50928 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
50929 a Certificate Status is requested (but not necessarily verified).  The default
50930 value is "*" meaning that requests are made unless configured
50931 otherwise.
50932 </para>
50933 <para>
50934 The host(s) should also be in <option>hosts_require_tls</option>, and
50935 <option>tls_verify_certificates</option> configured for the transport,
50936 for OCSP to be relevant.
50937 </para>
50938 <para>
50939 If
50940 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
50941 list of permitted cipher suites. If either of these checks fails, delivery to
50942 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
50943 alternative hosts, if any.
50944 </para>
50945 <para>
50946  <emphasis role="bold">Note</emphasis>:
50947 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
50948 is operating as a client. Exim does not assume that a server certificate (set
50949 by the global options of the same name) should also be used when operating as a
50950 client.
50951 </para>
50952 <para>
50953 <indexterm role="variable">
50954 <primary><varname>$host</varname></primary>
50955 </indexterm>
50956 <indexterm role="variable">
50957 <primary><varname>$host_address</varname></primary>
50958 </indexterm>
50959 All the TLS options in the <command>smtp</command> transport are expanded before use, with
50960 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
50961 which the client is connected. Forced failure of an expansion causes Exim to
50962 behave as if the relevant option were unset.
50963 </para>
50964 <para>
50965 <indexterm role="variable">
50966 <primary><varname>$tls_out_bits</varname></primary>
50967 </indexterm>
50968 <indexterm role="variable">
50969 <primary><varname>$tls_out_cipher</varname></primary>
50970 </indexterm>
50971 <indexterm role="variable">
50972 <primary><varname>$tls_out_peerdn</varname></primary>
50973 </indexterm>
50974 <indexterm role="variable">
50975 <primary><varname>$tls_out_sni</varname></primary>
50976 </indexterm>
50977 Before an SMTP connection is established, the
50978 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
50979 variables are emptied. (Until the first connection, they contain the values
50980 that were set when the message was received.) If STARTTLS is subsequently
50981 successfully obeyed, these variables are set to the relevant values for the
50982 outgoing connection.
50983 </para>
50984 </section>
50985 <section id="SECTtlssni">
50986 <title>Use of TLS Server Name Indication</title>
50987 <para>
50988 <indexterm role="concept">
50989 <primary>TLS</primary>
50990 <secondary>Server Name Indication</secondary>
50991 </indexterm>
50992 <indexterm role="variable">
50993 <primary><varname>$tls_in_sni</varname></primary>
50994 </indexterm>
50995 <indexterm role="option">
50996 <primary><option>tls_in_sni</option></primary>
50997 </indexterm>
50998 With TLS1.0 or above, there is an extension mechanism by which extra
50999 information can be included at various points in the protocol.  One of these
51000 extensions, documented in RFC 6066 (and before that RFC 4366) is
51001 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
51002 client in the initial handshake, so that the server can examine the servername
51003 within and possibly choose to use different certificates and keys (and more)
51004 for this session.
51005 </para>
51006 <para>
51007 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
51008 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
51009 address.
51010 </para>
51011 <para>
51012 With SMTP to MX, there are the same problems here as in choosing the identity
51013 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
51014 provide the identity which you then cryptographically verify.  So this will
51015 be of limited use in that environment.
51016 </para>
51017 <para>
51018 With SMTP to Submission, there is a well-defined hostname which clients are
51019 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
51020 choose to include this information in the TLS negotiation.  If this becomes
51021 wide-spread, then hosters can choose to present different certificates to
51022 different clients.  Or even negotiate different cipher suites.
51023 </para>
51024 <para>
51025 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
51026 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
51027 nothing more to it.  Choosing a sensible value not derived insecurely is the
51028 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
51029 for the lifetime of the client connection (including during authentication).
51030 </para>
51031 <para>
51032 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
51033 received from a client.
51034 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
51035 </para>
51036 <para>
51037 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
51038 option (prior to expansion) then the following options will be re-expanded
51039 during TLS session handshake, to permit alternative values to be chosen:
51040 </para>
51041 <itemizedlist>
51042 <listitem>
51043 <para>
51044 <indexterm role="variable">
51045 <primary><option>tls_certificate</option></primary>
51046 </indexterm>
51047 <option>tls_certificate</option>
51048 </para>
51049 </listitem>
51050 <listitem>
51051 <para>
51052 <indexterm role="variable">
51053 <primary><option>tls_crl</option></primary>
51054 </indexterm>
51055 <option>tls_crl</option>
51056 </para>
51057 </listitem>
51058 <listitem>
51059 <para>
51060 <indexterm role="variable">
51061 <primary><option>tls_privatekey</option></primary>
51062 </indexterm>
51063 <option>tls_privatekey</option>
51064 </para>
51065 </listitem>
51066 <listitem>
51067 <para>
51068 <indexterm role="variable">
51069 <primary><option>tls_verify_certificates</option></primary>
51070 </indexterm>
51071 <option>tls_verify_certificates</option>
51072 </para>
51073 </listitem>
51074 <listitem>
51075 <para>
51076 <indexterm role="variable">
51077 <primary><option>tls_ocsp_file</option></primary>
51078 </indexterm>
51079 <option>tls_ocsp_file</option>
51080 </para>
51081 </listitem>
51082 </itemizedlist>
51083 <para>
51084 Great care should be taken to deal with matters of case, various injection
51085 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
51086 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
51087 arbitrary unverified data provided prior to authentication.
51088 </para>
51089 <para>
51090 The Exim developers are proceeding cautiously and so far no other TLS options
51091 are re-expanded.
51092 </para>
51093 <para>
51094 When Exim is built againt OpenSSL, OpenSSL must have been built with support
51095 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
51096 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
51097 see <literal>-servername</literal> in the output, then OpenSSL has support.
51098 </para>
51099 <para>
51100 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
51101 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
51102 built, then you have SNI support).
51103 </para>
51104 </section>
51105 <section id="SECTmulmessam">
51106 <title>Multiple messages on the same encrypted TCP/IP connection</title>
51107 <para>
51108 <indexterm role="concept">
51109 <primary>multiple SMTP deliveries with TLS</primary>
51110 </indexterm>
51111 <indexterm role="concept">
51112 <primary>TLS</primary>
51113 <secondary>multiple message deliveries</secondary>
51114 </indexterm>
51115 Exim sends multiple messages down the same TCP/IP connection by starting up
51116 an entirely new delivery process for each message, passing the socket from
51117 one process to the next. This implementation does not fit well with the use
51118 of TLS, because there is quite a lot of state information associated with a TLS
51119 connection, not just a socket identification. Passing all the state information
51120 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
51121 session before passing the socket to a new process. The new process may then
51122 try to start a new TLS session, and if successful, may try to re-authenticate
51123 if AUTH is in use, before sending the next message.
51124 </para>
51125 <para>
51126 The RFC is not clear as to whether or not an SMTP session continues in clear
51127 after TLS has been shut down, or whether TLS may be restarted again later, as
51128 just described. However, if the server is Exim, this shutdown and
51129 reinitialization works. It is not known which (if any) other servers operate
51130 successfully if the client closes a TLS session and continues with unencrypted
51131 SMTP, but there are certainly some that do not work. For such servers, Exim
51132 should not pass the socket to another process, because the failure of the
51133 subsequent attempt to use it would cause Exim to record a temporary host error,
51134 and delay other deliveries to that host.
51135 </para>
51136 <para>
51137 To test for this case, Exim sends an EHLO command to the server after
51138 closing down the TLS session. If this fails in any way, the connection is
51139 closed instead of being passed to a new delivery process, but no retry
51140 information is recorded.
51141 </para>
51142 <para>
51143 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
51144 <command>smtp</command> transport to match those hosts for which Exim should not pass
51145 connections to new processes if TLS has been used.
51146 </para>
51147 </section>
51148 <section id="SECTcerandall">
51149 <title>Certificates and all that</title>
51150 <para>
51151 <indexterm role="concept">
51152 <primary>certificate</primary>
51153 <secondary>references to discussion</secondary>
51154 </indexterm>
51155 In order to understand fully how TLS works, you need to know about
51156 certificates, certificate signing, and certificate authorities. This is not the
51157 place to give a tutorial, especially as I do not know very much about it
51158 myself. Some helpful introduction can be found in the FAQ for the SSL addition
51159 to Apache, currently at
51160 </para>
51161 <literallayout>
51162 <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>
51163 </literallayout>
51164 <para>
51165 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
51166 links to further files.
51167 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
51168 0-201-61598-3), contains both introductory and more in-depth descriptions.
51169 Some sample programs taken from the book are available from
51170 </para>
51171 <literallayout>
51172 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
51173 </literallayout>
51174 </section>
51175 <section id="SECID186">
51176 <title>Certificate chains</title>
51177 <para>
51178 The file named by <option>tls_certificate</option> may contain more than one
51179 certificate. This is useful in the case where the certificate that is being
51180 sent is validated by an intermediate certificate which the other end does
51181 not have. Multiple certificates must be in the correct order in the file.
51182 First the host&#x2019;s certificate itself, then the first intermediate
51183 certificate to validate the issuer of the host certificate, then the next
51184 intermediate certificate to validate the issuer of the first intermediate
51185 certificate, and so on, until finally (optionally) the root certificate.
51186 The root certificate must already be trusted by the recipient for
51187 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
51188 root certificate along with the rest makes it available for the user to
51189 install if the receiving end is a client MUA that can interact with a user.
51190 </para>
51191 <para>
51192 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
51193 even if your libraries allow loading them for use in Exim when acting as a
51194 server, increasingly clients will not accept such certificates.  The error
51195 diagnostics in such a case can be frustratingly vague.
51196 </para>
51197 </section>
51198 <section id="SECID187">
51199 <title>Self-signed certificates</title>
51200 <para>
51201 <indexterm role="concept">
51202 <primary>certificate</primary>
51203 <secondary>self-signed</secondary>
51204 </indexterm>
51205 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
51206 with OpenSSL, like this:
51207 </para>
51208 <literallayout class="monospaced">
51209 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
51210             -days 9999 -nodes
51211 </literallayout>
51212 <para>
51213 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
51214 delimited and so can be identified independently. The <option>-days</option> option
51215 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
51216 important: if you do not set it, the key is encrypted with a passphrase
51217 that you are prompted for, and any use that is made of the key causes more
51218 prompting for the passphrase. This is not helpful if you are going to use
51219 this certificate and key in an MTA, where prompting is not possible.
51220 </para>
51221 <para>
51222 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
51223 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
51224 the above command might produce a date in the past.  Think carefully about
51225 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
51226 of the certificate or reconsider your platform deployment.  (At time of
51227 writing, reducing the duration is the most likely choice, but the inexorable
51228 progression of time takes us steadily towards an era where this will not
51229 be a sensible resolution).
51230 </para>
51231 <para>
51232 A self-signed certificate made in this way is sufficient for testing, and
51233 may be adequate for all your requirements if you are mainly interested in
51234 encrypting transfers, and not in secure identification.
51235 </para>
51236 <para>
51237 However, many clients require that the certificate presented by the server be a
51238 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
51239 certificate. In this situation, the self-signed certificate described above
51240 must be installed on the client host as a trusted root <emphasis>certification
51241 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
51242 signed with that self-signed certificate.
51243 </para>
51244 <para>
51245 For information on creating self-signed CA certificates and using them to sign
51246 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
51247 Open-source PKI book, available online at
51248 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
51249 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
51250 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
51251 </para>
51252 </section>
51253 </chapter>
51254
51255 <chapter id="CHAPACL">
51256 <title>Access control lists</title>
51257 <para>
51258 <indexterm role="concept" id="IIDacl" class="startofrange">
51259 <primary>access control lists (ACLs)</primary>
51260 <secondary>description</secondary>
51261 </indexterm>
51262 <indexterm role="concept">
51263 <primary>control of incoming mail</primary>
51264 </indexterm>
51265 <indexterm role="concept">
51266 <primary>message</primary>
51267 <secondary>controlling incoming</secondary>
51268 </indexterm>
51269 <indexterm role="concept">
51270 <primary>policy control</primary>
51271 <secondary>access control lists</secondary>
51272 </indexterm>
51273 Access Control Lists (ACLs) are defined in a separate section of the run time
51274 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
51275 name, terminated by a colon. Here is a complete ACL section that contains just
51276 one very small ACL:
51277 </para>
51278 <literallayout class="monospaced">
51279 begin acl
51280 small_acl:
51281   accept   hosts = one.host.only
51282 </literallayout>
51283 <para>
51284 You can have as many lists as you like in the ACL section, and the order in
51285 which they appear does not matter. The lists are self-terminating.
51286 </para>
51287 <para>
51288 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
51289 certain SMTP commands. This applies both to incoming TCP/IP connections, and
51290 when a local process submits a message using SMTP by specifying the <option>-bs</option>
51291 option. The most common use is for controlling which recipients are accepted
51292 in incoming messages. In addition, you can define an ACL that is used to check
51293 local non-SMTP messages. The default configuration file contains an example of
51294 a realistic ACL for checking RCPT commands. This is discussed in chapter
51295 <xref linkend="CHAPdefconfil"/>.
51296 </para>
51297 <section id="SECID188">
51298 <title>Testing ACLs</title>
51299 <para>
51300 The <option>-bh</option> command line option provides a way of testing your ACL
51301 configuration locally by running a fake SMTP session with which you interact.
51302 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
51303 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
51304 </para>
51305 </section>
51306 <section id="SECID189">
51307 <title>Specifying when ACLs are used</title>
51308 <para>
51309 <indexterm role="concept">
51310 <primary>access control lists (ACLs)</primary>
51311 <secondary>options for specifying</secondary>
51312 </indexterm>
51313 In order to cause an ACL to be used, you have to name it in one of the relevant
51314 options in the main part of the configuration. These options are:
51315 <indexterm role="concept">
51316 <primary>AUTH</primary>
51317 <secondary>ACL for</secondary>
51318 </indexterm>
51319 <indexterm role="concept">
51320 <primary>DATA</primary>
51321 <secondary>ACLs for</secondary>
51322 </indexterm>
51323 <indexterm role="concept">
51324 <primary>ETRN</primary>
51325 <secondary>ACL for</secondary>
51326 </indexterm>
51327 <indexterm role="concept">
51328 <primary>EXPN</primary>
51329 <secondary>ACL for</secondary>
51330 </indexterm>
51331 <indexterm role="concept">
51332 <primary>HELO</primary>
51333 <secondary>ACL for</secondary>
51334 </indexterm>
51335 <indexterm role="concept">
51336 <primary>EHLO</primary>
51337 <secondary>ACL for</secondary>
51338 </indexterm>
51339 <indexterm role="concept">
51340 <primary>MAIL</primary>
51341 <secondary>ACL for</secondary>
51342 </indexterm>
51343 <indexterm role="concept">
51344 <primary>QUIT, ACL for</primary>
51345 </indexterm>
51346 <indexterm role="concept">
51347 <primary>RCPT</primary>
51348 <secondary>ACL for</secondary>
51349 </indexterm>
51350 <indexterm role="concept">
51351 <primary>STARTTLS, ACL for</primary>
51352 </indexterm>
51353 <indexterm role="concept">
51354 <primary>VRFY</primary>
51355 <secondary>ACL for</secondary>
51356 </indexterm>
51357 <indexterm role="concept">
51358 <primary>SMTP</primary>
51359 <secondary>connection, ACL for</secondary>
51360 </indexterm>
51361 <indexterm role="concept">
51362 <primary>non-SMTP messages</primary>
51363 <secondary>ACLs for</secondary>
51364 </indexterm>
51365 <indexterm role="concept">
51366 <primary>MIME content scanning</primary>
51367 <secondary>ACL for</secondary>
51368 </indexterm>
51369 <indexterm role="concept">
51370 <primary>PRDR</primary>
51371 <secondary>ACL for</secondary>
51372 </indexterm>
51373 </para>
51374 <informaltable frame="none">
51375 <tgroup cols="2" colsep="0" rowsep="0">
51376 <colspec colwidth="140pt" align="left"/>
51377 <colspec colwidth="254pt" align="left"/>
51378 <tbody>
51379 <row>
51380 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
51381 <entry>ACL for non-SMTP messages</entry>
51382 </row>
51383 <row>
51384 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
51385 <entry>ACL for non-SMTP MIME parts</entry>
51386 </row>
51387 <row>
51388 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
51389 <entry>ACL at start of non-SMTP message</entry>
51390 </row>
51391 <row>
51392 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
51393 <entry>ACL for AUTH</entry>
51394 </row>
51395 <row>
51396 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
51397 <entry>ACL for start of SMTP connection</entry>
51398 </row>
51399 <row>
51400 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
51401 <entry>ACL after DATA is complete</entry>
51402 </row>
51403 <row>
51404 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
51405 <entry>ACL for each recipient, after DATA is complete</entry>
51406 </row>
51407 <row>
51408 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
51409 <entry>ACL for ETRN</entry>
51410 </row>
51411 <row>
51412 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
51413 <entry>ACL for EXPN</entry>
51414 </row>
51415 <row>
51416 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
51417 <entry>ACL for HELO or EHLO</entry>
51418 </row>
51419 <row>
51420 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
51421 <entry>ACL for MAIL</entry>
51422 </row>
51423 <row>
51424 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
51425 <entry>ACL for the AUTH parameter of MAIL</entry>
51426 </row>
51427 <row>
51428 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
51429 <entry>ACL for content-scanning MIME parts</entry>
51430 </row>
51431 <row>
51432 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
51433 <entry>ACL for non-QUIT terminations</entry>
51434 </row>
51435 <row>
51436 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
51437 <entry>ACL at start of DATA command</entry>
51438 </row>
51439 <row>
51440 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
51441 <entry>ACL for QUIT</entry>
51442 </row>
51443 <row>
51444 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
51445 <entry>ACL for RCPT</entry>
51446 </row>
51447 <row>
51448 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
51449 <entry>ACL for STARTTLS</entry>
51450 </row>
51451 <row>
51452 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
51453 <entry>ACL for VRFY</entry>
51454 </row>
51455 </tbody>
51456 </tgroup>
51457 </informaltable>
51458 <para>
51459 For example, if you set
51460 </para>
51461 <literallayout class="monospaced">
51462 acl_smtp_rcpt = small_acl
51463 </literallayout>
51464 <para>
51465 the little ACL defined above is used whenever Exim receives a RCPT command
51466 in an SMTP dialogue. The majority of policy tests on incoming messages can be
51467 done when RCPT commands arrive. A rejection of RCPT should cause the
51468 sending MTA to give up on the recipient address contained in the RCPT
51469 command, whereas rejection at other times may cause the client MTA to keep on
51470 trying to deliver the message. It is therefore recommended that you do as much
51471 testing as possible at RCPT time.
51472 </para>
51473 </section>
51474 <section id="SECID190">
51475 <title>The non-SMTP ACLs</title>
51476 <para>
51477 <indexterm role="concept">
51478 <primary>non-SMTP messages</primary>
51479 <secondary>ACLs for</secondary>
51480 </indexterm>
51481 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
51482 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
51483 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
51484 the state of the SMTP connection such as encryption and authentication) are not
51485 relevant and are forbidden in these ACLs. However, the sender and recipients
51486 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
51487 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
51488 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
51489 in any of these ACLs.
51490 </para>
51491 <para>
51492 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
51493 non-SMTP message, before any of the message has been read. (This is the
51494 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
51495 batched SMTP input, it runs after the DATA command has been reached. The
51496 result of this ACL is ignored; it cannot be used to reject a message. If you
51497 really need to, you could set a value in an ACL variable here and reject based
51498 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
51499 controls, and in particular, it can be used to set
51500 </para>
51501 <literallayout class="monospaced">
51502 control = suppress_local_fixups
51503 </literallayout>
51504 <para>
51505 This cannot be used in the other non-SMTP ACLs because by the time they are
51506 run, it is too late.
51507 </para>
51508 <para>
51509 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
51510 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51511 </para>
51512 <para>
51513 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
51514 kind of rejection is treated as permanent, because there is no way of sending a
51515 temporary error for these kinds of message.
51516 </para>
51517 </section>
51518 <section id="SECID191">
51519 <title>The SMTP connect ACL</title>
51520 <para>
51521 <indexterm role="concept">
51522 <primary>SMTP</primary>
51523 <secondary>connection, ACL for</secondary>
51524 </indexterm>
51525 <indexterm role="option">
51526 <primary><option>smtp_banner</option></primary>
51527 </indexterm>
51528 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
51529 session, after the test specified by <option>host_reject_connection</option> (which is now
51530 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
51531 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
51532 the message override the banner message that is otherwise specified by the
51533 <option>smtp_banner</option> option.
51534 </para>
51535 </section>
51536 <section id="SECID192">
51537 <title>The EHLO/HELO ACL</title>
51538 <para>
51539 <indexterm role="concept">
51540 <primary>EHLO</primary>
51541 <secondary>ACL for</secondary>
51542 </indexterm>
51543 <indexterm role="concept">
51544 <primary>HELO</primary>
51545 <secondary>ACL for</secondary>
51546 </indexterm>
51547 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
51548 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
51549 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
51550 Note that a client may issue more than one EHLO or HELO command in an SMTP
51551 session, and indeed is required to issue a new EHLO or HELO after successfully
51552 setting up encryption following a STARTTLS command.
51553 </para>
51554 <para>
51555 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
51556 modifier, the message may not contain more than one line (it will be truncated
51557 at the first newline and a panic logged if it does). Such a message cannot
51558 affect the EHLO options that are listed on the second and subsequent lines of
51559 an EHLO response.
51560 </para>
51561 </section>
51562 <section id="SECID193">
51563 <title>The DATA ACLs</title>
51564 <para>
51565 <indexterm role="concept">
51566 <primary>DATA</primary>
51567 <secondary>ACLs for</secondary>
51568 </indexterm>
51569 Two ACLs are associated with the DATA command, because it is two-stage
51570 command, with two responses being sent to the client.
51571 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
51572 is obeyed. This gives you control after all the RCPT commands, but before
51573 the message itself is received. It offers the opportunity to give a negative
51574 response to the DATA command before the data is transmitted. Header lines
51575 added by MAIL or RCPT ACLs are not visible at this time, but any that
51576 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
51577 </para>
51578 <para>
51579 You cannot test the contents of the message, for example, to verify addresses
51580 in the headers, at RCPT time or when the DATA command is received. Such
51581 tests have to appear in the ACL that is run after the message itself has been
51582 received, before the final response to the DATA command is sent. This is
51583 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
51584 associated with the DATA command.
51585 </para>
51586 <para>
51587 For both of these ACLs, it is not possible to reject individual recipients. An
51588 error response rejects the entire message. Unfortunately, it is known that some
51589 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
51590 before or after the data) correctly &ndash; they keep the message on their queues
51591 and try again later, but that is their problem, though it does waste some of
51592 your resources.
51593 </para>
51594 <para>
51595 The <option>acl_smtp_data</option> ACL is run after
51596 the <option>acl_smtp_data_prdr</option>,
51597 the <option>acl_smtp_dkim</option>
51598 and the <option>acl_smtp_mime</option> ACLs.
51599 </para>
51600 </section>
51601 <section id="SECTDKIMACL">
51602 <title>The SMTP DKIM ACL</title>
51603 <para>
51604 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
51605 enabled (which is the default).
51606 </para>
51607 <para>
51608 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
51609 received, and is executed for each DKIM signature found in a message.  If not
51610 otherwise specified, the default action is to accept.
51611 </para>
51612 <para>
51613 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
51614 </para>
51615 <para>
51616 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
51617 </para>
51618 </section>
51619 <section id="SECID194">
51620 <title>The SMTP MIME ACL</title>
51621 <para>
51622 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
51623 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
51624 </para>
51625 <para>
51626 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51627 </para>
51628 </section>
51629 <section id="SECTPRDRACL">
51630 <title>The SMTP PRDR ACL</title>
51631 <para>
51632 <indexterm role="option">
51633 <primary><option>prdr_enable</option></primary>
51634 </indexterm>
51635 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
51636 with PRDR support enabled (which is the default).
51637 It becomes active only when the PRDR feature is negotiated between
51638 client and server for a message, and more than one recipient
51639 has been accepted.
51640 </para>
51641 <para>
51642 The ACL test specfied by <option>acl_smtp_data_prdr</option> happens after a message
51643 has been recieved, and is executed for each recipient of the message.
51644 The test may accept or deny for inividual recipients.
51645 The <option>acl_smtp_data</option> will still be called after this ACL and
51646 can reject the message overall, even if this ACL has accepted it
51647 for some or all recipients.
51648 </para>
51649 <para>
51650 PRDR may be used to support per-user content filtering.  Without it
51651 one must defer any recipient after the first that has a different
51652 content-filter configuration.  With PRDR, the RCPT-time check
51653 for this can be disabled when the MAIL-time $smtp_command included
51654 "PRDR".  Any required difference in behaviour of the main DATA-time
51655 ACL should however depend on the PRDR-time ACL having run, as Exim
51656 will avoid doing so in some situations (eg.  single-recipient mails).
51657 </para>
51658 <para>
51659 See also the <option>prdr_enable</option> global option
51660 and the <option>hosts_try_prdr</option> smtp transport option.
51661 </para>
51662 <para>
51663 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
51664 If the ACL is not defined, processing completes as if
51665 the feature was not requested by the client.
51666 </para>
51667 </section>
51668 <section id="SECTQUITACL">
51669 <title>The QUIT ACL</title>
51670 <para>
51671 <indexterm role="concept">
51672 <primary>QUIT, ACL for</primary>
51673 </indexterm>
51674 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
51675 does not affect the response code to QUIT, which is always 221. Thus, the ACL
51676 does not in fact control any access. For this reason, the only verbs that are
51677 permitted are <option>accept</option> and <option>warn</option>.
51678 </para>
51679 <para>
51680 This ACL can be used for tasks such as custom logging at the end of an SMTP
51681 session. For example, you can use ACL variables in other ACLs to count
51682 messages, recipients, etc., and log the totals at QUIT time using one or
51683 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
51684 </para>
51685 <para>
51686 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
51687 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
51688 </para>
51689 <para>
51690 You do not need to have a final <option>accept</option>, but if you do, you can use a
51691 <option>message</option> modifier to specify custom text that is sent as part of the 221
51692 response to QUIT.
51693 </para>
51694 <para>
51695 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
51696 failure (for example, failure to open a log file, or when Exim is bombing out
51697 because it has detected an unrecoverable error), all SMTP commands from the
51698 client are given temporary error responses until QUIT is received or the
51699 connection is closed. In these special cases, the QUIT ACL does not run.
51700 </para>
51701 </section>
51702 <section id="SECTNOTQUITACL">
51703 <title>The not-QUIT ACL</title>
51704 <para>
51705 <indexterm role="variable">
51706 <primary><varname>$acl_smtp_notquit</varname></primary>
51707 </indexterm>
51708 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
51709 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
51710 trouble, such as being unable to write to its log files, this ACL is not run,
51711 because it might try to do things (such as write to log files) that make the
51712 situation even worse.
51713 </para>
51714 <para>
51715 Like the QUIT ACL, this ACL is provided to make it possible to do customized
51716 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
51717 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
51718 and <option>warn</option>.
51719 </para>
51720 <para>
51721 <indexterm role="variable">
51722 <primary><varname>$smtp_notquit_reason</varname></primary>
51723 </indexterm>
51724 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
51725 to a string that indicates the reason for the termination of the SMTP
51726 connection. The possible values are:
51727 </para>
51728 <informaltable frame="none">
51729 <tgroup cols="2" colsep="0" rowsep="0">
51730 <colspec colwidth="196pt" align="left"/>
51731 <colspec colwidth="254pt" align="left"/>
51732 <tbody>
51733 <row>
51734 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
51735 <entry>Another ACL issued a <option>drop</option> command</entry>
51736 </row>
51737 <row>
51738 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
51739 <entry>Too many unknown or non-mail commands</entry>
51740 </row>
51741 <row>
51742 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
51743 <entry>Timeout while reading SMTP commands</entry>
51744 </row>
51745 <row>
51746 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
51747 <entry>The SMTP connection has been lost</entry>
51748 </row>
51749 <row>
51750 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
51751 <entry>Timeout while reading message data</entry>
51752 </row>
51753 <row>
51754 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
51755 <entry>The <function>local_scan()</function> function crashed</entry>
51756 </row>
51757 <row>
51758 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
51759 <entry>The <function>local_scan()</function> function timed out</entry>
51760 </row>
51761 <row>
51762 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
51763 <entry>SIGTERM or SIGINT</entry>
51764 </row>
51765 <row>
51766 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
51767 <entry>SMTP synchronization error</entry>
51768 </row>
51769 <row>
51770 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
51771 <entry>TLS failed to start</entry>
51772 </row>
51773 </tbody>
51774 </tgroup>
51775 </informaltable>
51776 <para>
51777 In most cases when an SMTP connection is closed without having received QUIT,
51778 Exim sends an SMTP response message before actually closing the connection.
51779 With the exception of the <literal>acl-drop</literal> case, the default message can be
51780 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
51781 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
51782 used.
51783 </para>
51784 </section>
51785 <section id="SECID195">
51786 <title>Finding an ACL to use</title>
51787 <para>
51788 <indexterm role="concept">
51789 <primary>access control lists (ACLs)</primary>
51790 <secondary>finding which to use</secondary>
51791 </indexterm>
51792 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
51793 you can use different ACLs in different circumstances. For example,
51794 </para>
51795 <literallayout class="monospaced">
51796 acl_smtp_rcpt = ${if ={25}{$interface_port} \
51797                      {acl_check_rcpt} {acl_check_rcpt_submit} }
51798 </literallayout>
51799 <para>
51800 In the default configuration file there are some example settings for
51801 providing an RFC 4409 message submission service on port 587 and a
51802 non-standard <quote>smtps</quote> service on port 465. You can use a string
51803 expansion like this to choose an ACL for MUAs on these ports which is
51804 more appropriate for this purpose than the default ACL on port 25.
51805 </para>
51806 <para>
51807 The expanded string does not have to be the name of an ACL in the
51808 configuration file; there are other possibilities. Having expanded the
51809 string, Exim searches for an ACL as follows:
51810 </para>
51811 <itemizedlist>
51812 <listitem>
51813 <para>
51814 If the string begins with a slash, Exim uses it as a file name, and reads its
51815 contents as an ACL. The lines are processed in the same way as lines in the
51816 Exim configuration file. In particular, continuation lines are supported, blank
51817 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
51818 If the file does not exist or cannot be read, an error occurs (typically
51819 causing a temporary failure of whatever caused the ACL to be run). For example:
51820 </para>
51821 <literallayout class="monospaced">
51822 acl_smtp_data = /etc/acls/\
51823   ${lookup{$sender_host_address}lsearch\
51824   {/etc/acllist}{$value}{default}}
51825 </literallayout>
51826 <para>
51827 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
51828 back to a default if the lookup fails. If an ACL is successfully read from a
51829 file, it is retained in memory for the duration of the Exim process, so that it
51830 can be re-used without having to re-read the file.
51831 </para>
51832 </listitem>
51833 <listitem>
51834 <para>
51835 If the string does not start with a slash, and does not contain any spaces,
51836 Exim searches the ACL section of the configuration for an ACL whose name
51837 matches the string.
51838 </para>
51839 </listitem>
51840 <listitem>
51841 <para>
51842 If no named ACL is found, or if the string contains spaces, Exim parses
51843 the string as an inline ACL. This can save typing in cases where you just
51844 want to have something like
51845 </para>
51846 <literallayout class="monospaced">
51847 acl_smtp_vrfy = accept
51848 </literallayout>
51849 <para>
51850 in order to allow free use of the VRFY command. Such a string may contain
51851 newlines; it is processed in the same way as an ACL that is read from a file.
51852 </para>
51853 </listitem>
51854 </itemizedlist>
51855 </section>
51856 <section id="SECID196">
51857 <title>ACL return codes</title>
51858 <para>
51859 <indexterm role="concept">
51860 <primary>access control lists (ACLs)</primary>
51861 <secondary>return codes</secondary>
51862 </indexterm>
51863 Except for the QUIT ACL, which does not affect the SMTP return code (see
51864 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
51865 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
51866 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
51867 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
51868 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
51869 This also causes a 4<emphasis>xx</emphasis> return code.
51870 </para>
51871 <para>
51872 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
51873 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
51874 submitters of non-SMTP messages.
51875 </para>
51876 <para>
51877 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
51878 has the effect of <quote>accept</quote>, but causes either the entire message or an
51879 individual recipient address to be discarded. In other words, it is a
51880 blackholing facility. Use it with care.
51881 </para>
51882 <para>
51883 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
51884 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
51885 RCPT ACL is to discard just the one recipient address. If there are no
51886 recipients left when the message&#x2019;s data is received, the DATA ACL is not
51887 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
51888 remaining recipients. The <quote>discard</quote> return is not permitted for the
51889 <option>acl_smtp_predata</option> ACL.
51890 </para>
51891 <para>
51892 <indexterm role="concept">
51893 <primary><function>local_scan()</function> function</primary>
51894 <secondary>when all recipients discarded</secondary>
51895 </indexterm>
51896 The <function>local_scan()</function> function is always run, even if there are no remaining
51897 recipients; it may create new recipients.
51898 </para>
51899 </section>
51900 <section id="SECID197">
51901 <title>Unset ACL options</title>
51902 <para>
51903 <indexterm role="concept">
51904 <primary>access control lists (ACLs)</primary>
51905 <secondary>unset options</secondary>
51906 </indexterm>
51907 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
51908 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
51909 not defined at all. For any defined ACL, the default action when control
51910 reaches the end of the ACL statements is <quote>deny</quote>.
51911 </para>
51912 <para>
51913 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
51914 these two are ACLs that are used only for their side effects. They cannot be
51915 used to accept or reject anything.
51916 </para>
51917 <para>
51918 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
51919 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
51920 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
51921 when the ACL is not defined is <quote>accept</quote>.
51922 </para>
51923 <para>
51924 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
51925 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
51926 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
51927 messages over an SMTP connection. For an example, see the ACL in the default
51928 configuration file.
51929 </para>
51930 </section>
51931 <section id="SECID198">
51932 <title>Data for message ACLs</title>
51933 <para>
51934 <indexterm role="concept">
51935 <primary>access control lists (ACLs)</primary>
51936 <secondary>data for message ACL</secondary>
51937 </indexterm>
51938 <indexterm role="variable">
51939 <primary><varname>$domain</varname></primary>
51940 </indexterm>
51941 <indexterm role="variable">
51942 <primary><varname>$local_part</varname></primary>
51943 </indexterm>
51944 <indexterm role="variable">
51945 <primary><varname>$sender_address</varname></primary>
51946 </indexterm>
51947 <indexterm role="variable">
51948 <primary><varname>$sender_host_address</varname></primary>
51949 </indexterm>
51950 <indexterm role="variable">
51951 <primary><varname>$smtp_command</varname></primary>
51952 </indexterm>
51953 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
51954 that contain information about the host and the message&#x2019;s sender (for example,
51955 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
51956 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
51957 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
51958 is available in <varname>$smtp_command</varname>.
51959 </para>
51960 <para>
51961 When an ACL for the AUTH parameter of MAIL is running, the variables that
51962 contain information about the host are set, but <varname>$sender_address</varname> is not yet
51963 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
51964 how it is used.
51965 </para>
51966 <para>
51967 <indexterm role="variable">
51968 <primary><varname>$message_size</varname></primary>
51969 </indexterm>
51970 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
51971 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
51972 that parameter is not given. The value is updated to the true message size by
51973 the time the final DATA ACL is run (after the message data has been
51974 received).
51975 </para>
51976 <para>
51977 <indexterm role="variable">
51978 <primary><varname>$rcpt_count</varname></primary>
51979 </indexterm>
51980 <indexterm role="variable">
51981 <primary><varname>$recipients_count</varname></primary>
51982 </indexterm>
51983 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
51984 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
51985 accepted, so while an ACL for RCPT is being processed, it contains the number
51986 of previously accepted recipients. At DATA time (for both the DATA ACLs),
51987 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
51988 <varname>$recipients_count</varname> contains the total number of accepted recipients.
51989 </para>
51990 </section>
51991 <section id="SECTdatfornon">
51992 <title>Data for non-message ACLs</title>
51993 <para>
51994 <indexterm role="concept">
51995 <primary>access control lists (ACLs)</primary>
51996 <secondary>data for non-message ACL</secondary>
51997 </indexterm>
51998 <indexterm role="variable">
51999 <primary><varname>$smtp_command_argument</varname></primary>
52000 </indexterm>
52001 <indexterm role="variable">
52002 <primary><varname>$smtp_command</varname></primary>
52003 </indexterm>
52004 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
52005 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
52006 and the entire SMTP command is available in <varname>$smtp_command</varname>.
52007 These variables can be tested using a <option>condition</option> condition. For example,
52008 here is an ACL for use with AUTH, which insists that either the session is
52009 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
52010 does not permit authentication methods that use cleartext passwords on
52011 unencrypted connections.
52012 </para>
52013 <literallayout class="monospaced">
52014 acl_check_auth:
52015   accept encrypted = *
52016   accept condition = ${if eq{${uc:$smtp_command_argument}}\
52017                      {CRAM-MD5}}
52018   deny   message   = TLS encryption or CRAM-MD5 required
52019 </literallayout>
52020 <para>
52021 (Another way of applying this restriction is to arrange for the authenticators
52022 that use cleartext passwords not to be advertised when the connection is not
52023 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
52024 option to do this.)
52025 </para>
52026 </section>
52027 <section id="SECID199">
52028 <title>Format of an ACL</title>
52029 <para>
52030 <indexterm role="concept">
52031 <primary>access control lists (ACLs)</primary>
52032 <secondary>format of</secondary>
52033 </indexterm>
52034 <indexterm role="concept">
52035 <primary>access control lists (ACLs)</primary>
52036 <secondary>verbs, definition of</secondary>
52037 </indexterm>
52038 An individual ACL consists of a number of statements. Each statement starts
52039 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
52040 Modifiers can change the way the verb operates, define error and log messages,
52041 set variables, insert delays, and vary the processing of accepted messages.
52042 </para>
52043 <para>
52044 If all the conditions are met, the verb is obeyed. The same condition may be
52045 used (with different arguments) more than once in the same statement. This
52046 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
52047 example:
52048 </para>
52049 <literallayout class="monospaced">
52050 deny  dnslists = list1.example
52051 dnslists = list2.example
52052 </literallayout>
52053 <para>
52054 If there are no conditions, the verb is always obeyed. Exim stops evaluating
52055 the conditions and modifiers when it reaches a condition that fails. What
52056 happens then depends on the verb (and in one case, on a special modifier). Not
52057 all the conditions make sense at every testing point. For example, you cannot
52058 test a sender address in the ACL that is run for a VRFY command.
52059 </para>
52060 </section>
52061 <section id="SECID200">
52062 <title>ACL verbs</title>
52063 <para>
52064 The ACL verbs are as follows:
52065 </para>
52066 <itemizedlist>
52067 <listitem>
52068 <para>
52069 <indexterm role="concept">
52070 <primary><option>accept</option> ACL verb</primary>
52071 </indexterm>
52072 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
52073 of the conditions are not met, what happens depends on whether <option>endpass</option>
52074 appears among the conditions (for syntax see below). If the failing condition
52075 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
52076 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
52077 check a RCPT command:
52078 </para>
52079 <literallayout class="monospaced">
52080 accept domains = +local_domains
52081 endpass
52082 verify = recipient
52083 </literallayout>
52084 <para>
52085 If the recipient domain does not match the <option>domains</option> condition, control
52086 passes to the next statement. If it does match, the recipient is verified, and
52087 the command is accepted if verification succeeds. However, if verification
52088 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
52089 <option>endpass</option>.
52090 </para>
52091 <para>
52092 The <option>endpass</option> feature has turned out to be confusing to many people, so its
52093 use is not recommended nowadays. It is always possible to rewrite an ACL so
52094 that <option>endpass</option> is not needed, and it is no longer used in the default
52095 configuration.
52096 </para>
52097 <para>
52098 <indexterm role="concept">
52099 <primary><option>message</option> ACL modifier</primary>
52100 <secondary>with <option>accept</option></secondary>
52101 </indexterm>
52102 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
52103 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
52104 (when an <option>accept</option> verb either accepts or passes control to the next
52105 statement), <option>message</option> can be used to vary the message that is sent when an
52106 SMTP command is accepted. For example, in a RCPT ACL you could have:
52107 </para>
52108 <literallayout>
52109 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52110 <literal>        message = OK, I will allow you through today</literal>
52111 </literallayout>
52112 <para>
52113 You can specify an SMTP response code, optionally followed by an <quote>extended
52114 response code</quote> at the start of the message, but the first digit must be the
52115 same as would be sent by default, which is 2 for an <option>accept</option> verb.
52116 </para>
52117 <para>
52118 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
52119 an error message that is used when access is denied. This behaviour is retained
52120 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
52121 of <option>endpass</option>.
52122 </para>
52123 </listitem>
52124 <listitem>
52125 <para>
52126 <indexterm role="concept">
52127 <primary><option>defer</option> ACL verb</primary>
52128 </indexterm>
52129 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
52130 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
52131 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
52132 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
52133 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
52134 be used in any ACL, and even for a recipient it might be a simpler approach.
52135 </para>
52136 </listitem>
52137 <listitem>
52138 <para>
52139 <indexterm role="concept">
52140 <primary><option>deny</option> ACL verb</primary>
52141 </indexterm>
52142 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
52143 the conditions are not met, control is passed to the next ACL statement. For
52144 example,
52145 </para>
52146 <literallayout class="monospaced">
52147 deny dnslists = blackholes.mail-abuse.org
52148 </literallayout>
52149 <para>
52150 rejects commands from hosts that are on a DNS black list.
52151 </para>
52152 </listitem>
52153 <listitem>
52154 <para>
52155 <indexterm role="concept">
52156 <primary><option>discard</option> ACL verb</primary>
52157 </indexterm>
52158 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
52159 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
52160 that are concerned with receiving messages. When all the conditions are true,
52161 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
52162 recipients to be discarded. If it is used in an ACL for RCPT, just the one
52163 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
52164 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
52165 do not appear in the log line when the <option>received_recipients</option> log selector is set.
52166 </para>
52167 <para>
52168 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
52169 its contents are added to the line that is automatically written to the log.
52170 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
52171 </para>
52172 </listitem>
52173 <listitem>
52174 <para>
52175 <indexterm role="concept">
52176 <primary><option>drop</option> ACL verb</primary>
52177 </indexterm>
52178 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
52179 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
52180 </para>
52181 <literallayout class="monospaced">
52182 drop   message   = I don't take more than 20 RCPTs
52183        condition = ${if &gt; {$rcpt_count}{20}}
52184 </literallayout>
52185 <para>
52186 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
52187 The connection is always dropped after sending a 550 response.
52188 </para>
52189 </listitem>
52190 <listitem>
52191 <para>
52192 <indexterm role="concept">
52193 <primary><option>require</option> ACL verb</primary>
52194 </indexterm>
52195 <option>require</option>: If all the conditions are met, control is passed to the next ACL
52196 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
52197 example, when checking a RCPT command,
52198 </para>
52199 <literallayout class="monospaced">
52200 require message = Sender did not verify
52201         verify  = sender
52202 </literallayout>
52203 <para>
52204 passes control to subsequent statements only if the message&#x2019;s sender can be
52205 verified. Otherwise, it rejects the command. Note the positioning of the
52206 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
52207 discussed in section <xref linkend="SECTcondmodproc"/>.
52208 </para>
52209 </listitem>
52210 <listitem>
52211 <para>
52212 <indexterm role="concept">
52213 <primary><option>warn</option> ACL verb</primary>
52214 </indexterm>
52215 <option>warn</option>: If all the conditions are true, a line specified by the
52216 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
52217 to the next ACL statement. If any condition is false, the log line is not
52218 written. If an identical log line is requested several times in the same
52219 message, only one copy is actually written to the log. If you want to force
52220 duplicates to be written, use the <option>logwrite</option> modifier instead.
52221 </para>
52222 <para>
52223 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
52224 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
52225 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
52226 first failing condition. There is more about adding header lines in section
52227 <xref linkend="SECTaddheadacl"/>.
52228 </para>
52229 <para>
52230 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
52231 some sort of defer), the log line specified by <option>log_message</option> is not written.
52232 This does not include the case of a forced failure from a lookup, which
52233 is considered to be a successful completion. After a defer, no further
52234 conditions or modifiers in the <option>warn</option> statement are processed. The incident
52235 is logged, and the ACL continues to be processed, from the next statement
52236 onwards.
52237 </para>
52238 <para>
52239 <indexterm role="variable">
52240 <primary><varname>$acl_verify_message</varname></primary>
52241 </indexterm>
52242 When one of the <option>warn</option> conditions is an address verification that fails, the
52243 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
52244 want this logged, you must set it up explicitly. For example:
52245 </para>
52246 <literallayout class="monospaced">
52247 warn   !verify = sender
52248        log_message = sender verify failed: $acl_verify_message
52249 </literallayout>
52250 </listitem>
52251 </itemizedlist>
52252 <para>
52253 At the end of each ACL there is an implicit unconditional <option>deny</option>.
52254 </para>
52255 <para>
52256 As you can see from the examples above, the conditions and modifiers are
52257 written one to a line, with the first one on the same line as the verb, and
52258 subsequent ones on following lines. If you have a very long condition, you can
52259 continue it onto several physical lines by the usual backslash continuation
52260 mechanism. It is conventional to align the conditions vertically.
52261 </para>
52262 </section>
52263 <section id="SECTaclvariables">
52264 <title>ACL variables</title>
52265 <para>
52266 <indexterm role="concept">
52267 <primary>access control lists (ACLs)</primary>
52268 <secondary>variables</secondary>
52269 </indexterm>
52270 There are some special variables that can be set during ACL processing. They
52271 can be used to pass information between different ACLs, different invocations
52272 of the same ACL in the same SMTP connection, and between ACLs and the routers,
52273 transports, and filters that are used to deliver a message. The names of these
52274 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
52275 an underscore, but the remainder of the name can be any sequence of
52276 alphanumeric characters and underscores that you choose. There is no limit on
52277 the number of ACL variables. The two sets act as follows:
52278 </para>
52279 <itemizedlist>
52280 <listitem>
52281 <para>
52282 The values of those variables whose names begin with <varname>$acl_c</varname> persist
52283 throughout an SMTP connection. They are never reset. Thus, a value that is set
52284 while receiving one message is still available when receiving the next message
52285 on the same SMTP connection.
52286 </para>
52287 </listitem>
52288 <listitem>
52289 <para>
52290 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
52291 while a message is being received. They are reset afterwards. They are also
52292 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
52293 </para>
52294 </listitem>
52295 </itemizedlist>
52296 <para>
52297 When a message is accepted, the current values of all the ACL variables are
52298 preserved with the message and are subsequently made available at delivery
52299 time. The ACL variables are set by a modifier called <option>set</option>. For example:
52300 </para>
52301 <literallayout class="monospaced">
52302 accept hosts = whatever
52303        set acl_m4 = some value
52304 accept authenticated = *
52305        set acl_c_auth = yes
52306 </literallayout>
52307 <para>
52308 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
52309 be set. If you want to set a variable without taking any action, you can use a
52310 <option>warn</option> verb without any other modifiers or conditions.
52311 </para>
52312 <para>
52313 <indexterm role="option">
52314 <primary><option>strict_acl_vars</option></primary>
52315 </indexterm>
52316 What happens if a syntactically valid but undefined ACL variable is
52317 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
52318 false (the default), an empty string is substituted; if it is true, an
52319 error is generated.
52320 </para>
52321 <para>
52322 Versions of Exim before 4.64 have a limited set of numbered variables, but
52323 their names are compatible, so there is no problem with upgrading.
52324 </para>
52325 </section>
52326 <section id="SECTcondmodproc">
52327 <title>Condition and modifier processing</title>
52328 <para>
52329 <indexterm role="concept">
52330 <primary>access control lists (ACLs)</primary>
52331 <secondary>conditions; processing</secondary>
52332 </indexterm>
52333 <indexterm role="concept">
52334 <primary>access control lists (ACLs)</primary>
52335 <secondary>modifiers; processing</secondary>
52336 </indexterm>
52337 An exclamation mark preceding a condition negates its result. For example:
52338 </para>
52339 <literallayout class="monospaced">
52340 deny   domains = *.dom.example
52341       !verify  = recipient
52342 </literallayout>
52343 <para>
52344 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
52345 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
52346 negation can be used on the right-hand side of a condition. For example, these
52347 two statements are equivalent:
52348 </para>
52349 <literallayout class="monospaced">
52350 deny  hosts = !192.168.3.4
52351 deny !hosts =  192.168.3.4
52352 </literallayout>
52353 <para>
52354 However, for many conditions (<option>verify</option> being a good example), only left-hand
52355 side negation of the whole condition is possible.
52356 </para>
52357 <para>
52358 The arguments of conditions and modifiers are expanded. A forced failure
52359 of an expansion causes a condition to be ignored, that is, it behaves as if the
52360 condition is true. Consider these two statements:
52361 </para>
52362 <literallayout class="monospaced">
52363 accept  senders = ${lookup{$host_name}lsearch\
52364                   {/some/file}{$value}fail}
52365 accept  senders = ${lookup{$host_name}lsearch\
52366                   {/some/file}{$value}{}}
52367 </literallayout>
52368 <para>
52369 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
52370 the returned list is searched, but if the lookup fails the behaviour is
52371 different in the two cases. The <option>fail</option> in the first statement causes the
52372 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
52373 therefore succeeds. The second statement, however, generates an empty list when
52374 the lookup fails. No sender can match an empty list, so the condition fails,
52375 and therefore the <option>accept</option> also fails.
52376 </para>
52377 <para>
52378 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
52379 specify actions that are taken as the conditions for a statement are checked;
52380 others specify text for messages that are used when access is denied or a
52381 warning is generated. The <option>control</option> modifier affects the way an incoming
52382 message is handled.
52383 </para>
52384 <para>
52385 The positioning of the modifiers in an ACL statement is important, because the
52386 processing of a verb ceases as soon as its outcome is known. Only those
52387 modifiers that have already been encountered will take effect. For example,
52388 consider this use of the <option>message</option> modifier:
52389 </para>
52390 <literallayout class="monospaced">
52391 require message = Can't verify sender
52392         verify  = sender
52393         message = Can't verify recipient
52394         verify  = recipient
52395         message = This message cannot be used
52396 </literallayout>
52397 <para>
52398 If sender verification fails, Exim knows that the result of the statement is
52399 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
52400 so its text is used as the error message. If sender verification succeeds, but
52401 recipient verification fails, the second message is used. If recipient
52402 verification succeeds, the third message becomes <quote>current</quote>, but is never used
52403 because there are no more conditions to cause failure.
52404 </para>
52405 <para>
52406 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
52407 modifier that is used, because all the conditions must be true for rejection to
52408 happen. Specifying more than one <option>message</option> modifier does not make sense, and
52409 the message can even be specified after all the conditions. For example:
52410 </para>
52411 <literallayout class="monospaced">
52412 deny   hosts = ...
52413       !senders = *@my.domain.example
52414        message = Invalid sender from client host
52415 </literallayout>
52416 <para>
52417 The <quote>deny</quote> result does not happen until the end of the statement is reached,
52418 by which time Exim has set up the message.
52419 </para>
52420 </section>
52421 <section id="SECTACLmodi">
52422 <title>ACL modifiers</title>
52423 <para>
52424 <indexterm role="concept">
52425 <primary>access control lists (ACLs)</primary>
52426 <secondary>modifiers; list of</secondary>
52427 </indexterm>
52428 The ACL modifiers are as follows:
52429 </para>
52430 <variablelist>
52431 <varlistentry>
52432 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52433 <listitem>
52434 <para>
52435 This modifier specifies one or more header lines that are to be added to an
52436 incoming message, assuming, of course, that the message is ultimately
52437 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
52438 </para>
52439 </listitem></varlistentry>
52440 <varlistentry>
52441 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52442 <listitem>
52443 <para>
52444 <indexterm role="concept">
52445 <primary><option>continue</option> ACL modifier</primary>
52446 </indexterm>
52447 <indexterm role="concept">
52448 <primary>database</primary>
52449 <secondary>updating in ACL</secondary>
52450 </indexterm>
52451 This modifier does nothing of itself, and processing of the ACL always
52452 continues with the next condition or modifier. The value of <option>continue</option> is in
52453 the side effects of expanding its argument. Typically this could be used to
52454 update a database. It is really just a syntactic tidiness, to avoid having to
52455 write rather ugly lines like this:
52456 </para>
52457 <literallayout>
52458 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
52459 </literallayout>
52460 <para>
52461 Instead, all you need is
52462 </para>
52463 <literallayout>
52464 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
52465 </literallayout>
52466 </listitem></varlistentry>
52467 <varlistentry>
52468 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52469 <listitem>
52470 <para>
52471 <indexterm role="concept">
52472 <primary><option>control</option> ACL modifier</primary>
52473 </indexterm>
52474 This modifier affects the subsequent processing of the SMTP connection or of an
52475 incoming message that is accepted. The effect of the first type of control
52476 lasts for the duration of the connection, whereas the effect of the second type
52477 lasts only until the current message has been received. The message-specific
52478 controls always apply to the whole message, not to individual recipients,
52479 even if the <option>control</option> modifier appears in a RCPT ACL.
52480 </para>
52481 <para>
52482 As there are now quite a few controls that can be applied, they are described
52483 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
52484 in several different ways. For example:
52485 </para>
52486 <itemizedlist>
52487 <listitem>
52488 <para>
52489 It can be at the end of an <option>accept</option> statement:
52490 </para>
52491 <literallayout class="monospaced">
52492     accept  ...some conditions
52493             control = queue_only
52494 </literallayout>
52495 <para>
52496 In this case, the control is applied when this statement yields <quote>accept</quote>, in
52497 other words, when the conditions are all true.
52498 </para>
52499 </listitem>
52500 <listitem>
52501 <para>
52502 It can be in the middle of an <option>accept</option> statement:
52503 </para>
52504 <literallayout class="monospaced">
52505     accept  ...some conditions...
52506             control = queue_only
52507             ...some more conditions...
52508 </literallayout>
52509 <para>
52510 If the first set of conditions are true, the control is applied, even if the
52511 statement does not accept because one of the second set of conditions is false.
52512 In this case, some subsequent statement must yield <quote>accept</quote> for the control
52513 to be relevant.
52514 </para>
52515 </listitem>
52516 <listitem>
52517 <para>
52518 It can be used with <option>warn</option> to apply the control, leaving the
52519 decision about accepting or denying to a subsequent verb. For
52520 example:
52521 </para>
52522 <literallayout class="monospaced">
52523     warn    ...some conditions...
52524             control = freeze
52525     accept  ...
52526 </literallayout>
52527 <para>
52528 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
52529 <option>logwrite</option>, so it does not add anything to the message and does not write a
52530 log entry.
52531 </para>
52532 </listitem>
52533 <listitem>
52534 <para>
52535 If you want to apply a control unconditionally, you can use it with a
52536 <option>require</option> verb. For example:
52537 </para>
52538 <literallayout class="monospaced">
52539     require  control = no_multiline_responses
52540 </literallayout>
52541 </listitem>
52542 </itemizedlist>
52543 </listitem></varlistentry>
52544 <varlistentry>
52545 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
52546 <listitem>
52547 <para>
52548 <indexterm role="concept">
52549 <primary><option>delay</option> ACL modifier</primary>
52550 </indexterm>
52551 <indexterm role="option">
52552 <primary><option>-bh</option></primary>
52553 </indexterm>
52554 This modifier may appear in any ACL except notquit. It causes Exim to wait for
52555 the time interval before proceeding. However, when testing Exim using the
52556 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
52557 output instead). The time is given in the usual Exim notation, and the delay
52558 happens as soon as the modifier is processed. In an SMTP session, pending
52559 output is flushed before the delay is imposed.
52560 </para>
52561 <para>
52562 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
52563 example:
52564 </para>
52565 <literallayout class="monospaced">
52566 deny    ...some conditions...
52567         delay = 30s
52568 </literallayout>
52569 <para>
52570 The delay happens if all the conditions are true, before the statement returns
52571 <quote>deny</quote>. Compare this with:
52572 </para>
52573 <literallayout class="monospaced">
52574 deny    delay = 30s
52575         ...some conditions...
52576 </literallayout>
52577 <para>
52578 which waits for 30s before processing the conditions. The <option>delay</option> modifier
52579 can also be used with <option>warn</option> and together with <option>control</option>:
52580 </para>
52581 <literallayout class="monospaced">
52582 warn    ...some conditions...
52583         delay = 2m
52584         control = freeze
52585 accept  ...
52586 </literallayout>
52587 <para>
52588 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
52589 responses to several commands are no longer buffered and sent in one packet (as
52590 they would normally be) because all output is flushed before imposing the
52591 delay. This optimization is disabled so that a number of small delays do not
52592 appear to the client as one large aggregated delay that might provoke an
52593 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
52594 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
52595 </para>
52596 </listitem></varlistentry>
52597 <varlistentry>
52598 <term><emphasis role="bold">endpass</emphasis></term>
52599 <listitem>
52600 <para>
52601 <indexterm role="concept">
52602 <primary><option>endpass</option> ACL modifier</primary>
52603 </indexterm>
52604 This modifier, which has no argument, is recognized only in <option>accept</option> and
52605 <option>discard</option> statements. It marks the boundary between the conditions whose
52606 failure causes control to pass to the next statement, and the conditions whose
52607 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
52608 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
52609 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
52610 </para>
52611 </listitem></varlistentry>
52612 <varlistentry>
52613 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52614 <listitem>
52615 <para>
52616 <indexterm role="concept">
52617 <primary><option>log_message</option> ACL modifier</primary>
52618 </indexterm>
52619 This modifier sets up a message that is used as part of the log message if the
52620 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
52621 </para>
52622 <literallayout class="monospaced">
52623 require log_message = wrong cipher suite $tls_in_cipher
52624         encrypted   = DES-CBC3-SHA
52625 </literallayout>
52626 <para>
52627 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
52628 example:
52629 </para>
52630 <literallayout>
52631 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52632 <literal>        log_message = Discarded $local_part@$domain because...</literal>
52633 </literallayout>
52634 <para>
52635 When access is denied, <option>log_message</option> adds to any underlying error message
52636 that may exist because of a condition failure. For example, while verifying a
52637 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
52638 message.
52639 </para>
52640 <para>
52641 The message may be defined before the conditions to which it applies, because
52642 the string expansion does not happen until Exim decides that access is to be
52643 denied. This means that any variables that are set by the condition are
52644 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
52645 variables are set after a DNS black list lookup succeeds. If the expansion of
52646 <option>log_message</option> fails, or if the result is an empty string, the modifier is
52647 ignored.
52648 </para>
52649 <para>
52650 <indexterm role="variable">
52651 <primary><varname>$acl_verify_message</varname></primary>
52652 </indexterm>
52653 If you want to use a <option>warn</option> statement to log the result of an address
52654 verification, you can use <varname>$acl_verify_message</varname> to include the verification
52655 error message.
52656 </para>
52657 <para>
52658 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
52659 the start of the logged message. If the same warning log message is requested
52660 more than once while receiving  a single email message, only one copy is
52661 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
52662 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
52663 is logged for a successful <option>warn</option> statement.
52664 </para>
52665 <para>
52666 If <option>log_message</option> is not present and there is no underlying error message (for
52667 example, from the failure of address verification), but <option>message</option> is present,
52668 the <option>message</option> text is used for logging rejections. However, if any text for
52669 logging contains newlines, only the first line is logged. In the absence of
52670 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
52671 logging rejections.
52672 </para>
52673 </listitem></varlistentry>
52674 <varlistentry>
52675 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
52676 <listitem>
52677 <para>
52678 <indexterm role="concept">
52679 <primary><option>log_reject_target</option> ACL modifier</primary>
52680 </indexterm>
52681 <indexterm role="concept">
52682 <primary>logging in ACL</primary>
52683 <secondary>specifying which log</secondary>
52684 </indexterm>
52685 This modifier makes it possible to specify which logs are used for messages
52686 about ACL rejections. Its argument is a colon-separated list of words that can
52687 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
52688 may be empty, in which case a rejection is not logged at all. For example, this
52689 ACL fragment writes no logging information when access is denied:
52690 </para>
52691 <literallayout>
52692 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
52693 <literal>     log_reject_target =</literal>
52694 </literallayout>
52695 <para>
52696 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
52697 permanent and temporary rejections. Its effect lasts for the rest of the
52698 current ACL.
52699 </para>
52700 </listitem></varlistentry>
52701 <varlistentry>
52702 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52703 <listitem>
52704 <para>
52705 <indexterm role="concept">
52706 <primary><option>logwrite</option> ACL modifier</primary>
52707 </indexterm>
52708 <indexterm role="concept">
52709 <primary>logging in ACL</primary>
52710 <secondary>immediate</secondary>
52711 </indexterm>
52712 This modifier writes a message to a log file as soon as it is encountered when
52713 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
52714 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
52715 access.) The <option>logwrite</option> modifier can be used to log special incidents in
52716 ACLs. For example:
52717 </para>
52718 <literallayout>
52719 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
52720 <literal>       control  = freeze</literal>
52721 <literal>       logwrite = froze message because ...</literal>
52722 </literallayout>
52723 <para>
52724 By default, the message is written to the main log. However, it may begin
52725 with a colon, followed by a comma-separated list of log names, and then
52726 another colon, to specify exactly which logs are to be written. For
52727 example:
52728 </para>
52729 <literallayout class="monospaced">
52730 logwrite = :main,reject: text for main and reject logs
52731 logwrite = :panic: text for panic log only
52732 </literallayout>
52733 </listitem></varlistentry>
52734 <varlistentry>
52735 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52736 <listitem>
52737 <para>
52738 <indexterm role="concept">
52739 <primary><option>message</option> ACL modifier</primary>
52740 </indexterm>
52741 This modifier sets up a text string that is expanded and used as a response
52742 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
52743 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
52744 there is some complication if <option>endpass</option> is involved; see the description of
52745 <option>accept</option> for details.)
52746 </para>
52747 <para>
52748 The expansion of the message happens at the time Exim decides that the ACL is
52749 to end, not at the time it processes <option>message</option>. If the expansion fails, or
52750 generates an empty string, the modifier is ignored. Here is an example where
52751 <option>message</option> must be specified first, because the ACL ends with a rejection if
52752 the <option>hosts</option> condition fails:
52753 </para>
52754 <literallayout class="monospaced">
52755 require  message = Host not recognized
52756          hosts = 10.0.0.0/8
52757 </literallayout>
52758 <para>
52759 (Once a condition has failed, no further conditions or modifiers are
52760 processed.)
52761 </para>
52762 <para>
52763 <indexterm role="concept">
52764 <primary>SMTP</primary>
52765 <secondary>error codes</secondary>
52766 </indexterm>
52767 <indexterm role="option">
52768 <primary><option>smtp_banner</option></primary>
52769 </indexterm>
52770 For ACLs that are triggered by SMTP commands, the message is returned as part
52771 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
52772 is meaningful only for SMTP, as no message is returned when a non-SMTP message
52773 is accepted. In the case of the connect ACL, accepting with a message modifier
52774 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
52775 accept message may not contain more than one line (otherwise it will be
52776 truncated at the first newline and a panic logged), and it cannot affect the
52777 EHLO options.
52778 </para>
52779 <para>
52780 When SMTP is involved, the message may begin with an overriding response code,
52781 consisting of three digits optionally followed by an <quote>extended response code</quote>
52782 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
52783 </para>
52784 <literallayout class="monospaced">
52785 deny  message = 599 1.2.3 Host not welcome
52786       hosts = 192.168.34.0/24
52787 </literallayout>
52788 <para>
52789 The first digit of the supplied response code must be the same as would be sent
52790 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
52791 access, but for the predata ACL, note that the default success code is 354, not
52792 2<emphasis>xx</emphasis>.
52793 </para>
52794 <para>
52795 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
52796 the message modifier cannot override the 221 response code.
52797 </para>
52798 <para>
52799 The text in a <option>message</option> modifier is literal; any quotes are taken as
52800 literals, but because the string is expanded, backslash escapes are processed
52801 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
52802 response.
52803 </para>
52804 <para>
52805 <indexterm role="variable">
52806 <primary><varname>$acl_verify_message</varname></primary>
52807 </indexterm>
52808 </para>
52809 <para revisionflag="changed">
52810 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
52811 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
52812 </para>
52813 <para>
52814 If <option>message</option> is used on a statement that verifies an address, the message
52815 specified overrides any message that is generated by the verification process.
52816 However, the original message is available in the variable
52817 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
52818 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
52819 routers to be passed back as part of the SMTP response, you should either not
52820 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
52821 </para>
52822 <para>
52823 For compatibility with previous releases of Exim, a <option>message</option> modifier that
52824 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
52825 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
52826 all the conditions are true, wherever it appears in an ACL command, whereas
52827 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
52828 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
52829 effect.
52830 </para>
52831 </listitem></varlistentry>
52832 <varlistentry>
52833 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
52834 <listitem>
52835 <para>
52836 This modifier specifies one or more header names in a colon-separated list
52837  that are to be removed from an incoming message, assuming, of course, that
52838 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
52839 </para>
52840 </listitem></varlistentry>
52841 <varlistentry>
52842 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
52843 <listitem>
52844 <para>
52845 <indexterm role="concept">
52846 <primary><option>set</option> ACL modifier</primary>
52847 </indexterm>
52848 This modifier puts a value into one of the ACL variables (see section
52849 <xref linkend="SECTaclvariables"/>).
52850 </para>
52851 </listitem></varlistentry>
52852 <varlistentry>
52853 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
52854 <listitem>
52855 <para>
52856 This modifier sends a UDP packet, for purposes such as statistics
52857 collection or behaviour monitoring. The parameters are expanded, and
52858 the result of the expansion must be a colon-separated list consisting
52859 of a destination server, port number, and the packet contents. The
52860 server can be specified as a host name or IPv4 or IPv6 address. The
52861 separator can be changed with the usual angle bracket syntax. For
52862 example, you might want to collect information on which hosts connect
52863 when:
52864 </para>
52865 <literallayout class="monospaced">
52866 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
52867              $tod_zulu $sender_host_address
52868 </literallayout>
52869 </listitem></varlistentry>
52870 </variablelist>
52871 </section>
52872 <section id="SECTcontrols">
52873 <title>Use of the control modifier</title>
52874 <para>
52875 <indexterm role="concept">
52876 <primary><option>control</option> ACL modifier</primary>
52877 </indexterm>
52878 The <option>control</option> modifier supports the following settings:
52879 </para>
52880 <variablelist>
52881 <varlistentry>
52882 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
52883 <listitem>
52884 <para>
52885 This modifier allows a client host to use the SMTP AUTH command even when it
52886 has not been advertised in response to EHLO. Furthermore, because there are
52887 apparently some really broken clients that do this, Exim will accept AUTH after
52888 HELO (rather than EHLO) when this control is set. It should be used only if you
52889 really need it, and you should limit its use to those broken clients that do
52890 not work without it. For example:
52891 </para>
52892 <literallayout class="monospaced">
52893 warn hosts   = 192.168.34.25
52894      control = allow_auth_unadvertised
52895 </literallayout>
52896 <para>
52897 Normally, when an Exim server receives an AUTH command, it checks the name of
52898 the authentication mechanism that is given in the command to ensure that it
52899 matches an advertised mechanism. When this control is set, the check that a
52900 mechanism has been advertised is bypassed. Any configured mechanism can be used
52901 by the client. This control is permitted only in the connection and HELO ACLs.
52902 </para>
52903 </listitem></varlistentry>
52904 <varlistentry>
52905 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
52906 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
52907 <listitem>
52908 <para>
52909 <indexterm role="concept">
52910 <primary>access control lists (ACLs)</primary>
52911 <secondary>case of local part in</secondary>
52912 </indexterm>
52913 <indexterm role="concept">
52914 <primary>case of local parts</primary>
52915 </indexterm>
52916 <indexterm role="variable">
52917 <primary><varname>$local_part</varname></primary>
52918 </indexterm>
52919 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
52920 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
52921 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
52922 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
52923 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
52924 is encountered.
52925 </para>
52926 <para>
52927 These controls affect only the current recipient. Moreover, they apply only to
52928 local part handling that takes place directly in the ACL (for example, as a key
52929 in lookups). If a test to verify the recipient is obeyed, the case-related
52930 handling of the local part during the verification is controlled by the router
52931 configuration (see the <option>caseful_local_part</option> generic router option).
52932 </para>
52933 <para>
52934 This facility could be used, for example, to add a spam score to local parts
52935 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
52936 spam score:
52937 </para>
52938 <literallayout class="monospaced">
52939 warn  control = caseful_local_part
52940       set acl_m4 = ${eval:\
52941                      $acl_m4 + \
52942                      ${if match{$local_part}{[A-Z]}{1}{0}}\
52943                     }
52944       control = caselower_local_part
52945 </literallayout>
52946 <para>
52947 Notice that we put back the lower cased version afterwards, assuming that
52948 is what is wanted for subsequent tests.
52949 </para>
52950 </listitem></varlistentry>
52951 <varlistentry>
52952 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
52953 <listitem>
52954 <para>
52955 <indexterm role="concept">
52956 <primary>access control lists (ACLs)</primary>
52957 <secondary>cutthrough routing</secondary>
52958 </indexterm>
52959 <indexterm role="concept">
52960 <primary>cutthrough</primary>
52961 <secondary>requesting</secondary>
52962 </indexterm>
52963 This option requests delivery be attempted while the item is being received.
52964 </para>
52965 <para>
52966 The option usable in the RCPT ACL.
52967 If enabled for a message recieved via smtp and routed to an smtp transport,
52968 and the message has only one recipient,
52969 then the delivery connection is made while the receiving connection is open
52970 and data is copied from one to the other.
52971 </para>
52972 <para>
52973 If a recipient-verify callout connection is subsequently
52974 requested in the same ACL it is held open and used for the data,
52975 otherwise one is made after the initial RCPT ACL completes.
52976 </para>
52977 <para>
52978 Note that routers are used in verify mode,
52979 and cannot depend on content of received headers.
52980 Note also that headers cannot be
52981 modified by any of the post-data ACLs (DATA, MIME and DKIM).
52982 Headers may be modified by routers (subject to the above) and transports.
52983 </para>
52984 <para>
52985 Cutthrough delivery is not supported via transport-filters or when DKIM signing
52986 of outgoing messages is done, because it sends data to the ultimate destination
52987 before the entire message has been received from the source.
52988 </para>
52989 <para>
52990 Should the ultimate destination system positively accept or reject the mail,
52991 a corresponding indication is given to the source system and nothing is queued.
52992 If there is a temporary error the item is queued for later delivery in the
52993 usual fashion. If the item is successfully delivered in cutthrough mode
52994 the log line is tagged with "&gt;&gt;" rather than "=&gt;" and appears
52995 before the acceptance "&lt;=" line.
52996 </para>
52997 <para>
52998 Delivery in this mode avoids the generation of a bounce mail to a
52999 (possibly faked)
53000 sender when the destination system is doing content-scan based rejection.
53001 </para>
53002 </listitem></varlistentry>
53003 <varlistentry>
53004 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53005 <listitem>
53006 <para>
53007 <indexterm role="concept">
53008 <primary>access control lists (ACLs)</primary>
53009 <secondary>enabling debug logging</secondary>
53010 </indexterm>
53011 <indexterm role="concept">
53012 <primary>debugging</primary>
53013 <secondary>enabling from an ACL</secondary>
53014 </indexterm>
53015 This control turns on debug logging, almost as though Exim had been invoked
53016 with <literal>-d</literal>, with the output going to a new logfile, by default called
53017 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
53018 may access any variables already defined.  The logging may be adjusted with
53019 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
53020 option.  Some examples (which depend on variables that don&#x2019;t exist in all
53021 contexts):
53022 </para>
53023 <literallayout class="monospaced">
53024       control = debug
53025       control = debug/tag=.$sender_host_address
53026       control = debug/opts=+expand+acl
53027       control = debug/tag=.$message_exim_id/opts=+expand
53028 </literallayout>
53029 </listitem></varlistentry>
53030 <varlistentry>
53031 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
53032 <listitem>
53033 <para>
53034 <indexterm role="concept">
53035 <primary>disable DKIM verify</primary>
53036 </indexterm>
53037 <indexterm role="concept">
53038 <primary>DKIM</primary>
53039 <secondary>disable verify</secondary>
53040 </indexterm>
53041 This control turns off DKIM verification processing entirely.  For details on
53042 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53043 </para>
53044 </listitem></varlistentry>
53045 <varlistentry>
53046 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
53047 <listitem>
53048 <para>
53049 <indexterm role="concept">
53050 <primary>access control lists (ACLs)</primary>
53051 <secondary>setting DSCP value</secondary>
53052 </indexterm>
53053 <indexterm role="concept">
53054 <primary>DSCP</primary>
53055 <secondary>inbound</secondary>
53056 </indexterm>
53057 This option causes the DSCP value associated with the socket for the inbound
53058 connection to be adjusted to a given value, given as one of a number of fixed
53059 strings or to numeric value.
53060 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
53061 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
53062 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
53063 </para>
53064 <para>
53065 The outbound packets from Exim will be marked with this value in the header
53066 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
53067 that these values will have any effect, not be stripped by networking
53068 equipment, or do much of anything without cooperation with your Network
53069 Engineer and those of all network operators between the source and destination.
53070 </para>
53071 </listitem></varlistentry>
53072 <varlistentry>
53073 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
53074 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
53075 <listitem>
53076 <para>
53077 <indexterm role="concept">
53078 <primary>SMTP</primary>
53079 <secondary>synchronization checking</secondary>
53080 </indexterm>
53081 <indexterm role="concept">
53082 <primary>synchronization checking in SMTP</primary>
53083 </indexterm>
53084 These controls make it possible to be selective about when SMTP synchronization
53085 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
53086 state of the switch (it is true by default). See the description of this option
53087 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
53088 </para>
53089 <para>
53090 The effect of these two controls lasts for the remainder of the SMTP
53091 connection. They can appear in any ACL except the one for the non-SMTP
53092 messages. The most straightforward place to put them is in the ACL defined by
53093 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
53094 before the first synchronization check. The expected use is to turn off the
53095 synchronization checks for badly-behaved hosts that you nevertheless need to
53096 work with.
53097 </para>
53098 </listitem></varlistentry>
53099 <varlistentry>
53100 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53101 <listitem>
53102 <para>
53103 <indexterm role="concept">
53104 <primary>fake defer</primary>
53105 </indexterm>
53106 <indexterm role="concept">
53107 <primary>defer, fake</primary>
53108 </indexterm>
53109 This control works in exactly the same way as <option>fakereject</option> (described below)
53110 except that it causes an SMTP 450 response after the message data instead of a
53111 550 response. You must take care when using <option>fakedefer</option> because it causes the
53112 messages to be duplicated when the sender retries. Therefore, you should not
53113 use <option>fakedefer</option> if the message is to be delivered normally.
53114 </para>
53115 </listitem></varlistentry>
53116 <varlistentry>
53117 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
53118 <listitem>
53119 <para>
53120 <indexterm role="concept">
53121 <primary>fake rejection</primary>
53122 </indexterm>
53123 <indexterm role="concept">
53124 <primary>rejection, fake</primary>
53125 </indexterm>
53126 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
53127 words, only when an SMTP message is being received. If Exim accepts the
53128 message, instead the final 250 response, a 550 rejection message is sent.
53129 However, Exim proceeds to deliver the message as normal. The control applies
53130 only to the current message, not to any subsequent ones that may be received in
53131 the same SMTP connection.
53132 </para>
53133 <para>
53134 The text for the 550 response is taken from the <option>control</option> modifier. If no
53135 message is supplied, the following is used:
53136 </para>
53137 <literallayout class="monospaced">
53138 550-Your message has been rejected but is being
53139 550-kept for evaluation.
53140 550-If it was a legitimate message, it may still be
53141 550 delivered to the target recipient(s).
53142 </literallayout>
53143 <para>
53144 This facility should be used with extreme caution.
53145 </para>
53146 </listitem></varlistentry>
53147 <varlistentry>
53148 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
53149 <listitem>
53150 <para>
53151 <indexterm role="concept">
53152 <primary>frozen messages</primary>
53153 <secondary>forcing in ACL</secondary>
53154 </indexterm>
53155 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53156 other words, only when a message is being received. If the message is accepted,
53157 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
53158 current message, not to any subsequent ones that may be received in the same
53159 SMTP connection.
53160 </para>
53161 <para>
53162 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
53163 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
53164 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
53165 are obeyed for the current message have the <literal>/no_tell</literal> option.
53166 </para>
53167 </listitem></varlistentry>
53168 <varlistentry>
53169 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
53170 <listitem>
53171 <para>
53172 <indexterm role="concept">
53173 <primary>SMTP</primary>
53174 <secondary>output flushing, disabling for delay</secondary>
53175 </indexterm>
53176 Exim normally flushes SMTP output before implementing a delay in an ACL, to
53177 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53178 use. This control, as long as it is encountered before the <option>delay</option> modifier,
53179 disables such output flushing.
53180 </para>
53181 </listitem></varlistentry>
53182 <varlistentry>
53183 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
53184 <listitem>
53185 <para>
53186 <indexterm role="concept">
53187 <primary>SMTP</primary>
53188 <secondary>output flushing, disabling for callout</secondary>
53189 </indexterm>
53190 Exim normally flushes SMTP output before performing a callout in an ACL, to
53191 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
53192 use. This control, as long as it is encountered before the <option>verify</option> condition
53193 that causes the callout, disables such output flushing.
53194 </para>
53195 </listitem></varlistentry>
53196 <varlistentry>
53197 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
53198 <listitem>
53199 <para>
53200 This control is available when Exim is compiled with the content scanning
53201 extension. Content scanning may require a copy of the current message, or parts
53202 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
53203 or spam scanner. Normally, such copies are deleted when they are no longer
53204 needed. If this control is set, the copies are not deleted. The control applies
53205 only to the current message, not to any subsequent ones that may be received in
53206 the same SMTP connection. It is provided for debugging purposes and is unlikely
53207 to be useful in production.
53208 </para>
53209 </listitem></varlistentry>
53210 <varlistentry>
53211 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
53212 <listitem>
53213 <para>
53214 <indexterm role="concept">
53215 <primary>multiline responses, suppressing</primary>
53216 </indexterm>
53217 This control is permitted for any ACL except the one for non-SMTP messages.
53218 It seems that there are broken clients in use that cannot handle multiline
53219 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
53220 </para>
53221 <para>
53222 If this control is set, multiline SMTP responses from ACL rejections are
53223 suppressed. One way of doing this would have been to put out these responses as
53224 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
53225 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
53226 responses might get close to that. So this facility, which is after all only a
53227 sop to broken clients, is implemented by doing two very easy things:
53228 </para>
53229 <itemizedlist>
53230 <listitem>
53231 <para>
53232 Extra information that is normally output as part of a rejection caused by
53233 sender verification failure is omitted. Only the final line (typically <quote>sender
53234 verification failed</quote>) is sent.
53235 </para>
53236 </listitem>
53237 <listitem>
53238 <para>
53239 If a <option>message</option> modifier supplies a multiline response, only the first
53240 line is output.
53241 </para>
53242 </listitem>
53243 </itemizedlist>
53244 <para>
53245 The setting of the switch can, of course, be made conditional on the
53246 calling host. Its effect lasts until the end of the SMTP connection.
53247 </para>
53248 </listitem></varlistentry>
53249 <varlistentry>
53250 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
53251 <listitem>
53252 <para>
53253 <indexterm role="concept">
53254 <primary>PIPELINING</primary>
53255 <secondary>suppressing advertising</secondary>
53256 </indexterm>
53257 This control turns off the advertising of the PIPELINING extension to SMTP in
53258 the current session. To be useful, it must be obeyed before Exim sends its
53259 response to an EHLO command. Therefore, it should normally appear in an ACL
53260 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
53261 <option>pipelining_advertise_hosts</option>.
53262 </para>
53263 </listitem></varlistentry>
53264 <varlistentry>
53265 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
53266 <listitem>
53267 <para>
53268 <indexterm role="option">
53269 <primary><option>queue_only</option></primary>
53270 </indexterm>
53271 <indexterm role="concept">
53272 <primary>queueing incoming messages</primary>
53273 </indexterm>
53274 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
53275 other words, only when a message is being received. If the message is accepted,
53276 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
53277 runner. No immediate delivery process is started. In other words, it has the
53278 effect as the <option>queue_only</option> global option. However, the control applies only
53279 to the current message, not to any subsequent ones that may be received in the
53280 same SMTP connection.
53281 </para>
53282 </listitem></varlistentry>
53283 <varlistentry>
53284 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53285 <listitem>
53286 <para>
53287 <indexterm role="concept">
53288 <primary>message</primary>
53289 <secondary>submission</secondary>
53290 </indexterm>
53291 <indexterm role="concept">
53292 <primary>submission mode</primary>
53293 </indexterm>
53294 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
53295 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
53296 the current message is a submission from a local MUA. In this case, Exim
53297 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
53298 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
53299 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
53300 late (the message has already been created).
53301 </para>
53302 <para>
53303 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
53304 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
53305 submission mode; the available options for this control are described there.
53306 The control applies only to the current message, not to any subsequent ones
53307 that may be received in the same SMTP connection.
53308 </para>
53309 </listitem></varlistentry>
53310 <varlistentry>
53311 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
53312 <listitem>
53313 <para>
53314 <indexterm role="concept">
53315 <primary>submission fixups, suppressing</primary>
53316 </indexterm>
53317 This control applies to locally submitted (non TCP/IP) messages, and is the
53318 complement of <literal>control = submission</literal>. It disables the fixups that are
53319 normally applied to locally-submitted messages. Specifically:
53320 </para>
53321 <itemizedlist>
53322 <listitem>
53323 <para>
53324 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
53325 dynamic version of <option>local_sender_retain</option>).
53326 </para>
53327 </listitem>
53328 <listitem>
53329 <para>
53330 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
53331 </para>
53332 </listitem>
53333 <listitem>
53334 <para>
53335 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
53336 </para>
53337 </listitem>
53338 </itemizedlist>
53339 <para>
53340 This control may be useful when a remotely-originated message is accepted,
53341 passed to some scanning program, and then re-submitted for delivery. It can be
53342 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
53343 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
53344 data is read.
53345 </para>
53346 <para>
53347 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
53348 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
53349 </para>
53350 </listitem></varlistentry>
53351 </variablelist>
53352 </section>
53353 <section id="SECTsummesfix">
53354 <title>Summary of message fixup control</title>
53355 <para>
53356 All four possibilities for message fixups can be specified:
53357 </para>
53358 <itemizedlist>
53359 <listitem>
53360 <para>
53361 Locally submitted, fixups applied: the default.
53362 </para>
53363 </listitem>
53364 <listitem>
53365 <para>
53366 Locally submitted, no fixups applied: use
53367 <literal>control = suppress_local_fixups</literal>.
53368 </para>
53369 </listitem>
53370 <listitem>
53371 <para>
53372 Remotely submitted, no fixups applied: the default.
53373 </para>
53374 </listitem>
53375 <listitem>
53376 <para>
53377 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
53378 </para>
53379 </listitem>
53380 </itemizedlist>
53381 </section>
53382 <section id="SECTaddheadacl">
53383 <title>Adding header lines in ACLs</title>
53384 <para>
53385 <indexterm role="concept">
53386 <primary>header lines</primary>
53387 <secondary>adding in an ACL</secondary>
53388 </indexterm>
53389 <indexterm role="concept">
53390 <primary>header lines</primary>
53391 <secondary>position of added lines</secondary>
53392 </indexterm>
53393 <indexterm role="concept">
53394 <primary><option>add_header</option> ACL modifier</primary>
53395 </indexterm>
53396 The <option>add_header</option> modifier can be used to add one or more extra header lines
53397 to an incoming message, as in this example:
53398 </para>
53399 <literallayout class="monospaced">
53400 warn dnslists = sbl.spamhaus.org : \
53401                 dialup.mail-abuse.org
53402      add_header = X-blacklisted-at: $dnslist_domain
53403 </literallayout>
53404 <para>
53405 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53406 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53407 receiving a message). The message must ultimately be accepted for
53408 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
53409 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
53410 RCPT ACL).
53411 </para>
53412 <para>
53413 Headers will not be added to the message if the modifier is used in
53414 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53415 </para>
53416 <para>
53417 Leading and trailing newlines are removed from
53418 the data for the <option>add_header</option> modifier; if it then
53419 contains one or more newlines that
53420 are not followed by a space or a tab, it is assumed to contain multiple header
53421 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
53422 front of any line that is not a valid header line.
53423 </para>
53424 <para>
53425 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53426 They are added to the message before processing the DATA and MIME ACLs.
53427 However, if an identical header line is requested more than once, only one copy
53428 is actually added to the message. Further header lines may be accumulated
53429 during the DATA and MIME ACLs, after which they are added to the message, again
53430 with duplicates suppressed. Thus, it is possible to add two identical header
53431 lines to an SMTP message, but only if one is added before DATA and one after.
53432 In the case of non-SMTP messages, new headers are accumulated during the
53433 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
53434 message is rejected after DATA or by the non-SMTP ACL, all added header lines
53435 are included in the entry that is written to the reject log.
53436 </para>
53437 <para>
53438 <indexterm role="concept">
53439 <primary>header lines</primary>
53440 <secondary>added; visibility of</secondary>
53441 </indexterm>
53442 Header lines are not visible in string expansions
53443 of message headers
53444 until they are added to the
53445 message. It follows that header lines defined in the MAIL, RCPT, and predata
53446 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
53447 header lines that are added by the DATA or MIME ACLs are not visible in those
53448 ACLs. Because of this restriction, you cannot use header lines as a way of
53449 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
53450 this, you can use ACL variables, as described in section
53451 <xref linkend="SECTaclvariables"/>.
53452 </para>
53453 <para>
53454 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
53455 </para>
53456 <para>
53457 The <option>add_header</option> modifier acts immediately as it is encountered during the
53458 processing of an ACL. Notice the difference between these two cases:
53459 </para>
53460 <literallayout>
53461 <literal>accept add_header = ADDED: some text</literal>
53462 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53463
53464 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53465 <literal>       add_header = ADDED: some text</literal>
53466 </literallayout>
53467 <para>
53468 In the first case, the header line is always added, whether or not the
53469 condition is true. In the second case, the header line is added only if the
53470 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
53471 ACL statement. All those that are encountered before a condition fails are
53472 honoured.
53473 </para>
53474 <para>
53475 <indexterm role="concept">
53476 <primary><option>warn</option> ACL verb</primary>
53477 </indexterm>
53478 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
53479 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
53480 effect only if all the conditions are true, even if it appears before some of
53481 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
53482 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
53483 are present on a <option>warn</option> verb, both are processed according to their
53484 specifications.
53485 </para>
53486 <para>
53487 By default, new header lines are added to a message at the end of the existing
53488 header lines. However, you can specify that any particular header line should
53489 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
53490 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
53491 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
53492 </para>
53493 <para>
53494 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
53495 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
53496 header line, respectively. (Header text cannot start with a colon, as there has
53497 to be a header name first.) For example:
53498 </para>
53499 <literallayout class="monospaced">
53500 warn add_header = \
53501        :after_received:X-My-Header: something or other...
53502 </literallayout>
53503 <para>
53504 If more than one header line is supplied in a single <option>add_header</option> modifier,
53505 each one is treated independently and can therefore be placed differently. If
53506 you add more than one line at the start, or after the Received: block, they end
53507 up in reverse order.
53508 </para>
53509 <para>
53510 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53511 added in an ACL. It does NOT work for header lines that are added in a
53512 system filter or in a router or transport.
53513 </para>
53514 </section>
53515 <section id="SECTremoveheadacl">
53516 <title>Removing header lines in ACLs</title>
53517 <para>
53518 <indexterm role="concept">
53519 <primary>header lines</primary>
53520 <secondary>removing in an ACL</secondary>
53521 </indexterm>
53522 <indexterm role="concept">
53523 <primary>header lines</primary>
53524 <secondary>position of removed lines</secondary>
53525 </indexterm>
53526 <indexterm role="concept">
53527 <primary><option>remove_header</option> ACL modifier</primary>
53528 </indexterm>
53529 The <option>remove_header</option> modifier can be used to remove one or more header lines
53530 from an incoming message, as in this example:
53531 </para>
53532 <literallayout class="monospaced">
53533 warn   message        = Remove internal headers
53534        remove_header  = x-route-mail1 : x-route-mail2
53535 </literallayout>
53536 <para>
53537 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
53538 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
53539 receiving a message). The message must ultimately be accepted for
53540 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
53541 with any ACL verb, including <option>deny</option>, though this is really not useful for
53542 any verb that doesn&#x2019;t result in a delivered message.
53543 </para>
53544 <para>
53545 Headers will not be removed to the message if the modifier is used in
53546 DATA, MIME or DKIM ACLs for messages delivered by cutthrough routing.
53547 </para>
53548 <para>
53549 More than one header can be removed at the same time by using a colon separated
53550 list of header names. The header matching is case insensitive. Wildcards are
53551 not permitted, nor is list expansion performed, so you cannot use hostlists to
53552 create a list of headers, however both connection and message variable expansion
53553 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
53554 </para>
53555 <literallayout class="monospaced">
53556 warn   hosts           = +internal_hosts
53557        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
53558 warn   message         = Remove internal headers
53559        remove_header   = $acl_c_ihdrs
53560 </literallayout>
53561 <para>
53562 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
53563 They are removed from the message before processing the DATA and MIME ACLs.
53564 There is no harm in attempting to remove the same header twice nor is removing
53565 a non-existent header. Further header lines to be removed may be accumulated
53566 during the DATA and MIME ACLs, after which they are removed from the message,
53567 if present. In the case of non-SMTP messages, headers to be removed are
53568 accumulated during the non-SMTP ACLs, and are removed from the message after
53569 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
53570 ACL, there really is no effect because there is no logging of what headers
53571 would have been removed.
53572 </para>
53573 <para>
53574 <indexterm role="concept">
53575 <primary>header lines</primary>
53576 <secondary>removed; visibility of</secondary>
53577 </indexterm>
53578 Header lines are not visible in string expansions until the DATA phase when it
53579 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
53580 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
53581 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
53582 this restriction, you cannot use header lines as a way of controlling data
53583 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
53584 you should instead use ACL variables, as described in section
53585 <xref linkend="SECTaclvariables"/>.
53586 </para>
53587 <para>
53588 The <option>remove_header</option> modifier acts immediately as it is encountered during the
53589 processing of an ACL. Notice the difference between these two cases:
53590 </para>
53591 <literallayout>
53592 <literal>accept remove_header = X-Internal</literal>
53593 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
53594
53595 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
53596 <literal>       remove_header = X-Internal</literal>
53597 </literallayout>
53598 <para>
53599 In the first case, the header line is always removed, whether or not the
53600 condition is true. In the second case, the header line is removed only if the
53601 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
53602 same ACL statement. All those that are encountered before a condition fails
53603 are honoured.
53604 </para>
53605 <para>
53606 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
53607 present during ACL processing. It does NOT remove header lines that are added
53608 in a system filter or in a router or transport.
53609 </para>
53610 </section>
53611 <section id="SECTaclconditions">
53612 <title>ACL conditions</title>
53613 <para>
53614 <indexterm role="concept">
53615 <primary>access control lists (ACLs)</primary>
53616 <secondary>conditions; list of</secondary>
53617 </indexterm>
53618 Some of the conditions listed in this section are available only when Exim is
53619 compiled with the content-scanning extension. They are included here briefly
53620 for completeness. More detailed descriptions can be found in the discussion on
53621 content scanning in chapter <xref linkend="CHAPexiscan"/>.
53622 </para>
53623 <para>
53624 Not all conditions are relevant in all circumstances. For example, testing
53625 senders and recipients does not make sense in an ACL that is being run as the
53626 result of the arrival of an ETRN command, and checks on message headers can be
53627 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
53628 can use the same condition (with different parameters) more than once in the
53629 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
53630 The conditions are as follows:
53631 </para>
53632 <variablelist>
53633 <varlistentry>
53634 <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>
53635 <listitem>
53636 <para>
53637 <indexterm role="concept">
53638 <primary>access control lists (ACLs)</primary>
53639 <secondary>nested</secondary>
53640 </indexterm>
53641 <indexterm role="concept">
53642 <primary>access control lists (ACLs)</primary>
53643 <secondary>indirect</secondary>
53644 </indexterm>
53645 <indexterm role="concept">
53646 <primary>access control lists (ACLs)</primary>
53647 <secondary>arguments</secondary>
53648 </indexterm>
53649 <indexterm role="concept">
53650 <primary><option>acl</option> ACL condition</primary>
53651 </indexterm>
53652 The possible values of the argument are the same as for the
53653 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
53654 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
53655 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
53656 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
53657 condition false. This means that further processing of the <option>warn</option> verb
53658 ceases, but processing of the ACL continues.
53659 </para>
53660 <para>
53661 If the argument is a named ACL, up to nine space-separated optional values
53662 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
53663 and $acl_narg is set to the count of values.
53664 Previous values of these variables are restored after the call returns.
53665 The name and values are expanded separately.
53666 Note that spaces in complex expansions which are used as arguments
53667 will act as argument separators.
53668 </para>
53669 <para>
53670 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
53671 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
53672 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
53673 conditions are tested.
53674 </para>
53675 <para>
53676 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
53677 loops. This condition allows you to use different ACLs in different
53678 circumstances. For example, different ACLs can be used to handle RCPT commands
53679 for different local users or different local domains.
53680 </para>
53681 </listitem></varlistentry>
53682 <varlistentry>
53683 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53684 <listitem>
53685 <para>
53686 <indexterm role="concept">
53687 <primary><option>authenticated</option> ACL condition</primary>
53688 </indexterm>
53689 <indexterm role="concept">
53690 <primary>authentication</primary>
53691 <secondary>ACL checking</secondary>
53692 </indexterm>
53693 <indexterm role="concept">
53694 <primary>access control lists (ACLs)</primary>
53695 <secondary>testing for authentication</secondary>
53696 </indexterm>
53697 If the SMTP connection is not authenticated, the condition is false. Otherwise,
53698 the name of the authenticator is tested against the list. To test for
53699 authentication by any authenticator, you can set
53700 </para>
53701 <literallayout class="monospaced">
53702 authenticated = *
53703 </literallayout>
53704 </listitem></varlistentry>
53705 <varlistentry>
53706 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
53707 <listitem>
53708 <para>
53709 <indexterm role="concept">
53710 <primary><option>condition</option> ACL condition</primary>
53711 </indexterm>
53712 <indexterm role="concept">
53713 <primary>customizing</primary>
53714 <secondary>ACL condition</secondary>
53715 </indexterm>
53716 <indexterm role="concept">
53717 <primary>access control lists (ACLs)</primary>
53718 <secondary>customized test</secondary>
53719 </indexterm>
53720 <indexterm role="concept">
53721 <primary>access control lists (ACLs)</primary>
53722 <secondary>testing, customized</secondary>
53723 </indexterm>
53724 This feature allows you to make up custom conditions. If the result of
53725 expanding the string is an empty string, the number zero, or one of the strings
53726 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
53727 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
53728 any other value, some error is assumed to have occurred, and the ACL returns
53729 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
53730 ignored. The effect is to treat it as true, whether it is positive or
53731 negative.
53732 </para>
53733 </listitem></varlistentry>
53734 <varlistentry>
53735 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
53736 <listitem>
53737 <para>
53738 <indexterm role="concept">
53739 <primary><option>decode</option> ACL condition</primary>
53740 </indexterm>
53741 This condition is available only when Exim is compiled with the
53742 content-scanning extension, and it is allowed only in the ACL defined by
53743 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
53744 If all goes well, the condition is true. It is false only if there are
53745 problems such as a syntax error or a memory shortage. For more details, see
53746 chapter <xref linkend="CHAPexiscan"/>.
53747 </para>
53748 </listitem></varlistentry>
53749 <varlistentry>
53750 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
53751 <listitem>
53752 <para>
53753 <indexterm role="concept">
53754 <primary><option>demime</option> ACL condition</primary>
53755 </indexterm>
53756 This condition is available only when Exim is compiled with the
53757 content-scanning extension. Its use is described in section
53758 <xref linkend="SECTdemimecond"/>.
53759 </para>
53760 </listitem></varlistentry>
53761 <varlistentry>
53762 <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>
53763 <listitem>
53764 <para>
53765 <indexterm role="concept">
53766 <primary><option>dnslists</option> ACL condition</primary>
53767 </indexterm>
53768 <indexterm role="concept">
53769 <primary>DNS list</primary>
53770 <secondary>in ACL</secondary>
53771 </indexterm>
53772 <indexterm role="concept">
53773 <primary>black list (DNS)</primary>
53774 </indexterm>
53775 <indexterm role="concept">
53776 <primary>access control lists (ACLs)</primary>
53777 <secondary>testing a DNS list</secondary>
53778 </indexterm>
53779 This condition checks for entries in DNS black lists. These are also known as
53780 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
53781 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
53782 different variants of this condition to describe briefly here. See sections
53783 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
53784 </para>
53785 </listitem></varlistentry>
53786 <varlistentry>
53787 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
53788 <listitem>
53789 <para>
53790 <indexterm role="concept">
53791 <primary><option>domains</option> ACL condition</primary>
53792 </indexterm>
53793 <indexterm role="concept">
53794 <primary>domain</primary>
53795 <secondary>ACL checking</secondary>
53796 </indexterm>
53797 <indexterm role="concept">
53798 <primary>access control lists (ACLs)</primary>
53799 <secondary>testing a recipient domain</secondary>
53800 </indexterm>
53801 <indexterm role="variable">
53802 <primary><varname>$domain_data</varname></primary>
53803 </indexterm>
53804 This condition is relevant only after a RCPT command. It checks that the domain
53805 of the recipient address is in the domain list. If percent-hack processing is
53806 enabled, it is done before this test is done. If the check succeeds with a
53807 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
53808 <option>domains</option> test.
53809 </para>
53810 <para>
53811 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
53812 use <option>domains</option> in a DATA ACL.
53813 </para>
53814 </listitem></varlistentry>
53815 <varlistentry>
53816 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
53817 <listitem>
53818 <para>
53819 <indexterm role="concept">
53820 <primary><option>encrypted</option> ACL condition</primary>
53821 </indexterm>
53822 <indexterm role="concept">
53823 <primary>encryption</primary>
53824 <secondary>checking in an ACL</secondary>
53825 </indexterm>
53826 <indexterm role="concept">
53827 <primary>access control lists (ACLs)</primary>
53828 <secondary>testing for encryption</secondary>
53829 </indexterm>
53830 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
53831 name of the cipher suite in use is tested against the list. To test for
53832 encryption without testing for any specific cipher suite(s), set
53833 </para>
53834 <literallayout class="monospaced">
53835 encrypted = *
53836 </literallayout>
53837 </listitem></varlistentry>
53838 <varlistentry>
53839 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
53840 <listitem>
53841 <para>
53842 <indexterm role="concept">
53843 <primary><option>hosts</option> ACL condition</primary>
53844 </indexterm>
53845 <indexterm role="concept">
53846 <primary>host</primary>
53847 <secondary>ACL checking</secondary>
53848 </indexterm>
53849 <indexterm role="concept">
53850 <primary>access control lists (ACLs)</primary>
53851 <secondary>testing the client host</secondary>
53852 </indexterm>
53853 This condition tests that the calling host matches the host list. If you have
53854 name lookups or wildcarded host names and IP addresses in the same host list,
53855 you should normally put the IP addresses first. For example, you could have:
53856 </para>
53857 <literallayout class="monospaced">
53858 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
53859 </literallayout>
53860 <para>
53861 The lookup in this example uses the host name for its key. This is implied by
53862 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
53863 and it wouldn&#x2019;t matter which way round you had these two items.)
53864 </para>
53865 <para>
53866 The reason for the problem with host names lies in the left-to-right way that
53867 Exim processes lists. It can test IP addresses without doing any DNS lookups,
53868 but when it reaches an item that requires a host name, it fails if it cannot
53869 find a host name to compare with the pattern. If the above list is given in the
53870 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
53871 found, even if its IP address is 10.9.8.7.
53872 </para>
53873 <para>
53874 If you really do want to do the name check first, and still recognize the IP
53875 address even if the name lookup fails, you can rewrite the ACL like this:
53876 </para>
53877 <literallayout class="monospaced">
53878 accept hosts = dbm;/etc/friendly/hosts
53879 accept hosts = 10.9.8.7
53880 </literallayout>
53881 <para>
53882 The default action on failing to find the host name is to assume that the host
53883 is not in the list, so the first <option>accept</option> statement fails. The second
53884 statement can then check the IP address.
53885 </para>
53886 <para>
53887 <indexterm role="variable">
53888 <primary><varname>$host_data</varname></primary>
53889 </indexterm>
53890 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
53891 of the lookup is made available in the <varname>$host_data</varname> variable. This
53892 allows you, for example, to set up a statement like this:
53893 </para>
53894 <literallayout class="monospaced">
53895 deny  hosts = net-lsearch;/some/file
53896 message = $host_data
53897 </literallayout>
53898 <para>
53899 which gives a custom error message for each denied host.
53900 </para>
53901 </listitem></varlistentry>
53902 <varlistentry>
53903 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
53904 <listitem>
53905 <para>
53906 <indexterm role="concept">
53907 <primary><option>local_parts</option> ACL condition</primary>
53908 </indexterm>
53909 <indexterm role="concept">
53910 <primary>local part</primary>
53911 <secondary>ACL checking</secondary>
53912 </indexterm>
53913 <indexterm role="concept">
53914 <primary>access control lists (ACLs)</primary>
53915 <secondary>testing a local part</secondary>
53916 </indexterm>
53917 <indexterm role="variable">
53918 <primary><varname>$local_part_data</varname></primary>
53919 </indexterm>
53920 This condition is relevant only after a RCPT command. It checks that the local
53921 part of the recipient address is in the list. If percent-hack processing is
53922 enabled, it is done before this test. If the check succeeds with a lookup, the
53923 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
53924 the next <option>local_parts</option> test.
53925 </para>
53926 </listitem></varlistentry>
53927 <varlistentry>
53928 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
53929 <listitem>
53930 <para>
53931 <indexterm role="concept">
53932 <primary><option>malware</option> ACL condition</primary>
53933 </indexterm>
53934 <indexterm role="concept">
53935 <primary>access control lists (ACLs)</primary>
53936 <secondary>virus scanning</secondary>
53937 </indexterm>
53938 <indexterm role="concept">
53939 <primary>access control lists (ACLs)</primary>
53940 <secondary>scanning for viruses</secondary>
53941 </indexterm>
53942 This condition is available only when Exim is compiled with the
53943 content-scanning extension. It causes the incoming message to be scanned for
53944 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
53945 </para>
53946 </listitem></varlistentry>
53947 <varlistentry>
53948 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53949 <listitem>
53950 <para>
53951 <indexterm role="concept">
53952 <primary><option>mime_regex</option> ACL condition</primary>
53953 </indexterm>
53954 <indexterm role="concept">
53955 <primary>access control lists (ACLs)</primary>
53956 <secondary>testing by regex matching</secondary>
53957 </indexterm>
53958 This condition is available only when Exim is compiled with the
53959 content-scanning extension, and it is allowed only in the ACL defined by
53960 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
53961 with any of the regular expressions. For details, see chapter
53962 <xref linkend="CHAPexiscan"/>.
53963 </para>
53964 </listitem></varlistentry>
53965 <varlistentry>
53966 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
53967 <listitem>
53968 <para>
53969 <indexterm role="concept">
53970 <primary>rate limiting</primary>
53971 </indexterm>
53972 This condition can be used to limit the rate at which a user or host submits
53973 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
53974 </para>
53975 </listitem></varlistentry>
53976 <varlistentry>
53977 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
53978 <listitem>
53979 <para>
53980 <indexterm role="concept">
53981 <primary><option>recipients</option> ACL condition</primary>
53982 </indexterm>
53983 <indexterm role="concept">
53984 <primary>recipient</primary>
53985 <secondary>ACL checking</secondary>
53986 </indexterm>
53987 <indexterm role="concept">
53988 <primary>access control lists (ACLs)</primary>
53989 <secondary>testing a recipient</secondary>
53990 </indexterm>
53991 This condition is relevant only after a RCPT command. It checks the entire
53992 recipient address against a list of recipients.
53993 </para>
53994 </listitem></varlistentry>
53995 <varlistentry>
53996 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
53997 <listitem>
53998 <para>
53999 <indexterm role="concept">
54000 <primary><option>regex</option> ACL condition</primary>
54001 </indexterm>
54002 <indexterm role="concept">
54003 <primary>access control lists (ACLs)</primary>
54004 <secondary>testing by regex matching</secondary>
54005 </indexterm>
54006 This condition is available only when Exim is compiled with the
54007 content-scanning extension, and is available only in the DATA, MIME, and
54008 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
54009 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
54010 </para>
54011 </listitem></varlistentry>
54012 <varlistentry>
54013 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
54014 <listitem>
54015 <para>
54016 <indexterm role="concept">
54017 <primary><option>sender_domains</option> ACL condition</primary>
54018 </indexterm>
54019 <indexterm role="concept">
54020 <primary>sender</primary>
54021 <secondary>ACL checking</secondary>
54022 </indexterm>
54023 <indexterm role="concept">
54024 <primary>access control lists (ACLs)</primary>
54025 <secondary>testing a sender domain</secondary>
54026 </indexterm>
54027 <indexterm role="variable">
54028 <primary><varname>$domain</varname></primary>
54029 </indexterm>
54030 <indexterm role="variable">
54031 <primary><varname>$sender_address_domain</varname></primary>
54032 </indexterm>
54033 This condition tests the domain of the sender of the message against the given
54034 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
54035 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
54036 of this condition. This is an exception to the general rule for testing domain
54037 lists. It is done this way so that, if this condition is used in an ACL for a
54038 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
54039 influence the sender checking.
54040 </para>
54041 <para>
54042 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
54043 relaying, because sender addresses are easily, and commonly, forged.
54044 </para>
54045 </listitem></varlistentry>
54046 <varlistentry>
54047 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
54048 <listitem>
54049 <para>
54050 <indexterm role="concept">
54051 <primary><option>senders</option> ACL condition</primary>
54052 </indexterm>
54053 <indexterm role="concept">
54054 <primary>sender</primary>
54055 <secondary>ACL checking</secondary>
54056 </indexterm>
54057 <indexterm role="concept">
54058 <primary>access control lists (ACLs)</primary>
54059 <secondary>testing a sender</secondary>
54060 </indexterm>
54061 This condition tests the sender of the message against the given list. To test
54062 for a bounce message, which has an empty sender, set
54063 </para>
54064 <literallayout class="monospaced">
54065 senders = :
54066 </literallayout>
54067 <para>
54068 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
54069 relaying, because sender addresses are easily, and commonly, forged.
54070 </para>
54071 </listitem></varlistentry>
54072 <varlistentry>
54073 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
54074 <listitem>
54075 <para>
54076 <indexterm role="concept">
54077 <primary><option>spam</option> ACL condition</primary>
54078 </indexterm>
54079 <indexterm role="concept">
54080 <primary>access control lists (ACLs)</primary>
54081 <secondary>scanning for spam</secondary>
54082 </indexterm>
54083 This condition is available only when Exim is compiled with the
54084 content-scanning extension. It causes the incoming message to be scanned by
54085 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
54086 </para>
54087 </listitem></varlistentry>
54088 <varlistentry>
54089 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
54090 <listitem>
54091 <para>
54092 <indexterm role="concept">
54093 <primary><option>verify</option> ACL condition</primary>
54094 </indexterm>
54095 <indexterm role="concept">
54096 <primary>TLS</primary>
54097 <secondary>client certificate verification</secondary>
54098 </indexterm>
54099 <indexterm role="concept">
54100 <primary>certificate</primary>
54101 <secondary>verification of client</secondary>
54102 </indexterm>
54103 <indexterm role="concept">
54104 <primary>access control lists (ACLs)</primary>
54105 <secondary>certificate verification</secondary>
54106 </indexterm>
54107 <indexterm role="concept">
54108 <primary>access control lists (ACLs)</primary>
54109 <secondary>testing a TLS certificate</secondary>
54110 </indexterm>
54111 This condition is true in an SMTP session if the session is encrypted, and a
54112 certificate was received from the client, and the certificate was verified. The
54113 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
54114 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
54115 </para>
54116 </listitem></varlistentry>
54117 <varlistentry>
54118 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
54119 <listitem>
54120 <para>
54121 <indexterm role="concept">
54122 <primary>CSA verification</primary>
54123 </indexterm>
54124 This condition checks whether the sending host (the client) is authorized to
54125 send email. Details of how this works are given in section
54126 <xref linkend="SECTverifyCSA"/>.
54127 </para>
54128 </listitem></varlistentry>
54129 <varlistentry>
54130 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
54131 <listitem>
54132 <para>
54133 <indexterm role="concept">
54134 <primary><option>verify</option> ACL condition</primary>
54135 </indexterm>
54136 <indexterm role="concept">
54137 <primary>access control lists (ACLs)</primary>
54138 <secondary>verifying header names only ASCII</secondary>
54139 </indexterm>
54140 <indexterm role="concept">
54141 <primary>header lines</primary>
54142 <secondary>verifying header names only ASCII</secondary>
54143 </indexterm>
54144 <indexterm role="concept">
54145 <primary>verifying</primary>
54146 <secondary>header names only ASCII</secondary>
54147 </indexterm>
54148 This condition is relevant only in an ACL that is run after a message has been
54149 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54150 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
54151 there are no non-ASCII characters, also excluding control characters.  The
54152 allowable characters are decimal ASCII values 33 through 126.
54153 </para>
54154 <para>
54155 Exim itself will handle headers with non-ASCII characters, but it can cause
54156 problems for downstream applications, so this option will allow their
54157 detection and rejection in the DATA ACL&#x2019;s.
54158 </para>
54159 </listitem></varlistentry>
54160 <varlistentry>
54161 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54162 <listitem>
54163 <para>
54164 <indexterm role="concept">
54165 <primary><option>verify</option> ACL condition</primary>
54166 </indexterm>
54167 <indexterm role="concept">
54168 <primary>access control lists (ACLs)</primary>
54169 <secondary>verifying sender in the header</secondary>
54170 </indexterm>
54171 <indexterm role="concept">
54172 <primary>header lines</primary>
54173 <secondary>verifying the sender in</secondary>
54174 </indexterm>
54175 <indexterm role="concept">
54176 <primary>sender</primary>
54177 <secondary>verifying in header</secondary>
54178 </indexterm>
54179 <indexterm role="concept">
54180 <primary>verifying</primary>
54181 <secondary>sender in header</secondary>
54182 </indexterm>
54183 This condition is relevant only in an ACL that is run after a message has been
54184 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54185 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
54186 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
54187 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
54188 However, an address that appears in one of these headers need not be an address
54189 that accepts bounce messages; only sender addresses in envelopes are required
54190 to accept bounces. Therefore, if you use the callout option on this check, you
54191 might want to arrange for a non-empty address in the MAIL command.
54192 </para>
54193 <para>
54194 Details of address verification and the options are given later, starting at
54195 section <xref linkend="SECTaddressverification"/> (callouts are described in section
54196 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
54197 condition to restrict it to bounce messages only:
54198 </para>
54199 <literallayout class="monospaced">
54200 deny    senders = :
54201         message = A valid sender header is required for bounces
54202        !verify  = header_sender
54203 </literallayout>
54204 </listitem></varlistentry>
54205 <varlistentry>
54206 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
54207 <listitem>
54208 <para>
54209 <indexterm role="concept">
54210 <primary><option>verify</option> ACL condition</primary>
54211 </indexterm>
54212 <indexterm role="concept">
54213 <primary>access control lists (ACLs)</primary>
54214 <secondary>verifying header syntax</secondary>
54215 </indexterm>
54216 <indexterm role="concept">
54217 <primary>header lines</primary>
54218 <secondary>verifying syntax</secondary>
54219 </indexterm>
54220 <indexterm role="concept">
54221 <primary>verifying</primary>
54222 <secondary>header syntax</secondary>
54223 </indexterm>
54224 This condition is relevant only in an ACL that is run after a message has been
54225 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
54226 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
54227 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
54228 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
54229 permitted only in locally generated messages and from hosts that match
54230 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
54231 appropriate.
54232 </para>
54233 <para>
54234 Note that this condition is a syntax check only. However, a common spamming
54235 ploy used to be to send syntactically invalid headers such as
54236 </para>
54237 <literallayout class="monospaced">
54238 To: @
54239 </literallayout>
54240 <para>
54241 and this condition can be used to reject such messages, though they are not as
54242 common as they used to be.
54243 </para>
54244 </listitem></varlistentry>
54245 <varlistentry>
54246 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
54247 <listitem>
54248 <para>
54249 <indexterm role="concept">
54250 <primary><option>verify</option> ACL condition</primary>
54251 </indexterm>
54252 <indexterm role="concept">
54253 <primary>access control lists (ACLs)</primary>
54254 <secondary>verifying HELO/EHLO</secondary>
54255 </indexterm>
54256 <indexterm role="concept">
54257 <primary>HELO</primary>
54258 <secondary>verifying</secondary>
54259 </indexterm>
54260 <indexterm role="concept">
54261 <primary>EHLO</primary>
54262 <secondary>verifying</secondary>
54263 </indexterm>
54264 <indexterm role="concept">
54265 <primary>verifying</primary>
54266 <secondary>EHLO</secondary>
54267 </indexterm>
54268 <indexterm role="concept">
54269 <primary>verifying</primary>
54270 <secondary>HELO</secondary>
54271 </indexterm>
54272 This condition is true if a HELO or EHLO command has been received from the
54273 client host, and its contents have been verified. If there has been no previous
54274 attempt to verify the HELO/EHLO contents, it is carried out when this
54275 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
54276 <option>helo_try_verify_hosts</option> options for details of how to request verification
54277 independently of this condition.
54278 </para>
54279 <para>
54280 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
54281 option), this condition is always true.
54282 </para>
54283 </listitem></varlistentry>
54284 <varlistentry>
54285 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
54286 <listitem>
54287 <para>
54288 <indexterm role="concept">
54289 <primary>verifying</primary>
54290 <secondary>not blind</secondary>
54291 </indexterm>
54292 <indexterm role="concept">
54293 <primary>bcc recipients, verifying none</primary>
54294 </indexterm>
54295 This condition checks that there are no blind (bcc) recipients in the message.
54296 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
54297 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
54298 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
54299 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
54300 used only in a DATA or non-SMTP ACL.
54301 </para>
54302 <para>
54303 There are, of course, many legitimate messages that make use of blind (bcc)
54304 recipients. This check should not be used on its own for blocking messages.
54305 </para>
54306 </listitem></varlistentry>
54307 <varlistentry>
54308 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54309 <listitem>
54310 <para>
54311 <indexterm role="concept">
54312 <primary><option>verify</option> ACL condition</primary>
54313 </indexterm>
54314 <indexterm role="concept">
54315 <primary>access control lists (ACLs)</primary>
54316 <secondary>verifying recipient</secondary>
54317 </indexterm>
54318 <indexterm role="concept">
54319 <primary>recipient</primary>
54320 <secondary>verifying</secondary>
54321 </indexterm>
54322 <indexterm role="concept">
54323 <primary>verifying</primary>
54324 <secondary>recipient</secondary>
54325 </indexterm>
54326 <indexterm role="variable">
54327 <primary><varname>$address_data</varname></primary>
54328 </indexterm>
54329 This condition is relevant only after a RCPT command. It verifies the current
54330 recipient. Details of address verification are given later, starting at section
54331 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
54332 of <varname>$address_data</varname> is the last value that was set while routing the address.
54333 This applies even if the verification fails. When an address that is being
54334 verified is redirected to a single address, verification continues with the new
54335 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
54336 value for the child address.
54337 </para>
54338 </listitem></varlistentry>
54339 <varlistentry>
54340 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
54341 <listitem>
54342 <para>
54343 <indexterm role="concept">
54344 <primary><option>verify</option> ACL condition</primary>
54345 </indexterm>
54346 <indexterm role="concept">
54347 <primary>access control lists (ACLs)</primary>
54348 <secondary>verifying host reverse lookup</secondary>
54349 </indexterm>
54350 <indexterm role="concept">
54351 <primary>host</primary>
54352 <secondary>verifying reverse lookup</secondary>
54353 </indexterm>
54354 This condition ensures that a verified host name has been looked up from the IP
54355 address of the client host. (This may have happened already if the host name
54356 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
54357 Verification ensures that the host name obtained from a reverse DNS lookup, or
54358 one of its aliases, does, when it is itself looked up in the DNS, yield the
54359 original IP address.
54360 </para>
54361 <para>
54362 If this condition is used for a locally generated message (that is, when there
54363 is no client host involved), it always succeeds.
54364 </para>
54365 </listitem></varlistentry>
54366 <varlistentry>
54367 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54368 <listitem>
54369 <para>
54370 <indexterm role="concept">
54371 <primary><option>verify</option> ACL condition</primary>
54372 </indexterm>
54373 <indexterm role="concept">
54374 <primary>access control lists (ACLs)</primary>
54375 <secondary>verifying sender</secondary>
54376 </indexterm>
54377 <indexterm role="concept">
54378 <primary>sender</primary>
54379 <secondary>verifying</secondary>
54380 </indexterm>
54381 <indexterm role="concept">
54382 <primary>verifying</primary>
54383 <secondary>sender</secondary>
54384 </indexterm>
54385 This condition is relevant only after a MAIL or RCPT command, or after a
54386 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
54387 the message&#x2019;s sender is empty (that is, this is a bounce message), the
54388 condition is true. Otherwise, the sender address is verified.
54389 </para>
54390 <para>
54391 <indexterm role="variable">
54392 <primary><varname>$address_data</varname></primary>
54393 </indexterm>
54394 <indexterm role="variable">
54395 <primary><varname>$sender_address_data</varname></primary>
54396 </indexterm>
54397 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
54398 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
54399 value can be used in subsequent conditions and modifiers in the same ACL
54400 statement. It does not persist after the end of the current statement. If you
54401 want to preserve the value for longer, you can save it in an ACL variable.
54402 </para>
54403 <para>
54404 Details of verification are given later, starting at section
54405 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
54406 to avoid doing it more than once per message.
54407 </para>
54408 </listitem></varlistentry>
54409 <varlistentry>
54410 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
54411 <listitem>
54412 <para>
54413 <indexterm role="concept">
54414 <primary><option>verify</option> ACL condition</primary>
54415 </indexterm>
54416 This is a variation of the previous option, in which a modified address is
54417 verified as a sender.
54418 </para>
54419 </listitem></varlistentry>
54420 </variablelist>
54421 </section>
54422 <section id="SECTmorednslists">
54423 <title>Using DNS lists</title>
54424 <para>
54425 <indexterm role="concept">
54426 <primary>DNS list</primary>
54427 <secondary>in ACL</secondary>
54428 </indexterm>
54429 <indexterm role="concept">
54430 <primary>black list (DNS)</primary>
54431 </indexterm>
54432 <indexterm role="concept">
54433 <primary>access control lists (ACLs)</primary>
54434 <secondary>testing a DNS list</secondary>
54435 </indexterm>
54436 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
54437 is on at least one of a number of DNS lists by looking up the inverted IP
54438 address in one or more DNS domains. (Note that DNS list domains are not mail
54439 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
54440 special options instead.) For example, if the calling host&#x2019;s IP
54441 address is 192.168.62.43, and the ACL statement is
54442 </para>
54443 <literallayout class="monospaced">
54444 deny dnslists = blackholes.mail-abuse.org : \
54445                 dialups.mail-abuse.org
54446 </literallayout>
54447 <para>
54448 the following records are looked up:
54449 </para>
54450 <literallayout class="monospaced">
54451 43.62.168.192.blackholes.mail-abuse.org
54452 43.62.168.192.dialups.mail-abuse.org
54453 </literallayout>
54454 <para>
54455 As soon as Exim finds an existing DNS record, processing of the list stops.
54456 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
54457 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
54458 use two separate conditions:
54459 </para>
54460 <literallayout class="monospaced">
54461 deny dnslists = blackholes.mail-abuse.org
54462      dnslists = dialups.mail-abuse.org
54463 </literallayout>
54464 <para>
54465 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
54466 behaves as if the host does not match the list item, that is, as if the DNS
54467 record does not exist. If there are further items in the DNS list, they are
54468 processed.
54469 </para>
54470 <para>
54471 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
54472 (which is the most common usage), because it prevents a DNS failure from
54473 blocking mail. However, you can change this behaviour by putting one of the
54474 following special items in the list:
54475 </para>
54476 <literallayout>
54477 <literal>+include_unknown </literal>   behave as if the item is on the list
54478 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
54479 <literal>+defer_unknown   </literal>   give a temporary error
54480 </literallayout>
54481 <para>
54482 <indexterm role="concept">
54483 <primary><literal>+include_unknown</literal></primary>
54484 </indexterm>
54485 <indexterm role="concept">
54486 <primary><literal>+exclude_unknown</literal></primary>
54487 </indexterm>
54488 <indexterm role="concept">
54489 <primary><literal>+defer_unknown</literal></primary>
54490 </indexterm>
54491 Each of these applies to any subsequent items on the list. For example:
54492 </para>
54493 <literallayout class="monospaced">
54494 deny dnslists = +defer_unknown : foo.bar.example
54495 </literallayout>
54496 <para>
54497 Testing the list of domains stops as soon as a match is found. If you want to
54498 warn for one list and block for another, you can use two different statements:
54499 </para>
54500 <literallayout class="monospaced">
54501 deny  dnslists = blackholes.mail-abuse.org
54502 warn  message  = X-Warn: sending host is on dialups list
54503       dnslists = dialups.mail-abuse.org
54504 </literallayout>
54505 <para>
54506 DNS list lookups are cached by Exim for the duration of the SMTP session,
54507 so a lookup based on the IP address is done at most once for any incoming
54508 connection. Exim does not share information between multiple incoming
54509 connections (but your local name server cache should be active).
54510 </para>
54511 </section>
54512 <section id="SECID201">
54513 <title>Specifying the IP address for a DNS list lookup</title>
54514 <para>
54515 <indexterm role="concept">
54516 <primary>DNS list</primary>
54517 <secondary>keyed by explicit IP address</secondary>
54518 </indexterm>
54519 By default, the IP address that is used in a DNS list lookup is the IP address
54520 of the calling host. However, you can specify another IP address by listing it
54521 after the domain name, introduced by a slash. For example:
54522 </para>
54523 <literallayout class="monospaced">
54524 deny dnslists = black.list.tld/192.168.1.2
54525 </literallayout>
54526 <para>
54527 This feature is not very helpful with explicit IP addresses; it is intended for
54528 use with IP addresses that are looked up, for example, the IP addresses of the
54529 MX hosts or nameservers of an email sender address. For an example, see section
54530 <xref linkend="SECTmulkeyfor"/> below.
54531 </para>
54532 </section>
54533 <section id="SECID202">
54534 <title>DNS lists keyed on domain names</title>
54535 <para>
54536 <indexterm role="concept">
54537 <primary>DNS list</primary>
54538 <secondary>keyed by domain name</secondary>
54539 </indexterm>
54540 There are some lists that are keyed on domain names rather than inverted IP
54541 addresses (see for example the <emphasis>domain based zones</emphasis> link at
54542 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
54543 with these lists. You can change the name that is looked up in a DNS list by
54544 listing it after the domain name, introduced by a slash. For example,
54545 </para>
54546 <literallayout class="monospaced">
54547 deny  message  = Sender's domain is listed at $dnslist_domain
54548       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
54549 </literallayout>
54550 <para>
54551 This particular example is useful only in ACLs that are obeyed after the
54552 RCPT or DATA commands, when a sender address is available. If (for
54553 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
54554 up by this example is
54555 </para>
54556 <literallayout class="monospaced">
54557 tld.example.dsn.rfc-ignorant.org
54558 </literallayout>
54559 <para>
54560 A single <option>dnslists</option> condition can contain entries for both names and IP
54561 addresses. For example:
54562 </para>
54563 <literallayout class="monospaced">
54564 deny dnslists = sbl.spamhaus.org : \
54565                 dsn.rfc-ignorant.org/$sender_address_domain
54566 </literallayout>
54567 <para>
54568 The first item checks the sending host&#x2019;s IP address; the second checks a domain
54569 name. The whole condition is true if either of the DNS lookups succeeds.
54570 </para>
54571 </section>
54572 <section id="SECTmulkeyfor">
54573 <title>Multiple explicit keys for a DNS list</title>
54574 <para>
54575 <indexterm role="concept">
54576 <primary>DNS list</primary>
54577 <secondary>multiple keys for</secondary>
54578 </indexterm>
54579 The syntax described above for looking up explicitly-defined values (either
54580 names or IP addresses) in a DNS blacklist is a simplification. After the domain
54581 name for the DNS list, what follows the slash can in fact be a list of items.
54582 As with all lists in Exim, the default separator is a colon. However, because
54583 this is a sublist within the list of DNS blacklist domains, it is necessary
54584 either to double the separators like this:
54585 </para>
54586 <literallayout class="monospaced">
54587 dnslists = black.list.tld/name.1::name.2
54588 </literallayout>
54589 <para>
54590 or to change the separator character, like this:
54591 </para>
54592 <literallayout class="monospaced">
54593 dnslists = black.list.tld/&lt;;name.1;name.2
54594 </literallayout>
54595 <para>
54596 If an item in the list is an IP address, it is inverted before the DNS
54597 blacklist domain is appended. If it is not an IP address, no inversion
54598 occurs. Consider this condition:
54599 </para>
54600 <literallayout class="monospaced">
54601 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
54602 </literallayout>
54603 <para>
54604 The DNS lookups that occur are:
54605 </para>
54606 <literallayout class="monospaced">
54607 2.1.168.192.black.list.tld
54608 a.domain.black.list.tld
54609 </literallayout>
54610 <para>
54611 Once a DNS record has been found (that matches a specific IP return
54612 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
54613 are done. If there is a temporary DNS error, the rest of the sublist of domains
54614 or IP addresses is tried. A temporary error for the whole dnslists item occurs
54615 only if no other DNS lookup in this sublist succeeds. In other words, a
54616 successful lookup for any of the items in the sublist overrides a temporary
54617 error for a previous item.
54618 </para>
54619 <para>
54620 The ability to supply a list of items after the slash is in some sense just a
54621 syntactic convenience. These two examples have the same effect:
54622 </para>
54623 <literallayout class="monospaced">
54624 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
54625 dnslists = black.list.tld/a.domain::b.domain
54626 </literallayout>
54627 <para>
54628 However, when the data for the list is obtained from a lookup, the second form
54629 is usually much more convenient. Consider this example:
54630 </para>
54631 <literallayout class="monospaced">
54632 deny message  = The mail servers for the domain \
54633                 $sender_address_domain \
54634                 are listed at $dnslist_domain ($dnslist_value); \
54635                 see $dnslist_text.
54636      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
54637                                    ${lookup dnsdb {&gt;|mxh=\
54638                                    $sender_address_domain} }} }
54639 </literallayout>
54640 <para>
54641 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
54642 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
54643 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
54644 of expanding the condition might be something like this:
54645 </para>
54646 <literallayout class="monospaced">
54647 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
54648 </literallayout>
54649 <para>
54650 Thus, this example checks whether or not the IP addresses of the sender
54651 domain&#x2019;s mail servers are on the Spamhaus black list.
54652 </para>
54653 <para>
54654 The key that was used for a successful DNS list lookup is put into the variable
54655 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
54656 </para>
54657 </section>
54658 <section id="SECID203">
54659 <title>Data returned by DNS lists</title>
54660 <para>
54661 <indexterm role="concept">
54662 <primary>DNS list</primary>
54663 <secondary>data returned from</secondary>
54664 </indexterm>
54665 DNS lists are constructed using address records in the DNS. The original RBL
54666 just used the address 127.0.0.1 on the right hand side of each record, but the
54667 RBL+ list and some other lists use a number of values with different meanings.
54668 The values used on the RBL+ list are:
54669 </para>
54670 <literallayout>
54671 127.1.0.1  RBL
54672 127.1.0.2  DUL
54673 127.1.0.3  DUL and RBL
54674 127.1.0.4  RSS
54675 127.1.0.5  RSS and RBL
54676 127.1.0.6  RSS and DUL
54677 127.1.0.7  RSS and DUL and RBL
54678 </literallayout>
54679 <para>
54680 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
54681 different values. Some DNS lists may return more than one address record;
54682 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
54683 </para>
54684 </section>
54685 <section id="SECID204">
54686 <title>Variables set from DNS lists</title>
54687 <para>
54688 <indexterm role="concept">
54689 <primary>expansion</primary>
54690 <secondary>variables, set from DNS list</secondary>
54691 </indexterm>
54692 <indexterm role="concept">
54693 <primary>DNS list</primary>
54694 <secondary>variables set from</secondary>
54695 </indexterm>
54696 <indexterm role="variable">
54697 <primary><varname>$dnslist_domain</varname></primary>
54698 </indexterm>
54699 <indexterm role="variable">
54700 <primary><varname>$dnslist_matched</varname></primary>
54701 </indexterm>
54702 <indexterm role="variable">
54703 <primary><varname>$dnslist_text</varname></primary>
54704 </indexterm>
54705 <indexterm role="variable">
54706 <primary><varname>$dnslist_value</varname></primary>
54707 </indexterm>
54708 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
54709 the name of the overall domain that matched (for example,
54710 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
54711 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
54712 the DNS record. When the key is an IP address, it is not reversed in
54713 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
54714 cases, for example:
54715 </para>
54716 <literallayout class="monospaced">
54717 deny dnslists = spamhaus.example
54718 </literallayout>
54719 <para>
54720 the key is also available in another variable (in this case,
54721 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
54722 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
54723 might generate a dnslists lookup like this:
54724 </para>
54725 <literallayout class="monospaced">
54726 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
54727 </literallayout>
54728 <para>
54729 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
54730 <literal>192.168.6.7</literal> (for example).
54731 </para>
54732 <para>
54733 If more than one address record is returned by the DNS lookup, all the IP
54734 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
54735 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
54736 record. For lists such as RBL+ the TXT record for a merged entry is often not
54737 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
54738 information.
54739 </para>
54740 <para>
54741 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
54742 &ndash; although these appear before the condition in the ACL, they are not
54743 expanded until after it has failed. For example:
54744 </para>
54745 <literallayout class="monospaced">
54746 deny    hosts = !+local_networks
54747         message = $sender_host_address is listed \
54748                   at $dnslist_domain
54749         dnslists = rbl-plus.mail-abuse.example
54750 </literallayout>
54751 </section>
54752 <section id="SECTaddmatcon">
54753 <title>Additional matching conditions for DNS lists</title>
54754 <para>
54755 <indexterm role="concept">
54756 <primary>DNS list</primary>
54757 <secondary>matching specific returned data</secondary>
54758 </indexterm>
54759 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
54760 in order to restrict its action to DNS records with a matching right hand side.
54761 For example,
54762 </para>
54763 <literallayout class="monospaced">
54764 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
54765 </literallayout>
54766 <para>
54767 rejects only those hosts that yield 127.0.0.2. Without this additional data,
54768 any address record is considered to be a match. For the moment, we assume
54769 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
54770 describes how multiple records are handled.
54771 </para>
54772 <para>
54773 More than one IP address may be given for checking, using a comma as a
54774 separator. These are alternatives &ndash; if any one of them matches, the
54775 <option>dnslists</option> condition is true. For example:
54776 </para>
54777 <literallayout class="monospaced">
54778 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54779 </literallayout>
54780 <para>
54781 If you want to specify a constraining address list and also specify names or IP
54782 addresses to be looked up, the constraining address list must be specified
54783 first. For example:
54784 </para>
54785 <literallayout class="monospaced">
54786 deny dnslists = dsn.rfc-ignorant.org\
54787                 =127.0.0.2/$sender_address_domain
54788 </literallayout>
54789 <para>
54790 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
54791 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
54792 In other words, the listed addresses are used as bit masks. The comparison is
54793 true if all the bits in the mask are present in the address that is being
54794 tested. For example:
54795 </para>
54796 <literallayout class="monospaced">
54797 dnslists = a.b.c&amp;0.0.0.3
54798 </literallayout>
54799 <para>
54800 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
54801 want to test whether one bit or another bit is present (as opposed to both
54802 being present), you must use multiple values. For example:
54803 </para>
54804 <literallayout class="monospaced">
54805 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
54806 </literallayout>
54807 <para>
54808 matches if the final component of the address is an odd number or two times
54809 an odd number.
54810 </para>
54811 </section>
54812 <section id="SECID205">
54813 <title>Negated DNS matching conditions</title>
54814 <para>
54815 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
54816 condition. Whereas
54817 </para>
54818 <literallayout class="monospaced">
54819 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
54820 </literallayout>
54821 <para>
54822 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54823 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
54824 </para>
54825 <literallayout class="monospaced">
54826 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
54827 </literallayout>
54828 <para>
54829 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
54830 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
54831 words, the result of the test is inverted if an exclamation mark appears before
54832 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
54833 </para>
54834 <para>
54835 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
54836 host, or address list (which is why the syntax is different).
54837 </para>
54838 <para>
54839 If you are using just one list, the negation syntax does not gain you much. The
54840 previous example is precisely equivalent to
54841 </para>
54842 <literallayout class="monospaced">
54843 deny  dnslists = a.b.c
54844      !dnslists = a.b.c=127.0.0.2,127.0.0.3
54845 </literallayout>
54846 <para>
54847 However, if you are using multiple lists, the negation syntax is clearer.
54848 Consider this example:
54849 </para>
54850 <literallayout class="monospaced">
54851 deny  dnslists = sbl.spamhaus.org : \
54852                  list.dsbl.org : \
54853                  dnsbl.njabl.org!=127.0.0.3 : \
54854                  relays.ordb.org
54855 </literallayout>
54856 <para>
54857 Using only positive lists, this would have to be:
54858 </para>
54859 <literallayout class="monospaced">
54860 deny  dnslists = sbl.spamhaus.org : \
54861                  list.dsbl.org
54862 deny  dnslists = dnsbl.njabl.org
54863      !dnslists = dnsbl.njabl.org=127.0.0.3
54864 deny  dnslists = relays.ordb.org
54865 </literallayout>
54866 <para>
54867 which is less clear, and harder to maintain.
54868 </para>
54869 </section>
54870 <section id="SECThanmuldnsrec">
54871 <title>Handling multiple DNS records from a DNS list</title>
54872 <para>
54873 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
54874 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
54875 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
54876 the match to specific results from the DNS lookup, there are two ways in which
54877 the checking can be handled. For example, consider the condition:
54878 </para>
54879 <literallayout class="monospaced">
54880 dnslists = a.b.c=127.0.0.1
54881 </literallayout>
54882 <para>
54883 What happens if the DNS lookup for the incoming IP address yields both
54884 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
54885 condition true because at least one given value was found, or is it false
54886 because at least one of the found values was not listed? And how does this
54887 affect negated conditions? Both possibilities are provided for with the help of
54888 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
54889 </para>
54890 <itemizedlist>
54891 <listitem>
54892 <para>
54893 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
54894 IP addresses matches one of the listed addresses. For the example above, the
54895 condition is true because 127.0.0.1 matches.
54896 </para>
54897 </listitem>
54898 <listitem>
54899 <para>
54900 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
54901 looked up IP addresses matches one of the listed addresses. If the condition is
54902 changed to:
54903 </para>
54904 <literallayout class="monospaced">
54905 dnslists = a.b.c==127.0.0.1
54906 </literallayout>
54907 <para>
54908 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54909 false because 127.0.0.2 is not listed. You would need to have:
54910 </para>
54911 <literallayout class="monospaced">
54912 dnslists = a.b.c==127.0.0.1,127.0.0.2
54913 </literallayout>
54914 <para>
54915 for the condition to be true.
54916 </para>
54917 </listitem>
54918 </itemizedlist>
54919 <para>
54920 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
54921 the precise opposite of the behaviour above. Thus:
54922 </para>
54923 <itemizedlist>
54924 <listitem>
54925 <para>
54926 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
54927 addresses matches one of the listed addresses. Consider:
54928 </para>
54929 <literallayout class="monospaced">
54930 dnslists = a.b.c!&amp;0.0.0.1
54931 </literallayout>
54932 <para>
54933 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54934 false because 127.0.0.1 matches.
54935 </para>
54936 </listitem>
54937 <listitem>
54938 <para>
54939 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
54940 looked up IP address that does not match. Consider:
54941 </para>
54942 <literallayout class="monospaced">
54943 dnslists = a.b.c!=&amp;0.0.0.1
54944 </literallayout>
54945 <para>
54946 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
54947 true, because 127.0.0.2 does not match. You would need to have:
54948 </para>
54949 <literallayout class="monospaced">
54950 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
54951 </literallayout>
54952 <para>
54953 for the condition to be false.
54954 </para>
54955 </listitem>
54956 </itemizedlist>
54957 <para>
54958 When the DNS lookup yields only a single IP address, there is no difference
54959 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
54960 </para>
54961 </section>
54962 <section id="SECTmordetinf">
54963 <title>Detailed information from merged DNS lists</title>
54964 <para>
54965 <indexterm role="concept">
54966 <primary>DNS list</primary>
54967 <secondary>information from merged</secondary>
54968 </indexterm>
54969 When the facility for restricting the matching IP values in a DNS list is used,
54970 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
54971 the true reason for rejection. This happens when lists are merged and the IP
54972 address in the A record is used to distinguish them; unfortunately there is
54973 only one TXT record. One way round this is not to use merged lists, but that
54974 can be inefficient because it requires multiple DNS lookups where one would do
54975 in the vast majority of cases when the host of interest is not on any of the
54976 lists.
54977 </para>
54978 <para>
54979 A less inefficient way of solving this problem is available. If
54980 two domain names, comma-separated, are given, the second is used first to
54981 do an initial check, making use of any IP value restrictions that are set.
54982 If there is a match, the first domain is used, without any IP value
54983 restrictions, to get the TXT record. As a byproduct of this, there is also
54984 a check that the IP being tested is indeed on the first list. The first
54985 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
54986 </para>
54987 <literallayout class="monospaced">
54988 reject message  = \
54989          rejected because $sender_host_address is blacklisted \
54990          at $dnslist_domain\n$dnslist_text
54991        dnslists = \
54992          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
54993          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
54994 </literallayout>
54995 <para>
54996 For the first blacklist item, this starts by doing a lookup in
54997 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
54998 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
54999 value, and as long as something is found, it looks for the corresponding TXT
55000 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
55001 The second blacklist item is processed similarly.
55002 </para>
55003 <para>
55004 If you are interested in more than one merged list, the same list must be
55005 given several times, but because the results of the DNS lookups are cached,
55006 the DNS calls themselves are not repeated. For example:
55007 </para>
55008 <literallayout class="monospaced">
55009 reject dnslists = \
55010          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
55011          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
55012          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
55013          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
55014 </literallayout>
55015 <para>
55016 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
55017 values matches (or if no record is found), this is the only lookup that is
55018 done. Only if there is a match is one of the more specific lists consulted.
55019 </para>
55020 </section>
55021 <section id="SECTmorednslistslast">
55022 <title>DNS lists and IPv6</title>
55023 <para>
55024 <indexterm role="concept">
55025 <primary>IPv6</primary>
55026 <secondary>DNS black lists</secondary>
55027 </indexterm>
55028 <indexterm role="concept">
55029 <primary>DNS list</primary>
55030 <secondary>IPv6 usage</secondary>
55031 </indexterm>
55032 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
55033 nibble by nibble. For example, if the calling host&#x2019;s IP address is
55034 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
55035 </para>
55036 <literallayout class="monospaced">
55037 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
55038   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
55039 </literallayout>
55040 <para>
55041 (split over two lines here to fit on the page). Unfortunately, some of the DNS
55042 lists contain wildcard records, intended for IPv4, that interact badly with
55043 IPv6. For example, the DNS entry
55044 </para>
55045 <literallayout class="monospaced">
55046 *.3.some.list.example.    A    127.0.0.1
55047 </literallayout>
55048 <para>
55049 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
55050 Unfortunately, it also matches the entire 3::/4 IPv6 network.
55051 </para>
55052 <para>
55053 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
55054 <option>condition</option> condition, as in this example:
55055 </para>
55056 <literallayout class="monospaced">
55057 deny   condition = ${if isip4{$sender_host_address}}
55058        dnslists  = some.list.example
55059 </literallayout>
55060 <para>
55061 If an explicit key is being used for a DNS lookup and it may be an IPv6
55062 address you should specify alternate list separators for both the outer
55063 (DNS list name) list and inner (lookup keys) list:
55064 </para>
55065 <literallayout class="monospaced">
55066        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
55067 </literallayout>
55068 </section>
55069 <section id="SECTratelimiting">
55070 <title>Rate limiting incoming messages</title>
55071 <para>
55072 <indexterm role="concept">
55073 <primary>rate limiting</primary>
55074 <secondary>client sending</secondary>
55075 </indexterm>
55076 <indexterm role="concept">
55077 <primary>limiting client sending rates</primary>
55078 </indexterm>
55079 <indexterm role="option">
55080 <primary><option>smtp_ratelimit_*</option></primary>
55081 </indexterm>
55082 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
55083 which clients can send email. This is more powerful than the
55084 <option>smtp_ratelimit_*</option> options, because those options control the rate of
55085 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
55086 works across all connections (concurrent and sequential) from the same client
55087 host. The syntax of the <option>ratelimit</option> condition is:
55088 </para>
55089 <literallayout>
55090 <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;
55091 </literallayout>
55092 <para>
55093 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
55094 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
55095 </para>
55096 <para>
55097 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
55098 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
55099 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
55100 of <emphasis>p</emphasis>.
55101 </para>
55102 <para>
55103 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
55104 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
55105 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
55106 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
55107 send in each time interval. It also specifies the number of messages permitted
55108 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
55109 constant, you can allow a client to send more messages in a burst without
55110 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
55111 both small, messages must be sent at an even rate.
55112 </para>
55113 <para>
55114 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
55115 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
55116 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
55117 instructions when it is run with no arguments.
55118 </para>
55119 <para>
55120 The key is used to look up the data for calculating the client&#x2019;s average
55121 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
55122 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
55123 which means Exim computes the sending rate of each client host IP address.
55124 By changing the key you can change how Exim identifies clients for the purpose
55125 of ratelimiting. For example, to limit the sending rate of each authenticated
55126 user, independent of the computer they are sending from, set the key to
55127 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
55128 example, <varname>$authenticated_id</varname> is only meaningful if the client has
55129 authenticated (which you can check with the <option>authenticated</option> ACL condition).
55130 </para>
55131 <para>
55132 The lookup key does not have to identify clients: If you want to limit the
55133 rate at which a recipient receives messages, you can use the key
55134 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
55135 ACL.
55136 </para>
55137 <para>
55138 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
55139 specifies what Exim measures the rate of, for example messages or recipients
55140 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
55141 <option>count=</option> options. You can also control when Exim updates the recorded rate
55142 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
55143 separated by a slash, like the other parameters. They may appear in any order.
55144 </para>
55145 <para>
55146 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
55147 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
55148 stored, so you can alter the configured maximum rate and Exim will still
55149 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
55150 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
55151 behaviour. The lookup key is not affected by changes to the update mode and
55152 the <option>count=</option> option.
55153 </para>
55154 </section>
55155 <section id="ratoptmea">
55156 <title>Ratelimit options for what is being measured</title>
55157 <para>
55158 <indexterm role="concept">
55159 <primary>rate limiting</primary>
55160 <secondary>per_* options</secondary>
55161 </indexterm>
55162 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
55163 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
55164 <option>acl_not_smtp_start</option> ACLs.
55165 </para>
55166 <para>
55167 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
55168 the default if none of the <option>per_*</option> options is specified. It can be used in
55169 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
55170 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
55171 </para>
55172 <para>
55173 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
55174 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
55175 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
55176 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
55177 in its MAIL command, which may be inaccurate or completely missing. You can
55178 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
55179 in kilobytes, megabytes, or gigabytes, respectively.
55180 </para>
55181 <para>
55182 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
55183 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55184 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
55185 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
55186 ACLs the rate is updated with the total recipient count in one go. Note that
55187 in either case the rate limiting engine will see a message with many
55188 recipients as a large high-speed burst.
55189 </para>
55190 <para>
55191 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
55192 number of different recipients that the client has sent messages to in the
55193 last time period. That is, if the client repeatedly sends messages to the same
55194 recipient, its measured rate is not increased. This option can only be used in
55195 <option>acl_smtp_rcpt</option>.
55196 </para>
55197 <para>
55198 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
55199 condition is processed. This can be used to limit the rate of any SMTP
55200 command. If it is used in multiple ACLs it can limit the aggregate rate of
55201 multiple different commands.
55202 </para>
55203 <para>
55204 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
55205 measured rate. For example, the <option>per_byte</option> option is equivalent to
55206 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
55207 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
55208 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
55209 </para>
55210 <para>
55211 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
55212 </para>
55213 </section>
55214 <section id="ratoptupd">
55215 <title>Ratelimit update modes</title>
55216 <para>
55217 <indexterm role="concept">
55218 <primary>rate limiting</primary>
55219 <secondary>reading data without updating</secondary>
55220 </indexterm>
55221 You can specify one of three options with the <option>ratelimit</option> condition to
55222 control when its database is updated. This section describes the <option>readonly</option>
55223 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
55224 </para>
55225 <para>
55226 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
55227 previously-computed rate to check against the limit.
55228 </para>
55229 <para>
55230 For example, you can test the client&#x2019;s sending rate and deny it access (when
55231 it is too fast) in the connect ACL. If the client passes this check then it
55232 can go on to send a message, in which case its recorded rate will be updated
55233 in the MAIL ACL. Subsequent connections from the same client will check this
55234 new rate.
55235 </para>
55236 <literallayout class="monospaced">
55237 acl_check_connect:
55238  deny ratelimit = 100 / 5m / readonly
55239     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
55240                   (max $sender_rate_limit)
55241 # ...
55242 acl_check_mail:
55243  warn ratelimit = 100 / 5m / strict
55244     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
55245                   (max $sender_rate_limit)
55246 </literallayout>
55247 <para>
55248 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
55249 processing a message then it may increase the client&#x2019;s measured rate more than
55250 it should. For example, this will happen if you check the <option>per_rcpt</option> option
55251 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
55252 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
55253 multiple update problems by using the <option>readonly</option> option on later ratelimit
55254 checks.
55255 </para>
55256 <para>
55257 The <option>per_*</option> options described above do not make sense in some ACLs. If you
55258 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
55259 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
55260 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
55261 next section) so you must specify the <option>readonly</option> option explicitly.
55262 </para>
55263 </section>
55264 <section id="ratoptfast">
55265 <title>Ratelimit options for handling fast clients</title>
55266 <para>
55267 <indexterm role="concept">
55268 <primary>rate limiting</primary>
55269 <secondary>strict and leaky modes</secondary>
55270 </indexterm>
55271 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
55272 engine can react in two possible ways, depending on the presence of the
55273 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
55274 counter-measures (such as rejecting the message) that may be specified by the
55275 rest of the ACL.
55276 </para>
55277 <para>
55278 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
55279 updated if it is above the limit. The effect of this is that Exim measures the
55280 client&#x2019;s average rate of successfully sent email, which cannot be greater than
55281 the maximum allowed. If the client is over the limit it may suffer some
55282 counter-measures (as specified in the ACL), but it will still be able to send
55283 email at the configured maximum rate, whatever the rate of its attempts. This
55284 is generally the better choice if you have clients that retry automatically.
55285 For example, it does not prevent a sender with an over-aggressive retry rate
55286 from getting any email through.
55287 </para>
55288 <para>
55289 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
55290 updated. The effect of this is that Exim measures the client&#x2019;s average rate
55291 of attempts to send email, which can be much higher than the maximum it is
55292 actually allowed. If the client is over the limit it may be subjected to
55293 counter-measures by the ACL. It must slow down and allow sufficient time to
55294 pass that its computed rate falls below the maximum before it can send email
55295 again. The time (the number of smoothing periods) it must wait and not
55296 attempt to send mail can be calculated with this formula:
55297 </para>
55298 <literallayout class="monospaced">
55299         ln(peakrate/maxrate)
55300 </literallayout>
55301 </section>
55302 <section id="ratoptuniq">
55303 <title>Limiting the rate of different events</title>
55304 <para>
55305 <indexterm role="concept">
55306 <primary>rate limiting</primary>
55307 <secondary>counting unique events</secondary>
55308 </indexterm>
55309 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
55310 rate of different events. For example, the <option>per_addr</option> option uses this
55311 mechanism to count the number of different recipients that the client has
55312 sent messages to in the last time period; it is equivalent to
55313 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
55314 measure the rate that a client uses different sender addresses with the
55315 options <literal>per_mail/unique=$sender_address</literal>.
55316 </para>
55317 <para>
55318 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
55319 has seen for that key. The whole set is thrown away when it is older than the
55320 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
55321 per period. In the <option>leaky</option> update mode, an event that causes the client to
55322 go over the limit is not added to the set, in the same way that the client&#x2019;s
55323 recorded rate is not updated in the same situation.
55324 </para>
55325 <para>
55326 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
55327 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
55328 rate.
55329 </para>
55330 <para>
55331 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
55332 other <option>ratelimit</option> options in order to store the event set. The number of
55333 unique values is potentially as large as the rate limit, so the extra space
55334 required increases with larger limits.
55335 </para>
55336 <para>
55337 The uniqueification is not perfect: there is a small probability that Exim
55338 will think a new event has happened before. If the sender&#x2019;s rate is less than
55339 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
55340 the measured rate can go above the limit, in which case Exim may under-count
55341 events by a significant margin. Fortunately, if the rate is high enough (2.7
55342 times the limit) that the false positive rate goes above 9%, then Exim will
55343 throw away the over-full event set before the measured rate falls below the
55344 limit. Therefore the only harm should be that exceptionally high sending rates
55345 are logged incorrectly; any countermeasures you configure will be as effective
55346 as intended.
55347 </para>
55348 </section>
55349 <section id="useratlim">
55350 <title>Using rate limiting</title>
55351 <para>
55352 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
55353 when the rate limit is exceeded. This might be anything from logging a warning
55354 (for example, while measuring existing sending rates in order to define
55355 policy), through time delays to slow down fast senders, up to rejecting the
55356 message. For example:
55357 </para>
55358 <literallayout class="monospaced">
55359 # Log all senders' rates
55360 warn ratelimit = 0 / 1h / strict
55361      log_message = Sender rate $sender_rate / $sender_rate_period
55362
55363 # Slow down fast senders; note the need to truncate $sender_rate
55364 # at the decimal point.
55365 warn ratelimit = 100 / 1h / per_rcpt / strict
55366      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
55367                    $sender_rate_limit }s
55368
55369 # Keep authenticated users under control
55370 deny authenticated = *
55371      ratelimit = 100 / 1d / strict / $authenticated_id
55372
55373 # System-wide rate limit
55374 defer message = Sorry, too busy. Try again later.
55375      ratelimit = 10 / 1s / $primary_hostname
55376
55377 # Restrict incoming rate from each host, with a default
55378 # set using a macro and special cases looked up in a table.
55379 defer message = Sender rate exceeds $sender_rate_limit \
55380                messages per $sender_rate_period
55381      ratelimit = ${lookup {$sender_host_address} \
55382                    cdb {DB/ratelimits.cdb} \
55383                    {$value} {RATELIMIT} }
55384 </literallayout>
55385 <para>
55386 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
55387 especially with the <option>per_rcpt</option> option, you may suffer from a performance
55388 bottleneck caused by locking on the ratelimit hints database. Apart from
55389 making your ACLs less complicated, you can reduce the problem by using a
55390 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
55391 this means that Exim will lose its hints data after a reboot (including retry
55392 hints, the callout cache, and ratelimit data).
55393 </para>
55394 </section>
55395 <section id="SECTaddressverification">
55396 <title>Address verification</title>
55397 <para>
55398 <indexterm role="concept">
55399 <primary>verifying address</primary>
55400 <secondary>options for</secondary>
55401 </indexterm>
55402 <indexterm role="concept">
55403 <primary>policy control</primary>
55404 <secondary>address verification</secondary>
55405 </indexterm>
55406 Several of the <option>verify</option> conditions described in section
55407 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
55408 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
55409 The verification conditions can be followed by options that modify the
55410 verification process. The options are separated from the keyword and from each
55411 other by slashes, and some of them contain parameters. For example:
55412 </para>
55413 <literallayout class="monospaced">
55414 verify = sender/callout
55415 verify = recipient/defer_ok/callout=10s,defer_ok
55416 </literallayout>
55417 <para>
55418 The first stage of address verification, which always happens, is to run the
55419 address through the routers, in <quote>verify mode</quote>. Routers can detect the
55420 difference between verification and routing for delivery, and their actions can
55421 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
55422 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
55423 The available options are as follows:
55424 </para>
55425 <itemizedlist>
55426 <listitem>
55427 <para>
55428 If the <option>callout</option> option is specified, successful routing to one or more
55429 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
55430 check. Callouts and their sub-options are discussed in the next section.
55431 </para>
55432 </listitem>
55433 <listitem>
55434 <para>
55435 If there is a defer error while doing verification routing, the ACL
55436 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
55437 options, the condition is forced to be true instead. Note that this is a main
55438 verification option as well as a suboption for callouts.
55439 </para>
55440 </listitem>
55441 <listitem>
55442 <para>
55443 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
55444 discusses the reporting of sender address verification failures.
55445 </para>
55446 </listitem>
55447 <listitem>
55448 <para>
55449 The <option>success_on_redirect</option> option causes verification always to succeed
55450 immediately after a successful redirection. By default, if a redirection
55451 generates just one address, that address is also verified. See further
55452 discussion in section <xref linkend="SECTredirwhilveri"/>.
55453 </para>
55454 </listitem>
55455 </itemizedlist>
55456 <para>
55457 <indexterm role="concept">
55458 <primary>verifying address</primary>
55459 <secondary>differentiating failures</secondary>
55460 </indexterm>
55461 <indexterm role="variable">
55462 <primary><varname>$recipient_verify_failure</varname></primary>
55463 </indexterm>
55464 <indexterm role="variable">
55465 <primary><varname>$sender_verify_failure</varname></primary>
55466 </indexterm>
55467 <indexterm role="variable">
55468 <primary><varname>$acl_verify_message</varname></primary>
55469 </indexterm>
55470 After an address verification failure, <varname>$acl_verify_message</varname> contains the
55471 error message that is associated with the failure. It can be preserved by
55472 coding like this:
55473 </para>
55474 <literallayout class="monospaced">
55475 warn  !verify = sender
55476        set acl_m0 = $acl_verify_message
55477 </literallayout>
55478 <para>
55479 If you are writing your own custom rejection message or log message when
55480 denying access, you can use this variable to include information about the
55481 verification failure.
55482 </para>
55483 <para>
55484 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
55485 appropriate) contains one of the following words:
55486 </para>
55487 <itemizedlist>
55488 <listitem>
55489 <para>
55490 <option>qualify</option>: The address was unqualified (no domain), and the message
55491 was neither local nor came from an exempted host.
55492 </para>
55493 </listitem>
55494 <listitem>
55495 <para>
55496 <option>route</option>: Routing failed.
55497 </para>
55498 </listitem>
55499 <listitem>
55500 <para>
55501 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
55502 occurred at or before the MAIL command (that is, on initial
55503 connection, HELO, or MAIL).
55504 </para>
55505 </listitem>
55506 <listitem>
55507 <para>
55508 <option>recipient</option>: The RCPT command in a callout was rejected.
55509 </para>
55510 </listitem>
55511 <listitem>
55512 <para>
55513 <option>postmaster</option>: The postmaster check in a callout was rejected.
55514 </para>
55515 </listitem>
55516 </itemizedlist>
55517 <para>
55518 The main use of these variables is expected to be to distinguish between
55519 rejections of MAIL and rejections of RCPT in callouts.
55520 </para>
55521 </section>
55522 <section id="SECTcallver">
55523 <title>Callout verification</title>
55524 <para>
55525 <indexterm role="concept">
55526 <primary>verifying address</primary>
55527 <secondary>by callout</secondary>
55528 </indexterm>
55529 <indexterm role="concept">
55530 <primary>callout</primary>
55531 <secondary>verification</secondary>
55532 </indexterm>
55533 <indexterm role="concept">
55534 <primary>SMTP</primary>
55535 <secondary>callout verification</secondary>
55536 </indexterm>
55537 For non-local addresses, routing verifies the domain, but is unable to do any
55538 checking of the local part. There are situations where some means of verifying
55539 the local part is desirable. One way this can be done is to make an SMTP
55540 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
55541 a subsequent host for a recipient address, to see if the host accepts the
55542 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
55543 sender address, the callback is not to the client host that is trying to
55544 deliver the message, but to one of the hosts that accepts incoming mail for the
55545 sender&#x2019;s domain.
55546 </para>
55547 <para>
55548 Exim does not do callouts by default. If you want them to happen, you must
55549 request them by setting appropriate options on the <option>verify</option> condition, as
55550 described below. This facility should be used with care, because it can add a
55551 lot of resource usage to the cost of verifying an address. However, Exim does
55552 cache the results of callouts, which helps to reduce the cost. Details of
55553 caching are in section <xref linkend="SECTcallvercache"/>.
55554 </para>
55555 <para>
55556 Recipient callouts are usually used only between hosts that are controlled by
55557 the same administration. For example, a corporate gateway host could use
55558 callouts to check for valid recipients on an internal mailserver. A successful
55559 callout does not guarantee that a real delivery to the address would succeed;
55560 on the other hand, a failing callout does guarantee that a delivery would fail.
55561 </para>
55562 <para>
55563 If the <option>callout</option> option is present on a condition that verifies an address, a
55564 second stage of verification occurs if the address is successfully routed to
55565 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
55566 <command>manualroute</command> router, where the router specifies the hosts. However, if a
55567 router that does not set up hosts routes to an <command>smtp</command> transport with a
55568 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
55569 <option>hosts_override</option> set, its hosts are always used, whether or not the router
55570 supplies a host list.
55571 Callouts are only supported on <command>smtp</command> transports.
55572 </para>
55573 <para>
55574 The port that is used is taken from the transport, if it is specified and is a
55575 remote transport. (For routers that do verification only, no transport need be
55576 specified.) Otherwise, the default SMTP port is used. If a remote transport
55577 specifies an outgoing interface, this is used; otherwise the interface is not
55578 specified. Likewise, the text that is used for the HELO command is taken from
55579 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
55580 <varname>$smtp_active_hostname</varname> is used.
55581 </para>
55582 <para>
55583 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
55584 test whether a bounce message could be delivered to the sender address. The
55585 following SMTP commands are sent:
55586 </para>
55587 <literallayout>
55588 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
55589 <literal>MAIL FROM:&lt;&gt;</literal>
55590 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
55591 <literal>QUIT</literal>
55592 </literallayout>
55593 <para>
55594 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
55595 set to <quote>lmtp</quote>.
55596 </para>
55597 <para>
55598 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
55599 settings.
55600 </para>
55601 <para>
55602 A recipient callout check is similar. By default, it also uses an empty address
55603 for the sender. This default is chosen because most hosts do not make use of
55604 the sender address when verifying a recipient. Using the same address means
55605 that a single cache entry can be used for each recipient. Some sites, however,
55606 do make use of the sender address when verifying. These are catered for by the
55607 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
55608 </para>
55609 <para>
55610 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
55611 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
55612 Exim tries the next host, if any. If there is a problem with all the remote
55613 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
55614 <option>callout</option> option is given, in which case the condition is forced to succeed.
55615 </para>
55616 <para>
55617 <indexterm role="concept">
55618 <primary>SMTP</primary>
55619 <secondary>output flushing, disabling for callout</secondary>
55620 </indexterm>
55621 A callout may take a little time. For this reason, Exim normally flushes SMTP
55622 output before performing a callout in an ACL, to avoid unexpected timeouts in
55623 clients when the SMTP PIPELINING extension is in use. The flushing can be
55624 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
55625 </para>
55626 </section>
55627 <section id="CALLaddparcall">
55628 <title>Additional parameters for callouts</title>
55629 <para>
55630 <indexterm role="concept">
55631 <primary>callout</primary>
55632 <secondary>additional parameters for</secondary>
55633 </indexterm>
55634 The <option>callout</option> option can be followed by an equals sign and a number of
55635 optional parameters, separated by commas. For example:
55636 </para>
55637 <literallayout class="monospaced">
55638 verify = recipient/callout=10s,defer_ok
55639 </literallayout>
55640 <para>
55641 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
55642 separate verify options, is retained for backwards compatibility, but is now
55643 deprecated. The additional parameters for <option>callout</option> are as follows:
55644 </para>
55645 <variablelist>
55646 <varlistentry>
55647 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
55648 <listitem>
55649 <para>
55650 <indexterm role="concept">
55651 <primary>callout</primary>
55652 <secondary>timeout, specifying</secondary>
55653 </indexterm>
55654 This specifies the timeout that applies for the callout attempt to each host.
55655 For example:
55656 </para>
55657 <literallayout class="monospaced">
55658 verify = sender/callout=5s
55659 </literallayout>
55660 <para>
55661 The default is 30 seconds. The timeout is used for each response from the
55662 remote host. It is also used for the initial connection, unless overridden by
55663 the <option>connect</option> parameter.
55664 </para>
55665 </listitem></varlistentry>
55666 <varlistentry>
55667 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55668 <listitem>
55669 <para>
55670 <indexterm role="concept">
55671 <primary>callout</primary>
55672 <secondary>connection timeout, specifying</secondary>
55673 </indexterm>
55674 This parameter makes it possible to set a different (usually smaller) timeout
55675 for making the SMTP connection. For example:
55676 </para>
55677 <literallayout class="monospaced">
55678 verify = sender/callout=5s,connect=1s
55679 </literallayout>
55680 <para>
55681 If not specified, this timeout defaults to the general timeout value.
55682 </para>
55683 </listitem></varlistentry>
55684 <varlistentry>
55685 <term><emphasis role="bold">defer_ok</emphasis></term>
55686 <listitem>
55687 <para>
55688 <indexterm role="concept">
55689 <primary>callout</primary>
55690 <secondary>defer, action on</secondary>
55691 </indexterm>
55692 When this parameter is present, failure to contact any host, or any other kind
55693 of temporary error, is treated as success by the ACL. However, the cache is not
55694 updated in this circumstance.
55695 </para>
55696 </listitem></varlistentry>
55697 <varlistentry>
55698 <term><emphasis role="bold">fullpostmaster</emphasis></term>
55699 <listitem>
55700 <para>
55701 <indexterm role="concept">
55702 <primary>callout</primary>
55703 <secondary>full postmaster check</secondary>
55704 </indexterm>
55705 This operates like the <option>postmaster</option> option (see below), but if the check for
55706 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
55707 accordance with the specification in RFC 2821. The RFC states that the
55708 unqualified address <emphasis>postmaster</emphasis> should be accepted.
55709 </para>
55710 </listitem></varlistentry>
55711 <varlistentry>
55712 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55713 <listitem>
55714 <para>
55715 <indexterm role="concept">
55716 <primary>callout</primary>
55717 <secondary>sender when verifying header</secondary>
55718 </indexterm>
55719 When verifying addresses in header lines using the <option>header_sender</option>
55720 verification option, Exim behaves by default as if the addresses are envelope
55721 sender addresses from a message. Callout verification therefore tests to see
55722 whether a bounce message could be delivered, by using an empty address in the
55723 MAIL command. However, it is arguable that these addresses might never be used
55724 as envelope senders, and could therefore justifiably reject bounce messages
55725 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
55726 address to use in the MAIL command. For example:
55727 </para>
55728 <literallayout class="monospaced">
55729 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
55730 </literallayout>
55731 <para>
55732 This parameter is available only for the <option>header_sender</option> verification option.
55733 </para>
55734 </listitem></varlistentry>
55735 <varlistentry>
55736 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
55737 <listitem>
55738 <para>
55739 <indexterm role="concept">
55740 <primary>callout</primary>
55741 <secondary>overall timeout, specifying</secondary>
55742 </indexterm>
55743 This parameter sets an overall timeout for performing a callout verification.
55744 For example:
55745 </para>
55746 <literallayout class="monospaced">
55747 verify = sender/callout=5s,maxwait=30s
55748 </literallayout>
55749 <para>
55750 This timeout defaults to four times the callout timeout for individual SMTP
55751 commands. The overall timeout applies when there is more than one host that can
55752 be tried. The timeout is checked before trying the next host. This prevents
55753 very long delays if there are a large number of hosts and all are timing out
55754 (for example, when network connections are timing out).
55755 </para>
55756 </listitem></varlistentry>
55757 <varlistentry>
55758 <term><emphasis role="bold">no_cache</emphasis></term>
55759 <listitem>
55760 <para>
55761 <indexterm role="concept">
55762 <primary>callout</primary>
55763 <secondary>cache, suppressing</secondary>
55764 </indexterm>
55765 <indexterm role="concept">
55766 <primary>caching callout, suppressing</primary>
55767 </indexterm>
55768 When this parameter is given, the callout cache is neither read nor updated.
55769 </para>
55770 </listitem></varlistentry>
55771 <varlistentry>
55772 <term><emphasis role="bold">postmaster</emphasis></term>
55773 <listitem>
55774 <para>
55775 <indexterm role="concept">
55776 <primary>callout</primary>
55777 <secondary>postmaster; checking</secondary>
55778 </indexterm>
55779 When this parameter is set, a successful callout check is followed by a similar
55780 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
55781 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
55782 the postmaster check is recorded in a cache record; if it is a failure, this is
55783 used to fail subsequent callouts for the domain without a connection being
55784 made, until the cache record expires.
55785 </para>
55786 </listitem></varlistentry>
55787 <varlistentry>
55788 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
55789 <listitem>
55790 <para>
55791 The postmaster check uses an empty sender in the MAIL command by default.
55792 You can use this parameter to do a postmaster check using a different address.
55793 For example:
55794 </para>
55795 <literallayout class="monospaced">
55796 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
55797 </literallayout>
55798 <para>
55799 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
55800 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
55801 </para>
55802 <literallayout class="monospaced">
55803 require  verify = sender/callout=postmaster_mailfrom=
55804 </literallayout>
55805 <para>
55806 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
55807 account of the sender address. It is assumed that either the empty address or
55808 a fixed non-empty address will be used. All that Exim remembers is that the
55809 postmaster check for the domain succeeded or failed.
55810 </para>
55811 </listitem></varlistentry>
55812 <varlistentry>
55813 <term><emphasis role="bold">random</emphasis></term>
55814 <listitem>
55815 <para>
55816 <indexterm role="concept">
55817 <primary>callout</primary>
55818 <secondary><quote>random</quote> check</secondary>
55819 </indexterm>
55820 When this parameter is set, before doing the normal callout check, Exim does a
55821 check for a <quote>random</quote> local part at the same domain. The local part is not
55822 really random &ndash; it is defined by the expansion of the option
55823 <option>callout_random_local_part</option>, which defaults to
55824 </para>
55825 <literallayout class="monospaced">
55826 $primary_hostname-$tod_epoch-testing
55827 </literallayout>
55828 <para>
55829 The idea here is to try to determine whether the remote host accepts all local
55830 parts without checking. If it does, there is no point in doing callouts for
55831 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
55832 a cache record, and used to force the current and subsequent callout checks to
55833 succeed without a connection being made, until the cache record expires.
55834 </para>
55835 </listitem></varlistentry>
55836 <varlistentry>
55837 <term><emphasis role="bold">use_postmaster</emphasis></term>
55838 <listitem>
55839 <para>
55840 <indexterm role="concept">
55841 <primary>callout</primary>
55842 <secondary>sender for recipient check</secondary>
55843 </indexterm>
55844 This parameter applies to recipient callouts only. For example:
55845 </para>
55846 <literallayout class="monospaced">
55847 deny  !verify = recipient/callout=use_postmaster
55848 </literallayout>
55849 <para>
55850 <indexterm role="variable">
55851 <primary><varname>$qualify_domain</varname></primary>
55852 </indexterm>
55853 It causes a non-empty postmaster address to be used in the MAIL command when
55854 performing the callout for the recipient, and also for a <quote>random</quote> check if
55855 that is configured. The local part of the address is <literal>postmaster</literal> and the
55856 domain is the contents of <varname>$qualify_domain</varname>.
55857 </para>
55858 </listitem></varlistentry>
55859 <varlistentry>
55860 <term><emphasis role="bold">use_sender</emphasis></term>
55861 <listitem>
55862 <para>
55863 This option applies to recipient callouts only. For example:
55864 </para>
55865 <literallayout class="monospaced">
55866 require  verify = recipient/callout=use_sender
55867 </literallayout>
55868 <para>
55869 It causes the message&#x2019;s actual sender address to be used in the MAIL
55870 command when performing the callout, instead of an empty address. There is no
55871 need to use this option unless you know that the called hosts make use of the
55872 sender when checking recipients. If used indiscriminately, it reduces the
55873 usefulness of callout caching.
55874 </para>
55875 </listitem></varlistentry>
55876 </variablelist>
55877 <para>
55878 If you use any of the parameters that set a non-empty sender for the MAIL
55879 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
55880 <option>use_sender</option>), you should think about possible loops. Recipient checking is
55881 usually done between two hosts that are under the same management, and the host
55882 that receives the callouts is not normally configured to do callouts itself.
55883 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
55884 these circumstances.
55885 </para>
55886 <para>
55887 However, if you use a non-empty sender address for a callout to an arbitrary
55888 host, there is the likelihood that the remote host will itself initiate a
55889 callout check back to your host. As it is checking what appears to be a message
55890 sender, it is likely to use an empty address in MAIL, thus avoiding a
55891 callout loop. However, to be on the safe side it would be best to set up your
55892 own ACLs so that they do not do sender verification checks when the recipient
55893 is the address you use for header sender or postmaster callout checking.
55894 </para>
55895 <para>
55896 Another issue to think about when using non-empty senders for callouts is
55897 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
55898 by the sender/recipient combination; thus, for any given recipient, many more
55899 actual callouts are performed than when an empty sender or postmaster is used.
55900 </para>
55901 </section>
55902 <section id="SECTcallvercache">
55903 <title>Callout caching</title>
55904 <para>
55905 <indexterm role="concept">
55906 <primary>hints database</primary>
55907 <secondary>callout cache</secondary>
55908 </indexterm>
55909 <indexterm role="concept">
55910 <primary>callout</primary>
55911 <secondary>cache, description of</secondary>
55912 </indexterm>
55913 <indexterm role="concept">
55914 <primary>caching</primary>
55915 <secondary>callout</secondary>
55916 </indexterm>
55917 Exim caches the results of callouts in order to reduce the amount of resources
55918 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
55919 option. A hints database called <quote>callout</quote> is used for the cache. Two
55920 different record types are used: one records the result of a callout check for
55921 a specific address, and the other records information that applies to the
55922 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
55923 </para>
55924 <para>
55925 When an original callout fails, a detailed SMTP error message is given about
55926 the failure. However, for subsequent failures use the cache data, this message
55927 is not available.
55928 </para>
55929 <para>
55930 The expiry times for negative and positive address cache records are
55931 independent, and can be set by the global options <option>callout_negative_expire</option>
55932 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
55933 </para>
55934 <para>
55935 If a host gives a negative response to an SMTP connection, or rejects any
55936 commands up to and including
55937 </para>
55938 <literallayout class="monospaced">
55939 MAIL FROM:&lt;&gt;
55940 </literallayout>
55941 <para>
55942 (but not including the MAIL command with a non-empty address),
55943 any callout attempt is bound to fail. Exim remembers such failures in a
55944 domain cache record, which it uses to fail callouts for the domain without
55945 making new connections, until the domain record times out. There are two
55946 separate expiry times for domain cache records:
55947 <option>callout_domain_negative_expire</option> (default 3h) and
55948 <option>callout_domain_positive_expire</option> (default 7d).
55949 </para>
55950 <para>
55951 Domain records expire when the negative expiry time is reached if callouts
55952 cannot be made for the domain, or if the postmaster check failed.
55953 Otherwise, they expire when the positive expiry time is reached. This
55954 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
55955 will eventually be noticed.
55956 </para>
55957 <para>
55958 The callout caching mechanism is based on the domain of the address that is
55959 being tested. If the domain routes to several hosts, it is assumed that their
55960 behaviour will be the same.
55961 </para>
55962 </section>
55963 <section id="SECTsenaddver">
55964 <title>Sender address verification reporting</title>
55965 <para>
55966 <indexterm role="concept">
55967 <primary>verifying</primary>
55968 <secondary>suppressing error details</secondary>
55969 </indexterm>
55970 See section <xref linkend="SECTaddressverification"/> for a general discussion of
55971 verification. When sender verification fails in an ACL, the details of the
55972 failure are given as additional output lines before the 550 response to the
55973 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
55974 you might see:
55975 </para>
55976 <literallayout class="monospaced">
55977 MAIL FROM:&lt;xyz@abc.example&gt;
55978 250 OK
55979 RCPT TO:&lt;pqr@def.example&gt;
55980 550-Verification failed for &lt;xyz@abc.example&gt;
55981 550-Called:   192.168.34.43
55982 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
55983 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
55984 550 Sender verification failed
55985 </literallayout>
55986 <para>
55987 If more than one RCPT command fails in the same way, the details are given
55988 only for the first of them. However, some administrators do not want to send
55989 out this much information. You can suppress the details by adding
55990 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
55991 example:
55992 </para>
55993 <literallayout class="monospaced">
55994 verify = sender/no_details
55995 </literallayout>
55996 </section>
55997 <section id="SECTredirwhilveri">
55998 <title>Redirection while verifying</title>
55999 <para>
56000 <indexterm role="concept">
56001 <primary>verifying</primary>
56002 <secondary>redirection while</secondary>
56003 </indexterm>
56004 <indexterm role="concept">
56005 <primary>address redirection</primary>
56006 <secondary>while verifying</secondary>
56007 </indexterm>
56008 A dilemma arises when a local address is redirected by aliasing or forwarding
56009 during verification: should the generated addresses themselves be verified,
56010 or should the successful expansion of the original address be enough to verify
56011 it? By default, Exim takes the following pragmatic approach:
56012 </para>
56013 <itemizedlist>
56014 <listitem>
56015 <para>
56016 When an incoming address is redirected to just one child address, verification
56017 continues with the child address, and if that fails to verify, the original
56018 verification also fails.
56019 </para>
56020 </listitem>
56021 <listitem>
56022 <para>
56023 When an incoming address is redirected to more than one child address,
56024 verification does not continue. A success result is returned.
56025 </para>
56026 </listitem>
56027 </itemizedlist>
56028 <para>
56029 This seems the most reasonable behaviour for the common use of aliasing as a
56030 way of redirecting different local parts to the same mailbox. It means, for
56031 example, that a pair of alias entries of the form
56032 </para>
56033 <literallayout class="monospaced">
56034 A.Wol:   aw123
56035 aw123:   :fail: Gone away, no forwarding address
56036 </literallayout>
56037 <para>
56038 work as expected, with both local parts causing verification failure. When a
56039 redirection generates more than one address, the behaviour is more like a
56040 mailing list, where the existence of the alias itself is sufficient for
56041 verification to succeed.
56042 </para>
56043 <para>
56044 It is possible, however, to change the default behaviour so that all successful
56045 redirections count as successful verifications, however many new addresses are
56046 generated. This is specified by the <option>success_on_redirect</option> verification
56047 option. For example:
56048 </para>
56049 <literallayout class="monospaced">
56050 require verify = recipient/success_on_redirect/callout=10s
56051 </literallayout>
56052 <para>
56053 In this example, verification succeeds if a router generates a new address, and
56054 the callout does not occur, because no address was routed to a remote host.
56055 </para>
56056 <para>
56057 When verification is being tested via the <option>-bv</option> option, the treatment of
56058 redirections is as just described, unless the <option>-v</option> or any debugging option is
56059 also specified. In that case, full verification is done for every generated
56060 address and a report is output for each of them.
56061 </para>
56062 </section>
56063 <section id="SECTverifyCSA">
56064 <title>Client SMTP authorization (CSA)</title>
56065 <para>
56066 <indexterm role="concept">
56067 <primary>CSA</primary>
56068 <secondary>verifying</secondary>
56069 </indexterm>
56070 Client SMTP Authorization is a system that allows a site to advertise
56071 which machines are and are not permitted to send email. This is done by placing
56072 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
56073 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
56074 Authorization checks in Exim are performed by the ACL condition:
56075 </para>
56076 <literallayout class="monospaced">
56077 verify = csa
56078 </literallayout>
56079 <para>
56080 This fails if the client is not authorized. If there is a DNS problem, or if no
56081 valid CSA SRV record is found, or if the client is authorized, the condition
56082 succeeds. These three cases can be distinguished using the expansion variable
56083 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
56084 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
56085 be likely to cause problems for legitimate email.
56086 </para>
56087 <para>
56088 The error messages produced by the CSA code include slightly more
56089 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
56090 looking up the CSA SRV record, or problems looking up the CSA target
56091 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
56092 </para>
56093 <itemizedlist>
56094 <listitem>
56095 <para>
56096 The client&#x2019;s host name is explicitly not authorized.
56097 </para>
56098 </listitem>
56099 <listitem>
56100 <para>
56101 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
56102 </para>
56103 </listitem>
56104 <listitem>
56105 <para>
56106 The client&#x2019;s host name is authorized but it has no valid target IP addresses
56107 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
56108 </para>
56109 </listitem>
56110 <listitem>
56111 <para>
56112 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
56113 that all subdomains must be explicitly authorized.
56114 </para>
56115 </listitem>
56116 </itemizedlist>
56117 <para>
56118 The <option>csa</option> verification condition can take an argument which is the domain to
56119 use for the DNS query. The default is:
56120 </para>
56121 <literallayout class="monospaced">
56122 verify = csa/$sender_helo_name
56123 </literallayout>
56124 <para>
56125 This implementation includes an extension to CSA. If the query domain
56126 is an address literal such as [192.0.2.95], or if it is a bare IP
56127 address, Exim searches for CSA SRV records in the reverse DNS as if
56128 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
56129 meaningful to say:
56130 </para>
56131 <literallayout class="monospaced">
56132 verify = csa/$sender_host_address
56133 </literallayout>
56134 <para>
56135 In fact, this is the check that Exim performs if the client does not say HELO.
56136 This extension can be turned off by setting the main configuration option
56137 <option>dns_csa_use_reverse</option> to be false.
56138 </para>
56139 <para>
56140 If a CSA SRV record is not found for the domain itself, a search
56141 is performed through its parent domains for a record which might be
56142 making assertions about subdomains. The maximum depth of this search is limited
56143 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
56144 default. Exim does not look for CSA SRV records in a top level domain, so the
56145 default settings handle HELO domains as long as seven
56146 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
56147 of legitimate HELO domains.
56148 </para>
56149 <para>
56150 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
56151 direct SRV lookups, this is not sufficient because of the extra parent domain
56152 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
56153 addresses into lookups in the reverse DNS space. The result of a successful
56154 lookup such as:
56155 </para>
56156 <literallayout class="monospaced">
56157 ${lookup dnsdb {csa=$sender_helo_name}}
56158 </literallayout>
56159 <para>
56160 has two space-separated fields: an authorization code and a target host name.
56161 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
56162 authorization required but absent, or <quote>?</quote> for unknown.
56163 </para>
56164 </section>
56165 <section id="SECTverifyPRVS">
56166 <title>Bounce address tag validation</title>
56167 <para>
56168 <indexterm role="concept">
56169 <primary>BATV, verifying</primary>
56170 </indexterm>
56171 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
56172 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
56173 Genuine incoming bounce messages should therefore always be addressed to
56174 recipients that have a valid tag. This scheme is a way of detecting unwanted
56175 bounce messages caused by sender address forgeries (often called <quote>collateral
56176 spam</quote>), because the recipients of such messages do not include valid tags.
56177 </para>
56178 <para>
56179 There are two expansion items to help with the implementation of the BATV
56180 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
56181 the original envelope sender address by using a simple key to add a hash of the
56182 address and some time-based randomizing information. The <option>prvs</option> expansion
56183 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
56184 The syntax of these expansion items is described in section
56185 <xref linkend="SECTexpansionitems"/>.
56186 </para>
56187 <para>
56188 As an example, suppose the secret per-address keys are stored in an MySQL
56189 database. A query to look up the key for an address could be defined as a macro
56190 like this:
56191 </para>
56192 <literallayout class="monospaced">
56193 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
56194                 WHERE sender='${quote_mysql:$prvscheck_address}'\
56195                 }{$value}}
56196 </literallayout>
56197 <para>
56198 Suppose also that the senders who make use of BATV are defined by an address
56199 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
56200 use this:
56201 </para>
56202 <literallayout class="monospaced">
56203 # Bounces: drop unsigned addresses for BATV senders
56204 deny message = This address does not send an unsigned reverse path
56205      senders = :
56206      recipients = +batv_senders
56207
56208 # Bounces: In case of prvs-signed address, check signature.
56209 deny message = Invalid reverse path signature.
56210      senders = :
56211      condition  = ${prvscheck {$local_part@$domain}\
56212                   {PRVSCHECK_SQL}{1}}
56213      !condition = $prvscheck_result
56214 </literallayout>
56215 <para>
56216 The first statement rejects recipients for bounce messages that are addressed
56217 to plain BATV sender addresses, because it is known that BATV senders do not
56218 send out messages with plain sender addresses. The second statement rejects
56219 recipients that are prvs-signed, but with invalid signatures (either because
56220 the key is wrong, or the signature has timed out).
56221 </para>
56222 <para>
56223 A non-prvs-signed address is not rejected by the second statement, because the
56224 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
56225 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
56226 the first argument is a syntactically valid prvs-signed address, the yield is
56227 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
56228 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
56229 of the checks (empty for failure, <quote>1</quote> for success).
56230 </para>
56231 <para>
56232 There is one more issue you must consider when implementing prvs-signing:
56233 you have to ensure that the routers accept prvs-signed addresses and
56234 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
56235 router to remove the signature with a configuration along these lines:
56236 </para>
56237 <literallayout class="monospaced">
56238 batv_redirect:
56239   driver = redirect
56240   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
56241 </literallayout>
56242 <para>
56243 This works because, if the third argument of <option>prvscheck</option> is empty, the result
56244 of the expansion of a prvs-signed address is the decoded value of the original
56245 address. This router should probably be the first of your routers that handles
56246 local addresses.
56247 </para>
56248 <para>
56249 To create BATV-signed addresses in the first place, a transport of this form
56250 can be used:
56251 </para>
56252 <literallayout class="monospaced">
56253 external_smtp_batv:
56254   driver = smtp
56255   return_path = ${prvs {$return_path} \
56256                        {${lookup mysql{SELECT \
56257                        secret FROM batv_prvs WHERE \
56258                        sender='${quote_mysql:$sender_address}'} \
56259                        {$value}fail}}}
56260 </literallayout>
56261 <para>
56262 If no key can be found for the existing return path, no signing takes place.
56263 </para>
56264 </section>
56265 <section id="SECTrelaycontrol">
56266 <title>Using an ACL to control relaying</title>
56267 <para>
56268 <indexterm role="concept">
56269 <primary>access control lists (ACLs)</primary>
56270 <secondary>relay control</secondary>
56271 </indexterm>
56272 <indexterm role="concept">
56273 <primary>relaying</primary>
56274 <secondary>control by ACL</secondary>
56275 </indexterm>
56276 <indexterm role="concept">
56277 <primary>policy control</primary>
56278 <secondary>relay control</secondary>
56279 </indexterm>
56280 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
56281 delivers it directly to another host as a result of a remote address contained
56282 within it. Redirecting a local address via an alias or forward file and then
56283 passing the message on to another host is not relaying,
56284 <indexterm role="concept">
56285 <primary><quote>percent hack</quote></primary>
56286 </indexterm>
56287 but a redirection as a result of the <quote>percent hack</quote> is.
56288 </para>
56289 <para>
56290 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
56291 A host which is acting as a gateway or an MX backup is concerned with incoming
56292 relaying from arbitrary hosts to a specific set of domains. On the other hand,
56293 a host which is acting as a smart host for a number of clients is concerned
56294 with outgoing relaying from those clients to the Internet at large. Often the
56295 same host is fulfilling both functions,
56296 but in principle these two kinds of relaying are entirely independent. What is
56297 not wanted is the transmission of mail from arbitrary remote hosts through your
56298 system to arbitrary domains.
56299 </para>
56300 <para>
56301 You can implement relay control by means of suitable statements in the ACL that
56302 runs for each RCPT command. For convenience, it is often easiest to use
56303 Exim&#x2019;s named list facility to define the domains and hosts involved. For
56304 example, suppose you want to do the following:
56305 </para>
56306 <itemizedlist>
56307 <listitem>
56308 <para>
56309 Deliver a number of domains to mailboxes on the local host (or process them
56310 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
56311 <emphasis>my.dom2.example</emphasis>.
56312 </para>
56313 </listitem>
56314 <listitem>
56315 <para>
56316 Relay mail for a number of other domains for which you are the secondary MX.
56317 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
56318 </para>
56319 </listitem>
56320 <listitem>
56321 <para>
56322 Relay mail from the hosts on your local LAN, to whatever domains are involved.
56323 Suppose your LAN is 192.168.45.0/24.
56324 </para>
56325 </listitem>
56326 </itemizedlist>
56327 <para>
56328 In the main part of the configuration, you put the following definitions:
56329 </para>
56330 <literallayout class="monospaced">
56331 domainlist local_domains    = my.dom1.example : my.dom2.example
56332 domainlist relay_to_domains = friend1.example : friend2.example
56333 hostlist   relay_from_hosts = 192.168.45.0/24
56334 </literallayout>
56335 <para>
56336 Now you can use these definitions in the ACL that is run for every RCPT
56337 command:
56338 </para>
56339 <literallayout class="monospaced">
56340 acl_check_rcpt:
56341   accept domains = +local_domains : +relay_to_domains
56342   accept hosts   = +relay_from_hosts
56343 </literallayout>
56344 <para>
56345 The first statement accepts any RCPT command that contains an address in
56346 the local or relay domains. For any other domain, control passes to the second
56347 statement, which accepts the command only if it comes from one of the relay
56348 hosts. In practice, you will probably want to make your ACL more sophisticated
56349 than this, for example, by including sender and recipient verification. The
56350 default configuration includes a more comprehensive example, which is described
56351 in chapter <xref linkend="CHAPdefconfil"/>.
56352 </para>
56353 </section>
56354 <section id="SECTcheralcon">
56355 <title>Checking a relay configuration</title>
56356 <para>
56357 <indexterm role="concept">
56358 <primary>relaying</primary>
56359 <secondary>checking control of</secondary>
56360 </indexterm>
56361 You can check the relay characteristics of your configuration in the same way
56362 that you can test any ACL behaviour for an incoming SMTP connection, by using
56363 the <option>-bh</option> option to run a fake SMTP session with which you interact.
56364 </para>
56365 <para>
56366 For specifically testing for unwanted relaying, the host
56367 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
56368 host from the host on which Exim is running, using the normal telnet port, you
56369 will see a normal telnet connection message and then quite a long delay. Be
56370 patient. The remote host is making an SMTP connection back to your host, and
56371 trying a number of common probes to test for open relay vulnerability. The
56372 results of the tests will eventually appear on your terminal.
56373 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
56374 </para>
56375 </section>
56376 </chapter>
56377
56378 <chapter id="CHAPexiscan">
56379 <title>Content scanning at ACL time</title>
56380 <para>
56381 <indexterm role="concept" id="IIDcosca" class="startofrange">
56382 <primary>content scanning</primary>
56383 <secondary>at ACL time</secondary>
56384 </indexterm>
56385 The extension of Exim to include content scanning at ACL time, formerly known
56386 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
56387 was integrated into the main source for Exim release 4.50, and Tom continues to
56388 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
56389 specification.
56390 </para>
56391 <para>
56392 It is also possible to scan the content of messages at other times. The
56393 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
56394 scanning after all the ACLs have run. A transport filter can be used to scan
56395 messages at delivery time (see the <option>transport_filter</option> option, described in
56396 chapter <xref linkend="CHAPtransportgeneric"/>).
56397 </para>
56398 <para>
56399 If you want to include the ACL-time content-scanning features when you compile
56400 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
56401 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
56402 </para>
56403 <itemizedlist>
56404 <listitem>
56405 <para>
56406 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
56407 for all MIME parts for SMTP and non-SMTP messages, respectively.
56408 </para>
56409 </listitem>
56410 <listitem>
56411 <para>
56412 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
56413 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
56414 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
56415 </para>
56416 </listitem>
56417 <listitem>
56418 <para>
56419 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
56420 of messages, or parts of messages, for debugging purposes.
56421 </para>
56422 </listitem>
56423 <listitem>
56424 <para>
56425 Additional expansion variables that are set in the new ACL and by the new
56426 conditions.
56427 </para>
56428 </listitem>
56429 <listitem>
56430 <para>
56431 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
56432 </para>
56433 </listitem>
56434 </itemizedlist>
56435 <para>
56436 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
56437 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
56438 condition is compiled, in addition to all the other content-scanning features.
56439 </para>
56440 <para>
56441 Content-scanning is continually evolving, and new features are still being
56442 added. While such features are still unstable and liable to incompatible
56443 changes, they are made available in Exim by setting options whose names begin
56444 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
56445 this manual. You can find out about them by reading the file called
56446 <filename>doc/experimental.txt</filename>.
56447 </para>
56448 <para>
56449 All the content-scanning facilities work on a MBOX copy of the message that is
56450 temporarily created in a file called:
56451 </para>
56452 <literallayout>
56453 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
56454 </literallayout>
56455 <para>
56456 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
56457 expect an MBOX-like structure inside that file. The file is created when the
56458 first content scanning facility is called. Subsequent calls to content
56459 scanning conditions open the same file again. The directory is recursively
56460 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
56461 </para>
56462 <literallayout class="monospaced">
56463 control = no_mbox_unspool
56464 </literallayout>
56465 <para>
56466 has been encountered. When the MIME ACL decodes files, they are put into the
56467 same directory by default.
56468 </para>
56469 <section id="SECTscanvirus">
56470 <title>Scanning for viruses</title>
56471 <para>
56472 <indexterm role="concept">
56473 <primary>virus scanning</primary>
56474 </indexterm>
56475 <indexterm role="concept">
56476 <primary>content scanning</primary>
56477 <secondary>for viruses</secondary>
56478 </indexterm>
56479 <indexterm role="concept">
56480 <primary>content scanning</primary>
56481 <secondary>the <option>malware</option> condition</secondary>
56482 </indexterm>
56483 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
56484 It supports a <quote>generic</quote> interface to scanners called via the shell, and
56485 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
56486 in memory and thus are much faster.
56487 </para>
56488 <para>
56489 <indexterm role="option">
56490 <primary><option>av_scanner</option></primary>
56491 </indexterm>
56492 You can set the <option>av_scanner</option> option in first part of the Exim configuration
56493 file to specify which scanner to use, together with any additional options that
56494 are needed. The basic syntax is as follows:
56495 </para>
56496 <literallayout>
56497 <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>
56498 </literallayout>
56499 <para>
56500 If you do not set <option>av_scanner</option>, it defaults to
56501 </para>
56502 <literallayout class="monospaced">
56503 av_scanner = sophie:/var/run/sophie
56504 </literallayout>
56505 <para>
56506 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
56507 before use.
56508 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
56509 The following scanner types are supported in this release:
56510 </para>
56511 <variablelist>
56512 <varlistentry>
56513 <term><option>aveserver</option></term>
56514 <listitem>
56515 <para>
56516 <indexterm role="concept">
56517 <primary>virus scanners</primary>
56518 <secondary>Kaspersky</secondary>
56519 </indexterm>
56520 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
56521 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
56522 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
56523 example:
56524 </para>
56525 <literallayout class="monospaced">
56526 av_scanner = aveserver:/var/run/aveserver
56527 </literallayout>
56528 </listitem></varlistentry>
56529 <varlistentry>
56530 <term><option>clamd</option></term>
56531 <listitem>
56532 <para>
56533 <indexterm role="concept">
56534 <primary>virus scanners</primary>
56535 <secondary>clamd</secondary>
56536 </indexterm>
56537 This daemon-type scanner is GPL and free. You can get it at
56538 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
56539 unpack MIME containers, so it used to be recommended to unpack MIME attachments
56540 in the MIME ACL. This no longer believed to be necessary. One option is
56541 required: either the path and name of a UNIX socket file, or a hostname or IP
56542 number, and a port, separated by space, as in the second of these examples:
56543 </para>
56544 <literallayout class="monospaced">
56545 av_scanner = clamd:/opt/clamd/socket
56546 av_scanner = clamd:192.0.2.3 1234
56547 av_scanner = clamd:192.0.2.3 1234:local
56548 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
56549 </literallayout>
56550 <para>
56551 If the value of av_scanner points to a UNIX socket file or contains the local
56552 keyword, then the ClamAV interface will pass a filename containing the data
56553 to be scanned, which will should normally result in less I/O happening and be
56554 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
56555 Exim does not assume that there is a common filesystem with the remote host.
56556 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
56557 you be running a version of ClamAV prior to 0.95.
56558 </para>
56559 <para>
56560 The final example shows that multiple TCP targets can be specified.  Exim will
56561 randomly use one for each incoming email (i.e. it load balances them).  Note
56562 that only TCP targets may be used if specifying a list of scanners; a UNIX
56563 socket cannot be mixed in with TCP targets.  If one of the servers becomes
56564 unavailable, Exim will try the remaining one(s) until it finds one that works.
56565 When a clamd server becomes unreachable, Exim will log a message.  Exim does
56566 not keep track of scanner state between multiple messages, and the scanner
56567 selection is random, so the message will get logged in the mainlog for each
56568 email that the down scanner gets chosen first (message wrapped to be readable):
56569 </para>
56570 <literallayout class="monospaced">
56571 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
56572    clamd: connection to localhost, port 3310 failed
56573    (Connection refused)
56574 </literallayout>
56575 <para>
56576 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
56577 contributing the code for this scanner.
56578 </para>
56579 </listitem></varlistentry>
56580 <varlistentry>
56581 <term><option>cmdline</option></term>
56582 <listitem>
56583 <para>
56584 <indexterm role="concept">
56585 <primary>virus scanners</primary>
56586 <secondary>command line interface</secondary>
56587 </indexterm>
56588 This is the keyword for the generic command line scanner interface. It can be
56589 used to attach virus scanners that are invoked from the shell. This scanner
56590 type takes 3 mandatory options:
56591 </para>
56592 <orderedlist numeration="arabic">
56593 <listitem>
56594 <para>
56595 The full path and name of the scanner binary, with all command line options,
56596 and a placeholder (<literal>%s</literal>) for the directory to scan.
56597 </para>
56598 </listitem>
56599 <listitem>
56600 <para>
56601 A regular expression to match against the STDOUT and STDERR output of the
56602 virus scanner. If the expression matches, a virus was found. You must make
56603 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
56604 the <quote>trigger</quote> expression.
56605 </para>
56606 </listitem>
56607 <listitem>
56608 <para>
56609 Another regular expression, containing exactly one pair of parentheses, to
56610 match the name of the virus found in the scanners output. This is called the
56611 <quote>name</quote> expression.
56612 </para>
56613 </listitem>
56614 </orderedlist>
56615 <para>
56616 For example, Sophos Sweep reports a virus on a line like this:
56617 </para>
56618 <literallayout class="monospaced">
56619 Virus 'W32/Magistr-B' found in file ./those.bat
56620 </literallayout>
56621 <para>
56622 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
56623 name expression, we want to extract the W32/Magistr-B string, so we can match
56624 for the single quotes left and right of it. Altogether, this makes the
56625 configuration setting:
56626 </para>
56627 <literallayout class="monospaced">
56628 av_scanner = cmdline:\
56629              /path/to/sweep -ss -all -rec -archive %s:\
56630              found in file:'(.+)'
56631 </literallayout>
56632 </listitem></varlistentry>
56633 <varlistentry>
56634 <term><option>drweb</option></term>
56635 <listitem>
56636 <para>
56637 <indexterm role="concept">
56638 <primary>virus scanners</primary>
56639 <secondary>DrWeb</secondary>
56640 </indexterm>
56641 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
56642 takes one option,
56643 either a full path to a UNIX socket,
56644 or host and port specifiers separated by white space.
56645 The host may be a name or an IP address; the port is either a
56646 single number or a pair of numbers with a dash between.
56647 For example:
56648 </para>
56649 <literallayout class="monospaced">
56650 av_scanner = drweb:/var/run/drwebd.sock
56651 av_scanner = drweb:192.168.2.20 31337
56652 </literallayout>
56653 <para>
56654 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
56655 is used. Thanks to Alex Miller for contributing the code for this scanner.
56656 </para>
56657 </listitem></varlistentry>
56658 <varlistentry>
56659 <term><option>f-protd</option></term>
56660 <listitem>
56661 <para>
56662 <indexterm role="concept">
56663 <primary>virus scanners</primary>
56664 <secondary>f-protd</secondary>
56665 </indexterm>
56666 The f-protd scanner is accessed via HTTP over TCP.
56667 One argument is taken, being a space-separated hostname and port number
56668 (or port-range).
56669 For example:
56670 </para>
56671 <literallayout class="monospaced">
56672 av_scanner = f-protd:localhost 10200-10204
56673 </literallayout>
56674 <para>
56675 If you omit the argument, the default values show above are used.
56676 </para>
56677 </listitem></varlistentry>
56678 <varlistentry>
56679 <term><option>fsecure</option></term>
56680 <listitem>
56681 <para>
56682 <indexterm role="concept">
56683 <primary>virus scanners</primary>
56684 <secondary>F-Secure</secondary>
56685 </indexterm>
56686 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
56687 argument which is the path to a UNIX socket. For example:
56688 </para>
56689 <literallayout class="monospaced">
56690 av_scanner = fsecure:/path/to/.fsav
56691 </literallayout>
56692 <para>
56693 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
56694 Thelmen for contributing the code for this scanner.
56695 </para>
56696 </listitem></varlistentry>
56697 <varlistentry>
56698 <term><option>kavdaemon</option></term>
56699 <listitem>
56700 <para>
56701 <indexterm role="concept">
56702 <primary>virus scanners</primary>
56703 <secondary>Kaspersky</secondary>
56704 </indexterm>
56705 This is the scanner daemon of Kaspersky Version 4. This version of the
56706 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
56707 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
56708 For example:
56709 </para>
56710 <literallayout class="monospaced">
56711 av_scanner = kavdaemon:/opt/AVP/AvpCtl
56712 </literallayout>
56713 <para>
56714 The default path is <filename>/var/run/AvpCtl</filename>.
56715 </para>
56716 </listitem></varlistentry>
56717 <varlistentry>
56718 <term><option>mksd</option></term>
56719 <listitem>
56720 <para>
56721 <indexterm role="concept">
56722 <primary>virus scanners</primary>
56723 <secondary>mksd</secondary>
56724 </indexterm>
56725 This is a daemon type scanner that is aimed mainly at Polish users, though some
56726 parts of documentation are now available in English. You can get it at
56727 <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
56728 the maximum number of processes used simultaneously to scan the attachments,
56729 provided that the demime facility is employed and also provided that mksd has
56730 been run with at least the same number of child processes. For example:
56731 </para>
56732 <literallayout class="monospaced">
56733 av_scanner = mksd:2
56734 </literallayout>
56735 <para>
56736 You can safely omit this option (the default value is 1).
56737 </para>
56738 </listitem></varlistentry>
56739 <varlistentry>
56740 <term><option>sock</option></term>
56741 <listitem>
56742 <para>
56743 <indexterm role="concept">
56744 <primary>virus scanners</primary>
56745 <secondary>simple socket-connected</secondary>
56746 </indexterm>
56747 This is a general-purpose way of talking to simple scanner daemons
56748 running on the local machine.
56749 There are four options:
56750 an address (which may be an IP addres and port, or the path of a Unix socket),
56751 a commandline to send (may include a single %s which will be replaced with
56752 the path to the mail file to be scanned),
56753 an RE to trigger on from the returned data,
56754 an RE to extract malware_name from the returned data.
56755 For example:
56756 </para>
56757 <literallayout class="monospaced">
56758 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
56759 </literallayout>
56760 <para>
56761 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
56762 Default for the commandline is <filename>%s\n</filename>.
56763 Both regular-expressions are required.
56764 </para>
56765 </listitem></varlistentry>
56766 <varlistentry>
56767 <term><option>sophie</option></term>
56768 <listitem>
56769 <para>
56770 <indexterm role="concept">
56771 <primary>virus scanners</primary>
56772 <secondary>Sophos and Sophie</secondary>
56773 </indexterm>
56774 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
56775 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
56776 for this scanner type is the path to the UNIX socket that Sophie uses for
56777 client communication. For example:
56778 </para>
56779 <literallayout class="monospaced">
56780 av_scanner = sophie:/tmp/sophie
56781 </literallayout>
56782 <para>
56783 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
56784 the option.
56785 </para>
56786 </listitem></varlistentry>
56787 </variablelist>
56788 <para>
56789 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
56790 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
56791 ACL.
56792 </para>
56793 <para>
56794 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
56795 makes it possible to use different scanners. See further below for an example.
56796 The <option>malware</option> condition caches its results, so when you use it multiple times
56797 for the same message, the actual scanning process is only carried out once.
56798 However, using expandable items in <option>av_scanner</option> disables this caching, in
56799 which case each use of the <option>malware</option> condition causes a new scan of the
56800 message.
56801 </para>
56802 <para>
56803 The <option>malware</option> condition takes a right-hand argument that is expanded before
56804 use. It can then be one of
56805 </para>
56806 <itemizedlist>
56807 <listitem>
56808 <para>
56809 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
56810 The condition succeeds if a virus was found, and fail otherwise. This is the
56811 recommended usage.
56812 </para>
56813 </listitem>
56814 <listitem>
56815 <para>
56816 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
56817 the condition fails immediately.
56818 </para>
56819 </listitem>
56820 <listitem>
56821 <para>
56822 A regular expression, in which case the message is scanned for viruses. The
56823 condition succeeds if a virus is found and its name matches the regular
56824 expression. This allows you to take special actions on certain types of virus.
56825 </para>
56826 </listitem>
56827 </itemizedlist>
56828 <para>
56829 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
56830 even if there is a problem with the virus scanner. Otherwise, such a problem
56831 causes the ACL to defer.
56832 </para>
56833 <para>
56834 <indexterm role="variable">
56835 <primary><varname>$malware_name</varname></primary>
56836 </indexterm>
56837 When a virus is found, the condition sets up an expansion variable called
56838 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
56839 <option>message</option> modifier that specifies the error returned to the sender, and/or in
56840 logging data.
56841 </para>
56842 <para>
56843 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
56844 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
56845 <option>malware</option> condition.
56846 </para>
56847 <para>
56848 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
56849 imposed by your anti-virus scanner.
56850 </para>
56851 <para>
56852 Here is a very simple scanning example:
56853 </para>
56854 <literallayout class="monospaced">
56855 deny message = This message contains malware ($malware_name)
56856      demime = *
56857      malware = *
56858 </literallayout>
56859 <para>
56860 The next example accepts messages when there is a problem with the scanner:
56861 </para>
56862 <literallayout class="monospaced">
56863 deny message = This message contains malware ($malware_name)
56864      demime = *
56865      malware = */defer_ok
56866 </literallayout>
56867 <para>
56868 The next example shows how to use an ACL variable to scan with both sophie and
56869 aveserver. It assumes you have set:
56870 </para>
56871 <literallayout class="monospaced">
56872 av_scanner = $acl_m0
56873 </literallayout>
56874 <para>
56875 in the main Exim configuration.
56876 </para>
56877 <literallayout class="monospaced">
56878 deny message = This message contains malware ($malware_name)
56879      set acl_m0 = sophie
56880      malware = *
56881
56882 deny message = This message contains malware ($malware_name)
56883      set acl_m0 = aveserver
56884      malware = *
56885 </literallayout>
56886 </section>
56887 <section id="SECTscanspamass">
56888 <title>Scanning with SpamAssassin</title>
56889 <para>
56890 <indexterm role="concept">
56891 <primary>content scanning</primary>
56892 <secondary>for spam</secondary>
56893 </indexterm>
56894 <indexterm role="concept">
56895 <primary>spam scanning</primary>
56896 </indexterm>
56897 <indexterm role="concept">
56898 <primary>SpamAssassin</primary>
56899 </indexterm>
56900 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
56901 score and a report for the message. You can get SpamAssassin at
56902 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
56903 installation, you can use CPAN by running:
56904 </para>
56905 <literallayout class="monospaced">
56906 perl -MCPAN -e 'install Mail::SpamAssassin'
56907 </literallayout>
56908 <para>
56909 SpamAssassin has its own set of configuration files. Please review its
56910 documentation to see how you can tweak it. The default installation should work
56911 nicely, however.
56912 </para>
56913 <para>
56914 <indexterm role="option">
56915 <primary><option>spamd_address</option></primary>
56916 </indexterm>
56917 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
56918 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
56919 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
56920 part of the Exim configuration as follows (example):
56921 </para>
56922 <literallayout class="monospaced">
56923 spamd_address = 192.168.99.45 387
56924 </literallayout>
56925 <para>
56926 You do not need to set this option if you use the default. As of version 2.60,
56927 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
56928 these, supply <option>spamd_address</option> with an absolute file name instead of a
56929 address/port pair:
56930 </para>
56931 <literallayout class="monospaced">
56932 spamd_address = /var/run/spamd_socket
56933 </literallayout>
56934 <para>
56935 You can have multiple <option>spamd</option> servers to improve scalability. These can
56936 reside on other hardware reachable over the network. To specify multiple
56937 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
56938 option, separated with colons:
56939 </para>
56940 <literallayout class="monospaced">
56941 spamd_address = 192.168.2.10 783 : \
56942                 192.168.2.11 783 : \
56943                 192.168.2.12 783
56944 </literallayout>
56945 <para>
56946 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
56947 fashion. When a server fails to respond to the connection attempt, all other
56948 servers are tried until one succeeds. If no server responds, the <option>spam</option>
56949 condition defers.
56950 </para>
56951 <para>
56952 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
56953 multiple <option>spamd</option> servers.
56954 </para>
56955 <para>
56956 The <option>spamd_address</option> variable is expanded before use if it starts with
56957 a dollar sign. In this case, the expansion may return a string that is
56958 used as the list so that multiple spamd servers can be the result of an
56959 expansion.
56960 </para>
56961 </section>
56962 <section id="SECID206">
56963 <title>Calling SpamAssassin from an Exim ACL</title>
56964 <para>
56965 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
56966 </para>
56967 <literallayout class="monospaced">
56968 deny message = This message was classified as SPAM
56969      spam = joe
56970 </literallayout>
56971 <para>
56972 The right-hand side of the <option>spam</option> condition specifies a name. This is
56973 relevant if you have set up multiple SpamAssassin profiles. If you do not want
56974 to scan using a specific profile, but rather use the SpamAssassin system-wide
56975 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
56976 However, you must put something on the right-hand side.
56977 </para>
56978 <para>
56979 The name allows you to use per-domain or per-user antispam profiles in
56980 principle, but this is not straightforward in practice, because a message may
56981 have multiple recipients, not necessarily all in the same domain. Because the
56982 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
56983 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
56984 are not set.
56985 </para>
56986 <para>
56987 The right-hand side of the <option>spam</option> condition is expanded before being used, so
56988 you can put lookups or conditions there. When the right-hand side evaluates to
56989 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
56990 </para>
56991 <para>
56992 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
56993 large ones may cause significant performance degradation. As most spam messages
56994 are quite small, it is recommended that you do not scan the big ones. For
56995 example:
56996 </para>
56997 <literallayout class="monospaced">
56998 deny message = This message was classified as SPAM
56999      condition = ${if &lt; {$message_size}{10K}}
57000      spam = nobody
57001 </literallayout>
57002 <para>
57003 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
57004 SpamAssassin profile has been matched or exceeded. If you want to use the
57005 <option>spam</option> condition for its side effects (see the variables below), you can make
57006 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
57007 </para>
57008 <para>
57009 <indexterm role="concept">
57010 <primary>spam scanning</primary>
57011 <secondary>returned variables</secondary>
57012 </indexterm>
57013 When the <option>spam</option> condition is run, it sets up a number of expansion
57014 variables. These variables are saved with the received message, thus they are
57015 available for use at delivery time.
57016 </para>
57017 <variablelist>
57018 <varlistentry>
57019 <term><varname>$spam_score</varname></term>
57020 <listitem>
57021 <para>
57022 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
57023 for inclusion in log or reject messages.
57024 </para>
57025 </listitem></varlistentry>
57026 <varlistentry>
57027 <term><varname>$spam_score_int</varname></term>
57028 <listitem>
57029 <para>
57030 The spam score of the message, multiplied by ten, as an integer value. For
57031 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
57032 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
57033 The integer value is useful for numeric comparisons in conditions.
57034 </para>
57035 </listitem></varlistentry>
57036 <varlistentry>
57037 <term><varname>$spam_bar</varname></term>
57038 <listitem>
57039 <para>
57040 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
57041 integer part of the spam score value. A spam score of 4.4 would have a
57042 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
57043 headers, since MUAs can match on such strings.
57044 </para>
57045 </listitem></varlistentry>
57046 <varlistentry>
57047 <term><varname>$spam_report</varname></term>
57048 <listitem>
57049 <para>
57050 A multiline text table, containing the full SpamAssassin report for the
57051 message. Useful for inclusion in headers or reject messages.
57052 </para>
57053 </listitem></varlistentry>
57054 </variablelist>
57055 <para>
57056 The <option>spam</option> condition caches its results unless expansion in
57057 spamd_address was used. If you call it again with the same user name, it
57058 does not scan again, but rather returns the same values as before.
57059 </para>
57060 <para>
57061 The <option>spam</option> condition returns DEFER if there is any error while running
57062 the message through SpamAssassin or if the expansion of spamd_address
57063 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
57064 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
57065 spam condition, like this:
57066 </para>
57067 <literallayout class="monospaced">
57068 deny message = This message was classified as SPAM
57069      spam    = joe/defer_ok
57070 </literallayout>
57071 <para>
57072 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
57073 </para>
57074 <para>
57075 Here is a longer, commented example of the use of the <option>spam</option>
57076 condition:
57077 </para>
57078 <literallayout class="monospaced">
57079 # put headers in all messages (no matter if spam or not)
57080 warn  spam = nobody:true
57081       add_header = X-Spam-Score: $spam_score ($spam_bar)
57082       add_header = X-Spam-Report: $spam_report
57083
57084 # add second subject line with *SPAM* marker when message
57085 # is over threshold
57086 warn  spam = nobody
57087       add_header = Subject: *SPAM* $h_Subject:
57088
57089 # reject spam at high scores (&gt; 12)
57090 deny  message = This message scored $spam_score spam points.
57091       spam = nobody:true
57092       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
57093 </literallayout>
57094 </section>
57095 <section id="SECTscanmimepart">
57096 <title>Scanning MIME parts</title>
57097 <para>
57098 <indexterm role="concept">
57099 <primary>content scanning</primary>
57100 <secondary>MIME parts</secondary>
57101 </indexterm>
57102 <indexterm role="concept">
57103 <primary>MIME content scanning</primary>
57104 </indexterm>
57105 <indexterm role="option">
57106 <primary><option>acl_smtp_mime</option></primary>
57107 </indexterm>
57108 <indexterm role="option">
57109 <primary><option>acl_not_smtp_mime</option></primary>
57110 </indexterm>
57111 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
57112 each MIME part of an SMTP message, including multipart types, in the sequence
57113 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
57114 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
57115 options may both refer to the same ACL if you want the same processing in both
57116 cases.
57117 </para>
57118 <para>
57119 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
57120 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
57121 the case of a non-SMTP message. However, a MIME ACL is called only if the
57122 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
57123 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
57124 result code is sent to the client. In the case of an SMTP message, the
57125 <option>acl_smtp_data</option> ACL is not called when this happens.
57126 </para>
57127 <para>
57128 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
57129 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
57130 condition to match against the raw MIME part. You can also use the
57131 <option>mime_regex</option> condition to match against the decoded MIME part (see section
57132 <xref linkend="SECTscanregex"/>).
57133 </para>
57134 <para>
57135 At the start of a MIME ACL, a number of variables are set from the header
57136 information for the relevant MIME part. These are described below. The contents
57137 of the MIME part are not by default decoded into a disk file except for MIME
57138 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
57139 part into a disk file, you can use the <option>decode</option> condition. The general
57140 syntax is:
57141 </para>
57142 <literallayout>
57143 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
57144 </literallayout>
57145 <para>
57146 The right hand side is expanded before use. After expansion,
57147 the value can be:
57148 </para>
57149 <orderedlist numeration="arabic">
57150 <listitem>
57151 <para>
57152 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
57153 </para>
57154 </listitem>
57155 <listitem>
57156 <para>
57157 The string <quote>default</quote>. In that case, the file is put in the temporary
57158 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
57159 a sequential file name consisting of the message id and a sequence number. The
57160 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
57161 </para>
57162 </listitem>
57163 <listitem>
57164 <para>
57165 A full path name starting with a slash. If the full name is an existing
57166 directory, it is used as a replacement for the default directory. The filename
57167 is then sequentially assigned. If the path does not exist, it is used as
57168 the full path and file name.
57169 </para>
57170 </listitem>
57171 <listitem>
57172 <para>
57173 If the string does not start with a slash, it is used as the
57174 filename, and the default path is then used.
57175 </para>
57176 </listitem>
57177 </orderedlist>
57178 <para>
57179 The <option>decode</option> condition normally succeeds. It is only false for syntax
57180 errors or unusual circumstances such as memory shortages. You can easily decode
57181 a file with its original, proposed filename using
57182 </para>
57183 <literallayout class="monospaced">
57184 decode = $mime_filename
57185 </literallayout>
57186 <para>
57187 However, you should keep in mind that <varname>$mime_filename</varname> might contain
57188 anything. If you place files outside of the default path, they are not
57189 automatically unlinked.
57190 </para>
57191 <para>
57192 For RFC822 attachments (these are messages attached to messages, with a
57193 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
57194 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
57195 variable is set (see below). Attached messages are always decoded to disk
57196 before being checked, and the files are unlinked once the check is done.
57197 </para>
57198 <para>
57199 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
57200 used to match regular expressions against raw and decoded MIME parts,
57201 respectively. They are described in section <xref linkend="SECTscanregex"/>.
57202 </para>
57203 <para>
57204 <indexterm role="concept">
57205 <primary>MIME content scanning</primary>
57206 <secondary>returned variables</secondary>
57207 </indexterm>
57208 The following list describes all expansion variables that are
57209 available in the MIME ACL:
57210 </para>
57211 <variablelist>
57212 <varlistentry>
57213 <term><varname>$mime_boundary</varname></term>
57214 <listitem>
57215 <para>
57216 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
57217 have a boundary string, which is stored in this variable. If the current part
57218 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
57219 contains the empty string.
57220 </para>
57221 </listitem></varlistentry>
57222 <varlistentry>
57223 <term><varname>$mime_charset</varname></term>
57224 <listitem>
57225 <para>
57226 This variable contains the character set identifier, if one was found in the
57227 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
57228 </para>
57229 <literallayout class="monospaced">
57230 us-ascii
57231 gb2312 (Chinese)
57232 iso-8859-1
57233 </literallayout>
57234 <para>
57235 Please note that this value is not normalized, so you should do matches
57236 case-insensitively.
57237 </para>
57238 </listitem></varlistentry>
57239 <varlistentry>
57240 <term><varname>$mime_content_description</varname></term>
57241 <listitem>
57242 <para>
57243 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
57244 header. It can contain a human-readable description of the parts content. Some
57245 implementations repeat the filename for attachments here, but they are usually
57246 only used for display purposes.
57247 </para>
57248 </listitem></varlistentry>
57249 <varlistentry>
57250 <term><varname>$mime_content_disposition</varname></term>
57251 <listitem>
57252 <para>
57253 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
57254 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
57255 </para>
57256 </listitem></varlistentry>
57257 <varlistentry>
57258 <term><varname>$mime_content_id</varname></term>
57259 <listitem>
57260 <para>
57261 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
57262 This is a unique ID that can be used to reference a part from another part.
57263 </para>
57264 </listitem></varlistentry>
57265 <varlistentry>
57266 <term><varname>$mime_content_size</varname></term>
57267 <listitem>
57268 <para>
57269 This variable is set only after the <option>decode</option> modifier (see above) has been
57270 successfully run. It contains the size of the decoded part in kilobytes. The
57271 size is always rounded up to full kilobytes, so only a completely empty part
57272 has a <varname>$mime_content_size</varname> of zero.
57273 </para>
57274 </listitem></varlistentry>
57275 <varlistentry>
57276 <term><varname>$mime_content_transfer_encoding</varname></term>
57277 <listitem>
57278 <para>
57279 This variable contains the normalized content of the
57280 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
57281 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
57282 </para>
57283 </listitem></varlistentry>
57284 <varlistentry>
57285 <term><varname>$mime_content_type</varname></term>
57286 <listitem>
57287 <para>
57288 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
57289 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
57290 are some examples of popular MIME types, as they may appear in this variable:
57291 </para>
57292 <literallayout class="monospaced">
57293 text/plain
57294 text/html
57295 application/octet-stream
57296 image/jpeg
57297 audio/midi
57298 </literallayout>
57299 <para>
57300 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
57301 empty string.
57302 </para>
57303 </listitem></varlistentry>
57304 <varlistentry>
57305 <term><varname>$mime_decoded_filename</varname></term>
57306 <listitem>
57307 <para>
57308 This variable is set only after the <option>decode</option> modifier (see above) has been
57309 successfully run. It contains the full path and file name of the file
57310 containing the decoded data.
57311 </para>
57312 </listitem></varlistentry>
57313 </variablelist>
57314 <para>
57315 <indexterm role="concept">
57316 <primary>RFC 2047</primary>
57317 </indexterm>
57318 </para>
57319 <variablelist>
57320 <varlistentry>
57321 <term><varname>$mime_filename</varname></term>
57322 <listitem>
57323 <para>
57324 This is perhaps the most important of the MIME variables. It contains a
57325 proposed filename for an attachment, if one was found in either the
57326 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
57327 RFC2047 decoded, but no additional sanity checks are done. If no filename was
57328 found, this variable contains the empty string.
57329 </para>
57330 </listitem></varlistentry>
57331 <varlistentry>
57332 <term><varname>$mime_is_coverletter</varname></term>
57333 <listitem>
57334 <para>
57335 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
57336 attached data. It can be used to clamp down on flashy or unnecessarily encoded
57337 content in the cover letter, while not restricting attachments at all.
57338 </para>
57339 <para>
57340 The variable contains 1 (true) for a MIME part believed to be part of the
57341 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
57342 follows:
57343 </para>
57344 <orderedlist numeration="arabic">
57345 <listitem>
57346 <para>
57347 The outermost MIME part of a message is always a cover letter.
57348 </para>
57349 </listitem>
57350 <listitem>
57351 <para>
57352 If a multipart/alternative or multipart/related MIME part is a cover letter,
57353 so are all MIME subparts within that multipart.
57354 </para>
57355 </listitem>
57356 <listitem>
57357 <para>
57358 If any other multipart is a cover letter, the first subpart is a cover letter,
57359 and the rest are attachments.
57360 </para>
57361 </listitem>
57362 <listitem>
57363 <para>
57364 All parts contained within an attachment multipart are attachments.
57365 </para>
57366 </listitem>
57367 </orderedlist>
57368 <para>
57369 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
57370 alternative plain text), while allowing HTML files to be attached. HTML
57371 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
57372 </para>
57373 <literallayout class="monospaced">
57374 deny message = HTML mail is not accepted here
57375 !condition = $mime_is_rfc822
57376 condition = $mime_is_coverletter
57377 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
57378 </literallayout>
57379 </listitem></varlistentry>
57380 <varlistentry>
57381 <term><varname>$mime_is_multipart</varname></term>
57382 <listitem>
57383 <para>
57384 This variable has the value 1 (true) when the current part has the main type
57385 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
57386 Since multipart entities only serve as containers for other parts, you may not
57387 want to carry out specific actions on them.
57388 </para>
57389 </listitem></varlistentry>
57390 <varlistentry>
57391 <term><varname>$mime_is_rfc822</varname></term>
57392 <listitem>
57393 <para>
57394 This variable has the value 1 (true) if the current part is not a part of the
57395 checked message itself, but part of an attached message. Attached message
57396 decoding is fully recursive.
57397 </para>
57398 </listitem></varlistentry>
57399 <varlistentry>
57400 <term><varname>$mime_part_count</varname></term>
57401 <listitem>
57402 <para>
57403 This variable is a counter that is raised for each processed MIME part. It
57404 starts at zero for the very first part (which is usually a multipart). The
57405 counter is per-message, so it is reset when processing RFC822 attachments (see
57406 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
57407 complete, so you can use it in the DATA ACL to determine the number of MIME
57408 parts of a message. For non-MIME messages, this variable contains the value -1.
57409 </para>
57410 </listitem></varlistentry>
57411 </variablelist>
57412 </section>
57413 <section id="SECTscanregex">
57414 <title>Scanning with regular expressions</title>
57415 <para>
57416 <indexterm role="concept">
57417 <primary>content scanning</primary>
57418 <secondary>with regular expressions</secondary>
57419 </indexterm>
57420 <indexterm role="concept">
57421 <primary>regular expressions</primary>
57422 <secondary>content scanning with</secondary>
57423 </indexterm>
57424 You can specify your own custom regular expression matches on the full body of
57425 the message, or on individual MIME parts.
57426 </para>
57427 <para>
57428 The <option>regex</option> condition takes one or more regular expressions as arguments and
57429 matches them against the full message (when called in the DATA ACL) or a raw
57430 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
57431 linewise, with a maximum line length of 32K characters. That means you cannot
57432 have multiline matches with the <option>regex</option> condition.
57433 </para>
57434 <para>
57435 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
57436 to 32K of decoded content (the whole content at once, not linewise). If the
57437 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
57438 is decoded automatically when <option>mime_regex</option> is executed (using default path
57439 and filename values). If the decoded data is larger than  32K, only the first
57440 32K characters are checked.
57441 </para>
57442 <para>
57443 The regular expressions are passed as a colon-separated list. To include a
57444 literal colon, you must double it. Since the whole right-hand side string is
57445 expanded before being used, you must also escape dollar signs and backslashes
57446 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
57447 Here is a simple example that contains two regular expressions:
57448 </para>
57449 <literallayout class="monospaced">
57450 deny message = contains blacklisted regex ($regex_match_string)
57451      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
57452 </literallayout>
57453 <para>
57454 The conditions returns true if any one of the regular expressions matches. The
57455 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
57456 matching regular expression.
57457 </para>
57458 <para>
57459 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
57460 CPU-intensive.
57461 </para>
57462 </section>
57463 <section id="SECTdemimecond">
57464 <title>The demime condition</title>
57465 <para>
57466 <indexterm role="concept">
57467 <primary>content scanning</primary>
57468 <secondary>MIME checking</secondary>
57469 </indexterm>
57470 <indexterm role="concept">
57471 <primary>MIME content scanning</primary>
57472 </indexterm>
57473 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
57474 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
57475 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
57476 ACL functionality, but provides no additional facilities. Please note that this
57477 condition is deprecated and kept only for backward compatibility. You must set
57478 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
57479 use the <option>demime</option> condition.
57480 </para>
57481 <para>
57482 The <option>demime</option> condition unpacks MIME containers in the message. It detects
57483 errors in MIME containers and can match file extensions found in the message
57484 against a list. Using this facility produces files containing the unpacked MIME
57485 parts of the message in the temporary scan directory. If you do antivirus
57486 scanning, it is recommended that you use the <option>demime</option> condition before the
57487 antivirus (<option>malware</option>) condition.
57488 </para>
57489 <para>
57490 On the right-hand side of the <option>demime</option> condition you can pass a
57491 colon-separated list of file extensions that it should match against. For
57492 example:
57493 </para>
57494 <literallayout class="monospaced">
57495 deny message = Found blacklisted file attachment
57496      demime  = vbs:com:bat:pif:prf:lnk
57497 </literallayout>
57498 <para>
57499 If one of the file extensions is found, the condition is true, otherwise it is
57500 false. If there is a temporary error while demimeing (for example, <quote>disk
57501 full</quote>), the condition defers, and the message is temporarily rejected (unless
57502 the condition is on a <option>warn</option> verb).
57503 </para>
57504 <para>
57505 The right-hand side is expanded before being treated as a list, so you can have
57506 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
57507 zero (<quote>0</quote>), no demimeing is done and the condition is false.
57508 </para>
57509 <para>
57510 The <option>demime</option> condition set the following variables:
57511 </para>
57512 <variablelist>
57513 <varlistentry>
57514 <term><varname>$demime_errorlevel</varname></term>
57515 <listitem>
57516 <para>
57517 <indexterm role="variable">
57518 <primary><varname>$demime_errorlevel</varname></primary>
57519 </indexterm>
57520 When an error is detected in a MIME container, this variable contains the
57521 severity of the error, as an integer number. The higher the value, the more
57522 severe the error (the current maximum value is 3). If this variable is unset or
57523 zero, no error occurred.
57524 </para>
57525 </listitem></varlistentry>
57526 <varlistentry>
57527 <term><varname>$demime_reason</varname></term>
57528 <listitem>
57529 <para>
57530 <indexterm role="variable">
57531 <primary><varname>$demime_reason</varname></primary>
57532 </indexterm>
57533 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
57534 human-readable text string describing the MIME error that occurred.
57535 </para>
57536 </listitem></varlistentry>
57537 </variablelist>
57538 <variablelist>
57539 <varlistentry>
57540 <term><varname>$found_extension</varname></term>
57541 <listitem>
57542 <para>
57543 <indexterm role="variable">
57544 <primary><varname>$found_extension</varname></primary>
57545 </indexterm>
57546 When the <option>demime</option> condition is true, this variable contains the file
57547 extension it found.
57548 </para>
57549 </listitem></varlistentry>
57550 </variablelist>
57551 <para>
57552 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
57553 the <option>demime</option> condition, and are not changed on subsequent calls.
57554 </para>
57555 <para>
57556 If you do not want to check for file extensions, but rather use the <option>demime</option>
57557 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
57558 right-hand side value. Here is a more elaborate example of how to use this
57559 facility:
57560 </para>
57561 <literallayout class="monospaced">
57562 # Reject messages with serious MIME container errors
57563 deny  message = Found MIME error ($demime_reason).
57564       demime = *
57565       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
57566
57567 # Reject known virus spreading file extensions.
57568 # Accepting these is pretty much braindead.
57569 deny  message = contains $found_extension file (blacklisted).
57570       demime  = com:vbs:bat:pif:scr
57571
57572 # Freeze .exe and .doc files. Postmaster can
57573 # examine them and eventually thaw them.
57574 deny  log_message = Another $found_extension file.
57575       demime = exe:doc
57576       control = freeze
57577 </literallayout>
57578 <para>
57579 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
57580 </para>
57581 </section>
57582 </chapter>
57583
57584 <chapter id="CHAPlocalscan">
57585 <title>Adding a local scan function to Exim</title>
57586 <titleabbrev>Local scan function</titleabbrev>
57587 <para>
57588 <indexterm role="concept" id="IIDlosca" class="startofrange">
57589 <primary><function>local_scan()</function> function</primary>
57590 <secondary>description of</secondary>
57591 </indexterm>
57592 <indexterm role="concept">
57593 <primary>customizing</primary>
57594 <secondary>input scan using C function</secondary>
57595 </indexterm>
57596 <indexterm role="concept">
57597 <primary>policy control</primary>
57598 <secondary>by local scan function</secondary>
57599 </indexterm>
57600 In these days of email worms, viruses, and ever-increasing spam, some sites
57601 want to apply a lot of checking to messages before accepting them.
57602 </para>
57603 <para>
57604 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
57605 passing messages to external virus and spam scanning software. You can also do
57606 a certain amount in Exim itself through string expansions and the <option>condition</option>
57607 condition in the ACL that runs after the SMTP DATA command or the ACL for
57608 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
57609 </para>
57610 <para>
57611 To allow for further customization to a site&#x2019;s own requirements, there is the
57612 possibility of linking Exim with a private message scanning function, written
57613 in C. If you want to run code that is written in something other than C, you
57614 can of course use a little C stub to call it.
57615 </para>
57616 <para>
57617 The local scan function is run once for every incoming message, at the point
57618 when Exim is just about to accept the message.
57619 It can therefore be used to control non-SMTP messages from local processes as
57620 well as messages arriving via SMTP.
57621 </para>
57622 <para>
57623 Exim applies a timeout to calls of the local scan function, and there is an
57624 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
57625 Zero means <quote>no timeout</quote>.
57626 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
57627 before calling the local scan function, so that the most common types of crash
57628 are caught. If the timeout is exceeded or one of those signals is caught, the
57629 incoming message is rejected with a temporary error if it is an SMTP message.
57630 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
57631 code. The incident is logged on the main and reject logs.
57632 </para>
57633 <section id="SECID207">
57634 <title>Building Exim to use a local scan function</title>
57635 <para>
57636 <indexterm role="concept">
57637 <primary><function>local_scan()</function> function</primary>
57638 <secondary>building Exim to use</secondary>
57639 </indexterm>
57640 To make use of the local scan function feature, you must tell Exim where your
57641 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
57642 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
57643 directory, so you might set
57644 </para>
57645 <literallayout class="monospaced">
57646 LOCAL_SCAN_SOURCE=Local/local_scan.c
57647 </literallayout>
57648 <para>
57649 for example. The function must be called <function>local_scan()</function>. It is called by
57650 Exim after it has received a message, when the success return code is about to
57651 be sent. This is after all the ACLs have been run. The return code from your
57652 function controls whether the message is actually accepted or not. There is a
57653 commented template function (that just accepts the message) in the file
57654 _src/local_scan.c_.
57655 </para>
57656 <para>
57657 If you want to make use of Exim&#x2019;s run time configuration file to set options
57658 for your <function>local_scan()</function> function, you must also set
57659 </para>
57660 <literallayout class="monospaced">
57661 LOCAL_SCAN_HAS_OPTIONS=yes
57662 </literallayout>
57663 <para>
57664 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
57665 </para>
57666 </section>
57667 <section id="SECTapiforloc">
57668 <title>API for local_scan()</title>
57669 <para>
57670 <indexterm role="concept">
57671 <primary><function>local_scan()</function> function</primary>
57672 <secondary>API description</secondary>
57673 </indexterm>
57674 You must include this line near the start of your code:
57675 </para>
57676 <literallayout class="monospaced">
57677 #include "local_scan.h"
57678 </literallayout>
57679 <para>
57680 This header file defines a number of variables and other values, and the
57681 prototype for the function itself. Exim is coded to use unsigned char values
57682 almost exclusively, and one of the things this header defines is a shorthand
57683 for <literal>unsigned char</literal> called <literal>uschar</literal>.
57684 It also contains the following macro definitions, to simplify casting character
57685 strings and pointers to character strings:
57686 </para>
57687 <literallayout class="monospaced">
57688 #define CS   (char *)
57689 #define CCS  (const char *)
57690 #define CSS  (char **)
57691 #define US   (unsigned char *)
57692 #define CUS  (const unsigned char *)
57693 #define USS  (unsigned char **)
57694 </literallayout>
57695 <para>
57696 The function prototype for <function>local_scan()</function> is:
57697 </para>
57698 <literallayout class="monospaced">
57699 extern int local_scan(int fd, uschar **return_text);
57700 </literallayout>
57701 <para>
57702 The arguments are as follows:
57703 </para>
57704 <itemizedlist>
57705 <listitem>
57706 <para>
57707 <option>fd</option> is a file descriptor for the file that contains the body of the message
57708 (the -D file). The file is open for reading and writing, but updating it is not
57709 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
57710 </para>
57711 <para>
57712 The descriptor is positioned at character 19 of the file, which is the first
57713 character of the body itself, because the first 19 characters are the message
57714 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
57715 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
57716 case this changes in some future version.
57717 </para>
57718 </listitem>
57719 <listitem>
57720 <para>
57721 <option>return_text</option> is an address which you can use to return a pointer to a text
57722 string at the end of the function. The value it points to on entry is NULL.
57723 </para>
57724 </listitem>
57725 </itemizedlist>
57726 <para>
57727 The function must return an <option>int</option> value which is one of the following macros:
57728 </para>
57729 <variablelist>
57730 <varlistentry>
57731 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
57732 <listitem>
57733 <para>
57734 <indexterm role="variable">
57735 <primary><varname>$local_scan_data</varname></primary>
57736 </indexterm>
57737 The message is accepted. If you pass back a string of text, it is saved with
57738 the message, and made available in the variable <varname>$local_scan_data</varname>. No
57739 newlines are permitted (if there are any, they are turned into spaces) and the
57740 maximum length of text is 1000 characters.
57741 </para>
57742 </listitem></varlistentry>
57743 <varlistentry>
57744 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
57745 <listitem>
57746 <para>
57747 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57748 queued without immediate delivery, and is frozen.
57749 </para>
57750 </listitem></varlistentry>
57751 <varlistentry>
57752 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
57753 <listitem>
57754 <para>
57755 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
57756 queued without immediate delivery.
57757 </para>
57758 </listitem></varlistentry>
57759 <varlistentry>
57760 <term><literal>LOCAL_SCAN_REJECT</literal></term>
57761 <listitem>
57762 <para>
57763 The message is rejected; the returned text is used as an error message which is
57764 passed back to the sender and which is also logged. Newlines are permitted &ndash;
57765 they cause a multiline response for SMTP rejections, but are converted to
57766 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
57767 used.
57768 </para>
57769 </listitem></varlistentry>
57770 <varlistentry>
57771 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
57772 <listitem>
57773 <para>
57774 The message is temporarily rejected; the returned text is used as an error
57775 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
57776 problem</quote> is used.
57777 </para>
57778 </listitem></varlistentry>
57779 <varlistentry>
57780 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
57781 <listitem>
57782 <para>
57783 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
57784 message is not written to the reject log. It has the effect of unsetting the
57785 <option>rejected_header</option> log selector for just this rejection. If
57786 <option>rejected_header</option> is already unset (see the discussion of the
57787 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
57788 same as LOCAL_SCAN_REJECT.
57789 </para>
57790 </listitem></varlistentry>
57791 <varlistentry>
57792 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
57793 <listitem>
57794 <para>
57795 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
57796 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
57797 </para>
57798 </listitem></varlistentry>
57799 </variablelist>
57800 <para>
57801 If the message is not being received by interactive SMTP, rejections are
57802 reported by writing to <option>stderr</option> or by sending an email, as configured by the
57803 <option>-oe</option> command line options.
57804 </para>
57805 </section>
57806 <section id="SECTconoptloc">
57807 <title>Configuration options for local_scan()</title>
57808 <para>
57809 <indexterm role="concept">
57810 <primary><function>local_scan()</function> function</primary>
57811 <secondary>configuration options</secondary>
57812 </indexterm>
57813 It is possible to have option settings in the main configuration file
57814 that set values in static variables in the <function>local_scan()</function> module. If you
57815 want to do this, you must have the line
57816 </para>
57817 <literallayout class="monospaced">
57818 LOCAL_SCAN_HAS_OPTIONS=yes
57819 </literallayout>
57820 <para>
57821 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
57822 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
57823 file, you must define static variables to hold the option values, and a table
57824 to define them.
57825 </para>
57826 <para>
57827 The table must be a vector called <option>local_scan_options</option>, of type
57828 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
57829 and a pointer to the variable that holds the value. The entries must appear in
57830 alphabetical order. Following <option>local_scan_options</option> you must also define a
57831 variable called <option>local_scan_options_count</option> that contains the number of
57832 entries in the table. Here is a short example, showing two kinds of option:
57833 </para>
57834 <literallayout class="monospaced">
57835 static int my_integer_option = 42;
57836 static uschar *my_string_option = US"a default string";
57837
57838 optionlist local_scan_options[] = {
57839   { "my_integer", opt_int,       &amp;my_integer_option },
57840   { "my_string",  opt_stringptr, &amp;my_string_option }
57841 };
57842
57843 int local_scan_options_count =
57844   sizeof(local_scan_options)/sizeof(optionlist);
57845 </literallayout>
57846 <para>
57847 The values of the variables can now be changed from Exim&#x2019;s runtime
57848 configuration file by including a local scan section as in this example:
57849 </para>
57850 <literallayout class="monospaced">
57851 begin local_scan
57852 my_integer = 99
57853 my_string = some string of text...
57854 </literallayout>
57855 <para>
57856 The available types of option data are as follows:
57857 </para>
57858 <variablelist>
57859 <varlistentry>
57860 <term><emphasis role="bold">opt_bool</emphasis></term>
57861 <listitem>
57862 <para>
57863 This specifies a boolean (true/false) option. The address should point to a
57864 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
57865 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
57866 whether such a variable has been set at all, you can initialize it to
57867 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
57868 values.)
57869 </para>
57870 </listitem></varlistentry>
57871 <varlistentry>
57872 <term><emphasis role="bold">opt_fixed</emphasis></term>
57873 <listitem>
57874 <para>
57875 This specifies a fixed point number, such as is used for load averages.
57876 The address should point to a variable of type <literal>int</literal>. The value is stored
57877 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
57878 </para>
57879 </listitem></varlistentry>
57880 <varlistentry>
57881 <term><emphasis role="bold">opt_int</emphasis></term>
57882 <listitem>
57883 <para>
57884 This specifies an integer; the address should point to a variable of type
57885 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
57886 Exim.
57887 </para>
57888 </listitem></varlistentry>
57889 <varlistentry>
57890 <term><emphasis role="bold">opt_mkint</emphasis></term>
57891 <listitem>
57892 <para>
57893 This is the same as <option>opt_int</option>, except that when such a value is output in a
57894 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
57895 printed with the suffix K or M.
57896 </para>
57897 </listitem></varlistentry>
57898 <varlistentry>
57899 <term><emphasis role="bold">opt_octint</emphasis></term>
57900 <listitem>
57901 <para>
57902 This also specifies an integer, but the value is always interpreted as an
57903 octal integer, whether or not it starts with the digit zero, and it is
57904 always output in octal.
57905 </para>
57906 </listitem></varlistentry>
57907 <varlistentry>
57908 <term><emphasis role="bold">opt_stringptr</emphasis></term>
57909 <listitem>
57910 <para>
57911 This specifies a string value; the address must be a pointer to a
57912 variable that points to a string (for example, of type <literal>uschar *</literal>).
57913 </para>
57914 </listitem></varlistentry>
57915 <varlistentry>
57916 <term><emphasis role="bold">opt_time</emphasis></term>
57917 <listitem>
57918 <para>
57919 This specifies a time interval value. The address must point to a variable of
57920 type <literal>int</literal>. The value that is placed there is a number of seconds.
57921 </para>
57922 </listitem></varlistentry>
57923 </variablelist>
57924 <para>
57925 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
57926 out the values of all the <function>local_scan()</function> options.
57927 </para>
57928 </section>
57929 <section id="SECID208">
57930 <title>Available Exim variables</title>
57931 <para>
57932 <indexterm role="concept">
57933 <primary><function>local_scan()</function> function</primary>
57934 <secondary>available Exim variables</secondary>
57935 </indexterm>
57936 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
57937 are the only ones that are guaranteed to be maintained from release to release.
57938 Note, however, that you can obtain the value of any Exim expansion variable,
57939 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
57940 C variables are as follows:
57941 </para>
57942 <variablelist>
57943 <varlistentry>
57944 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
57945 <listitem>
57946 <para>
57947 This variable contains the number of lines in the message&#x2019;s body.
57948 </para>
57949 </listitem></varlistentry>
57950 <varlistentry>
57951 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
57952 <listitem>
57953 <para>
57954 This variable contains the number of binary zero bytes in the message&#x2019;s body.
57955 </para>
57956 </listitem></varlistentry>
57957 <varlistentry>
57958 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
57959 <listitem>
57960 <para>
57961 This variable is set to zero when no debugging is taking place. Otherwise, it
57962 is a bitmap of debugging selectors. Two bits are identified for use in
57963 <function>local_scan()</function>; they are defined as macros:
57964 </para>
57965 <itemizedlist>
57966 <listitem>
57967 <para>
57968 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
57969 testing option that is not privileged &ndash; any caller may set it. All the
57970 other selector bits can be set only by admin users.
57971 </para>
57972 </listitem>
57973 <listitem>
57974 <para>
57975 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
57976 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
57977 of debugging bits.
57978 </para>
57979 </listitem>
57980 </itemizedlist>
57981 <para>
57982 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
57983 selected, you should use code like this:
57984 </para>
57985 <literallayout class="monospaced">
57986 if ((debug_selector &amp; D_local_scan) != 0)
57987   debug_printf("xxx", ...);
57988 </literallayout>
57989 </listitem></varlistentry>
57990 <varlistentry>
57991 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
57992 <listitem>
57993 <para>
57994 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
57995 variable <option>expand_string_message</option> contains the error message, zero-terminated.
57996 </para>
57997 </listitem></varlistentry>
57998 <varlistentry>
57999 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
58000 <listitem>
58001 <para>
58002 A pointer to a chain of header lines. The <option>header_line</option> structure is
58003 discussed below.
58004 </para>
58005 </listitem></varlistentry>
58006 <varlistentry>
58007 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
58008 <listitem>
58009 <para>
58010 A pointer to the last of the header lines.
58011 </para>
58012 </listitem></varlistentry>
58013 <varlistentry>
58014 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
58015 <listitem>
58016 <para>
58017 The value of the <option>headers_charset</option> configuration option.
58018 </para>
58019 </listitem></varlistentry>
58020 <varlistentry>
58021 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
58022 <listitem>
58023 <para>
58024 This variable is TRUE during a host checking session that is initiated by the
58025 <option>-bh</option> command line option.
58026 </para>
58027 </listitem></varlistentry>
58028 <varlistentry>
58029 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
58030 <listitem>
58031 <para>
58032 The IP address of the interface that received the message, as a string. This
58033 is NULL for locally submitted messages.
58034 </para>
58035 </listitem></varlistentry>
58036 <varlistentry>
58037 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
58038 <listitem>
58039 <para>
58040 The port on which this message was received. When testing with the <option>-bh</option>
58041 command line option, the value of this variable is -1 unless a port has been
58042 specified via the <option>-oMi</option> option.
58043 </para>
58044 </listitem></varlistentry>
58045 <varlistentry>
58046 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
58047 <listitem>
58048 <para>
58049 This variable contains Exim&#x2019;s message id for the incoming message (the value of
58050 <varname>$message_exim_id</varname>) as a zero-terminated string.
58051 </para>
58052 </listitem></varlistentry>
58053 <varlistentry>
58054 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
58055 <listitem>
58056 <para>
58057 The name of the protocol by which the message was received.
58058 </para>
58059 </listitem></varlistentry>
58060 <varlistentry>
58061 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
58062 <listitem>
58063 <para>
58064 The number of accepted recipients.
58065 </para>
58066 </listitem></varlistentry>
58067 <varlistentry>
58068 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
58069 <listitem>
58070 <para>
58071 <indexterm role="concept">
58072 <primary>recipient</primary>
58073 <secondary>adding in local scan</secondary>
58074 </indexterm>
58075 <indexterm role="concept">
58076 <primary>recipient</primary>
58077 <secondary>removing in local scan</secondary>
58078 </indexterm>
58079 The list of accepted recipients, held in a vector of length
58080 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
58081 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
58082 below). You can delete recipients by removing them from the vector and
58083 adjusting the value in <option>recipients_count</option>. In particular, by setting
58084 <option>recipients_count</option> to zero you remove all recipients. If you then return the
58085 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
58086 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
58087 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
58088 </para>
58089 </listitem></varlistentry>
58090 <varlistentry>
58091 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
58092 <listitem>
58093 <para>
58094 The envelope sender address. For bounce messages this is the empty string.
58095 </para>
58096 </listitem></varlistentry>
58097 <varlistentry>
58098 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
58099 <listitem>
58100 <para>
58101 The IP address of the sending host, as a string. This is NULL for
58102 locally-submitted messages.
58103 </para>
58104 </listitem></varlistentry>
58105 <varlistentry>
58106 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
58107 <listitem>
58108 <para>
58109 The name of the authentication mechanism that was used, or NULL if the message
58110 was not received over an authenticated SMTP connection.
58111 </para>
58112 </listitem></varlistentry>
58113 <varlistentry>
58114 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
58115 <listitem>
58116 <para>
58117 The name of the sending host, if known.
58118 </para>
58119 </listitem></varlistentry>
58120 <varlistentry>
58121 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
58122 <listitem>
58123 <para>
58124 The port on the sending host.
58125 </para>
58126 </listitem></varlistentry>
58127 <varlistentry>
58128 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
58129 <listitem>
58130 <para>
58131 This variable is TRUE for all SMTP input, including BSMTP.
58132 </para>
58133 </listitem></varlistentry>
58134 <varlistentry>
58135 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
58136 <listitem>
58137 <para>
58138 This variable is TRUE for BSMTP input.
58139 </para>
58140 </listitem></varlistentry>
58141 <varlistentry>
58142 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
58143 <listitem>
58144 <para>
58145 The contents of this variable control which pool of memory is used for new
58146 requests. See section <xref linkend="SECTmemhanloc"/> for details.
58147 </para>
58148 </listitem></varlistentry>
58149 </variablelist>
58150 </section>
58151 <section id="SECID209">
58152 <title>Structure of header lines</title>
58153 <para>
58154 The <option>header_line</option> structure contains the members listed below.
58155 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
58156 (see below). You can cause header lines to be ignored (deleted) by setting
58157 their type to *.
58158 </para>
58159 <variablelist>
58160 <varlistentry>
58161 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
58162 <listitem>
58163 <para>
58164 A pointer to the next header line, or NULL for the last line.
58165 </para>
58166 </listitem></varlistentry>
58167 <varlistentry>
58168 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
58169 <listitem>
58170 <para>
58171 A code identifying certain headers that Exim recognizes. The codes are printing
58172 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
58173 Notice in particular that any header line whose type is * is not transmitted
58174 with the message. This flagging is used for header lines that have been
58175 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
58176 lines.) Effectively, * means <quote>deleted</quote>.
58177 </para>
58178 </listitem></varlistentry>
58179 <varlistentry>
58180 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
58181 <listitem>
58182 <para>
58183 The number of characters in the header line, including the terminating and any
58184 internal newlines.
58185 </para>
58186 </listitem></varlistentry>
58187 <varlistentry>
58188 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
58189 <listitem>
58190 <para>
58191 A pointer to the text of the header. It always ends with a newline, followed by
58192 a zero byte. Internal newlines are preserved.
58193 </para>
58194 </listitem></varlistentry>
58195 </variablelist>
58196 </section>
58197 <section id="SECID210">
58198 <title>Structure of recipient items</title>
58199 <para>
58200 The <option>recipient_item</option> structure contains these members:
58201 </para>
58202 <variablelist>
58203 <varlistentry>
58204 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
58205 <listitem>
58206 <para>
58207 This is a pointer to the recipient address as it was received.
58208 </para>
58209 </listitem></varlistentry>
58210 <varlistentry>
58211 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
58212 <listitem>
58213 <para>
58214 This is used in later Exim processing when top level addresses are created by
58215 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
58216 and must always contain -1 at this stage.
58217 </para>
58218 </listitem></varlistentry>
58219 <varlistentry>
58220 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
58221 <listitem>
58222 <para>
58223 If this value is not NULL, bounce messages caused by failing to deliver to the
58224 recipient are sent to the address it contains. In other words, it overrides the
58225 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
58226 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
58227 an unqualified address, Exim qualifies it using the domain from
58228 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
58229 is NULL for all recipients.
58230 </para>
58231 </listitem></varlistentry>
58232 </variablelist>
58233 </section>
58234 <section id="SECID211">
58235 <title>Available Exim functions</title>
58236 <para>
58237 <indexterm role="concept">
58238 <primary><function>local_scan()</function> function</primary>
58239 <secondary>available Exim functions</secondary>
58240 </indexterm>
58241 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
58242 These are the only ones that are guaranteed to be maintained from release to
58243 release:
58244 </para>
58245 <variablelist>
58246 <varlistentry>
58247 <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>
58248 <listitem>
58249 <para>
58250 This function creates a child process that runs the command specified by
58251 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
58252 be NULL if no environment variables are to be passed. A new umask is supplied
58253 for the process in <option>newumask</option>.
58254 </para>
58255 <para>
58256 Pipes to the standard input and output of the new process are set up
58257 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
58258 standard error is cloned to the standard output. If there are any file
58259 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
58260 argument is TRUE, the new process is made into a process group leader.
58261 </para>
58262 <para>
58263 The function returns the pid of the new process, or -1 if things go wrong.
58264 </para>
58265 </listitem></varlistentry>
58266 <varlistentry>
58267 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
58268 <listitem>
58269 <para>
58270 This function waits for a child process to terminate, or for a timeout (in
58271 seconds) to expire. A timeout value of zero means wait as long as it takes. The
58272 return value is as follows:
58273 </para>
58274 <itemizedlist>
58275 <listitem>
58276 <para>
58277 &gt;= 0
58278 </para>
58279 <para>
58280 The process terminated by a normal exit and the value is the process
58281 ending status.
58282 </para>
58283 </listitem>
58284 <listitem>
58285 <para>
58286 &lt; 0 and &gt; &ndash;256
58287 </para>
58288 <para>
58289 The process was terminated by a signal and the value is the negation of the
58290 signal number.
58291 </para>
58292 </listitem>
58293 <listitem>
58294 <para>
58295 &ndash;256
58296 </para>
58297 <para>
58298 The process timed out.
58299 </para>
58300 </listitem>
58301 <listitem>
58302 <para>
58303 &ndash;257
58304 </para>
58305 <para>
58306 The was some other error in wait(); <option>errno</option> is still set.
58307 </para>
58308 </listitem>
58309 </itemizedlist>
58310 </listitem></varlistentry>
58311 <varlistentry>
58312 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
58313 <listitem>
58314 <para>
58315 This function provide you with a means of submitting a new message to
58316 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
58317 want, but this packages it all up for you.) The function creates a pipe,
58318 forks a subprocess that is running
58319 </para>
58320 <literallayout class="monospaced">
58321 exim -t -oem -oi -f &lt;&gt;
58322 </literallayout>
58323 <para>
58324 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
58325 that is connected to the standard input. The yield of the function is the PID
58326 of the subprocess. You can then write a message to the file descriptor, with
58327 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
58328 </para>
58329 <para>
58330 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
58331 finish and to collect its ending status. A timeout value of zero is usually
58332 fine in this circumstance. Unless you have made a mistake with the recipient
58333 addresses, you should get a return code of zero.
58334 </para>
58335 </listitem></varlistentry>
58336 <varlistentry>
58337 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
58338 <listitem>
58339 <para>
58340 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
58341 that it runs is:
58342 </para>
58343 <literallayout>
58344 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
58345 </literallayout>
58346 <para>
58347 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
58348 </para>
58349 </listitem></varlistentry>
58350 <varlistentry>
58351 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58352 <listitem>
58353 <para>
58354 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
58355 output is written to the standard error stream. If no debugging is selected,
58356 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
58357 conditional on the <literal>local_scan</literal> debug selector by coding like this:
58358 </para>
58359 <literallayout class="monospaced">
58360 if ((debug_selector &amp; D_local_scan) != 0)
58361   debug_printf("xxx", ...);
58362 </literallayout>
58363 </listitem></varlistentry>
58364 <varlistentry>
58365 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
58366 <listitem>
58367 <para>
58368 This is an interface to Exim&#x2019;s string expansion code. The return value is the
58369 expanded string, or NULL if there was an expansion failure.
58370 The C variable <option>expand_string_message</option> contains an error message after an
58371 expansion failure. If expansion does not change the string, the return value is
58372 the pointer to the input string. Otherwise, the return value points to a new
58373 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
58374 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
58375 </para>
58376 </listitem></varlistentry>
58377 <varlistentry>
58378 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58379 <listitem>
58380 <para>
58381 This function allows you to an add additional header line at the end of the
58382 existing ones. The first argument is the type, and should normally be a space
58383 character. The second argument is a format string and any number of
58384 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
58385 if you want, and you must ensure that the string ends with a newline.
58386 </para>
58387 </listitem></varlistentry>
58388 <varlistentry>
58389 <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>
58390 <listitem>
58391 <para>
58392 This function adds a new header line at a specified point in the header
58393 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
58394 </para>
58395 <para>
58396 If <option>name</option> is NULL, the new header is added at the end of the chain if
58397 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
58398 NULL, the header lines are searched for the first non-deleted header that
58399 matches the name. If one is found, the new header is added before it if
58400 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
58401 found header and any adjacent subsequent ones with the same name (even if
58402 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
58403 option controls where the header is added. If it is true, addition is at the
58404 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
58405 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
58406 </para>
58407 <literallayout class="monospaced">
58408 header_add_at_position(TRUE, US"Received", TRUE,
58409   ' ', "X-xxx: ...");
58410 </literallayout>
58411 <para>
58412 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
58413 there may not be if <option>received_header_text</option> expands to an empty string.
58414 </para>
58415 </listitem></varlistentry>
58416 <varlistentry>
58417 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
58418 <listitem>
58419 <para>
58420 This function removes header lines. If <option>occurrence</option> is zero or negative, all
58421 occurrences of the header are removed. If occurrence is greater than zero, that
58422 particular instance of the header is removed. If no header(s) can be found that
58423 match the specification, the function does nothing.
58424 </para>
58425 </listitem></varlistentry>
58426 <varlistentry>
58427 <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>
58428 <listitem>
58429 <para>
58430 This function tests whether the given header has the given name. It is not just
58431 a string comparison, because white space is permitted between the name and the
58432 colon. If the <option>notdel</option> argument is true, a false return is forced for all
58433 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
58434 </para>
58435 <literallayout class="monospaced">
58436 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
58437 </literallayout>
58438 </listitem></varlistentry>
58439 <varlistentry>
58440 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
58441 <listitem>
58442 <para>
58443 <indexterm role="concept">
58444 <primary>base64 encoding</primary>
58445 <secondary>functions for <function>local_scan()</function> use</secondary>
58446 </indexterm>
58447 This function base64-encodes a string, which is passed by address and length.
58448 The text may contain bytes of any value, including zero. The result is passed
58449 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
58450 zero-terminated.
58451 </para>
58452 </listitem></varlistentry>
58453 <varlistentry>
58454 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
58455 <listitem>
58456 <para>
58457 This function decodes a base64-encoded string. Its arguments are a
58458 zero-terminated base64-encoded string and the address of a variable that is set
58459 to point to the result, which is in dynamic memory. The length of the decoded
58460 string is the yield of the function. If the input is invalid base64 data, the
58461 yield is -1. A zero byte is added to the end of the output string to make it
58462 easy to interpret as a C string (assuming it contains no zeros of its own). The
58463 added zero byte is not included in the returned count.
58464 </para>
58465 </listitem></varlistentry>
58466 <varlistentry>
58467 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
58468 <listitem>
58469 <para>
58470 This function checks for a match in a domain list. Domains are always
58471 matched caselessly. The return value is one of the following:
58472 </para>
58473 <literallayout>
58474 <literal>OK     </literal> match succeeded
58475 <literal>FAIL   </literal> match failed
58476 <literal>DEFER  </literal> match deferred
58477 </literallayout>
58478 <para>
58479 DEFER is usually caused by some kind of lookup defer, such as the
58480 inability to contact a database.
58481 </para>
58482 </listitem></varlistentry>
58483 <varlistentry>
58484 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58485 <listitem>
58486 <para>
58487 This function checks for a match in a local part list. The third argument
58488 controls case-sensitivity. The return values are as for
58489 <emphasis>lss_match_domain()</emphasis>.
58490 </para>
58491 </listitem></varlistentry>
58492 <varlistentry>
58493 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
58494 <listitem>
58495 <para>
58496 This function checks for a match in an address list. The third argument
58497 controls the case-sensitivity of the local part match. The domain is always
58498 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
58499 </para>
58500 </listitem></varlistentry>
58501 <varlistentry>
58502 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
58503 <listitem>
58504 <para>
58505 This function checks for a match in a host list. The most common usage is
58506 expected to be
58507 </para>
58508 <literallayout class="monospaced">
58509 lss_match_host(sender_host_name, sender_host_address, ...)
58510 </literallayout>
58511 <para>
58512 <indexterm role="variable">
58513 <primary><varname>$sender_host_address</varname></primary>
58514 </indexterm>
58515 An empty address field matches an empty item in the host list. If the host name
58516 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
58517 looked up if a host name is required to match an item in the list. The return
58518 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
58519 returns ERROR in the case when it had to look up a host name, but the lookup
58520 failed.
58521 </para>
58522 </listitem></varlistentry>
58523 <varlistentry>
58524 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
58525 <listitem>
58526 <para>
58527 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
58528 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
58529 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
58530 them. It specifies to which log or logs the message is written. The remaining
58531 arguments are a format and relevant insertion arguments. The string should not
58532 contain any newlines, not even at the end.
58533 </para>
58534 </listitem></varlistentry>
58535 <varlistentry>
58536 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
58537 <listitem>
58538 <para>
58539 This function adds an additional recipient to the message. The first argument
58540 is the recipient address. If it is unqualified (has no domain), it is qualified
58541 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
58542 </para>
58543 <para>
58544 This function does not allow you to specify a private <option>errors_to</option> address (as
58545 described with the structure of <option>recipient_item</option> above), because it pre-dates
58546 the addition of that field to the structure. However, it is easy to add such a
58547 value afterwards. For example:
58548 </para>
58549 <literallayout class="monospaced">
58550  receive_add_recipient(US"monitor@mydom.example", -1);
58551  recipients_list[recipients_count-1].errors_to =
58552    US"postmaster@mydom.example";
58553 </literallayout>
58554 </listitem></varlistentry>
58555 <varlistentry>
58556 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
58557 <listitem>
58558 <para>
58559 This is a convenience function to remove a named recipient from the list of
58560 recipients. It returns true if a recipient was removed, and false if no
58561 matching recipient could be found. The argument must be a complete email
58562 address.
58563 </para>
58564 </listitem></varlistentry>
58565 </variablelist>
58566 <para>
58567 <indexterm role="concept">
58568 <primary>RFC 2047</primary>
58569 </indexterm>
58570 </para>
58571 <variablelist>
58572 <varlistentry>
58573 <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>
58574 <listitem>
58575 <para>
58576 This function decodes strings that are encoded according to RFC 2047. Typically
58577 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
58578 from the Q or B encoding into a byte-string. Then, if provided with the name of
58579 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
58580 made  to translate the result to the named character set. If this fails, the
58581 binary string is returned with an error message.
58582 </para>
58583 <para>
58584 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
58585 maximum MIME word length is enforced. The third argument is the target
58586 encoding, or NULL if no translation is wanted.
58587 </para>
58588 <para>
58589 <indexterm role="concept">
58590 <primary>binary zero</primary>
58591 <secondary>in RFC 2047 decoding</secondary>
58592 </indexterm>
58593 <indexterm role="concept">
58594 <primary>RFC 2047</primary>
58595 <secondary>binary zero in</secondary>
58596 </indexterm>
58597 If a binary zero is encountered in the decoded string, it is replaced by the
58598 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
58599 not be 0 because header lines are handled as zero-terminated strings.
58600 </para>
58601 <para>
58602 The function returns the result of processing the string, zero-terminated; if
58603 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
58604 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
58605 </para>
58606 <para>
58607 If an error is encountered, the function returns NULL and uses the <option>error</option>
58608 argument to return an error message. The variable pointed to by <option>error</option> is
58609 set to NULL if there is no error; it may be set non-NULL even when the function
58610 returns a non-NULL value if decoding was successful, but there was a problem
58611 with translation.
58612 </para>
58613 </listitem></varlistentry>
58614 <varlistentry>
58615 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
58616 <listitem>
58617 <para>
58618 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
58619 below.
58620 </para>
58621 </listitem></varlistentry>
58622 <varlistentry>
58623 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
58624 <listitem>
58625 <para>
58626 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
58627 output stream. You should use this function only when there is an SMTP output
58628 stream, that is, when the incoming message is being received via interactive
58629 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
58630 is FALSE. If you want to test for an incoming message from another host (as
58631 opposed to a local process that used the <option>-bs</option> command line option), you can
58632 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
58633 is involved.
58634 </para>
58635 <para>
58636 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
58637 output function, so it can be used for all forms of SMTP connection.
58638 </para>
58639 <para>
58640 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
58641 must start with an appropriate response code: 550 if you are going to return
58642 LOCAL_SCAN_REJECT, 451 if you are going to return
58643 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
58644 initial lines of a multi-line response, the code must be followed by a hyphen
58645 to indicate that the line is not the final response line. You must also ensure
58646 that the lines you write terminate with CRLF. For example:
58647 </para>
58648 <literallayout class="monospaced">
58649 smtp_printf("550-this is some extra info\r\n");
58650 return LOCAL_SCAN_REJECT;
58651 </literallayout>
58652 <para>
58653 Note that you can also create multi-line responses by including newlines in
58654 the data returned via the <option>return_text</option> argument. The added value of using
58655 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
58656 multiple output lines.
58657 </para>
58658 <para>
58659 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
58660 does not automatically flush pending output, and therefore does not test
58661 the state of the stream. (In the main code of Exim, flushing and error
58662 detection is done when Exim is ready for the next SMTP input command.) If
58663 you want to flush the output and check for an error (for example, the
58664 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
58665 arguments. It flushes the output stream, and returns a non-zero value if there
58666 is an error.
58667 </para>
58668 </listitem></varlistentry>
58669 <varlistentry>
58670 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
58671 <listitem>
58672 <para>
58673 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
58674 chunk of memory whose size is given by the argument. Exim bombs out if it ever
58675 runs out of memory. See the next section for a discussion of memory handling.
58676 </para>
58677 </listitem></varlistentry>
58678 <varlistentry>
58679 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
58680 <listitem>
58681 <para>
58682 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
58683 permanent pool. See the next section for a discussion of memory handling.
58684 </para>
58685 </listitem></varlistentry>
58686 <varlistentry>
58687 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
58688 <listitem>
58689 <para>
58690 See below.
58691 </para>
58692 </listitem></varlistentry>
58693 <varlistentry>
58694 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
58695 <listitem>
58696 <para>
58697 See below.
58698 </para>
58699 </listitem></varlistentry>
58700 <varlistentry>
58701 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
58702 <listitem>
58703 <para>
58704 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
58705 The first makes a copy of an entire string. The second copies up to a maximum
58706 number of characters, indicated by the second argument. The third uses a format
58707 and insertion arguments to create a new string. In each case, the result is a
58708 pointer to a new string in the current memory pool. See the next section for
58709 more discussion.
58710 </para>
58711 </listitem></varlistentry>
58712 </variablelist>
58713 </section>
58714 <section id="SECTmemhanloc">
58715 <title>More about Exim&#x2019;s memory handling</title>
58716 <para>
58717 <indexterm role="concept">
58718 <primary><function>local_scan()</function> function</primary>
58719 <secondary>memory handling</secondary>
58720 </indexterm>
58721 No function is provided for freeing memory, because that is never needed.
58722 The dynamic memory that Exim uses when receiving a message is automatically
58723 recycled if another message is received by the same process (this applies only
58724 to incoming SMTP connections &ndash; other input methods can supply only one
58725 message at a time). After receiving the last message, a reception process
58726 terminates.
58727 </para>
58728 <para>
58729 Because it is recycled, the normal dynamic memory cannot be used for holding
58730 data that must be preserved over a number of incoming messages on the same SMTP
58731 connection. However, Exim in fact uses two pools of dynamic memory; the second
58732 one is not recycled, and can be used for this purpose.
58733 </para>
58734 <para>
58735 If you want to allocate memory that remains available for subsequent messages
58736 in the same SMTP connection, you should set
58737 </para>
58738 <literallayout class="monospaced">
58739 store_pool = POOL_PERM
58740 </literallayout>
58741 <para>
58742 before calling the function that does the allocation. There is no need to
58743 restore the value if you do not need to; however, if you do want to revert to
58744 the normal pool, you can either restore the previous value of <option>store_pool</option> or
58745 set it explicitly to POOL_MAIN.
58746 </para>
58747 <para>
58748 The pool setting applies to all functions that get dynamic memory, including
58749 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
58750 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
58751 block of memory from the permanent pool while preserving the value of
58752 <option>store_pool</option>.
58753 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
58754 </para>
58755 </section>
58756 </chapter>
58757
58758 <chapter id="CHAPsystemfilter">
58759 <title>System-wide message filtering</title>
58760 <para>
58761 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
58762 <primary>filter</primary>
58763 <secondary>system filter</secondary>
58764 </indexterm>
58765 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
58766 <primary>filtering all mail</primary>
58767 </indexterm>
58768 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
58769 <primary>system filter</primary>
58770 </indexterm>
58771 The previous chapters (on ACLs and the local scan function) describe checks
58772 that can be applied to messages before they are accepted by a host. There is
58773 also a mechanism for checking messages once they have been received, but before
58774 they are delivered. This is called the <emphasis>system filter</emphasis>.
58775 </para>
58776 <para>
58777 The system filter operates in a similar manner to users&#x2019; filter files, but it
58778 is run just once per message (however many recipients the message has).
58779 It should not normally be used as a substitute for routing, because <option>deliver</option>
58780 commands in a system router provide new envelope recipient addresses.
58781 The system filter must be an Exim filter. It cannot be a Sieve filter.
58782 </para>
58783 <para>
58784 The system filter is run at the start of a delivery attempt, before any routing
58785 is done. If a message fails to be completely delivered at the first attempt,
58786 the system filter is run again at the start of every retry.
58787 If you want your filter to do something only once per message, you can make use
58788 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
58789 prevent it happening on retries.
58790 </para>
58791 <para>
58792 <indexterm role="variable">
58793 <primary><varname>$domain</varname></primary>
58794 </indexterm>
58795 <indexterm role="variable">
58796 <primary><varname>$local_part</varname></primary>
58797 </indexterm>
58798 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
58799 specific to individual recipient addresses, such as <varname>$local_part</varname> and
58800 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
58801 you want to run a centrally-specified filter for each recipient address
58802 independently, you can do so by setting up a suitable <command>redirect</command> router, as
58803 described in section <xref linkend="SECTperaddfil"/> below.
58804 </para>
58805 <section id="SECID212">
58806 <title>Specifying a system filter</title>
58807 <para>
58808 <indexterm role="concept">
58809 <primary>uid (user id)</primary>
58810 <secondary>system filter</secondary>
58811 </indexterm>
58812 <indexterm role="concept">
58813 <primary>gid (group id)</primary>
58814 <secondary>system filter</secondary>
58815 </indexterm>
58816 The name of the file that contains the system filter must be specified by
58817 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
58818 other than root, you must also set <option>system_filter_user</option> and
58819 <option>system_filter_group</option> as appropriate. For example:
58820 </para>
58821 <literallayout class="monospaced">
58822 system_filter = /etc/mail/exim.filter
58823 system_filter_user = exim
58824 </literallayout>
58825 <para>
58826 If a system filter generates any deliveries directly to files or pipes (via the
58827 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
58828 specified by setting <option>system_filter_file_transport</option> and
58829 <option>system_filter_pipe_transport</option>, respectively. Similarly,
58830 <option>system_filter_reply_transport</option> must be set to handle any messages generated
58831 by the <option>reply</option> command.
58832 </para>
58833 </section>
58834 <section id="SECID213">
58835 <title>Testing a system filter</title>
58836 <para>
58837 You can run simple tests of a system filter in the same way as for a user
58838 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
58839 are permitted only in system filters are recognized.
58840 </para>
58841 <para>
58842 If you want to test the combined effect of a system filter and a user filter,
58843 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
58844 </para>
58845 </section>
58846 <section id="SECID214">
58847 <title>Contents of a system filter</title>
58848 <para>
58849 The language used to specify system filters is the same as for users&#x2019; filter
58850 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
58851 mail filtering</emphasis>. However, there are some additional features that are
58852 available only in system filters; these are described in subsequent sections.
58853 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
58854 they cause errors.
58855 </para>
58856 <para>
58857 <indexterm role="concept">
58858 <primary>frozen messages</primary>
58859 <secondary>manual thaw; testing in filter</secondary>
58860 </indexterm>
58861 There are two special conditions which, though available in users&#x2019; filter
58862 files, are designed for use in system filters. The condition <option>first_delivery</option>
58863 is true only for the first attempt at delivering a message, and
58864 <option>manually_thawed</option> is true only if the message has been frozen, and
58865 subsequently thawed by an admin user. An explicit forced delivery counts as a
58866 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
58867 </para>
58868 <para>
58869 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
58870 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
58871 succeed, it will not be tried again.
58872 If you want Exim to retry an unseen delivery until it succeeds, you should
58873 arrange to set it up every time the filter runs.
58874 </para>
58875 <para>
58876 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
58877 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
58878 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
58879 to which users&#x2019; filter files can refer.
58880 </para>
58881 </section>
58882 <section id="SECID215">
58883 <title>Additional variable for system filters</title>
58884 <para>
58885 <indexterm role="variable">
58886 <primary><varname>$recipients</varname></primary>
58887 </indexterm>
58888 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
58889 of the message (separated by commas and white space), is available in system
58890 filters. It is not available in users&#x2019; filters for privacy reasons.
58891 </para>
58892 </section>
58893 <section id="SECID216">
58894 <title>Defer, freeze, and fail commands for system filters</title>
58895 <para>
58896 <indexterm role="concept">
58897 <primary>freezing messages</primary>
58898 </indexterm>
58899 <indexterm role="concept">
58900 <primary>message</primary>
58901 <secondary>freezing</secondary>
58902 </indexterm>
58903 <indexterm role="concept">
58904 <primary>message</primary>
58905 <secondary>forced failure</secondary>
58906 </indexterm>
58907 <indexterm role="concept">
58908 <primary><option>fail</option></primary>
58909 <secondary>in system filter</secondary>
58910 </indexterm>
58911 <indexterm role="concept">
58912 <primary><option>freeze</option> in system filter</primary>
58913 </indexterm>
58914 <indexterm role="concept">
58915 <primary><option>defer</option> in system filter</primary>
58916 </indexterm>
58917 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
58918 always available in system filters, but are not normally enabled in users&#x2019;
58919 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
58920 for the <command>redirect</command> router.) These commands can optionally be followed by the
58921 word <option>text</option> and a string containing an error message, for example:
58922 </para>
58923 <literallayout class="monospaced">
58924 fail text "this message looks like spam to me"
58925 </literallayout>
58926 <para>
58927 The keyword <option>text</option> is optional if the next character is a double quote.
58928 </para>
58929 <para>
58930 The <option>defer</option> command defers delivery of the original recipients of the
58931 message. The <option>fail</option> command causes all the original recipients to be failed,
58932 and a bounce message to be created. The <option>freeze</option> command suspends all
58933 delivery attempts for the original recipients. In all cases, any new deliveries
58934 that are specified by the filter are attempted as normal after the filter has
58935 run.
58936 </para>
58937 <para>
58938 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
58939 not manually frozen since. This means that automatic freezing by a system
58940 filter can be used as a way of checking out suspicious messages. If a message
58941 is found to be all right, manually unfreezing it allows it to be delivered.
58942 </para>
58943 <para>
58944 <indexterm role="concept">
58945 <primary>log</primary>
58946 <secondary><option>fail</option> command log line</secondary>
58947 </indexterm>
58948 <indexterm role="concept">
58949 <primary><option>fail</option></primary>
58950 <secondary>log line; reducing</secondary>
58951 </indexterm>
58952 The text given with a fail command is used as part of the bounce message as
58953 well as being written to the log. If the message is quite long, this can fill
58954 up a lot of log space when such failures are common. To reduce the size of the
58955 log message, Exim interprets the text in a special way if it starts with the
58956 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
58957 strings is written to the log, and the rest of the text is used in the bounce
58958 message. For example:
58959 </para>
58960 <literallayout class="monospaced">
58961 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
58962      because it contains attachments that we are \
58963      not prepared to receive."
58964 </literallayout>
58965 <para>
58966 <indexterm role="concept">
58967 <primary>loop</primary>
58968 <secondary>caused by <option>fail</option></secondary>
58969 </indexterm>
58970 Take great care with the <option>fail</option> command when basing the decision to fail on
58971 the contents of the message, because the bounce message will of course include
58972 the contents of the original message and will therefore trigger the <option>fail</option>
58973 command again (causing a mail loop) unless steps are taken to prevent this.
58974 Testing the <option>error_message</option> condition is one way to prevent this. You could
58975 use, for example
58976 </para>
58977 <literallayout class="monospaced">
58978 if $message_body contains "this is spam" and not error_message
58979 then fail text "spam is not wanted here" endif
58980 </literallayout>
58981 <para>
58982 though of course that might let through unwanted bounce messages. The
58983 alternative is clever checking of the body and/or headers to detect bounces
58984 generated by the filter.
58985 </para>
58986 <para>
58987 The interpretation of a system filter file ceases after a
58988 <option>defer</option>,
58989 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
58990 set up earlier in the filter file are honoured, so you can use a sequence such
58991 as
58992 </para>
58993 <literallayout class="monospaced">
58994 mail ...
58995 freeze
58996 </literallayout>
58997 <para>
58998 to send a specified message when the system filter is freezing (or deferring or
58999 failing) a message. The normal deliveries for the message do not, of course,
59000 take place.
59001 </para>
59002 </section>
59003 <section id="SECTaddremheasys">
59004 <title>Adding and removing headers in a system filter</title>
59005 <para>
59006 <indexterm role="concept">
59007 <primary>header lines</primary>
59008 <secondary>adding; in system filter</secondary>
59009 </indexterm>
59010 <indexterm role="concept">
59011 <primary>header lines</primary>
59012 <secondary>removing; in system filter</secondary>
59013 </indexterm>
59014 <indexterm role="concept">
59015 <primary>filter</primary>
59016 <secondary>header lines; adding/removing</secondary>
59017 </indexterm>
59018 Two filter commands that are available only in system filters are:
59019 </para>
59020 <literallayout class="monospaced">
59021 headers add &lt;string&gt;
59022 headers remove &lt;string&gt;
59023 </literallayout>
59024 <para>
59025 The argument for the <option>headers add</option> is a string that is expanded and then
59026 added to the end of the message&#x2019;s headers. It is the responsibility of the
59027 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
59028 space is ignored, and if the string is otherwise empty, or if the expansion is
59029 forced to fail, the command has no effect.
59030 </para>
59031 <para>
59032 You can use <quote>\n</quote> within the string, followed by white space, to specify
59033 continued header lines. More than one header may be added in one command by
59034 including <quote>\n</quote> within the string without any following white space. For
59035 example:
59036 </para>
59037 <literallayout class="monospaced">
59038 headers add "X-header-1: ....\n  \
59039              continuation of X-header-1 ...\n\
59040              X-header-2: ...."
59041 </literallayout>
59042 <para>
59043 Note that the header line continuation white space after the first newline must
59044 be placed before the backslash that continues the input string, because white
59045 space after input continuations is ignored.
59046 </para>
59047 <para>
59048 The argument for <option>headers remove</option> is a colon-separated list of header names.
59049 This command applies only to those headers that are stored with the message;
59050 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
59051 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
59052 header with the same name, they are all removed.
59053 </para>
59054 <para>
59055 The <option>headers</option> command in a system filter makes an immediate change to the set
59056 of header lines that was received with the message (with possible additions
59057 from ACL processing). Subsequent commands in the system filter operate on the
59058 modified set, which also forms the basis for subsequent message delivery.
59059 Unless further modified during routing or transporting, this set of headers is
59060 used for all recipients of the message.
59061 </para>
59062 <para>
59063 During routing and transporting, the variables that refer to the contents of
59064 header lines refer only to those lines that are in this set. Thus, header lines
59065 that are added by a system filter are visible to users&#x2019; filter files and to all
59066 routers and transports. This contrasts with the manipulation of header lines by
59067 routers and transports, which is not immediate, but which instead is saved up
59068 until the message is actually being written (see section
59069 <xref linkend="SECTheadersaddrem"/>).
59070 </para>
59071 <para>
59072 If the message is not delivered at the first attempt, header lines that were
59073 added by the system filter are stored with the message, and so are still
59074 present at the next delivery attempt. Header lines that were removed are still
59075 present, but marked <quote>deleted</quote> so that they are not transported with the
59076 message. For this reason, it is usual to make the <option>headers</option> command
59077 conditional on <option>first_delivery</option> so that the set of header lines is not
59078 modified more than once.
59079 </para>
59080 <para>
59081 Because header modification in a system filter acts immediately, you have to
59082 use an indirect approach if you want to modify the contents of a header line.
59083 For example:
59084 </para>
59085 <literallayout class="monospaced">
59086 headers add "Old-Subject: $h_subject:"
59087 headers remove "Subject"
59088 headers add "Subject: new subject (was: $h_old-subject:)"
59089 headers remove "Old-Subject"
59090 </literallayout>
59091 </section>
59092 <section id="SECID217">
59093 <title>Setting an errors address in a system filter</title>
59094 <para>
59095 <indexterm role="concept">
59096 <primary>envelope sender</primary>
59097 </indexterm>
59098 In a system filter, if a <option>deliver</option> command is followed by
59099 </para>
59100 <literallayout class="monospaced">
59101 errors_to &lt;some address&gt;
59102 </literallayout>
59103 <para>
59104 in order to change the envelope sender (and hence the error reporting) for that
59105 delivery, any address may be specified. (In a user filter, only the current
59106 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
59107 might use
59108 </para>
59109 <literallayout class="monospaced">
59110 unseen deliver monitor@spying.example errors_to root@local.example
59111 </literallayout>
59112 <para>
59113 to take a copy which would not be sent back to the normal error reporting
59114 address if its delivery failed.
59115 </para>
59116 </section>
59117 <section id="SECTperaddfil">
59118 <title>Per-address filtering</title>
59119 <para>
59120 <indexterm role="variable">
59121 <primary><varname>$domain</varname></primary>
59122 </indexterm>
59123 <indexterm role="variable">
59124 <primary><varname>$local_part</varname></primary>
59125 </indexterm>
59126 In contrast to the system filter, which is run just once per message for each
59127 delivery attempt, it is also possible to set up a system-wide filtering
59128 operation that runs once for each recipient address. In this case, variables
59129 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
59130 filter file could be made dependent on them. This is an example of a router
59131 which implements such a filter:
59132 </para>
59133 <literallayout class="monospaced">
59134 central_filter:
59135   check_local_user
59136   driver = redirect
59137   domains = +local_domains
59138   file = /central/filters/$local_part
59139   no_verify
59140   allow_filter
59141   allow_freeze
59142 </literallayout>
59143 <para>
59144 The filter is run in a separate process under its own uid. Therefore, either
59145 <option>check_local_user</option> must be set (as above), in which case the filter is run as
59146 the local user, or the <option>user</option> option must be used to specify which user to
59147 use. If both are set, <option>user</option> overrides.
59148 </para>
59149 <para>
59150 Care should be taken to ensure that none of the commands in the filter file
59151 specify a significant delivery if the message is to go on to be delivered to
59152 its intended recipient. The router will not then claim to have dealt with the
59153 address, so it will be passed on to subsequent routers to be delivered in the
59154 normal way.
59155 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
59156 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
59157 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
59158 </para>
59159 </section>
59160 </chapter>
59161
59162 <chapter id="CHAPmsgproc">
59163 <title>Message processing</title>
59164 <para>
59165 <indexterm role="concept" id="IIDmesproc" class="startofrange">
59166 <primary>message</primary>
59167 <secondary>general processing</secondary>
59168 </indexterm>
59169 Exim performs various transformations on the sender and recipient addresses of
59170 all messages that it handles, and also on the messages&#x2019; header lines. Some of
59171 these are optional and configurable, while others always take place. All of
59172 this processing, except rewriting as a result of routing, and the addition or
59173 removal of header lines while delivering, happens when a message is received,
59174 before it is placed on Exim&#x2019;s queue.
59175 </para>
59176 <para>
59177 Some of the automatic processing takes place by default only for
59178 <quote>locally-originated</quote> messages. This adjective is used to describe messages
59179 that are not received over TCP/IP, but instead are passed to an Exim process on
59180 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
59181 set up by the <option>-bs</option> command line option.
59182 </para>
59183 <para>
59184 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
59185 or ::1) are not considered to be locally-originated. Exim does not treat the
59186 loopback interface specially in any way.
59187 </para>
59188 <para>
59189 If you want the loopback interface to be treated specially, you must ensure
59190 that there are appropriate entries in your ACLs.
59191 </para>
59192 <section id="SECTsubmodnon">
59193 <title>Submission mode for non-local messages</title>
59194 <para>
59195 <indexterm role="concept">
59196 <primary>message</primary>
59197 <secondary>submission</secondary>
59198 </indexterm>
59199 <indexterm role="concept">
59200 <primary>submission mode</primary>
59201 </indexterm>
59202 Processing that happens automatically for locally-originated messages (unless
59203 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
59204 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
59205 state. Submission mode is set by the modifier
59206 </para>
59207 <literallayout class="monospaced">
59208 control = submission
59209 </literallayout>
59210 <para>
59211 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
59212 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
59213 a local submission, and is normally used when the source of the message is
59214 known to be an MUA running on a client host (as opposed to an MTA). For
59215 example, to set submission mode for messages originating on the IPv4 loopback
59216 interface, you could include the following in the MAIL ACL:
59217 </para>
59218 <literallayout class="monospaced">
59219 warn  hosts = 127.0.0.1
59220       control = submission
59221 </literallayout>
59222 <para>
59223 <indexterm role="concept">
59224 <primary><option>sender_retain</option> submission option</primary>
59225 </indexterm>
59226 There are some options that can be used when setting submission mode. A slash
59227 is used to separate options. For example:
59228 </para>
59229 <literallayout class="monospaced">
59230 control = submission/sender_retain
59231 </literallayout>
59232 <para>
59233 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
59234 true and <option>local_from_check</option> false for the current incoming message. The first
59235 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
59236 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
59237 authenticated sender. With this setting, Exim still fixes up messages by adding
59238 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
59239 attempt to check sender authenticity in header lines.
59240 </para>
59241 <para>
59242 When <option>sender_retain</option> is not set, a submission mode setting may specify a
59243 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
59244 example:
59245 </para>
59246 <literallayout class="monospaced">
59247 control = submission/domain=some.domain
59248 </literallayout>
59249 <para>
59250 The domain may be empty. How this value is used is described in sections
59251 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
59252 that allows you to specify the user&#x2019;s full name for inclusion in a created
59253 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
59254 </para>
59255 <literallayout class="monospaced">
59256 accept authenticated = *
59257        control = submission/domain=wonderland.example/\
59258                             name=${lookup {$authenticated_id} \
59259                                    lsearch {/etc/exim/namelist}}
59260 </literallayout>
59261 <para>
59262 Because the name may contain any characters, including slashes, the <option>name</option>
59263 option must be given last. The remainder of the string is used as the name. For
59264 the example above, if <filename>/etc/exim/namelist</filename> contains:
59265 </para>
59266 <literallayout class="monospaced">
59267 bigegg:  Humpty Dumpty
59268 </literallayout>
59269 <para>
59270 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
59271 line would be:
59272 </para>
59273 <literallayout class="monospaced">
59274 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
59275 </literallayout>
59276 <para>
59277 <indexterm role="concept">
59278 <primary>return path</primary>
59279 <secondary>in submission mode</secondary>
59280 </indexterm>
59281 By default, submission mode forces the return path to the same address as is
59282 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
59283 specified, the return path is also left unchanged.
59284 </para>
59285 <para>
59286 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
59287 ACL. This means that any sender checks performed before the fix-ups use the
59288 untrusted sender address specified by the user, not the trusted sender address
59289 specified by submission mode. Although this might be slightly unexpected, it
59290 does mean that you can configure ACL checks to spot that a user is trying to
59291 spoof another&#x2019;s address.
59292 </para>
59293 </section>
59294 <section id="SECTlineendings">
59295 <title>Line endings</title>
59296 <para>
59297 <indexterm role="concept">
59298 <primary>line endings</primary>
59299 </indexterm>
59300 <indexterm role="concept">
59301 <primary>carriage return</primary>
59302 </indexterm>
59303 <indexterm role="concept">
59304 <primary>linefeed</primary>
59305 </indexterm>
59306 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
59307 linefeed) is the line ending for messages transmitted over the Internet using
59308 SMTP over TCP/IP. However, within individual operating systems, different
59309 conventions are used. For example, Unix-like systems use just LF, but others
59310 use CRLF or just CR.
59311 </para>
59312 <para>
59313 Exim was designed for Unix-like systems, and internally, it stores messages
59314 using the system&#x2019;s convention of a single LF as a line terminator. When
59315 receiving a message, all line endings are translated to this standard format.
59316 Originally, it was thought that programs that passed messages directly to an
59317 MTA within an operating system would use that system&#x2019;s convention. Experience
59318 has shown that this is not the case; for example, there are Unix applications
59319 that use CRLF in this circumstance. For this reason, and for compatibility with
59320 other MTAs, the way Exim handles line endings for all messages is now as
59321 follows:
59322 </para>
59323 <itemizedlist>
59324 <listitem>
59325 <para>
59326 LF not preceded by CR is treated as a line ending.
59327 </para>
59328 </listitem>
59329 <listitem>
59330 <para>
59331 CR is treated as a line ending; if it is immediately followed by LF, the LF
59332 is ignored.
59333 </para>
59334 </listitem>
59335 <listitem>
59336 <para>
59337 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
59338 nor a local message in the state where a line containing only a dot is a
59339 terminator.
59340 </para>
59341 </listitem>
59342 <listitem>
59343 <para>
59344 If a bare CR is encountered within a header line, an extra space is added after
59345 the line terminator so as not to end the header line. The reasoning behind this
59346 is that bare CRs in header lines are most likely either to be mistakes, or
59347 people trying to play silly games.
59348 </para>
59349 </listitem>
59350 <listitem>
59351 <para>
59352 If the first header line received in a message ends with CRLF, a subsequent
59353 bare LF in a header line is treated in the same way as a bare CR in a header
59354 line.
59355 </para>
59356 </listitem>
59357 </itemizedlist>
59358 </section>
59359 <section id="SECID218">
59360 <title>Unqualified addresses</title>
59361 <para>
59362 <indexterm role="concept">
59363 <primary>unqualified addresses</primary>
59364 </indexterm>
59365 <indexterm role="concept">
59366 <primary>address</primary>
59367 <secondary>qualification</secondary>
59368 </indexterm>
59369 By default, Exim expects every envelope address it receives from an external
59370 host to be fully qualified. Unqualified addresses cause negative responses to
59371 SMTP commands. However, because SMTP is used as a means of transporting
59372 messages from MUAs running on personal workstations, there is sometimes a
59373 requirement to accept unqualified addresses from specific hosts or IP networks.
59374 </para>
59375 <para>
59376 Exim has two options that separately control which hosts may send unqualified
59377 sender or recipient addresses in SMTP commands, namely
59378 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
59379 cases, if an unqualified address is accepted, it is qualified by adding the
59380 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
59381 </para>
59382 <para>
59383 <indexterm role="option">
59384 <primary><option>qualify_domain</option></primary>
59385 </indexterm>
59386 <indexterm role="option">
59387 <primary><option>qualify_recipient</option></primary>
59388 </indexterm>
59389 Unqualified addresses in header lines are automatically qualified for messages
59390 that are locally originated, unless the <option>-bnq</option> option is given on the command
59391 line. For messages received over SMTP, unqualified addresses in header lines
59392 are qualified only if unqualified addresses are permitted in SMTP commands. In
59393 other words, such qualification is also controlled by
59394 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
59395 </para>
59396 </section>
59397 <section id="SECID219">
59398 <title>The UUCP From line</title>
59399 <para>
59400 <indexterm role="concept">
59401 <primary><quote>From</quote> line</primary>
59402 </indexterm>
59403 <indexterm role="concept">
59404 <primary>UUCP</primary>
59405 <secondary><quote>From</quote> line</secondary>
59406 </indexterm>
59407 <indexterm role="concept">
59408 <primary>sender</primary>
59409 <secondary>address</secondary>
59410 </indexterm>
59411 <indexterm role="option">
59412 <primary><option>uucp_from_pattern</option></primary>
59413 </indexterm>
59414 <indexterm role="option">
59415 <primary><option>uucp_from_sender</option></primary>
59416 </indexterm>
59417 <indexterm role="concept">
59418 <primary>envelope sender</primary>
59419 </indexterm>
59420 <indexterm role="concept">
59421 <primary>Sendmail compatibility</primary>
59422 <secondary><quote>From</quote> line</secondary>
59423 </indexterm>
59424 Messages that have come from UUCP (and some other applications) often begin
59425 with a line containing the envelope sender and a timestamp, following the word
59426 <quote>From</quote>. Examples of two common formats are:
59427 </para>
59428 <literallayout class="monospaced">
59429 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
59430 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
59431 </literallayout>
59432 <para>
59433 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
59434 Exim recognizes such lines at the start of messages that are submitted to it
59435 via the command line (that is, on the standard input). It does not recognize
59436 such lines in incoming SMTP messages, unless the sending host matches
59437 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
59438 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
59439 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
59440 default value matches the two common cases shown above and puts the address
59441 that follows <quote>From</quote> into <varname>$1</varname>.
59442 </para>
59443 <para>
59444 <indexterm role="concept">
59445 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
59446 <secondary>in <quote>From </quote> line handling</secondary>
59447 </indexterm>
59448 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
59449 a trusted user, the message&#x2019;s sender address is constructed by expanding the
59450 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
59451 then parsed as an RFC 2822 address. If there is no domain, the local part is
59452 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
59453 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
59454 </para>
59455 <para>
59456 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
59457 sender address is not changed. This is also the case for incoming SMTP messages
59458 that are permitted to contain <quote>From</quote> lines.
59459 </para>
59460 <para>
59461 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
59462 treated as a data line that starts the body of the message, as it is not valid
59463 as a header line. This also happens if a <quote>From</quote> line is present in an
59464 incoming SMTP message from a source that is not permitted to send them.
59465 </para>
59466 </section>
59467 <section id="SECID220">
59468 <title>Resent- header lines</title>
59469 <para>
59470 <indexterm role="concept">
59471 <primary><option>Resent-</option> header lines</primary>
59472 </indexterm>
59473 RFC 2822 makes provision for sets of header lines starting with the string
59474 <literal>Resent-</literal> to be added to a message when it is resent by the original
59475 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
59476 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
59477 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
59478 </para>
59479 <blockquote>
59480 <para>
59481 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
59482 processing of replies or other such automatic actions on messages.</emphasis>
59483 </para>
59484 </blockquote>
59485 <para>
59486 This leaves things a bit vague as far as other processing actions such as
59487 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
59488 follows:
59489 </para>
59490 <itemizedlist>
59491 <listitem>
59492 <para>
59493 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
59494 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
59495 </para>
59496 </listitem>
59497 <listitem>
59498 <para>
59499 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
59500 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
59501 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
59502 </para>
59503 </listitem>
59504 <listitem>
59505 <para>
59506 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
59507 also removed.
59508 </para>
59509 </listitem>
59510 <listitem>
59511 <para>
59512 For a locally-submitted message,
59513 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
59514 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
59515 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
59516 included in log lines in this case.
59517 </para>
59518 </listitem>
59519 <listitem>
59520 <para>
59521 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
59522 <option>Resent-</option> header lines are present.
59523 </para>
59524 </listitem>
59525 </itemizedlist>
59526 </section>
59527 <section id="SECID221">
59528 <title>The Auto-Submitted: header line</title>
59529 <para>
59530 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
59531 includes the header line:
59532 </para>
59533 <literallayout class="monospaced">
59534 Auto-Submitted: auto-replied
59535 </literallayout>
59536 </section>
59537 <section id="SECID222">
59538 <title>The Bcc: header line</title>
59539 <para>
59540 <indexterm role="concept">
59541 <primary><emphasis>Bcc:</emphasis> header line</primary>
59542 </indexterm>
59543 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
59544 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
59545 extracting its addresses). If <option>-t</option> is not present on the command line, any
59546 existing <emphasis>Bcc:</emphasis> is not removed.
59547 </para>
59548 </section>
59549 <section id="SECID223">
59550 <title>The Date: header line</title>
59551 <para>
59552 <indexterm role="concept">
59553 <primary><emphasis>Date:</emphasis> header line</primary>
59554 </indexterm>
59555 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
59556 Exim adds one, using the current date and time, unless the
59557 <option>suppress_local_fixups</option> control has been specified.
59558 </para>
59559 </section>
59560 <section id="SECID224">
59561 <title>The Delivery-date: header line</title>
59562 <para>
59563 <indexterm role="concept">
59564 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
59565 </indexterm>
59566 <indexterm role="option">
59567 <primary><option>delivery_date_remove</option></primary>
59568 </indexterm>
59569 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
59570 set. Exim can be configured to add them to the final delivery of messages. (See
59571 the generic <option>delivery_date_add</option> transport option.) They should not be present
59572 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
59573 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
59574 messages.
59575 </para>
59576 </section>
59577 <section id="SECID225">
59578 <title>The Envelope-to: header line</title>
59579 <para>
59580 <indexterm role="concept">
59581 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
59582 </indexterm>
59583 <indexterm role="option">
59584 <primary><option>envelope_to_remove</option></primary>
59585 </indexterm>
59586 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
59587 Exim can be configured to add them to the final delivery of messages. (See the
59588 generic <option>envelope_to_add</option> transport option.) They should not be present in
59589 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
59590 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
59591 messages.
59592 </para>
59593 </section>
59594 <section id="SECTthefrohea">
59595 <title>The From: header line</title>
59596 <para>
59597 <indexterm role="concept">
59598 <primary><emphasis>From:</emphasis> header line</primary>
59599 </indexterm>
59600 <indexterm role="concept">
59601 <primary>Sendmail compatibility</primary>
59602 <secondary><quote>From</quote> line</secondary>
59603 </indexterm>
59604 <indexterm role="concept">
59605 <primary>message</primary>
59606 <secondary>submission</secondary>
59607 </indexterm>
59608 <indexterm role="concept">
59609 <primary>submission mode</primary>
59610 </indexterm>
59611 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
59612 adds one if either of the following conditions is true:
59613 </para>
59614 <itemizedlist>
59615 <listitem>
59616 <para>
59617 The envelope sender address is not empty (that is, this is not a bounce
59618 message). The added header line copies the envelope sender address.
59619 </para>
59620 </listitem>
59621 <listitem>
59622 <para>
59623 <indexterm role="variable">
59624 <primary><varname>$authenticated_id</varname></primary>
59625 </indexterm>
59626 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
59627 </para>
59628 <orderedlist numeration="arabic">
59629 <listitem>
59630 <para>
59631 <indexterm role="variable">
59632 <primary><varname>$qualify_domain</varname></primary>
59633 </indexterm>
59634 If no domain is specified by the submission control, the local part is
59635 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59636 </para>
59637 </listitem>
59638 <listitem>
59639 <para>
59640 If a non-empty domain is specified by the submission control, the local
59641 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59642 </para>
59643 </listitem>
59644 <listitem>
59645 <para>
59646 If an empty domain is specified by the submission control,
59647 <varname>$authenticated_id</varname> is assumed to be the complete address.
59648 </para>
59649 </listitem>
59650 </orderedlist>
59651 </listitem>
59652 </itemizedlist>
59653 <para>
59654 A non-empty envelope sender takes precedence.
59655 </para>
59656 <para>
59657 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
59658 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
59659 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
59660 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
59661 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
59662 <option>unknown_login</option> configuration option). The address is qualified with
59663 <option>qualify_domain</option>.
59664 </para>
59665 <para>
59666 For compatibility with Sendmail, if an incoming, non-SMTP message has a
59667 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
59668 user, this is replaced by an address containing the user&#x2019;s login name and full
59669 name as described in section <xref linkend="SECTconstr"/>.
59670 </para>
59671 </section>
59672 <section id="SECID226">
59673 <title>The Message-ID: header line</title>
59674 <para>
59675 <indexterm role="concept">
59676 <primary><emphasis>Message-ID:</emphasis> header line</primary>
59677 </indexterm>
59678 <indexterm role="concept">
59679 <primary>message</primary>
59680 <secondary>submission</secondary>
59681 </indexterm>
59682 <indexterm role="option">
59683 <primary><option>message_id_header_text</option></primary>
59684 </indexterm>
59685 If a locally-generated or submission-mode incoming message does not contain a
59686 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
59687 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
59688 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
59689 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
59690 message id, preceded by the letter E to ensure it starts with a letter, and
59691 followed by @ and the primary host name. Additional information can be included
59692 in this header line by setting the <option>message_id_header_text</option> and/or
59693 <option>message_id_header_domain</option> options.
59694 </para>
59695 </section>
59696 <section id="SECID227">
59697 <title>The Received: header line</title>
59698 <para>
59699 <indexterm role="concept">
59700 <primary><emphasis>Received:</emphasis> header line</primary>
59701 </indexterm>
59702 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
59703 contents are defined by the <option>received_header_text</option> configuration option, and
59704 Exim automatically adds a semicolon and a timestamp to the configured string.
59705 </para>
59706 <para>
59707 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
59708 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
59709 line is the time that the message started to be received. This is the value
59710 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
59711 </para>
59712 <para>
59713 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
59714 changed to the time of acceptance, which is (apart from a small delay while the
59715 -H spool file is written) the earliest time at which delivery could start.
59716 </para>
59717 </section>
59718 <section id="SECID228">
59719 <title>The References: header line</title>
59720 <para>
59721 <indexterm role="concept">
59722 <primary><emphasis>References:</emphasis> header line</primary>
59723 </indexterm>
59724 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
59725 header line. This is constructed according to the rules that are described in
59726 section 3.64 of RFC 2822 (which states that replies should contain such a
59727 header line), and section 3.14 of RFC 3834 (which states that automatic
59728 responses are not different in this respect). However, because some mail
59729 processing software does not cope well with very long header lines, no more
59730 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
59731 incoming message. If there are more than 12, the first one and then the final
59732 11 are copied, before adding the message ID of the incoming message.
59733 </para>
59734 </section>
59735 <section id="SECID229">
59736 <title>The Return-path: header line</title>
59737 <para>
59738 <indexterm role="concept">
59739 <primary><emphasis>Return-path:</emphasis> header line</primary>
59740 </indexterm>
59741 <indexterm role="option">
59742 <primary><option>return_path_remove</option></primary>
59743 </indexterm>
59744 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
59745 it does the final delivery of messages. (See the generic <option>return_path_add</option>
59746 transport option.) Therefore, they should not be present in messages in
59747 transit. If the <option>return_path_remove</option> configuration option is set (the
59748 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
59749 </para>
59750 </section>
59751 <section id="SECTthesenhea">
59752 <title>The Sender: header line</title>
59753 <para>
59754 <indexterm role="concept">
59755 <primary><emphasis>Sender:</emphasis> header line</primary>
59756 </indexterm>
59757 <indexterm role="concept">
59758 <primary>message</primary>
59759 <secondary>submission</secondary>
59760 </indexterm>
59761 For a locally-originated message from an untrusted user, Exim may remove an
59762 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
59763 these actions by setting the <option>local_sender_retain</option> option true, the
59764 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
59765 control setting.
59766 </para>
59767 <para>
59768 When a local message is received from an untrusted user and
59769 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
59770 control has not been set, a check is made to see if the address given in the
59771 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
59772 that is expected has the login name as the local part and the value of
59773 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
59774 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
59775 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
59776 line is added to the message.
59777 </para>
59778 <para>
59779 If you set <option>local_from_check</option> false, this checking does not occur. However,
59780 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
59781 <option>local_sender_retain</option> to be true. It is not possible to set both of these
59782 options true at the same time.
59783 </para>
59784 <para>
59785 <indexterm role="concept">
59786 <primary>submission mode</primary>
59787 </indexterm>
59788 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
59789 received over TCP/IP or for messages submitted by trusted users. However, when
59790 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
59791 not specified on the submission control, the following processing takes place:
59792 </para>
59793 <para>
59794 <indexterm role="variable">
59795 <primary><varname>$authenticated_id</varname></primary>
59796 </indexterm>
59797 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
59798 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
59799 created as follows:
59800 </para>
59801 <itemizedlist>
59802 <listitem>
59803 <para>
59804 <indexterm role="variable">
59805 <primary><varname>$qualify_domain</varname></primary>
59806 </indexterm>
59807 If no domain is specified by the submission control, the local part is
59808 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
59809 </para>
59810 </listitem>
59811 <listitem>
59812 <para>
59813 If a non-empty domain is specified by the submission control, the local part
59814 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
59815 </para>
59816 </listitem>
59817 <listitem>
59818 <para>
59819 If an empty domain is specified by the submission control,
59820 <varname>$authenticated_id</varname> is assumed to be the complete address.
59821 </para>
59822 </listitem>
59823 </itemizedlist>
59824 <para>
59825 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
59826 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
59827 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
59828 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
59829 </para>
59830 <para>
59831 <indexterm role="concept">
59832 <primary>return path</primary>
59833 <secondary>created from <emphasis>Sender:</emphasis></secondary>
59834 </indexterm>
59835 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
59836 the message (the envelope sender address) is changed to be the same address,
59837 except in the case of submission mode when <option>sender_retain</option> is specified.
59838 </para>
59839 </section>
59840 <section id="SECTheadersaddrem">
59841 <title>Adding and removing header lines in routers and transports</title>
59842 <para>
59843 <indexterm role="concept">
59844 <primary>header lines</primary>
59845 <secondary>adding; in router or transport</secondary>
59846 </indexterm>
59847 <indexterm role="concept">
59848 <primary>header lines</primary>
59849 <secondary>removing; in router or transport</secondary>
59850 </indexterm>
59851 When a message is delivered, the addition and removal of header lines can be
59852 specified in a system filter, or on any of the routers and transports that
59853 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
59854 modifying headers in a system filter. Header lines can also be added in an ACL
59855 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
59856 </para>
59857 <para>
59858 In contrast to what happens in a system filter, header modifications that are
59859 specified on routers and transports apply only to the particular recipient
59860 addresses that are being processed by those routers and transports. These
59861 changes do not actually take place until a copy of the message is being
59862 transported. Therefore, they do not affect the basic set of header lines, and
59863 they do not affect the values of the variables that refer to header lines.
59864 </para>
59865 <para>
59866 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
59867 the transport cannot refer to the modified header lines, because such
59868 expansions all occur before the message is actually transported.
59869 </para>
59870 <para>
59871 For both routers and transports, the argument of a <option>headers_add</option>
59872 option must be in the form of one or more RFC 2822 header lines, separated by
59873 newlines (coded as <quote>\n</quote>). For example:
59874 </para>
59875 <literallayout class="monospaced">
59876 headers_add = X-added-header: added by $primary_hostname\n\
59877               X-added-second: another added header line
59878 </literallayout>
59879 <para>
59880 Exim does not check the syntax of these added header lines.
59881 </para>
59882 <para>
59883 Multiple <option>headers_add</option> options for a single router or transport can be
59884 specified; the values will append to a single list of header lines.
59885 Each header-line is separately expanded.
59886 </para>
59887 <para>
59888 The argument of a <option>headers_remove</option> option must consist of a colon-separated
59889 list of header names. This is confusing, because header names themselves are
59890 often terminated by colons. In this case, the colons are the list separators,
59891 not part of the names. For example:
59892 </para>
59893 <literallayout class="monospaced">
59894 headers_remove = return-receipt-to:acknowledge-to
59895 </literallayout>
59896 <para>
59897 Multiple <option>headers_remove</option> options for a single router or transport can be
59898 specified; the arguments will append to a single header-names list.
59899 Each item is separately expanded.
59900 Note that colons in complex expansions which are used to
59901 form all or part of a <option>headers_remove</option> list
59902 will act as list separators.
59903 </para>
59904 <para>
59905 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
59906 items are expanded at routing time,
59907 and then associated with all addresses that are
59908 accepted by that router, and also with any new addresses that it generates. If
59909 an address passes through several routers as a result of aliasing or
59910 forwarding, the changes are cumulative.
59911 </para>
59912 <para>
59913 <indexterm role="option">
59914 <primary><option>unseen</option></primary>
59915 </indexterm>
59916 However, this does not apply to multiple routers that result from the use of
59917 the <option>unseen</option> option. Any header modifications that were specified by the
59918 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
59919 </para>
59920 <para>
59921 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
59922 settings cannot be delivered together in a batch, so a transport is always
59923 dealing with a set of addresses that have the same header-processing
59924 requirements.
59925 </para>
59926 <para>
59927 The transport starts by writing the original set of header lines that arrived
59928 with the message, possibly modified by the system filter. As it writes out
59929 these lines, it consults the list of header names that were attached to the
59930 recipient address(es) by <option>headers_remove</option> options in routers, and it also
59931 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
59932 names are on either of these lists are not written out. If there are multiple
59933 instances of any listed header, they are all skipped.
59934 </para>
59935 <para>
59936 After the remaining original header lines have been written, new header
59937 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
59938 the order in which they were attached to the address. These are followed by any
59939 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
59940 </para>
59941 <para>
59942 This way of handling header line modifications in routers and transports has
59943 the following consequences:
59944 </para>
59945 <itemizedlist>
59946 <listitem>
59947 <para>
59948 The original set of header lines, possibly modified by the system filter,
59949 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
59950 to it, at all times.
59951 </para>
59952 </listitem>
59953 <listitem>
59954 <para>
59955 Header lines that are added by a router&#x2019;s
59956 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
59957 expansion syntax in subsequent routers or the transport.
59958 </para>
59959 </listitem>
59960 <listitem>
59961 <para>
59962 Conversely, header lines that are specified for removal by <option>headers_remove</option>
59963 in a router remain visible to subsequent routers and the transport.
59964 </para>
59965 </listitem>
59966 <listitem>
59967 <para>
59968 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
59969 a later router or by a transport.
59970 </para>
59971 </listitem>
59972 <listitem>
59973 <para>
59974 An added header can refer to the contents of an original header that is to be
59975 removed, even it has the same name as the added header. For example:
59976 </para>
59977 <literallayout class="monospaced">
59978 headers_remove = subject
59979 headers_add = Subject: new subject (was: $h_subject:)
59980 </literallayout>
59981 </listitem>
59982 </itemizedlist>
59983 <para>
59984 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
59985 for a <command>redirect</command> router that has the <option>one_time</option> option set.
59986 </para>
59987 </section>
59988 <section id="SECTconstr">
59989 <title>Constructed addresses</title>
59990 <para>
59991 <indexterm role="concept">
59992 <primary>address</primary>
59993 <secondary>constructed</secondary>
59994 </indexterm>
59995 <indexterm role="concept">
59996 <primary>constructed address</primary>
59997 </indexterm>
59998 When Exim constructs a sender address for a locally-generated message, it uses
59999 the form
60000 </para>
60001 <literallayout>
60002 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
60003 </literallayout>
60004 <para>
60005 For example:
60006 </para>
60007 <literallayout class="monospaced">
60008 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
60009 </literallayout>
60010 <para>
60011 The user name is obtained from the <option>-F</option> command line option if set, or
60012 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
60013 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
60014 ampersand character, this is replaced by the login name with the first letter
60015 upper cased, as is conventional in a number of operating systems. See the
60016 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
60017 The <option>unknown_username</option> option can be used to specify user names in cases when
60018 there is no password file entry.
60019 </para>
60020 <para>
60021 <indexterm role="concept">
60022 <primary>RFC 2047</primary>
60023 </indexterm>
60024 In all cases, the user name is made to conform to RFC 2822 by quoting all or
60025 parts of it if necessary. In addition, if it contains any non-printing
60026 characters, it is encoded as described in RFC 2047, which defines a way of
60027 including non-ASCII characters in header lines. The value of the
60028 <option>headers_charset</option> option specifies the name of the encoding that is used (the
60029 characters are assumed to be in this encoding). The setting of
60030 <option>print_topbitchars</option> controls whether characters with the top bit set (that
60031 is, with codes greater than 127) count as printing characters or not.
60032 </para>
60033 </section>
60034 <section id="SECID230">
60035 <title>Case of local parts</title>
60036 <para>
60037 <indexterm role="concept">
60038 <primary>case of local parts</primary>
60039 </indexterm>
60040 <indexterm role="concept">
60041 <primary>local part</primary>
60042 <secondary>case of</secondary>
60043 </indexterm>
60044 RFC 2822 states that the case of letters in the local parts of addresses cannot
60045 be assumed to be non-significant. Exim preserves the case of local parts of
60046 addresses, but by default it uses a lower-cased form when it is routing,
60047 because on most Unix systems, usernames are in lower case and case-insensitive
60048 routing is required. However, any particular router can be made to use the
60049 original case for local parts by setting the <option>caseful_local_part</option> generic
60050 router option.
60051 </para>
60052 <para>
60053 <indexterm role="concept">
60054 <primary>mixed-case login names</primary>
60055 </indexterm>
60056 If you must have mixed-case user names on your system, the best way to proceed,
60057 assuming you want case-independent handling of incoming email, is to set up
60058 your first router to convert incoming local parts in your domains to the
60059 correct case by means of a file lookup. For example:
60060 </para>
60061 <literallayout class="monospaced">
60062 correct_case:
60063   driver = redirect
60064   domains = +local_domains
60065   data = ${lookup{$local_part}cdb\
60066               {/etc/usercased.cdb}{$value}fail}\
60067               @$domain
60068 </literallayout>
60069 <para>
60070 For this router, the local part is forced to lower case by the default action
60071 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
60072 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
60073 on any subsequent routers which process your domains, they will operate on
60074 local parts with the correct case in a case-sensitive manner.
60075 </para>
60076 </section>
60077 <section id="SECID231">
60078 <title>Dots in local parts</title>
60079 <para>
60080 <indexterm role="concept">
60081 <primary>dot</primary>
60082 <secondary>in local part</secondary>
60083 </indexterm>
60084 <indexterm role="concept">
60085 <primary>local part</primary>
60086 <secondary>dots in</secondary>
60087 </indexterm>
60088 RFC 2822 forbids empty components in local parts. That is, an unquoted local
60089 part may not begin or end with a dot, nor have two consecutive dots in the
60090 middle. However, it seems that many MTAs do not enforce this, so Exim permits
60091 empty components for compatibility.
60092 </para>
60093 </section>
60094 <section id="SECID232">
60095 <title>Rewriting addresses</title>
60096 <para>
60097 <indexterm role="concept">
60098 <primary>rewriting</primary>
60099 <secondary>addresses</secondary>
60100 </indexterm>
60101 Rewriting of sender and recipient addresses, and addresses in headers, can
60102 happen automatically, or as the result of configuration options, as described
60103 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
60104 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
60105 </para>
60106 <para>
60107 Automatic rewriting includes qualification, as mentioned above. The other case
60108 in which it can happen is when an incomplete non-local domain is given. The
60109 routing process may cause this to be expanded into the full domain name. For
60110 example, a header such as
60111 </para>
60112 <literallayout class="monospaced">
60113 To: hare@teaparty
60114 </literallayout>
60115 <para>
60116 might get rewritten as
60117 </para>
60118 <literallayout class="monospaced">
60119 To: hare@teaparty.wonderland.fict.example
60120 </literallayout>
60121 <para>
60122 Rewriting as a result of routing is the one kind of message processing that
60123 does not happen at input time, as it cannot be done until the address has
60124 been routed.
60125 </para>
60126 <para>
60127 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
60128 addresses have been routed, in case any of the headers get changed as a
60129 result of routing. However, doing this in practice would hold up many
60130 deliveries for unreasonable amounts of time, just because one address could not
60131 immediately be routed. Exim therefore does not delay other deliveries when
60132 routing of one or more addresses is deferred.
60133 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
60134 </para>
60135 </section>
60136 </chapter>
60137
60138 <chapter id="CHAPSMTP">
60139 <title>SMTP processing</title>
60140 <para>
60141 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
60142 <primary>SMTP</primary>
60143 <secondary>processing details</secondary>
60144 </indexterm>
60145 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
60146 <primary>LMTP</primary>
60147 <secondary>processing details</secondary>
60148 </indexterm>
60149 Exim supports a number of different ways of using the SMTP protocol, and its
60150 LMTP variant, which is an interactive protocol for transferring messages into a
60151 closed mail store application. This chapter contains details of how SMTP is
60152 processed. For incoming mail, the following are available:
60153 </para>
60154 <itemizedlist>
60155 <listitem>
60156 <para>
60157 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
60158 </para>
60159 </listitem>
60160 <listitem>
60161 <para>
60162 SMTP over the standard input and output (the <option>-bs</option> option);
60163 </para>
60164 </listitem>
60165 <listitem>
60166 <para>
60167 Batched SMTP on the standard input (the <option>-bS</option> option).
60168 </para>
60169 </listitem>
60170 </itemizedlist>
60171 <para>
60172 For mail delivery, the following are available:
60173 </para>
60174 <itemizedlist>
60175 <listitem>
60176 <para>
60177 SMTP over TCP/IP (the <command>smtp</command> transport);
60178 </para>
60179 </listitem>
60180 <listitem>
60181 <para>
60182 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
60183 <quote>lmtp</quote>);
60184 </para>
60185 </listitem>
60186 <listitem>
60187 <para>
60188 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
60189 transport);
60190 </para>
60191 </listitem>
60192 <listitem>
60193 <para>
60194 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
60195 the <option>use_bsmtp</option> option set).
60196 </para>
60197 </listitem>
60198 </itemizedlist>
60199 <para>
60200 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
60201 stored in or read from files (or pipes), in a format in which SMTP commands are
60202 used to contain the envelope information.
60203 </para>
60204 <section id="SECToutSMTPTCP">
60205 <title>Outgoing SMTP and LMTP over TCP/IP</title>
60206 <para>
60207 <indexterm role="concept">
60208 <primary>SMTP</primary>
60209 <secondary>outgoing over TCP/IP</secondary>
60210 </indexterm>
60211 <indexterm role="concept">
60212 <primary>outgoing SMTP over TCP/IP</primary>
60213 </indexterm>
60214 <indexterm role="concept">
60215 <primary>LMTP</primary>
60216 <secondary>over TCP/IP</secondary>
60217 </indexterm>
60218 <indexterm role="concept">
60219 <primary>outgoing LMTP over TCP/IP</primary>
60220 </indexterm>
60221 <indexterm role="concept">
60222 <primary>EHLO</primary>
60223 </indexterm>
60224 <indexterm role="concept">
60225 <primary>HELO</primary>
60226 </indexterm>
60227 <indexterm role="concept">
60228 <primary>SIZE option on MAIL command</primary>
60229 </indexterm>
60230 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
60231 The <option>protocol</option> option selects which protocol is to be used, but the actual
60232 processing is the same in both cases.
60233 </para>
60234 <para>
60235 If, in response to its EHLO command, Exim is told that the SIZE
60236 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
60237 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
60238 <option>size_addition</option> option (default 1024) to allow for additions to the message
60239 such as per-transport header lines, or changes made in a
60240 <indexterm role="concept">
60241 <primary>transport</primary>
60242 <secondary>filter</secondary>
60243 </indexterm>
60244 <indexterm role="concept">
60245 <primary>filter</primary>
60246 <secondary>transport filter</secondary>
60247 </indexterm>
60248 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
60249 suppressed.
60250 </para>
60251 <para>
60252 If the remote server advertises support for PIPELINING, Exim uses the
60253 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
60254 required for the transaction.
60255 </para>
60256 <para>
60257 If the remote server advertises support for the STARTTLS command, and Exim
60258 was built to support TLS encryption, it tries to start a TLS session unless the
60259 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
60260 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
60261 is called for verification.
60262 </para>
60263 <para>
60264 If the remote server advertises support for the AUTH command, Exim scans
60265 the authenticators configuration for any suitable client settings, as described
60266 in chapter <xref linkend="CHAPSMTPAUTH"/>.
60267 </para>
60268 <para>
60269 <indexterm role="concept">
60270 <primary>carriage return</primary>
60271 </indexterm>
60272 <indexterm role="concept">
60273 <primary>linefeed</primary>
60274 </indexterm>
60275 Responses from the remote host are supposed to be terminated by CR followed by
60276 LF. However, there are known to be hosts that do not send CR characters, so in
60277 order to be able to interwork with such hosts, Exim treats LF on its own as a
60278 line terminator.
60279 </para>
60280 <para>
60281 If a message contains a number of different addresses, all those with the same
60282 characteristics (for example, the same envelope sender) that resolve to the
60283 same set of hosts, in the same order, are sent in a single SMTP transaction,
60284 even if they are for different domains, unless there are more than the setting
60285 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
60286 they are split into groups containing no more than <option>max_rcpt</option>s addresses
60287 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
60288 in parallel sessions. The order of hosts with identical MX values is not
60289 significant when checking whether addresses can be batched in this way.
60290 </para>
60291 <para>
60292 When the <command>smtp</command> transport suffers a temporary failure that is not
60293 message-related, Exim updates its transport-specific database, which contains
60294 records indexed by host name that remember which messages are waiting for each
60295 particular host. It also updates the retry database with new retry times.
60296 </para>
60297 <para>
60298 <indexterm role="concept">
60299 <primary>hints database</primary>
60300 <secondary>retry keys</secondary>
60301 </indexterm>
60302 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
60303 a multi-homed host is broken, it will soon be skipped most of the time.
60304 See the next section for more detail about error handling.
60305 </para>
60306 <para>
60307 <indexterm role="concept">
60308 <primary>SMTP</primary>
60309 <secondary>passed connection</secondary>
60310 </indexterm>
60311 <indexterm role="concept">
60312 <primary>SMTP</primary>
60313 <secondary>batching over TCP/IP</secondary>
60314 </indexterm>
60315 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
60316 looks in the hints database for the transport to see if there are any queued
60317 messages waiting for the host to which it is connected. If it finds one, it
60318 creates a new Exim process using the <option>-MC</option> option (which can only be used by
60319 a process running as root or the Exim user) and passes the TCP/IP socket to it
60320 so that it can deliver another message using the same socket. The new process
60321 does only those deliveries that are routed to the connected host, and may in
60322 turn pass the socket on to a third process, and so on.
60323 </para>
60324 <para>
60325 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
60326 limit the number of messages sent down a single TCP/IP connection.
60327 </para>
60328 <para>
60329 <indexterm role="concept">
60330 <primary>asterisk</primary>
60331 <secondary>after IP address</secondary>
60332 </indexterm>
60333 The second and subsequent messages delivered down an existing connection are
60334 identified in the main log by the addition of an asterisk after the closing
60335 square bracket of the IP address.
60336 </para>
60337 </section>
60338 <section id="SECToutSMTPerr">
60339 <title>Errors in outgoing SMTP</title>
60340 <para>
60341 <indexterm role="concept">
60342 <primary>error</primary>
60343 <secondary>in outgoing SMTP</secondary>
60344 </indexterm>
60345 <indexterm role="concept">
60346 <primary>SMTP</primary>
60347 <secondary>errors in outgoing</secondary>
60348 </indexterm>
60349 <indexterm role="concept">
60350 <primary>host</primary>
60351 <secondary>error</secondary>
60352 </indexterm>
60353 Three different kinds of error are recognized for outgoing SMTP: host errors,
60354 message errors, and recipient errors.
60355 </para>
60356 <variablelist>
60357 <varlistentry>
60358 <term><emphasis role="bold">Host errors</emphasis></term>
60359 <listitem>
60360 <para>
60361 A host error is not associated with a particular message or with a
60362 particular recipient of a message. The host errors are:
60363 </para>
60364 <itemizedlist>
60365 <listitem>
60366 <para>
60367 Connection refused or timed out,
60368 </para>
60369 </listitem>
60370 <listitem>
60371 <para>
60372 Any error response code on connection,
60373 </para>
60374 </listitem>
60375 <listitem>
60376 <para>
60377 Any error response code to EHLO or HELO,
60378 </para>
60379 </listitem>
60380 <listitem>
60381 <para>
60382 Loss of connection at any time, except after <quote>.</quote>,
60383 </para>
60384 </listitem>
60385 <listitem>
60386 <para>
60387 I/O errors at any time,
60388 </para>
60389 </listitem>
60390 <listitem>
60391 <para>
60392 Timeouts during the session, other than in response to MAIL, RCPT or
60393 the <quote>.</quote> at the end of the data.
60394 </para>
60395 </listitem>
60396 </itemizedlist>
60397 <para>
60398 For a host error, a permanent error response on connection, or in response to
60399 EHLO, causes all addresses routed to the host to be failed. Any other host
60400 error causes all addresses to be deferred, and retry data to be created for the
60401 host. It is not tried again, for any message, until its retry time arrives. If
60402 the current set of addresses are not all delivered in this run (to some
60403 alternative host), the message is added to the list of those waiting for this
60404 host, so if it is still undelivered when a subsequent successful delivery is
60405 made to the host, it will be sent down the same SMTP connection.
60406 </para>
60407 </listitem></varlistentry>
60408 <varlistentry>
60409 <term><emphasis role="bold">Message errors</emphasis></term>
60410 <listitem>
60411 <para>
60412 <indexterm role="concept">
60413 <primary>message</primary>
60414 <secondary>error</secondary>
60415 </indexterm>
60416 A message error is associated with a particular message when sent to a
60417 particular host, but not with a particular recipient of the message. The
60418 message errors are:
60419 </para>
60420 <itemizedlist>
60421 <listitem>
60422 <para>
60423 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
60424 the data,
60425 </para>
60426 </listitem>
60427 <listitem>
60428 <para>
60429 Timeout after MAIL,
60430 </para>
60431 </listitem>
60432 <listitem>
60433 <para>
60434 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
60435 timeout after the DATA command itself is treated as a host error, as is loss of
60436 connection at any other time.
60437 </para>
60438 </listitem>
60439 </itemizedlist>
60440 <para>
60441 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
60442 to be failed, and a delivery error report to be returned to the sender. A
60443 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
60444 addresses to be deferred. Retry data is not created for the host, but instead,
60445 a retry record for the combination of host plus message id is created. The
60446 message is not added to the list of those waiting for this host. This ensures
60447 that the failing message will not be sent to this host again until the retry
60448 time arrives. However, other messages that are routed to the host are not
60449 affected, so if it is some property of the message that is causing the error,
60450 it will not stop the delivery of other mail.
60451 </para>
60452 <para>
60453 If the remote host specified support for the SIZE parameter in its response
60454 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
60455 over-large message will cause a message error because the error arrives as a
60456 response to MAIL.
60457 </para>
60458 </listitem></varlistentry>
60459 <varlistentry>
60460 <term><emphasis role="bold">Recipient errors</emphasis></term>
60461 <listitem>
60462 <para>
60463 <indexterm role="concept">
60464 <primary>recipient</primary>
60465 <secondary>error</secondary>
60466 </indexterm>
60467 A recipient error is associated with a particular recipient of a message. The
60468 recipient errors are:
60469 </para>
60470 <itemizedlist>
60471 <listitem>
60472 <para>
60473 Any error response to RCPT,
60474 </para>
60475 </listitem>
60476 <listitem>
60477 <para>
60478 Timeout after RCPT.
60479 </para>
60480 </listitem>
60481 </itemizedlist>
60482 <para>
60483 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
60484 recipient address to be failed, and a bounce message to be returned to the
60485 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
60486 address to be deferred, and routing retry data to be created for it. This is
60487 used to delay processing of the address in subsequent queue runs, until its
60488 routing retry time arrives. This applies to all messages, but because it
60489 operates only in queue runs, one attempt will be made to deliver a new message
60490 to the failing address before the delay starts to operate. This ensures that,
60491 if the failure is really related to the message rather than the recipient
60492 (<quote>message too big for this recipient</quote> is a possible example), other messages
60493 have a chance of getting delivered. If a delivery to the address does succeed,
60494 the retry information gets cleared, so all stuck messages get tried again, and
60495 the retry clock is reset.
60496 </para>
60497 <para>
60498 The message is not added to the list of those waiting for this host. Use of the
60499 host for other messages is unaffected, and except in the case of a timeout,
60500 other recipients are processed independently, and may be successfully delivered
60501 in the current SMTP session. After a timeout it is of course impossible to
60502 proceed with the session, so all addresses get deferred. However, those other
60503 than the one that failed do not suffer any subsequent retry delays. Therefore,
60504 if one recipient is causing trouble, the others have a chance of getting
60505 through when a subsequent delivery attempt occurs before the failing
60506 recipient&#x2019;s retry time.
60507 </para>
60508 </listitem></varlistentry>
60509 </variablelist>
60510 <para>
60511 In all cases, if there are other hosts (or IP addresses) available for the
60512 current set of addresses (for example, from multiple MX records), they are
60513 tried in this run for any undelivered addresses, subject of course to their
60514 own retry data. In other words, recipient error retry data does not take effect
60515 until the next delivery attempt.
60516 </para>
60517 <para>
60518 Some hosts have been observed to give temporary error responses to every
60519 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
60520 would be nice if such circumstances could be recognized, and defer data for the
60521 host itself created, but this is not possible within the current Exim design.
60522 What actually happens is that retry data for every (host, message) combination
60523 is created.
60524 </para>
60525 <para>
60526 The reason that timeouts after MAIL and RCPT are treated specially is that
60527 these can sometimes arise as a result of the remote host&#x2019;s verification
60528 procedures. Exim makes this assumption, and treats them as if a temporary error
60529 response had been received. A timeout after <quote>.</quote> is treated specially because
60530 it is known that some broken implementations fail to recognize the end of the
60531 message if the last character of the last line is a binary zero. Thus, it is
60532 helpful to treat this case as a message error.
60533 </para>
60534 <para>
60535 Timeouts at other times are treated as host errors, assuming a problem with the
60536 host, or the connection to it. If a timeout after MAIL, RCPT,
60537 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
60538 the timeout is likely to occur at some other point in the dialogue, causing it
60539 then to be treated as a host error.
60540 </para>
60541 <para>
60542 There is experimental evidence that some MTAs drop the connection after the
60543 terminating <quote>.</quote> if they do not like the contents of the message for some
60544 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
60545 should be given. That is why Exim treats this case as a message rather than a
60546 host error, in order not to delay other messages to the same host.
60547 </para>
60548 </section>
60549 <section id="SECID233">
60550 <title>Incoming SMTP messages over TCP/IP</title>
60551 <para>
60552 <indexterm role="concept">
60553 <primary>SMTP</primary>
60554 <secondary>incoming over TCP/IP</secondary>
60555 </indexterm>
60556 <indexterm role="concept">
60557 <primary>incoming SMTP over TCP/IP</primary>
60558 </indexterm>
60559 <indexterm role="concept">
60560 <primary>inetd</primary>
60561 </indexterm>
60562 <indexterm role="concept">
60563 <primary>daemon</primary>
60564 </indexterm>
60565 Incoming SMTP messages can be accepted in one of two ways: by running a
60566 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
60567 <filename>/etc/inetd.conf</filename> should be like this:
60568 </para>
60569 <literallayout class="monospaced">
60570 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
60571 </literallayout>
60572 <para>
60573 Exim distinguishes between this case and the case of a locally running user
60574 agent using the <option>-bs</option> option by checking whether or not the standard input is
60575 a socket. When it is, either the port must be privileged (less than 1024), or
60576 the caller must be root or the Exim user. If any other user passes a socket
60577 with an unprivileged port number, Exim prints a message on the standard error
60578 stream and exits with an error code.
60579 </para>
60580 <para>
60581 By default, Exim does not make a log entry when a remote host connects or
60582 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
60583 unexpected. It can be made to write such log entries by setting the
60584 <option>smtp_connection</option> log selector.
60585 </para>
60586 <para>
60587 <indexterm role="concept">
60588 <primary>carriage return</primary>
60589 </indexterm>
60590 <indexterm role="concept">
60591 <primary>linefeed</primary>
60592 </indexterm>
60593 Commands from the remote host are supposed to be terminated by CR followed by
60594 LF. However, there are known to be hosts that do not send CR characters. In
60595 order to be able to interwork with such hosts, Exim treats LF on its own as a
60596 line terminator.
60597 Furthermore, because common code is used for receiving messages from all
60598 sources, a CR on its own is also interpreted as a line terminator. However, the
60599 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
60600 </para>
60601 <para>
60602 <indexterm role="concept">
60603 <primary>EHLO</primary>
60604 <secondary>invalid data</secondary>
60605 </indexterm>
60606 <indexterm role="concept">
60607 <primary>HELO</primary>
60608 <secondary>invalid data</secondary>
60609 </indexterm>
60610 One area that sometimes gives rise to problems concerns the EHLO or
60611 HELO commands. Some clients send syntactically invalid versions of these
60612 commands, which Exim rejects by default. (This is nothing to do with verifying
60613 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
60614 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
60615 match the broken hosts that send invalid commands.
60616 </para>
60617 <para>
60618 <indexterm role="concept">
60619 <primary>SIZE option on MAIL command</primary>
60620 </indexterm>
60621 <indexterm role="concept">
60622 <primary>MAIL</primary>
60623 <secondary>SIZE option</secondary>
60624 </indexterm>
60625 The amount of disk space available is checked whenever SIZE is received on
60626 a MAIL command, independently of whether <option>message_size_limit</option> or
60627 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
60628 false. A temporary error is given if there is not enough space. If
60629 <option>check_spool_space</option> is set, the check is for that amount of space plus the
60630 value given with SIZE, that is, it checks that the addition of the incoming
60631 message will not reduce the space below the threshold.
60632 </para>
60633 <para>
60634 When a message is successfully received, Exim includes the local message id in
60635 its response to the final <quote>.</quote> that terminates the data. If the remote host
60636 logs this text it can help with tracing what has happened to a message.
60637 </para>
60638 <para>
60639 The Exim daemon can limit the number of simultaneous incoming connections it is
60640 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
60641 number of simultaneous incoming connections from a single remote host (see the
60642 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
60643 rejected using the SMTP temporary error code 421.
60644 </para>
60645 <para>
60646 The Exim daemon does not rely on the SIGCHLD signal to detect when a
60647 subprocess has finished, as this can get lost at busy times. Instead, it looks
60648 for completed subprocesses every time it wakes up. Provided there are other
60649 things happening (new incoming calls, starts of queue runs), completed
60650 processes will be noticed and tidied away. On very quiet systems you may
60651 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
60652 it will be noticed when the daemon next wakes up.
60653 </para>
60654 <para>
60655 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
60656 and can also be set up to reject SMTP calls from non-reserved hosts at times of
60657 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
60658 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
60659 applies in both the daemon and <emphasis>inetd</emphasis> cases.
60660 </para>
60661 <para>
60662 Exim normally starts a delivery process for each message received, though this
60663 can be varied by means of the <option>-odq</option> command line option and the
60664 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
60665 number of simultaneously running delivery processes started in this way from
60666 SMTP input can be limited by the <option>smtp_accept_queue</option> and
60667 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
60668 subsequently received messages are just put on the input queue without starting
60669 a delivery process.
60670 </para>
60671 <para>
60672 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
60673 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
60674 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
60675 handled by an entirely independent Exim process. Control by load average is,
60676 however, available with <emphasis>inetd</emphasis>.
60677 </para>
60678 <para>
60679 Exim can be configured to verify addresses in incoming SMTP commands as they
60680 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
60681 to rewrite addresses at this time &ndash; before any syntax checking is done. See
60682 section <xref linkend="SECTrewriteS"/>.
60683 </para>
60684 <para>
60685 Exim can also be configured to limit the rate at which a client host submits
60686 MAIL and RCPT commands in a single SMTP session. See the
60687 <option>smtp_ratelimit_hosts</option> option.
60688 </para>
60689 </section>
60690 <section id="SECID234">
60691 <title>Unrecognized SMTP commands</title>
60692 <para>
60693 <indexterm role="concept">
60694 <primary>SMTP</primary>
60695 <secondary>unrecognized commands</secondary>
60696 </indexterm>
60697 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
60698 commands during a single SMTP connection, it drops the connection after sending
60699 the error response to the last command. The default value for
60700 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
60701 abuse that subvert web servers into making connections to SMTP ports; in these
60702 circumstances, a number of non-SMTP lines are sent first.
60703 </para>
60704 </section>
60705 <section id="SECID235">
60706 <title>Syntax and protocol errors in SMTP commands</title>
60707 <para>
60708 <indexterm role="concept">
60709 <primary>SMTP</primary>
60710 <secondary>syntax errors</secondary>
60711 </indexterm>
60712 <indexterm role="concept">
60713 <primary>SMTP</primary>
60714 <secondary>protocol errors</secondary>
60715 </indexterm>
60716 A syntax error is detected if an SMTP command is recognized, but there is
60717 something syntactically wrong with its data, for example, a malformed email
60718 address in a RCPT command. Protocol errors include invalid command
60719 sequencing such as RCPT before MAIL. If Exim receives more than
60720 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
60721 drops the connection after sending the error response to the last command. The
60722 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
60723 broken clients that loop sending bad commands (yes, it has been seen).
60724 </para>
60725 </section>
60726 <section id="SECID236">
60727 <title>Use of non-mail SMTP commands</title>
60728 <para>
60729 <indexterm role="concept">
60730 <primary>SMTP</primary>
60731 <secondary>non-mail commands</secondary>
60732 </indexterm>
60733 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
60734 DATA. Exim counts such commands, and drops the connection if there are too
60735 many of them in a single SMTP session. This action catches some
60736 denial-of-service attempts and things like repeated failing AUTHs, or a mad
60737 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
60738 defines what <quote>too many</quote> means. Its default value is 10.
60739 </para>
60740 <para>
60741 When a new message is expected, one occurrence of RSET is not counted. This
60742 allows a client to send one RSET between messages (this is not necessary,
60743 but some clients do it). Exim also allows one uncounted occurrence of HELO
60744 or EHLO, and one occurrence of STARTTLS between messages. After
60745 starting up a TLS session, another EHLO is expected, and so it too is not
60746 counted.
60747 </para>
60748 <para>
60749 The first occurrence of AUTH in a connection, or immediately following
60750 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
60751 RCPT, DATA, and QUIT are counted.
60752 </para>
60753 <para>
60754 You can control which hosts are subject to the limit set by
60755 <option>smtp_accept_max_nonmail</option> by setting
60756 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
60757 the limit apply to all hosts. This option means that you can exclude any
60758 specific badly-behaved hosts that you have to live with.
60759 </para>
60760 </section>
60761 <section id="SECID237">
60762 <title>The VRFY and EXPN commands</title>
60763 <para>
60764 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
60765 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
60766 appropriate) in order to decide whether the command should be accepted or not.
60767 If no ACL is defined, the command is rejected.
60768 </para>
60769 <para>
60770 <indexterm role="concept">
60771 <primary>VRFY</primary>
60772 <secondary>processing</secondary>
60773 </indexterm>
60774 When VRFY is accepted, it runs exactly the same code as when Exim is
60775 called with the <option>-bv</option> option.
60776 </para>
60777 <para>
60778 <indexterm role="concept">
60779 <primary>EXPN</primary>
60780 <secondary>processing</secondary>
60781 </indexterm>
60782 When EXPN is accepted, a single-level expansion of the address is done.
60783 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
60784 than a verification (the <option>-bv</option> option). If an unqualified local part is given
60785 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
60786 of VRFY and EXPN commands are logged on the main and reject logs, and
60787 VRFY verification failures are logged on the main log for consistency with
60788 RCPT failures.
60789 </para>
60790 </section>
60791 <section id="SECTETRN">
60792 <title>The ETRN command</title>
60793 <para>
60794 <indexterm role="concept">
60795 <primary>ETRN</primary>
60796 <secondary>processing</secondary>
60797 </indexterm>
60798 RFC 1985 describes an SMTP command called ETRN that is designed to
60799 overcome the security problems of the TURN command (which has fallen into
60800 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
60801 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
60802 should be accepted or not. If no ACL is defined, the command is rejected.
60803 </para>
60804 <para>
60805 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
60806 delivery to certain hosts. As Exim does not organize its message queue by host,
60807 the only form of ETRN that is supported by default is the one where the
60808 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
60809 specific to the SMTP server. A valid ETRN command causes a run of Exim with
60810 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
60811 argument. For example,
60812 </para>
60813 <literallayout class="monospaced">
60814 ETRN #brigadoon
60815 </literallayout>
60816 <para>
60817 runs the command
60818 </para>
60819 <literallayout class="monospaced">
60820 exim -R brigadoon
60821 </literallayout>
60822 <para>
60823 which causes a delivery attempt on all messages with undelivered addresses
60824 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
60825 default), Exim prevents the simultaneous execution of more than one queue run
60826 for the same argument string as a result of an ETRN command. This stops
60827 a misbehaving client from starting more than one queue runner at once.
60828 </para>
60829 <para>
60830 <indexterm role="concept">
60831 <primary>hints database</primary>
60832 <secondary>ETRN serialization</secondary>
60833 </indexterm>
60834 Exim implements the serialization by means of a hints database in which a
60835 record is written whenever a process is started by ETRN, and deleted when
60836 the process completes. However, Exim does not keep the SMTP session waiting for
60837 the ETRN process to complete. Once ETRN is accepted, the client is sent
60838 a <quote>success</quote> return code. Obviously there is scope for hints records to get
60839 left lying around if there is a system or program crash. To guard against this,
60840 Exim ignores any records that are more than six hours old.
60841 </para>
60842 <para>
60843 <indexterm role="option">
60844 <primary><option>smtp_etrn_command</option></primary>
60845 </indexterm>
60846 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
60847 used. This specifies a command that is run whenever ETRN is received,
60848 whatever the form of its argument. For
60849 example:
60850 </para>
60851 <literallayout class="monospaced">
60852 smtp_etrn_command = /etc/etrn_command $domain \
60853                     $sender_host_address
60854 </literallayout>
60855 <para>
60856 <indexterm role="variable">
60857 <primary><varname>$domain</varname></primary>
60858 </indexterm>
60859 The string is split up into arguments which are independently expanded. The
60860 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
60861 and no syntax checking is done on the contents of this argument. Exim does not
60862 wait for the command to complete, so its status code is not checked. Exim runs
60863 under its own uid and gid when receiving incoming SMTP, so it is not possible
60864 for it to change them before running the command.
60865 </para>
60866 </section>
60867 <section id="SECID238">
60868 <title>Incoming local SMTP</title>
60869 <para>
60870 <indexterm role="concept">
60871 <primary>SMTP</primary>
60872 <secondary>local incoming</secondary>
60873 </indexterm>
60874 Some user agents use SMTP to pass messages to their local MTA using the
60875 standard input and output, as opposed to passing the envelope on the command
60876 line and writing the message to the standard input. This is supported by the
60877 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
60878 messages over TCP/IP (including the use of ACLs), except that the envelope
60879 sender given in a MAIL command is ignored unless the caller is trusted. In
60880 an ACL you can detect this form of SMTP input by testing for an empty host
60881 identification. It is common to have this as the first line in the ACL that
60882 runs for RCPT commands:
60883 </para>
60884 <literallayout class="monospaced">
60885 accept hosts = :
60886 </literallayout>
60887 <para>
60888 This accepts SMTP messages from local processes without doing any other tests.
60889 </para>
60890 </section>
60891 <section id="SECTbatchSMTP">
60892 <title>Outgoing batched SMTP</title>
60893 <para>
60894 <indexterm role="concept">
60895 <primary>SMTP</primary>
60896 <secondary>batched outgoing</secondary>
60897 </indexterm>
60898 <indexterm role="concept">
60899 <primary>batched SMTP output</primary>
60900 </indexterm>
60901 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
60902 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
60903 be output in BSMTP format. No SMTP responses are possible for this form of
60904 delivery. All it is doing is using SMTP commands as a way of transmitting the
60905 envelope along with the message.
60906 </para>
60907 <para>
60908 The message is written to the file or pipe preceded by the SMTP commands
60909 MAIL and RCPT, and followed by a line containing a single dot. Lines in
60910 the message that start with a dot have an extra dot added. The SMTP command
60911 HELO is not normally used. If it is required, the <option>message_prefix</option> option
60912 can be used to specify it.
60913 </para>
60914 <para>
60915 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
60916 one recipient address at a time by default. However, you can arrange for them
60917 to handle several addresses at once by setting the <option>batch_max</option> option. When
60918 this is done for BSMTP, messages may contain multiple RCPT commands. See
60919 chapter <xref linkend="CHAPbatching"/> for more details.
60920 </para>
60921 <para>
60922 <indexterm role="variable">
60923 <primary><varname>$host</varname></primary>
60924 </indexterm>
60925 When one or more addresses are routed to a BSMTP transport by a router that
60926 sets up a host list, the name of the first host on the list is available to the
60927 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
60928 router:
60929 </para>
60930 <literallayout class="monospaced">
60931 begin routers
60932 route_append:
60933   driver = manualroute
60934   transport = smtp_appendfile
60935   route_list = domain.example  batch.host.example
60936
60937 begin transports
60938 smtp_appendfile:
60939   driver = appendfile
60940   directory = /var/bsmtp/$host
60941   batch_max = 1000
60942   use_bsmtp
60943   user = exim
60944 </literallayout>
60945 <para>
60946 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
60947 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
60948 message (unless there are more than 1000 recipients).
60949 </para>
60950 </section>
60951 <section id="SECTincomingbatchedSMTP">
60952 <title>Incoming batched SMTP</title>
60953 <para>
60954 <indexterm role="concept">
60955 <primary>SMTP</primary>
60956 <secondary>batched incoming</secondary>
60957 </indexterm>
60958 <indexterm role="concept">
60959 <primary>batched SMTP input</primary>
60960 </indexterm>
60961 The <option>-bS</option> command line option causes Exim to accept one or more messages by
60962 reading SMTP on the standard input, but to generate no responses. If the caller
60963 is trusted, the senders in the MAIL commands are believed; otherwise the
60964 sender is always the caller of Exim. Unqualified senders and receivers are not
60965 rejected (there seems little point) but instead just get qualified. HELO
60966 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
60967 as NOOP; QUIT quits.
60968 </para>
60969 <para>
60970 Minimal policy checking is done for BSMTP input. Only the non-SMTP
60971 ACL is run in the same way as for non-SMTP local input.
60972 </para>
60973 <para>
60974 If an error is detected while reading a message, including a missing <quote>.</quote> at
60975 the end, Exim gives up immediately. It writes details of the error to the
60976 standard output in a stylized way that the calling program should be able to
60977 make some use of automatically, for example:
60978 </para>
60979 <literallayout class="monospaced">
60980 554 Unexpected end of file
60981 Transaction started in line 10
60982 Error detected in line 14
60983 </literallayout>
60984 <para>
60985 It writes a more verbose version, for human consumption, to the standard error
60986 file, for example:
60987 </para>
60988 <literallayout class="monospaced">
60989 An error was detected while processing a file of BSMTP input.
60990 The error message was:
60991
60992 501 '&gt;' missing at end of address
60993
60994 The SMTP transaction started in line 10.
60995 The error was detected in line 12.
60996 The SMTP command at fault was:
60997
60998 rcpt to:&lt;malformed@in.com.plete
60999
61000 1 previous message was successfully processed.
61001 The rest of the batch was abandoned.
61002 </literallayout>
61003 <para>
61004 The return code from Exim is zero only if there were no errors. It is 1 if some
61005 messages were accepted before an error was detected, and 2 if no messages were
61006 accepted.
61007 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
61008 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
61009 </para>
61010 </section>
61011 </chapter>
61012
61013 <chapter id="CHAPemsgcust">
61014 <title>Customizing bounce and warning messages</title>
61015 <titleabbrev>Customizing messages</titleabbrev>
61016 <para>
61017 When a message fails to be delivered, or remains on the queue for more than a
61018 configured amount of time, Exim sends a message to the original sender, or
61019 to an alternative configured address. The text of these messages is built into
61020 the code of Exim, but it is possible to change it, either by adding a single
61021 string, or by replacing each of the paragraphs by text supplied in a file.
61022 </para>
61023 <para>
61024 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
61025 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
61026 option. Exim also adds the line
61027 </para>
61028 <literallayout class="monospaced">
61029 Auto-Submitted: auto-generated
61030 </literallayout>
61031 <para>
61032 to all warning and bounce messages,
61033 </para>
61034 <section id="SECID239">
61035 <title>Customizing bounce messages</title>
61036 <para>
61037 <indexterm role="concept">
61038 <primary>customizing</primary>
61039 <secondary>bounce message</secondary>
61040 </indexterm>
61041 <indexterm role="concept">
61042 <primary>bounce message</primary>
61043 <secondary>customizing</secondary>
61044 </indexterm>
61045 If <option>bounce_message_text</option> is set, its contents are included in the default
61046 message immediately after <quote>This message was created automatically by mail
61047 delivery software.</quote> The string is not expanded. It is not used if
61048 <option>bounce_message_file</option> is set.
61049 </para>
61050 <para>
61051 When <option>bounce_message_file</option> is set, it must point to a template file for
61052 constructing error messages. The file consists of a series of text items,
61053 separated by lines consisting of exactly four asterisks. If the file cannot be
61054 opened, default text is used and a message is written to the main and panic
61055 logs. If any text item in the file is empty, default text is used for that
61056 item.
61057 </para>
61058 <para>
61059 <indexterm role="variable">
61060 <primary><varname>$bounce_recipient</varname></primary>
61061 </indexterm>
61062 <indexterm role="variable">
61063 <primary><varname>$bounce_return_size_limit</varname></primary>
61064 </indexterm>
61065 Each item of text that is read from the file is expanded, and there are two
61066 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
61067 the recipient of an error message while it is being created, and
61068 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
61069 option, rounded to a whole number.
61070 </para>
61071 <para>
61072 The items must appear in the file in the following order:
61073 </para>
61074 <itemizedlist>
61075 <listitem>
61076 <para>
61077 The first item is included in the headers, and should include at least a
61078 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
61079 </para>
61080 </listitem>
61081 <listitem>
61082 <para>
61083 The second item forms the start of the error message. After it, Exim lists the
61084 failing addresses with their error messages.
61085 </para>
61086 </listitem>
61087 <listitem>
61088 <para>
61089 The third item is used to introduce any text from pipe transports that is to be
61090 returned to the sender. It is omitted if there is no such text.
61091 </para>
61092 </listitem>
61093 <listitem>
61094 <para>
61095 The fourth item is used to introduce the copy of the message that is returned
61096 as part of the error report.
61097 </para>
61098 </listitem>
61099 <listitem>
61100 <para>
61101 The fifth item is added after the fourth one if the returned message is
61102 truncated because it is bigger than <option>return_size_limit</option>.
61103 </para>
61104 </listitem>
61105 <listitem>
61106 <para>
61107 The sixth item is added after the copy of the original message.
61108 </para>
61109 </listitem>
61110 </itemizedlist>
61111 <para>
61112 The default state (<option>bounce_message_file</option> unset) is equivalent to the
61113 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
61114 other lines have been split in order to fit them on the page:
61115 </para>
61116 <literallayout class="monospaced">
61117 Subject: Mail delivery failed
61118   ${if eq{$sender_address}{$bounce_recipient}
61119   {: returning message to sender}}
61120 ****
61121 This message was created automatically by mail delivery software.
61122
61123 A message ${if eq{$sender_address}{$bounce_recipient}
61124   {that you sent }{sent by
61125
61126 &lt;$sender_address&gt;
61127
61128 }}could not be delivered to all of its recipients.
61129 This is a permanent error. The following address(es) failed:
61130 ****
61131 The following text was generated during the delivery attempt(s):
61132 ****
61133 ------ This is a copy of the message, including all the headers.
61134   ------
61135 ****
61136 ------ The body of the message is $message_size characters long;
61137   only the first
61138 ------ $bounce_return_size_limit or so are included here.
61139 ****
61140 </literallayout>
61141 </section>
61142 <section id="SECTcustwarn">
61143 <title>Customizing warning messages</title>
61144 <para>
61145 <indexterm role="concept">
61146 <primary>customizing</primary>
61147 <secondary>warning message</secondary>
61148 </indexterm>
61149 <indexterm role="concept">
61150 <primary>warning of delay</primary>
61151 <secondary>customizing the message</secondary>
61152 </indexterm>
61153 The option <option>warn_message_file</option> can be pointed at a template file for use when
61154 warnings about message delays are created. In this case there are only three
61155 text sections:
61156 </para>
61157 <itemizedlist>
61158 <listitem>
61159 <para>
61160 The first item is included in the headers, and should include at least a
61161 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
61162 </para>
61163 </listitem>
61164 <listitem>
61165 <para>
61166 The second item forms the start of the warning message. After it, Exim lists
61167 the delayed addresses.
61168 </para>
61169 </listitem>
61170 <listitem>
61171 <para>
61172 The third item then ends the message.
61173 </para>
61174 </listitem>
61175 </itemizedlist>
61176 <para>
61177 The default state is equivalent to the following file, except that some lines
61178 have been split here, in order to fit them on the page:
61179 </para>
61180 <literallayout class="monospaced">
61181 Subject: Warning: message $message_exim_id delayed
61182   $warn_message_delay
61183 ****
61184 This message was created automatically by mail delivery software.
61185
61186 A message ${if eq{$sender_address}{$warn_message_recipients}
61187 {that you sent }{sent by
61188
61189 &lt;$sender_address&gt;
61190
61191 }}has not been delivered to all of its recipients after
61192 more than $warn_message_delay on the queue on $primary_hostname.
61193
61194 The message identifier is:     $message_exim_id
61195 The subject of the message is: $h_subject
61196 The date of the message is:    $h_date
61197
61198 The following address(es) have not yet been delivered:
61199 ****
61200 No action is required on your part. Delivery attempts will
61201 continue for some time, and this warning may be repeated at
61202 intervals if the message remains undelivered. Eventually the
61203 mail delivery software will give up, and when that happens,
61204 the message will be returned to you.
61205 </literallayout>
61206 <para>
61207 <indexterm role="variable">
61208 <primary><varname>$warn_message_delay</varname></primary>
61209 </indexterm>
61210 <indexterm role="variable">
61211 <primary><varname>$warn_message_recipients</varname></primary>
61212 </indexterm>
61213 However, in the default state the subject and date lines are omitted if no
61214 appropriate headers exist. During the expansion of this file,
61215 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
61216 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
61217 of recipients for the warning message. There may be more than one if there are
61218 multiple addresses with different <option>errors_to</option> settings on the routers that
61219 handled them.
61220 </para>
61221 </section>
61222 </chapter>
61223
61224 <chapter id="CHAPcomconreq">
61225 <title>Some common configuration settings</title>
61226 <para>
61227 This chapter discusses some configuration settings that seem to be fairly
61228 common. More examples and discussion can be found in the Exim book.
61229 </para>
61230 <section id="SECID240">
61231 <title>Sending mail to a smart host</title>
61232 <para>
61233 <indexterm role="concept">
61234 <primary>smart host</primary>
61235 <secondary>example router</secondary>
61236 </indexterm>
61237 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
61238 should replace the default <command>dnslookup</command> router with a router which does the
61239 routing explicitly:
61240 </para>
61241 <literallayout class="monospaced">
61242 send_to_smart_host:
61243   driver = manualroute
61244   route_list = !+local_domains smart.host.name
61245   transport = remote_smtp
61246 </literallayout>
61247 <para>
61248 You can use the smart host&#x2019;s IP address instead of the name if you wish.
61249 If you are using Exim only to submit messages to a smart host, and not for
61250 receiving incoming messages, you can arrange for it to do the submission
61251 synchronously by setting the <option>mua_wrapper</option> option (see chapter
61252 <xref linkend="CHAPnonqueueing"/>).
61253 </para>
61254 </section>
61255 <section id="SECTmailinglists">
61256 <title>Using Exim to handle mailing lists</title>
61257 <para>
61258 <indexterm role="concept">
61259 <primary>mailing lists</primary>
61260 </indexterm>
61261 Exim can be used to run simple mailing lists, but for large and/or complicated
61262 requirements, the use of additional specialized mailing list software such as
61263 Majordomo or Mailman is recommended.
61264 </para>
61265 <para>
61266 The <command>redirect</command> router can be used to handle mailing lists where each list
61267 is maintained in a separate file, which can therefore be managed by an
61268 independent manager. The <option>domains</option> router option can be used to run these
61269 lists in a separate domain from normal mail. For example:
61270 </para>
61271 <literallayout class="monospaced">
61272 lists:
61273   driver = redirect
61274   domains = lists.example
61275   file = /usr/lists/$local_part
61276   forbid_pipe
61277   forbid_file
61278   errors_to = $local_part-request@lists.example
61279   no_more
61280 </literallayout>
61281 <para>
61282 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
61283 in that domain, it looks for a file that matches the local part. If there is no
61284 such file, the router declines, but because <option>no_more</option> is set, no subsequent
61285 routers are tried, and so the whole delivery fails.
61286 </para>
61287 <para>
61288 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
61289 expanded into a file name or a pipe delivery, which is usually inappropriate in
61290 a mailing list.
61291 </para>
61292 <para>
61293 <indexterm role="option">
61294 <primary><option>errors_to</option></primary>
61295 </indexterm>
61296 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
61297 taken from a mailing list are to be sent to the given address rather than the
61298 original sender of the message. However, before acting on this, Exim verifies
61299 the error address, and ignores it if verification fails.
61300 </para>
61301 <para>
61302 For example, using the configuration above, mail sent to
61303 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
61304 <filename>/usr/lists/dicts</filename>, with error reports directed to
61305 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
61306 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
61307 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
61308 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
61309 or <option>local_part_suffix</option> options) to handle addresses of the form
61310 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
61311 </para>
61312 </section>
61313 <section id="SECID241">
61314 <title>Syntax errors in mailing lists</title>
61315 <para>
61316 <indexterm role="concept">
61317 <primary>mailing lists</primary>
61318 <secondary>syntax errors in</secondary>
61319 </indexterm>
61320 If an entry in redirection data contains a syntax error, Exim normally defers
61321 delivery of the original address. That means that a syntax error in a mailing
61322 list holds up all deliveries to the list. This may not be appropriate when a
61323 list is being maintained automatically from data supplied by users, and the
61324 addresses are not rigorously checked.
61325 </para>
61326 <para>
61327 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
61328 entries that fail to parse, noting the incident in the log. If in addition
61329 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
61330 whenever a broken address is skipped. It is usually appropriate to set
61331 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
61332 </para>
61333 </section>
61334 <section id="SECID242">
61335 <title>Re-expansion of mailing lists</title>
61336 <para>
61337 <indexterm role="concept">
61338 <primary>mailing lists</primary>
61339 <secondary>re-expansion of</secondary>
61340 </indexterm>
61341 Exim remembers every individual address to which a message has been delivered,
61342 in order to avoid duplication, but it normally stores only the original
61343 recipient addresses with a message. If all the deliveries to a mailing list
61344 cannot be done at the first attempt, the mailing list is re-expanded when the
61345 delivery is next tried. This means that alterations to the list are taken into
61346 account at each delivery attempt, so addresses that have been added to
61347 the list since the message arrived will therefore receive a copy of the
61348 message, even though it pre-dates their subscription.
61349 </para>
61350 <para>
61351 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
61352 on the <command>redirect</command> router. If this is done, any addresses generated by the
61353 router that fail to deliver at the first attempt are added to the message as
61354 <quote>top level</quote> addresses, and the parent address that generated them is marked
61355 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
61356 subsequent delivery attempts. The disadvantage of this is that if any of the
61357 failing addresses are incorrect, correcting them in the file has no effect on
61358 pre-existing messages.
61359 </para>
61360 <para>
61361 The original top-level address is remembered with each of the generated
61362 addresses, and is output in any log messages. However, any intermediate parent
61363 addresses are not recorded. This makes a difference to the log only if the
61364 <option>all_parents</option> selector is set, but for mailing lists there is normally only
61365 one level of expansion anyway.
61366 </para>
61367 </section>
61368 <section id="SECID243">
61369 <title>Closed mailing lists</title>
61370 <para>
61371 <indexterm role="concept">
61372 <primary>mailing lists</primary>
61373 <secondary>closed</secondary>
61374 </indexterm>
61375 The examples so far have assumed open mailing lists, to which anybody may
61376 send mail. It is also possible to set up closed lists, where mail is accepted
61377 from specified senders only. This is done by making use of the generic
61378 <option>senders</option> option to restrict the router that handles the list.
61379 </para>
61380 <para>
61381 The following example uses the same file as a list of recipients and as a list
61382 of permitted senders. It requires three routers:
61383 </para>
61384 <literallayout class="monospaced">
61385 lists_request:
61386   driver = redirect
61387   domains = lists.example
61388   local_part_suffix = -request
61389   file = /usr/lists/$local_part$local_part_suffix
61390   no_more
61391
61392 lists_post:
61393   driver = redirect
61394   domains = lists.example
61395   senders = ${if exists {/usr/lists/$local_part}\
61396              {lsearch;/usr/lists/$local_part}{*}}
61397   file = /usr/lists/$local_part
61398   forbid_pipe
61399   forbid_file
61400   errors_to = $local_part-request@lists.example
61401   no_more
61402
61403 lists_closed:
61404   driver = redirect
61405   domains = lists.example
61406   allow_fail
61407   data = :fail: $local_part@lists.example is a closed mailing list
61408 </literallayout>
61409 <para>
61410 All three routers have the same <option>domains</option> setting, so for any other domains,
61411 they are all skipped. The first router runs only if the local part ends in
61412 <option>-request</option>. It handles messages to the list manager(s) by means of an open
61413 mailing list.
61414 </para>
61415 <para>
61416 The second router runs only if the <option>senders</option> precondition is satisfied. It
61417 checks for the existence of a list that corresponds to the local part, and then
61418 checks that the sender is on the list by means of a linear search. It is
61419 necessary to check for the existence of the file before trying to search it,
61420 because otherwise Exim thinks there is a configuration error. If the file does
61421 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
61422 means that the router runs, but because there is no list, declines, and
61423 <option>no_more</option> ensures that no further routers are run. The address fails with an
61424 <quote>unrouteable address</quote> error.
61425 </para>
61426 <para>
61427 The third router runs only if the second router is skipped, which happens when
61428 a mailing list exists, but the sender is not on it. This router forcibly fails
61429 the address, giving a suitable error message.
61430 </para>
61431 </section>
61432 <section id="SECTverp">
61433 <title>Variable Envelope Return Paths (VERP)</title>
61434 <para>
61435 <indexterm role="concept">
61436 <primary>VERP</primary>
61437 </indexterm>
61438 <indexterm role="concept">
61439 <primary>Variable Envelope Return Paths</primary>
61440 </indexterm>
61441 <indexterm role="concept">
61442 <primary>envelope sender</primary>
61443 </indexterm>
61444 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;
61445 are a way of helping mailing list administrators discover which subscription
61446 address is the cause of a particular delivery failure. The idea is to encode
61447 the original recipient address in the outgoing envelope sender address, so that
61448 if the message is forwarded by another host and then subsequently bounces, the
61449 original recipient can be extracted from the recipient address of the bounce.
61450 </para>
61451 <para>
61452 <indexterm role="option">
61453 <primary><option>errors_to</option></primary>
61454 </indexterm>
61455 <indexterm role="option">
61456 <primary><option>return_path</option></primary>
61457 </indexterm>
61458 Envelope sender addresses can be modified by Exim using two different
61459 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
61460 list examples), or the <option>return_path</option> option on a transport. The second of
61461 these is effective only if the message is successfully delivered to another
61462 host; it is not used for errors detected on the local host (see the description
61463 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
61464 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
61465 </para>
61466 <literallayout class="monospaced">
61467 verp_smtp:
61468   driver = smtp
61469   max_rcpt = 1
61470   return_path = \
61471     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61472       {$1-request+$local_part=$domain@your.dom.example}fail}
61473 </literallayout>
61474 <para>
61475 This has the effect of rewriting the return path (envelope sender) on outgoing
61476 SMTP messages, if the local part of the original return path ends in
61477 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
61478 local part and domain of the recipient into the return path. Suppose, for
61479 example, that a message whose return path has been set to
61480 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
61481 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
61482 rewritten as
61483 </para>
61484 <literallayout class="monospaced">
61485 somelist-request+subscriber=other.dom.example@your.dom.example
61486 </literallayout>
61487 <para>
61488 <indexterm role="variable">
61489 <primary><varname>$local_part</varname></primary>
61490 </indexterm>
61491 For this to work, you must tell Exim to send multiple copies of messages that
61492 have more than one recipient, so that each copy has just one recipient. This is
61493 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
61494 might be sent to several different recipients in the same domain, in which case
61495 <varname>$local_part</varname> is not available in the transport, because it is not unique.
61496 </para>
61497 <para>
61498 Unless your host is doing nothing but mailing list deliveries, you should
61499 probably use a separate transport for the VERP deliveries, so as not to use
61500 extra resources in making one-per-recipient copies for other deliveries. This
61501 can easily be done by expanding the <option>transport</option> option in the router:
61502 </para>
61503 <literallayout class="monospaced">
61504 dnslookup:
61505   driver = dnslookup
61506   domains = ! +local_domains
61507   transport = \
61508     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
61509       {verp_smtp}{remote_smtp}}
61510   no_more
61511 </literallayout>
61512 <para>
61513 If you want to change the return path using <option>errors_to</option> in a router instead
61514 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
61515 routers that handle mailing list addresses. This will ensure that all delivery
61516 errors, including those detected on the local host, are sent to the VERP
61517 address.
61518 </para>
61519 <para>
61520 On a host that does no local deliveries and has no manual routing, only the
61521 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
61522 SMTP deliveries. Every mailing list recipient has its own return path value,
61523 and so Exim must hand them to the transport one at a time. Here is an example
61524 of a <command>dnslookup</command> router that implements VERP:
61525 </para>
61526 <literallayout class="monospaced">
61527 verp_dnslookup:
61528   driver = dnslookup
61529   domains = ! +local_domains
61530   transport = remote_smtp
61531   errors_to = \
61532     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
61533      {$1-request+$local_part=$domain@your.dom.example}fail}
61534   no_more
61535 </literallayout>
61536 <para>
61537 Before you start sending out messages with VERPed return paths, you must also
61538 configure Exim to accept the bounce messages that come back to those paths.
61539 Typically this is done by setting a <option>local_part_suffix</option> option for a
61540 router, and using this to route the messages to wherever you want to handle
61541 them.
61542 </para>
61543 <para>
61544 The overhead incurred in using VERP depends very much on the size of the
61545 message, the number of recipient addresses that resolve to the same remote
61546 host, and the speed of the connection over which the message is being sent. If
61547 a lot of addresses resolve to the same host and the connection is slow, sending
61548 a separate copy of the message for each address may take substantially longer
61549 than sending a single copy with many recipients (for which VERP cannot be
61550 used).
61551 </para>
61552 </section>
61553 <section id="SECTvirtualdomains">
61554 <title>Virtual domains</title>
61555 <para>
61556 <indexterm role="concept">
61557 <primary>virtual domains</primary>
61558 </indexterm>
61559 <indexterm role="concept">
61560 <primary>domain</primary>
61561 <secondary>virtual</secondary>
61562 </indexterm>
61563 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
61564 meanings:
61565 </para>
61566 <itemizedlist>
61567 <listitem>
61568 <para>
61569 A domain for which there are no real mailboxes; all valid local parts are
61570 aliases for other email addresses. Common examples are organizational
61571 top-level domains and <quote>vanity</quote> domains.
61572 </para>
61573 </listitem>
61574 <listitem>
61575 <para>
61576 One of a number of independent domains that are all handled by the same host,
61577 with mailboxes on that host, but where the mailbox owners do not necessarily
61578 have login accounts on that host.
61579 </para>
61580 </listitem>
61581 </itemizedlist>
61582 <para>
61583 The first usage is probably more common, and does seem more <quote>virtual</quote> than
61584 the second. This kind of domain can be handled in Exim with a straightforward
61585 aliasing router. One approach is to create a separate alias file for each
61586 virtual domain. Exim can test for the existence of the alias file to determine
61587 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
61588 to a router of this form:
61589 </para>
61590 <literallayout class="monospaced">
61591 virtual:
61592   driver = redirect
61593   domains = dsearch;/etc/mail/virtual
61594   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
61595   no_more
61596 </literallayout>
61597 <para>
61598 The <option>domains</option> option specifies that the router is to be skipped, unless there
61599 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
61600 domain that is being processed. When the router runs, it looks up the local
61601 part in the file to find a new address (or list of addresses). The <option>no_more</option>
61602 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
61603 string), Exim gives up on the address without trying any subsequent routers.
61604 </para>
61605 <para>
61606 This one router can handle all the virtual domains because the alias file names
61607 follow a fixed pattern. Permissions can be arranged so that appropriate people
61608 can edit the different alias files. A successful aliasing operation results in
61609 a new envelope recipient address, which is then routed from scratch.
61610 </para>
61611 <para>
61612 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
61613 way. One approach is to create a file for each domain containing a list of
61614 valid local parts, and use it in a router like this:
61615 </para>
61616 <literallayout class="monospaced">
61617 my_domains:
61618   driver = accept
61619   domains = dsearch;/etc/mail/domains
61620   local_parts = lsearch;/etc/mail/domains/$domain
61621   transport = my_mailboxes
61622 </literallayout>
61623 <para>
61624 The address is accepted if there is a file for the domain, and the local part
61625 can be found in the file. The <option>domains</option> option is used to check for the
61626 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
61627 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
61628 because that option is tested after <option>local_parts</option>. The transport is as
61629 follows:
61630 </para>
61631 <literallayout class="monospaced">
61632 my_mailboxes:
61633   driver = appendfile
61634   file = /var/mail/$domain/$local_part
61635   user = mail
61636 </literallayout>
61637 <para>
61638 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
61639 required, to specify which uid is to be used for writing to the mailboxes.
61640 </para>
61641 <para>
61642 The configuration shown here is just one example of how you might support this
61643 requirement. There are many other ways this kind of configuration can be set
61644 up, for example, by using a database instead of separate files to hold all the
61645 information about the domains.
61646 </para>
61647 </section>
61648 <section id="SECTmulbox">
61649 <title>Multiple user mailboxes</title>
61650 <para>
61651 <indexterm role="concept">
61652 <primary>multiple mailboxes</primary>
61653 </indexterm>
61654 <indexterm role="concept">
61655 <primary>mailbox</primary>
61656 <secondary>multiple</secondary>
61657 </indexterm>
61658 <indexterm role="concept">
61659 <primary>local part</primary>
61660 <secondary>prefix</secondary>
61661 </indexterm>
61662 <indexterm role="concept">
61663 <primary>local part</primary>
61664 <secondary>suffix</secondary>
61665 </indexterm>
61666 Heavy email users often want to operate with multiple mailboxes, into which
61667 incoming mail is automatically sorted. A popular way of handling this is to
61668 allow users to use multiple sender addresses, so that replies can easily be
61669 identified. Users are permitted to add prefixes or suffixes to their local
61670 parts for this purpose. The wildcard facility of the generic router options
61671 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
61672 example, consider this router:
61673 </para>
61674 <literallayout class="monospaced">
61675 userforward:
61676   driver = redirect
61677   check_local_user
61678   file = $home/.forward
61679   local_part_suffix = -*
61680   local_part_suffix_optional
61681   allow_filter
61682 </literallayout>
61683 <para>
61684 <indexterm role="variable">
61685 <primary><varname>$local_part_suffix</varname></primary>
61686 </indexterm>
61687 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
61688 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
61689 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
61690 </para>
61691 <literallayout class="monospaced">
61692 if $local_part_suffix contains -special then
61693 save /home/$local_part/Mail/special
61694 endif
61695 </literallayout>
61696 <para>
61697 If the filter file does not exist, or does not deal with such addresses, they
61698 fall through to subsequent routers, and, assuming no subsequent use of the
61699 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
61700 control over which suffixes are valid.
61701 </para>
61702 <para>
61703 Alternatively, a suffix can be used to trigger the use of a different
61704 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
61705 another MTA:
61706 </para>
61707 <literallayout class="monospaced">
61708 userforward:
61709   driver = redirect
61710   check_local_user
61711   file = $home/.forward$local_part_suffix
61712   local_part_suffix = -*
61713   local_part_suffix_optional
61714   allow_filter
61715 </literallayout>
61716 <para>
61717 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
61718 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
61719 does not exist, or does not deal with the address, it is passed on to
61720 subsequent routers, which could, if required, look for an unqualified
61721 <filename>.forward</filename> file to use as a default.
61722 </para>
61723 </section>
61724 <section id="SECID244">
61725 <title>Simplified vacation processing</title>
61726 <para>
61727 <indexterm role="concept">
61728 <primary>vacation processing</primary>
61729 </indexterm>
61730 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
61731 a pipe command in a <filename>.forward</filename> file
61732 (see section <xref linkend="SECTspecitredli"/> for syntax details).
61733 This is prone to error by inexperienced users. There are two features of Exim
61734 that can be used to make this process simpler for users:
61735 </para>
61736 <itemizedlist>
61737 <listitem>
61738 <para>
61739 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
61740 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
61741 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
61742 <filename>.forward</filename> file are then much simpler. For example:
61743 </para>
61744 <literallayout class="monospaced">
61745 spqr, vacation-spqr
61746 </literallayout>
61747 </listitem>
61748 <listitem>
61749 <para>
61750 The <option>require_files</option> generic router option can be used to trigger a
61751 vacation delivery by checking for the existence of a certain file in the
61752 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
61753 ensure that the original delivery also proceeds. In this case, all the user has
61754 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
61755 message.
61756 </para>
61757 </listitem>
61758 </itemizedlist>
61759 <para>
61760 Another advantage of both these methods is that they both work even when the
61761 use of arbitrary pipes by users is locked out.
61762 </para>
61763 </section>
61764 <section id="SECID245">
61765 <title>Taking copies of mail</title>
61766 <para>
61767 <indexterm role="concept">
61768 <primary>message</primary>
61769 <secondary>copying every</secondary>
61770 </indexterm>
61771 Some installations have policies that require archive copies of all messages to
61772 be made. A single copy of each message can easily be taken by an appropriate
61773 command in a system filter, which could, for example, use a different file for
61774 each day&#x2019;s messages.
61775 </para>
61776 <para>
61777 There is also a shadow transport mechanism that can be used to take copies of
61778 messages that are successfully delivered by local transports, one copy per
61779 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
61780 notification of delivery by sites that insist on doing such things.
61781 </para>
61782 </section>
61783 <section id="SECID246">
61784 <title>Intermittently connected hosts</title>
61785 <para>
61786 <indexterm role="concept">
61787 <primary>intermittently connected hosts</primary>
61788 </indexterm>
61789 It has become quite common (because it is cheaper) for hosts to connect to the
61790 Internet periodically rather than remain connected all the time. The normal
61791 arrangement is that mail for such hosts accumulates on a system that is
61792 permanently connected.
61793 </para>
61794 <para>
61795 Exim was designed for use on permanently connected hosts, and so it is not
61796 particularly well-suited to use in an intermittently connected environment.
61797 Nevertheless there are some features that can be used.
61798 </para>
61799 </section>
61800 <section id="SECID247">
61801 <title>Exim on the upstream server host</title>
61802 <para>
61803 It is tempting to arrange for incoming mail for the intermittently connected
61804 host to remain on Exim&#x2019;s queue until the client connects. However, this
61805 approach does not scale very well. Two different kinds of waiting message are
61806 being mixed up in the same queue &ndash; those that cannot be delivered because of
61807 some temporary problem, and those that are waiting for their destination host
61808 to connect. This makes it hard to manage the queue, as well as wasting
61809 resources, because each queue runner scans the entire queue.
61810 </para>
61811 <para>
61812 A better approach is to separate off those messages that are waiting for an
61813 intermittently connected host. This can be done by delivering these messages
61814 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
61815 format, from where they are transmitted by other software when their
61816 destination connects. This makes it easy to collect all the mail for one host
61817 in a single directory, and to apply local timeout rules on a per-message basis
61818 if required.
61819 </para>
61820 <para>
61821 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
61822 you are doing this, you should configure Exim with a long retry period for the
61823 intermittent host. For example:
61824 </para>
61825 <literallayout class="monospaced">
61826 cheshire.wonderland.fict.example    *   F,5d,24h
61827 </literallayout>
61828 <para>
61829 This stops a lot of failed delivery attempts from occurring, but Exim remembers
61830 which messages it has queued up for that host. Once the intermittent host comes
61831 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
61832 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
61833 causes all the queued up messages to be delivered, often down a single SMTP
61834 connection. While the host remains connected, any new messages get delivered
61835 immediately.
61836 </para>
61837 <para>
61838 If the connecting hosts do not have fixed IP addresses, that is, if a host is
61839 issued with a different IP address each time it connects, Exim&#x2019;s retry
61840 mechanisms on the holding host get confused, because the IP address is normally
61841 used as part of the key string for holding retry information. This can be
61842 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
61843 Since this has disadvantages for permanently connected hosts, it is best to
61844 arrange a separate transport for the intermittently connected ones.
61845 </para>
61846 </section>
61847 <section id="SECID248">
61848 <title>Exim on the intermittently connected client host</title>
61849 <para>
61850 The value of <option>smtp_accept_queue_per_connection</option> should probably be
61851 increased, or even set to zero (that is, disabled) on the intermittently
61852 connected host, so that all incoming messages down a single connection get
61853 delivered immediately.
61854 </para>
61855 <para>
61856 <indexterm role="concept">
61857 <primary>SMTP</primary>
61858 <secondary>passed connection</secondary>
61859 </indexterm>
61860 <indexterm role="concept">
61861 <primary>SMTP</primary>
61862 <secondary>multiple deliveries</secondary>
61863 </indexterm>
61864 <indexterm role="concept">
61865 <primary>multiple SMTP deliveries</primary>
61866 </indexterm>
61867 Mail waiting to be sent from an intermittently connected host will probably
61868 not have been routed, because without a connection DNS lookups are not
61869 possible. This means that if a normal queue run is done at connection time,
61870 each message is likely to be sent in a separate SMTP session. This can be
61871 avoided by starting the queue run with a command line option beginning with
61872 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
61873 first pass, routing is done but no deliveries take place. The second pass is a
61874 normal queue run; since all the messages have been previously routed, those
61875 destined for the same host are likely to get sent as multiple deliveries in a
61876 single SMTP connection.
61877 </para>
61878 </section>
61879 </chapter>
61880
61881 <chapter id="CHAPnonqueueing">
61882 <title>Using Exim as a non-queueing client</title>
61883 <titleabbrev>Exim as a non-queueing client</titleabbrev>
61884 <para>
61885 <indexterm role="concept">
61886 <primary>client, non-queueing</primary>
61887 </indexterm>
61888 <indexterm role="concept">
61889 <primary>smart host</primary>
61890 <secondary>suppressing queueing</secondary>
61891 </indexterm>
61892 On a personal computer, it is a common requirement for all
61893 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
61894 configured to operate that way, for all the popular operating systems.
61895 However, there are some MUAs for Unix-like systems that cannot be so
61896 configured: they submit messages using the command line interface of
61897 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
61898 messages this way.
61899 </para>
61900 <para>
61901 If the personal computer runs continuously, there is no problem, because it can
61902 run a conventional MTA that handles delivery to the smart host, and deal with
61903 any delays via its queueing mechanism. However, if the computer does not run
61904 continuously or runs different operating systems at different times, queueing
61905 email is not desirable.
61906 </para>
61907 <para>
61908 There is therefore a requirement for something that can provide the
61909 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
61910 any queueing or retrying facilities. Furthermore, the delivery to the smart
61911 host should be synchronous, so that if it fails, the sending MUA is immediately
61912 informed. In other words, we want something that extends an MUA that submits
61913 to a local MTA via the command line so that it behaves like one that submits
61914 to a remote smart host using TCP/SMTP.
61915 </para>
61916 <para>
61917 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
61918 that do this job. However, people have found them to be lacking in various
61919 ways. For instance, you might want to allow aliasing and forwarding to be done
61920 before sending a message to the smart host.
61921 </para>
61922 <para>
61923 Exim already had the necessary infrastructure for doing this job. Just a few
61924 tweaks were needed to make it behave as required, though it is somewhat of an
61925 overkill to use a fully-featured MTA for this purpose.
61926 </para>
61927 <para>
61928 <indexterm role="option">
61929 <primary><option>mua_wrapper</option></primary>
61930 </indexterm>
61931 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
61932 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
61933 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
61934 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
61935 compatible router and transport configuration. Typically there will be just one
61936 router and one transport, sending everything to a smart host.
61937 </para>
61938 <para>
61939 When run in MUA wrapping mode, the behaviour of Exim changes in the
61940 following ways:
61941 </para>
61942 <itemizedlist>
61943 <listitem>
61944 <para>
61945 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
61946 In other words, the only way to submit messages is via the command line.
61947 </para>
61948 </listitem>
61949 <listitem>
61950 <para>
61951 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
61952 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
61953 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
61954 does not finish until the delivery attempt is complete. If the delivery is
61955 successful, a zero return code is given.
61956 </para>
61957 </listitem>
61958 <listitem>
61959 <para>
61960 Address redirection is permitted, but the final routing for all addresses must
61961 be to the same remote transport, and to the same list of hosts. Furthermore,
61962 the return address (envelope sender) must be the same for all recipients, as
61963 must any added or deleted header lines. In other words, it must be possible to
61964 deliver the message in a single SMTP transaction, however many recipients there
61965 are.
61966 </para>
61967 </listitem>
61968 <listitem>
61969 <para>
61970 If these conditions are not met, or if routing any address results in a
61971 failure or defer status, or if Exim is unable to deliver all the recipients
61972 successfully to one of the smart hosts, delivery of the entire message fails.
61973 </para>
61974 </listitem>
61975 <listitem>
61976 <para>
61977 Because no queueing is allowed, all failures are treated as permanent; there
61978 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
61979 smart host. Furthermore, because only a single yes/no response can be given to
61980 the caller, it is not possible to deliver to some recipients and not others. If
61981 there is an error (temporary or permanent) for any recipient, all are failed.
61982 </para>
61983 </listitem>
61984 <listitem>
61985 <para>
61986 If more than one smart host is listed, Exim will try another host after a
61987 connection failure or a timeout, in the normal way. However, if this kind of
61988 failure happens for all the hosts, the delivery fails.
61989 </para>
61990 </listitem>
61991 <listitem>
61992 <para>
61993 When delivery fails, an error message is written to the standard error stream
61994 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
61995 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
61996 are ever generated.
61997 </para>
61998 </listitem>
61999 <listitem>
62000 <para>
62001 No retry data is maintained, and any retry rules are ignored.
62002 </para>
62003 </listitem>
62004 <listitem>
62005 <para>
62006 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
62007 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
62008 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
62009 </para>
62010 </listitem>
62011 </itemizedlist>
62012 <para>
62013 The overall effect is that Exim makes a single synchronous attempt to deliver
62014 the message, failing if there is any kind of problem. Because no local
62015 deliveries are done and no daemon can be run, Exim does not need root
62016 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
62017 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
62018 the advantages and disadvantages of running without root privilege.
62019 </para>
62020 </chapter>
62021
62022 <chapter id="CHAPlog">
62023 <title>Log files</title>
62024 <para>
62025 <indexterm role="concept" id="IIDloggen" class="startofrange">
62026 <primary>log</primary>
62027 <secondary>general description</secondary>
62028 </indexterm>
62029 <indexterm role="concept">
62030 <primary>log</primary>
62031 <secondary>types of</secondary>
62032 </indexterm>
62033 Exim writes three different logs, referred to as the main log, the reject log,
62034 and the panic log:
62035 </para>
62036 <itemizedlist>
62037 <listitem>
62038 <para>
62039 <indexterm role="concept">
62040 <primary>main log</primary>
62041 </indexterm>
62042 The main log records the arrival of each message and each delivery in a single
62043 line in each case. The format is as compact as possible, in an attempt to keep
62044 down the size of log files. Two-character flag sequences make it easy to pick
62045 out these lines. A number of other events are recorded in the main log. Some of
62046 them are optional, in which case the <option>log_selector</option> option controls whether
62047 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
62048 analysis of main log files, is provided in the Exim distribution (see section
62049 <xref linkend="SECTmailstat"/>).
62050 </para>
62051 </listitem>
62052 <listitem>
62053 <para>
62054 <indexterm role="concept">
62055 <primary>reject log</primary>
62056 </indexterm>
62057 The reject log records information from messages that are rejected as a result
62058 of a configuration option (that is, for policy reasons).
62059 The first line of each rejection is a copy of the line that is also written to
62060 the main log. Then, if the message&#x2019;s header has been read at the time the log
62061 is written, its contents are written to this log. Only the original header
62062 lines are available; header lines added by ACLs are not logged. You can use the
62063 reject log to check that your policy controls are working correctly; on a busy
62064 host this may be easier than scanning the main log for rejection messages. You
62065 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
62066 false.
62067 </para>
62068 </listitem>
62069 <listitem>
62070 <para>
62071 <indexterm role="concept">
62072 <primary>panic log</primary>
62073 </indexterm>
62074 <indexterm role="concept">
62075 <primary>system log</primary>
62076 </indexterm>
62077 When certain serious errors occur, Exim writes entries to its panic log. If the
62078 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
62079 are usually written to the main log as well, but can get lost amid the mass of
62080 other entries. The panic log should be empty under normal circumstances. It is
62081 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
62082 regularly, in order to become aware of any problems. When Exim cannot open its
62083 panic log, it tries as a last resort to write to the system log (syslog). This
62084 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
62085 message itself is written at priority LOG_CRIT.
62086 </para>
62087 </listitem>
62088 </itemizedlist>
62089 <para>
62090 Every log line starts with a timestamp, in the format shown in the following
62091 example. Note that many of the examples shown in this chapter are line-wrapped.
62092 In the log file, this would be all on one line:
62093 </para>
62094 <literallayout class="monospaced">
62095 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
62096   by QUIT
62097 </literallayout>
62098 <para>
62099 By default, the timestamps are in the local timezone. There are two
62100 ways of changing this:
62101 </para>
62102 <itemizedlist>
62103 <listitem>
62104 <para>
62105 You can set the <option>timezone</option> option to a different time zone; in particular, if
62106 you set
62107 </para>
62108 <literallayout class="monospaced">
62109 timezone = UTC
62110 </literallayout>
62111 <para>
62112 the timestamps will be in UTC (aka GMT).
62113 </para>
62114 </listitem>
62115 <listitem>
62116 <para>
62117 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
62118 example:
62119 </para>
62120 <literallayout class="monospaced">
62121 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
62122 </literallayout>
62123 </listitem>
62124 </itemizedlist>
62125 <para>
62126 <indexterm role="concept">
62127 <primary>log</primary>
62128 <secondary>process ids in</secondary>
62129 </indexterm>
62130 <indexterm role="concept">
62131 <primary>pid (process id)</primary>
62132 <secondary>in log lines</secondary>
62133 </indexterm>
62134 Exim does not include its process id in log lines by default, but you can
62135 request that it does so by specifying the <literal>pid</literal> log selector (see section
62136 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
62137 brackets, immediately after the time and date.
62138 </para>
62139 <section id="SECTwhelogwri">
62140 <title>Where the logs are written</title>
62141 <para>
62142 <indexterm role="concept">
62143 <primary>log</primary>
62144 <secondary>destination</secondary>
62145 </indexterm>
62146 <indexterm role="concept">
62147 <primary>log</primary>
62148 <secondary>to file</secondary>
62149 </indexterm>
62150 <indexterm role="concept">
62151 <primary>log</primary>
62152 <secondary>to syslog</secondary>
62153 </indexterm>
62154 <indexterm role="concept">
62155 <primary>syslog</primary>
62156 </indexterm>
62157 The logs may be written to local files, or to syslog, or both. However, it
62158 should be noted that many syslog implementations use UDP as a transport, and
62159 are therefore unreliable in the sense that messages are not guaranteed to
62160 arrive at the loghost, nor is the ordering of messages necessarily maintained.
62161 It has also been reported that on large log files (tens of megabytes) you may
62162 need to tweak syslog to prevent it syncing the file with each write &ndash; on
62163 Linux this has been seen to make syslog take 90% plus of CPU time.
62164 </para>
62165 <para>
62166 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
62167 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
62168 configuration. This latter string is expanded, so it can contain, for example,
62169 references to the host name:
62170 </para>
62171 <literallayout class="monospaced">
62172 log_file_path = /var/log/$primary_hostname/exim_%slog
62173 </literallayout>
62174 <para>
62175 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
62176 rather than at run time, because then the setting is available right from the
62177 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
62178 before it has read the configuration file (for example, an error in the
62179 configuration file) it will not use the path you want, and may not be able to
62180 log at all.
62181 </para>
62182 <para>
62183 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
62184 list, currently limited to at most two items. This is one option where the
62185 facility for changing a list separator may not be used. The list must always be
62186 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
62187 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
62188 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
62189 implying the use of a default path.
62190 </para>
62191 <para>
62192 When Exim encounters an empty item in the list, it searches the list defined by
62193 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
62194 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
62195 mean <quote>use the path specified at build time</quote>. It no such item exists, log
62196 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
62197 equivalent to the setting:
62198 </para>
62199 <literallayout class="monospaced">
62200 log_file_path = $spool_directory/log/%slog
62201 </literallayout>
62202 <para>
62203 If you do not specify anything at build time or run time, that is where the
62204 logs are written.
62205 </para>
62206 <para>
62207 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
62208 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
62209 </para>
62210 <para>
62211 Here are some examples of possible settings:
62212 </para>
62213 <literallayout>
62214 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
62215 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
62216 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
62217 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
62218 </literallayout>
62219 <para>
62220 If there are more than two paths in the list, the first is used and a panic
62221 error is logged.
62222 </para>
62223 </section>
62224 <section id="SECID285">
62225 <title>Logging to local files that are periodically <quote>cycled</quote></title>
62226 <para>
62227 <indexterm role="concept">
62228 <primary>log</primary>
62229 <secondary>cycling local files</secondary>
62230 </indexterm>
62231 <indexterm role="concept">
62232 <primary>cycling logs</primary>
62233 </indexterm>
62234 <indexterm role="concept">
62235 <primary><emphasis>exicyclog</emphasis></primary>
62236 </indexterm>
62237 <indexterm role="concept">
62238 <primary>log</primary>
62239 <secondary>local files; writing to</secondary>
62240 </indexterm>
62241 Some operating systems provide centralized and standardized methods for cycling
62242 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
62243 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
62244 main and reject logs each time it is called. The maximum number of old logs to
62245 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
62246 </para>
62247 <para>
62248 An Exim delivery process opens the main log when it first needs to write to it,
62249 and it keeps the file open in case subsequent entries are required &ndash; for
62250 example, if a number of different deliveries are being done for the same
62251 message. However, remote SMTP deliveries can take a long time, and this means
62252 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
62253 something similar is being used to rename log files on a regular basis. To
62254 ensure that a switch of log files is noticed as soon as possible, Exim calls
62255 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
62256 does not exist, or its inode has changed, the old file is closed and Exim
62257 tries to open the main log from scratch. Thus, an old log file may remain open
62258 for quite some time, but no Exim processes should write to it once it has been
62259 renamed.
62260 </para>
62261 </section>
62262 <section id="SECTdatlogfil">
62263 <title>Datestamped log files</title>
62264 <para>
62265 <indexterm role="concept">
62266 <primary>log</primary>
62267 <secondary>datestamped files</secondary>
62268 </indexterm>
62269 Instead of cycling the main and reject log files by renaming them
62270 periodically, some sites like to use files whose names contain a datestamp,
62271 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
62272 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
62273 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
62274 point where the datestamp is required. For example:
62275 </para>
62276 <literallayout class="monospaced">
62277 log_file_path = /var/spool/exim/log/%slog-%D
62278 log_file_path = /var/log/exim-%s-%D.log
62279 log_file_path = /var/spool/exim/log/%D-%slog
62280 log_file_path = /var/log/exim/%s.%M
62281 </literallayout>
62282 <para>
62283 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
62284 examples of names generated by the above examples:
62285 </para>
62286 <literallayout class="monospaced">
62287 /var/spool/exim/log/mainlog-20021225
62288 /var/log/exim-reject-20021225.log
62289 /var/spool/exim/log/20021225-mainlog
62290 /var/log/exim/main.200212
62291 </literallayout>
62292 <para>
62293 When this form of log file is specified, Exim automatically switches to new
62294 files at midnight. It does not make any attempt to compress old logs; you
62295 will need to write your own script if you require this. You should not
62296 run <emphasis>exicyclog</emphasis> with this form of logging.
62297 </para>
62298 <para>
62299 The location of the panic log is also determined by <option>log_file_path</option>, but it
62300 is not datestamped, because rotation of the panic log does not make sense.
62301 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
62302 the string. In addition, if it immediately follows a slash, a following
62303 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
62304 character is removed. Thus, the four examples above would give these panic
62305 log names:
62306 </para>
62307 <literallayout class="monospaced">
62308 /var/spool/exim/log/paniclog
62309 /var/log/exim-panic.log
62310 /var/spool/exim/log/paniclog
62311 /var/log/exim/panic
62312 </literallayout>
62313 </section>
62314 <section id="SECID249">
62315 <title>Logging to syslog</title>
62316 <para>
62317 <indexterm role="concept">
62318 <primary>log</primary>
62319 <secondary>syslog; writing to</secondary>
62320 </indexterm>
62321 The use of syslog does not change what Exim logs or the format of its messages,
62322 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
62323 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
62324 that, the same strings are written to syslog as to log files. The syslog
62325 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
62326 by default, but you can change these by setting the <option>syslog_facility</option> and
62327 <option>syslog_processname</option> options, respectively. If Exim was compiled with
62328 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
62329 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
62330 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
62331 the time and host name to each line.
62332 The three log streams are mapped onto syslog priorities as follows:
62333 </para>
62334 <itemizedlist>
62335 <listitem>
62336 <para>
62337 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
62338 </para>
62339 </listitem>
62340 <listitem>
62341 <para>
62342 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
62343 </para>
62344 </listitem>
62345 <listitem>
62346 <para>
62347 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
62348 </para>
62349 </listitem>
62350 </itemizedlist>
62351 <para>
62352 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
62353 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
62354 these are routed by syslog to the same place. You can suppress this duplication
62355 by setting <option>syslog_duplication</option> false.
62356 </para>
62357 <para>
62358 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
62359 entries contain multiple lines when headers are included. To cope with both
62360 these cases, entries written to syslog are split into separate <function>syslog()</function>
62361 calls at each internal newline, and also after a maximum of
62362 870 data characters. (This allows for a total syslog line length of 1024, when
62363 additions such as timestamps are added.) If you are running a syslog
62364 replacement that can handle lines longer than the 1024 characters allowed by
62365 RFC 3164, you should set
62366 </para>
62367 <literallayout class="monospaced">
62368 SYSLOG_LONG_LINES=yes
62369 </literallayout>
62370 <para>
62371 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
62372 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
62373 </para>
62374 <para>
62375 To make it easy to re-assemble split lines later, each component of a split
62376 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;]
62377 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
62378 components in the entry. The / delimiter is used when the line was split
62379 because it was too long; if it was split because of an internal newline, the \
62380 delimiter is used. For example, supposing the length limit to be 50 instead of
62381 870, the following would be the result of a typical rejection message to
62382 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
62383 name, and pid as added by syslog:
62384 </para>
62385 <literallayout class="monospaced">
62386 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
62387 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
62388 [3/5]  when scanning for sender: missing or malformed lo
62389 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
62390 [5/5] mple&gt;)
62391 </literallayout>
62392 <para>
62393 The same error might cause the following lines to be written to <quote>rejectlog</quote>
62394 (LOG_NOTICE):
62395 </para>
62396 <literallayout class="monospaced">
62397 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
62398 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
62399 [3/18] er when scanning for sender: missing or malformed
62400 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
62401 [5\18] .example&gt;)
62402 [6\18] Recipients: ph10@some.domain.cam.example
62403 [7\18] P Received: from [127.0.0.1] (ident=ph10)
62404 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
62405 [9\18]        id 16RdAL-0006pc-00
62406 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
62407 [11\18] 09:43 +0100
62408 [12\18] F From: &lt;&gt;
62409 [13\18]   Subject: this is a test header
62410 [18\18]   X-something: this is another header
62411 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
62412 [16\18] le&gt;
62413 [17\18] B Bcc:
62414 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
62415 </literallayout>
62416 <para>
62417 Log lines that are neither too long nor contain newlines are written to syslog
62418 without modification.
62419 </para>
62420 <para>
62421 If only syslog is being used, the Exim monitor is unable to provide a log tail
62422 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
62423 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
62424 where it is.
62425 </para>
62426 </section>
62427 <section id="SECID250">
62428 <title>Log line flags</title>
62429 <para>
62430 One line is written to the main log for each message received, and for each
62431 successful, unsuccessful, and delayed delivery. These lines can readily be
62432 picked out by the distinctive two-character flags that immediately follow the
62433 timestamp. The flags are:
62434 </para>
62435 <literallayout>
62436 <literal>&lt;=</literal>     message arrival
62437 <literal>=&gt;</literal>     normal message delivery
62438 <literal>-&gt;</literal>     additional address in same delivery
62439 <literal>&gt;&gt;</literal>     cutthrough message delivery
62440 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
62441 <literal>**</literal>     delivery failed; address bounced
62442 <literal>==</literal>     delivery deferred; temporary problem
62443 </literallayout>
62444 </section>
62445 <section id="SECID251">
62446 <title>Logging message reception</title>
62447 <para>
62448 <indexterm role="concept">
62449 <primary>log</primary>
62450 <secondary>reception line</secondary>
62451 </indexterm>
62452 The format of the single-line entry in the main log that is written for every
62453 message received is shown in the basic example below, which is split over
62454 several lines in order to fit it on the page:
62455 </para>
62456 <literallayout class="monospaced">
62457 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
62458   H=mailer.fict.example [192.168.123.123] U=exim
62459   P=smtp S=5678 id=&lt;incoming message id&gt;
62460 </literallayout>
62461 <para>
62462 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
62463 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
62464 generated, this is followed by an item of the form
62465 </para>
62466 <literallayout class="monospaced">
62467 R=&lt;message id&gt;
62468 </literallayout>
62469 <para>
62470 which is a reference to the message that caused the bounce to be sent.
62471 </para>
62472 <para>
62473 <indexterm role="concept">
62474 <primary>HELO</primary>
62475 </indexterm>
62476 <indexterm role="concept">
62477 <primary>EHLO</primary>
62478 </indexterm>
62479 For messages from other hosts, the H and U fields identify the remote host and
62480 record the RFC 1413 identity of the user that sent the message, if one was
62481 received. The number given in square brackets is the IP address of the sending
62482 host. If there is a single, unparenthesized  host name in the H field, as
62483 above, it has been verified to correspond to the IP address (see the
62484 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
62485 by the remote host in the SMTP HELO or EHLO command, and has not been
62486 verified. If verification yields a different name to that given for HELO or
62487 EHLO, the verified name appears first, followed by the HELO or EHLO
62488 name in parentheses.
62489 </para>
62490 <para>
62491 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
62492 without brackets, in the HELO or EHLO command, leading to entries in
62493 the log containing text like these examples:
62494 </para>
62495 <literallayout class="monospaced">
62496 H=(10.21.32.43) [192.168.8.34]
62497 H=([10.21.32.43]) [192.168.8.34]
62498 </literallayout>
62499 <para>
62500 This can be confusing. Only the final address in square brackets can be relied
62501 on.
62502 </para>
62503 <para>
62504 For locally generated messages (that is, messages not received over TCP/IP),
62505 the H field is omitted, and the U field contains the login name of the caller
62506 of Exim.
62507 </para>
62508 <para>
62509 <indexterm role="concept">
62510 <primary>authentication</primary>
62511 <secondary>logging</secondary>
62512 </indexterm>
62513 <indexterm role="concept">
62514 <primary>AUTH</primary>
62515 <secondary>logging</secondary>
62516 </indexterm>
62517 For all messages, the P field specifies the protocol used to receive the
62518 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
62519 of incoming SMTP messages, the value indicates whether or not any SMTP
62520 extensions (ESMTP), encryption, or authentication were used. If the SMTP
62521 session was encrypted, there is an additional X field that records the cipher
62522 suite that was used.
62523 </para>
62524 <para>
62525 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
62526 hosts that have authenticated themselves using the SMTP AUTH command. The first
62527 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
62528 there is an additional item A= followed by the name of the authenticator that
62529 was used. If an authenticated identification was set up by the authenticator&#x2019;s
62530 <option>server_set_id</option> option, this is logged too, separated by a colon from the
62531 authenticator name.
62532 </para>
62533 <para>
62534 <indexterm role="concept">
62535 <primary>size</primary>
62536 <secondary>of message</secondary>
62537 </indexterm>
62538 The id field records the existing message id, if present. The size of the
62539 received message is given by the S field. When the message is delivered,
62540 headers may be removed or added, so that the size of delivered copies of the
62541 message may not correspond with this value (and indeed may be different to each
62542 other).
62543 </para>
62544 <para>
62545 The <option>log_selector</option> option can be used to request the logging of additional
62546 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
62547 </para>
62548 </section>
62549 <section id="SECID252">
62550 <title>Logging deliveries</title>
62551 <para>
62552 <indexterm role="concept">
62553 <primary>log</primary>
62554 <secondary>delivery line</secondary>
62555 </indexterm>
62556 The format of the single-line entry in the main log that is written for every
62557 delivery is shown in one of the examples below, for local and remote
62558 deliveries, respectively. Each example has been split into two lines in order
62559 to fit it on the page:
62560 </para>
62561 <literallayout class="monospaced">
62562 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
62563   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
62564 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
62565   monk@holistic.fict.example R=dnslookup T=remote_smtp
62566   H=holistic.fict.example [192.168.234.234]
62567 </literallayout>
62568 <para>
62569 For ordinary local deliveries, the original address is given in angle brackets
62570 after the final delivery address, which might be a pipe or a file. If
62571 intermediate address(es) exist between the original and the final address, the
62572 last of these is given in parentheses after the final address. The R and T
62573 fields record the router and transport that were used to process the address.
62574 </para>
62575 <para>
62576 If SMTP AUTH was used for the delivery there is an additional item A=
62577 followed by the name of the authenticator that was used.
62578 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
62579 option, this is logged too, separated by a colon from the authenticator name.
62580 </para>
62581 <para>
62582 If a shadow transport was run after a successful local delivery, the log line
62583 for the successful delivery has an item added on the end, of the form
62584 </para>
62585 <literallayout>
62586 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
62587 </literallayout>
62588 <para>
62589 If the shadow transport did not succeed, the error message is put in
62590 parentheses afterwards.
62591 </para>
62592 <para>
62593 <indexterm role="concept">
62594 <primary>asterisk</primary>
62595 <secondary>after IP address</secondary>
62596 </indexterm>
62597 When more than one address is included in a single delivery (for example, two
62598 SMTP RCPT commands in one transaction) the second and subsequent addresses are
62599 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
62600 down a single SMTP connection, an asterisk follows the IP address in the log
62601 lines for the second and subsequent messages.
62602 </para>
62603 <para>
62604 <indexterm role="concept">
62605 <primary>delivery</primary>
62606 <secondary>cutthrough; logging</secondary>
62607 </indexterm>
62608 <indexterm role="concept">
62609 <primary>cutthrough</primary>
62610 <secondary>logging</secondary>
62611 </indexterm>
62612 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
62613 line precedes the reception line, since cutthrough waits for a possible
62614 rejection from the destination in case it can reject the sourced item.
62615 </para>
62616 <para>
62617 The generation of a reply message by a filter file gets logged as a
62618 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
62619 </para>
62620 <para>
62621 The <option>log_selector</option> option can be used to request the logging of additional
62622 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
62623 </para>
62624 </section>
62625 <section id="SECID253">
62626 <title>Discarded deliveries</title>
62627 <para>
62628 <indexterm role="concept">
62629 <primary>discarded messages</primary>
62630 </indexterm>
62631 <indexterm role="concept">
62632 <primary>message</primary>
62633 <secondary>discarded</secondary>
62634 </indexterm>
62635 <indexterm role="concept">
62636 <primary>delivery</primary>
62637 <secondary>discarded; logging</secondary>
62638 </indexterm>
62639 When a message is discarded as a result of the command <quote>seen finish</quote> being
62640 obeyed in a filter file which generates no deliveries, a log entry of the form
62641 </para>
62642 <literallayout class="monospaced">
62643 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
62644   &lt;low.club@bridge.example&gt; R=userforward
62645 </literallayout>
62646 <para>
62647 is written, to record why no deliveries are logged. When a message is discarded
62648 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
62649 </para>
62650 <literallayout class="monospaced">
62651 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
62652   &lt;hole@nowhere.example&gt; R=blackhole_router
62653 </literallayout>
62654 </section>
62655 <section id="SECID254">
62656 <title>Deferred deliveries</title>
62657 <para>
62658 When a delivery is deferred, a line of the following form is logged:
62659 </para>
62660 <literallayout class="monospaced">
62661 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
62662   R=dnslookup T=smtp defer (146): Connection refused
62663 </literallayout>
62664 <para>
62665 In the case of remote deliveries, the error is the one that was given for the
62666 last IP address that was tried. Details of individual SMTP failures are also
62667 written to the log, so the above line would be preceded by something like
62668 </para>
62669 <literallayout class="monospaced">
62670 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
62671   mail1.endrest.example [192.168.239.239]: Connection refused
62672 </literallayout>
62673 <para>
62674 When a deferred address is skipped because its retry time has not been reached,
62675 a message is written to the log, but this can be suppressed by setting an
62676 appropriate value in <option>log_selector</option>.
62677 </para>
62678 </section>
62679 <section id="SECID255">
62680 <title>Delivery failures</title>
62681 <para>
62682 <indexterm role="concept">
62683 <primary>delivery</primary>
62684 <secondary>failure; logging</secondary>
62685 </indexterm>
62686 If a delivery fails because an address cannot be routed, a line of the
62687 following form is logged:
62688 </para>
62689 <literallayout class="monospaced">
62690 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
62691   &lt;jim@trek99.example&gt;: unknown mail domain
62692 </literallayout>
62693 <para>
62694 If a delivery fails at transport time, the router and transport are shown, and
62695 the response from the remote host is included, as in this example:
62696 </para>
62697 <literallayout class="monospaced">
62698 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
62699   R=dnslookup T=remote_smtp: SMTP error from remote mailer
62700   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
62701   pbmail3.py.example [192.168.63.111]: 553 5.3.0
62702   &lt;ace400@pb.example&gt;...Addressee unknown
62703 </literallayout>
62704 <para>
62705 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
62706 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
62707 disabling PIPELINING. The log lines for all forms of delivery failure are
62708 flagged with <literal>**</literal>.
62709 </para>
62710 </section>
62711 <section id="SECID256">
62712 <title>Fake deliveries</title>
62713 <para>
62714 <indexterm role="concept">
62715 <primary>delivery</primary>
62716 <secondary>fake; logging</secondary>
62717 </indexterm>
62718 If a delivery does not actually take place because the <option>-N</option> option has been
62719 used to suppress it, a normal delivery line is written to the log, except that
62720 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
62721 </para>
62722 </section>
62723 <section id="SECID257">
62724 <title>Completion</title>
62725 <para>
62726 A line of the form
62727 </para>
62728 <literallayout class="monospaced">
62729 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
62730 </literallayout>
62731 <para>
62732 is written to the main log when a message is about to be removed from the spool
62733 at the end of its processing.
62734 </para>
62735 </section>
62736 <section id="SECID258">
62737 <title>Summary of Fields in Log Lines</title>
62738 <para>
62739 <indexterm role="concept">
62740 <primary>log</primary>
62741 <secondary>summary of fields</secondary>
62742 </indexterm>
62743 A summary of the field identifiers that are used in log lines is shown in
62744 the following table:
62745 </para>
62746 <literallayout>
62747 <literal>A   </literal>        authenticator name (and optional id and sender)
62748 <literal>C   </literal>        SMTP confirmation on delivery
62749 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
62750 <literal>CV  </literal>        certificate verification status
62751 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
62752 <literal>DN  </literal>        distinguished name from peer certificate
62753 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
62754 <literal>F   </literal>        sender address (on delivery lines)
62755 <literal>H   </literal>        host name and IP address
62756 <literal>I   </literal>        local interface used
62757 <literal>id  </literal>        message id for incoming message
62758 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
62759 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
62760 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
62761 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
62762 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
62763 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
62764 <literal>S   </literal>        size of message
62765 <literal>SNI </literal>        server name indication from TLS client hello
62766 <literal>ST  </literal>        shadow transport name
62767 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
62768 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
62769 <literal>U   </literal>        local user or RFC 1413 identity
62770 <literal>X   </literal>        TLS cipher suite
62771 </literallayout>
62772 </section>
62773 <section id="SECID259">
62774 <title>Other log entries</title>
62775 <para>
62776 Various other types of log entry are written from time to time. Most should be
62777 self-explanatory. Among the more common are:
62778 </para>
62779 <itemizedlist>
62780 <listitem>
62781 <para>
62782 <indexterm role="concept">
62783 <primary>retry</primary>
62784 <secondary>time not reached</secondary>
62785 </indexterm>
62786 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
62787 during routing or local delivery, and the time to retry has not yet arrived.
62788 This message is not written to an individual message log file unless it happens
62789 during the first delivery attempt.
62790 </para>
62791 </listitem>
62792 <listitem>
62793 <para>
62794 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
62795 temporary errors during remote delivery, and the retry time has not yet arrived
62796 for any of the hosts to which it is routed.
62797 </para>
62798 </listitem>
62799 <listitem>
62800 <para>
62801 <indexterm role="concept">
62802 <primary>spool directory</primary>
62803 <secondary>file locked</secondary>
62804 </indexterm>
62805 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
62806 some other Exim process is already working on the message. This can be quite
62807 common if queue running processes are started at frequent intervals. The
62808 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
62809 doing.
62810 </para>
62811 </listitem>
62812 <listitem>
62813 <para>
62814 <indexterm role="concept">
62815 <primary>error</primary>
62816 <secondary>ignored</secondary>
62817 </indexterm>
62818 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
62819 message:
62820 </para>
62821 <orderedlist numeration="arabic">
62822 <listitem>
62823 <para>
62824 Exim failed to deliver a bounce message whose age was greater than
62825 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
62826 </para>
62827 </listitem>
62828 <listitem>
62829 <para>
62830 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
62831 failed. The delivery was discarded.
62832 </para>
62833 </listitem>
62834 <listitem>
62835 <para>
62836 A delivery set up by a router configured with
62837 </para>
62838 <literallayout class="monospaced">
62839     errors_to = &lt;&gt;
62840 </literallayout>
62841 <para>
62842 failed. The delivery was discarded.
62843 </para>
62844 </listitem>
62845 </orderedlist>
62846 </listitem>
62847 </itemizedlist>
62848 </section>
62849 <section id="SECTlogselector">
62850 <title>Reducing or increasing what is logged</title>
62851 <para>
62852 <indexterm role="concept">
62853 <primary>log</primary>
62854 <secondary>selectors</secondary>
62855 </indexterm>
62856 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
62857 default logging, or you can request additional logging. The value of
62858 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
62859 example:
62860 </para>
62861 <literallayout class="monospaced">
62862 log_selector = +arguments -retry_defer
62863 </literallayout>
62864 <para>
62865 The list of optional log items is in the following table, with the default
62866 selection marked by asterisks:
62867 </para>
62868 <literallayout>
62869 <literal> 8bitmime                   </literal>  received 8BITMIME status
62870 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
62871 <literal> address_rewrite            </literal>  address rewriting
62872 <literal> all_parents                </literal>  all parents in =&gt; lines
62873 <literal> arguments                  </literal>  command line arguments
62874 <literal>*connection_reject          </literal>  connection rejections
62875 <literal>*delay_delivery             </literal>  immediate delivery delayed
62876 <literal> deliver_time               </literal>  time taken to perform delivery
62877 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
62878 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
62879 <literal>*etrn                       </literal>  ETRN commands
62880 <literal>*host_lookup_failed         </literal>  as it says
62881 <literal> ident_timeout              </literal>  timeout for ident connection
62882 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
62883 <literal> incoming_port              </literal>  incoming port on &lt;= lines
62884 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
62885 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
62886 <literal>*queue_run                  </literal>  start and end queue runs
62887 <literal> queue_time                 </literal>  time on queue for one recipient
62888 <literal> queue_time_overall         </literal>  time on queue for whole message
62889 <literal> pid                        </literal>  Exim process id
62890 <literal> received_recipients        </literal>  recipients on &lt;= lines
62891 <literal> received_sender            </literal>  sender on &lt;= lines
62892 <literal>*rejected_header            </literal>  header contents on reject log
62893 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
62894 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
62895 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
62896 <literal>*sender_verify_fail         </literal>  sender verification failures
62897 <literal>*size_reject                </literal>  rejection because too big
62898 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
62899 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
62900 <literal> smtp_connection            </literal>  SMTP connections
62901 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
62902 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
62903 <literal> smtp_no_mail               </literal>  session with no MAIL commands
62904 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
62905 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
62906 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
62907 <literal> tls_certificate_verified   </literal>  certificate verification status
62908 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
62909 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
62910 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
62911 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
62912
62913 <literal> all                        </literal>  all of the above
62914 </literallayout>
62915 <para>
62916 More details on each of these items follows:
62917 </para>
62918 <itemizedlist>
62919 <listitem>
62920 <para>
62921 <indexterm role="concept">
62922 <primary>8BITMIME</primary>
62923 </indexterm>
62924 <indexterm role="concept">
62925 <primary>log</primary>
62926 <secondary>8BITMIME</secondary>
62927 </indexterm>
62928 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
62929 which may help in tracking down interoperability issues with ancient MTAs
62930 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
62931 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
62932 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
62933 </para>
62934 </listitem>
62935 <listitem>
62936 <para>
62937 <indexterm role="concept">
62938 <primary><option>warn</option> ACL verb</primary>
62939 <secondary>log when skipping</secondary>
62940 </indexterm>
62941 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
62942 its conditions cannot be evaluated, a log line to this effect is written if
62943 this log selector is set.
62944 </para>
62945 </listitem>
62946 <listitem>
62947 <para>
62948 <indexterm role="concept">
62949 <primary>log</primary>
62950 <secondary>rewriting</secondary>
62951 </indexterm>
62952 <indexterm role="concept">
62953 <primary>rewriting</primary>
62954 <secondary>logging</secondary>
62955 </indexterm>
62956 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
62957 rewrites, but not to rewrites in filters run as an unprivileged user (because
62958 such users cannot access the log).
62959 </para>
62960 </listitem>
62961 <listitem>
62962 <para>
62963 <indexterm role="concept">
62964 <primary>log</primary>
62965 <secondary>full parentage</secondary>
62966 </indexterm>
62967 <option>all_parents</option>: Normally only the original and final addresses are logged on
62968 delivery lines; with this selector, intermediate parents are given in
62969 parentheses between them.
62970 </para>
62971 </listitem>
62972 <listitem>
62973 <para>
62974 <indexterm role="concept">
62975 <primary>log</primary>
62976 <secondary>Exim arguments</secondary>
62977 </indexterm>
62978 <indexterm role="concept">
62979 <primary>Exim arguments, logging</primary>
62980 </indexterm>
62981 <option>arguments</option>: This causes Exim to write the arguments with which it was called
62982 to the main log, preceded by the current working directory. This is a debugging
62983 feature, added to make it easier to find out how certain MUAs call
62984 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
62985 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
62986 that are empty or that contain white space are quoted. Non-printing characters
62987 are shown as escape sequences. This facility cannot log unrecognized arguments,
62988 because the arguments are checked before the configuration file is read. The
62989 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
62990 between the caller and Exim.
62991 </para>
62992 </listitem>
62993 <listitem>
62994 <para>
62995 <indexterm role="concept">
62996 <primary>log</primary>
62997 <secondary>connection rejections</secondary>
62998 </indexterm>
62999 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
63000 connection is rejected, for whatever reason.
63001 </para>
63002 </listitem>
63003 <listitem>
63004 <para>
63005 <indexterm role="concept">
63006 <primary>log</primary>
63007 <secondary>delayed delivery</secondary>
63008 </indexterm>
63009 <indexterm role="concept">
63010 <primary>delayed delivery, logging</primary>
63011 </indexterm>
63012 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
63013 started for an incoming message because the load is too high or too many
63014 messages were received on one connection. Logging does not occur if no delivery
63015 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
63016 </para>
63017 </listitem>
63018 <listitem>
63019 <para>
63020 <indexterm role="concept">
63021 <primary>log</primary>
63022 <secondary>delivery duration</secondary>
63023 </indexterm>
63024 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
63025 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
63026 </para>
63027 </listitem>
63028 <listitem>
63029 <para>
63030 <indexterm role="concept">
63031 <primary>log</primary>
63032 <secondary>message size on delivery</secondary>
63033 </indexterm>
63034 <indexterm role="concept">
63035 <primary>size</primary>
63036 <secondary>of message</secondary>
63037 </indexterm>
63038 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
63039 the <quote>=&gt;</quote> line, tagged with S=.
63040 </para>
63041 </listitem>
63042 <listitem>
63043 <para>
63044 <indexterm role="concept">
63045 <primary>log</primary>
63046 <secondary>dnslist defer</secondary>
63047 </indexterm>
63048 <indexterm role="concept">
63049 <primary>DNS list</primary>
63050 <secondary>logging defer</secondary>
63051 </indexterm>
63052 <indexterm role="concept">
63053 <primary>black list (DNS)</primary>
63054 </indexterm>
63055 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
63056 DNS black list suffers a temporary error.
63057 </para>
63058 </listitem>
63059 <listitem>
63060 <para>
63061 <indexterm role="concept">
63062 <primary>log</primary>
63063 <secondary>ETRN commands</secondary>
63064 </indexterm>
63065 <indexterm role="concept">
63066 <primary>ETRN</primary>
63067 <secondary>logging</secondary>
63068 </indexterm>
63069 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
63070 is run to determine whether or not it is actually accepted. An invalid ETRN
63071 command, or one received within a message transaction is not logged by this
63072 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
63073 </para>
63074 </listitem>
63075 <listitem>
63076 <para>
63077 <indexterm role="concept">
63078 <primary>log</primary>
63079 <secondary>host lookup failure</secondary>
63080 </indexterm>
63081 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
63082 any addresses, or when a lookup of an IP address fails to find a host name, a
63083 log line is written. This logging does not apply to direct DNS lookups when
63084 routing email addresses, but it does apply to <quote>byname</quote> lookups.
63085 </para>
63086 </listitem>
63087 <listitem>
63088 <para>
63089 <indexterm role="concept">
63090 <primary>log</primary>
63091 <secondary>ident timeout</secondary>
63092 </indexterm>
63093 <indexterm role="concept">
63094 <primary>RFC 1413</primary>
63095 <secondary>logging timeout</secondary>
63096 </indexterm>
63097 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
63098 client&#x2019;s ident port times out.
63099 </para>
63100 </listitem>
63101 <listitem>
63102 <para>
63103 <indexterm role="concept">
63104 <primary>log</primary>
63105 <secondary>incoming interface</secondary>
63106 </indexterm>
63107 <indexterm role="concept">
63108 <primary>interface</primary>
63109 <secondary>logging</secondary>
63110 </indexterm>
63111 <option>incoming_interface</option>: The interface on which a message was received is added
63112 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
63113 followed by a colon and the port number. The local interface and port are also
63114 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
63115 rejection lines.
63116 </para>
63117 </listitem>
63118 <listitem>
63119 <para>
63120 <indexterm role="concept">
63121 <primary>log</primary>
63122 <secondary>incoming remote port</secondary>
63123 </indexterm>
63124 <indexterm role="concept">
63125 <primary>port</primary>
63126 <secondary>logging remote</secondary>
63127 </indexterm>
63128 <indexterm role="concept">
63129 <primary>TCP/IP</primary>
63130 <secondary>logging incoming remote port</secondary>
63131 </indexterm>
63132 <indexterm role="variable">
63133 <primary><varname>$sender_fullhost</varname></primary>
63134 </indexterm>
63135 <indexterm role="variable">
63136 <primary><varname>$sender_rcvhost</varname></primary>
63137 </indexterm>
63138 <option>incoming_port</option>: The remote port number from which a message was received is
63139 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
63140 in square brackets, and separated from it by a colon. This is implemented by
63141 changing the value that is put in the <varname>$sender_fullhost</varname> and
63142 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
63143 important with the widening use of NAT (see RFC 2505).
63144 </para>
63145 </listitem>
63146 <listitem>
63147 <para>
63148 <indexterm role="concept">
63149 <primary>log</primary>
63150 <secondary>dropped connection</secondary>
63151 </indexterm>
63152 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
63153 connection is unexpectedly dropped.
63154 </para>
63155 </listitem>
63156 <listitem>
63157 <para>
63158 <indexterm role="concept">
63159 <primary>log</primary>
63160 <secondary>outgoing remote port</secondary>
63161 </indexterm>
63162 <indexterm role="concept">
63163 <primary>port</primary>
63164 <secondary>logging outgoint remote</secondary>
63165 </indexterm>
63166 <indexterm role="concept">
63167 <primary>TCP/IP</primary>
63168 <secondary>logging ougtoing remote port</secondary>
63169 </indexterm>
63170 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
63171 containing =&gt; tags) following the IP address. This option is not included in
63172 the default setting, because for most ordinary configurations, the remote port
63173 number is always 25 (the SMTP port).
63174 </para>
63175 </listitem>
63176 <listitem>
63177 <para>
63178 <indexterm role="concept">
63179 <primary>log</primary>
63180 <secondary>process ids in</secondary>
63181 </indexterm>
63182 <indexterm role="concept">
63183 <primary>pid (process id)</primary>
63184 <secondary>in log lines</secondary>
63185 </indexterm>
63186 <option>pid</option>: The current process id is added to every log line, in square brackets,
63187 immediately after the time and date.
63188 </para>
63189 </listitem>
63190 <listitem>
63191 <para>
63192 <indexterm role="concept">
63193 <primary>log</primary>
63194 <secondary>queue run</secondary>
63195 </indexterm>
63196 <indexterm role="concept">
63197 <primary>queue runner</primary>
63198 <secondary>logging</secondary>
63199 </indexterm>
63200 <option>queue_run</option>: The start and end of every queue run are logged.
63201 </para>
63202 </listitem>
63203 <listitem>
63204 <para>
63205 <indexterm role="concept">
63206 <primary>log</primary>
63207 <secondary>queue time</secondary>
63208 </indexterm>
63209 <option>queue_time</option>: The amount of time the message has been in the queue on the
63210 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
63211 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
63212 includes reception time as well as the delivery time for the current address.
63213 This means that it may be longer than the difference between the arrival and
63214 delivery log line times, because the arrival log line is not written until the
63215 message has been successfully received.
63216 </para>
63217 </listitem>
63218 <listitem>
63219 <para>
63220 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
63221 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
63222 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
63223 message, so it includes reception time as well as the total delivery time.
63224 </para>
63225 </listitem>
63226 <listitem>
63227 <para>
63228 <indexterm role="concept">
63229 <primary>log</primary>
63230 <secondary>recipients</secondary>
63231 </indexterm>
63232 <option>received_recipients</option>: The recipients of a message are listed in the main log
63233 as soon as the message is received. The list appears at the end of the log line
63234 that is written when a message is received, preceded by the word <quote>for</quote>. The
63235 addresses are listed after they have been qualified, but before any rewriting
63236 has taken place.
63237 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
63238 in the list.
63239 </para>
63240 </listitem>
63241 <listitem>
63242 <para>
63243 <indexterm role="concept">
63244 <primary>log</primary>
63245 <secondary>sender reception</secondary>
63246 </indexterm>
63247 <option>received_sender</option>: The unrewritten original sender of a message is added to
63248 the end of the log line that records the message&#x2019;s arrival, after the word
63249 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
63250 </para>
63251 </listitem>
63252 <listitem>
63253 <para>
63254 <indexterm role="concept">
63255 <primary>log</primary>
63256 <secondary>header lines for rejection</secondary>
63257 </indexterm>
63258 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
63259 rejection is written to the reject log, the complete header is added to the
63260 log. Header logging can be turned off individually for messages that are
63261 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
63262 </para>
63263 </listitem>
63264 <listitem>
63265 <para>
63266 <indexterm role="concept">
63267 <primary>log</primary>
63268 <secondary>retry defer</secondary>
63269 </indexterm>
63270 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
63271 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
63272 message is always omitted from individual message logs after the first delivery
63273 attempt.
63274 </para>
63275 </listitem>
63276 <listitem>
63277 <para>
63278 <indexterm role="concept">
63279 <primary>log</primary>
63280 <secondary>return path</secondary>
63281 </indexterm>
63282 <option>return_path_on_delivery</option>: The return path that is being transmitted with
63283 the message is included in delivery and bounce lines, using the tag P=.
63284 This is omitted if no delivery actually happens, for example, if routing fails,
63285 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
63286 </para>
63287 </listitem>
63288 <listitem>
63289 <para>
63290 <indexterm role="concept">
63291 <primary>log</primary>
63292 <secondary>sender on delivery</secondary>
63293 </indexterm>
63294 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
63295 and bounce line, tagged by F= (for <quote>from</quote>).
63296 This is the original sender that was received with the message; it is not
63297 necessarily the same as the outgoing return path.
63298 </para>
63299 </listitem>
63300 <listitem>
63301 <para>
63302 <indexterm role="concept">
63303 <primary>log</primary>
63304 <secondary>sender verify failure</secondary>
63305 </indexterm>
63306 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
63307 gives details of a sender verification failure is not written. Log lines for
63308 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
63309 detail is lost.
63310 </para>
63311 </listitem>
63312 <listitem>
63313 <para>
63314 <indexterm role="concept">
63315 <primary>log</primary>
63316 <secondary>size rejection</secondary>
63317 </indexterm>
63318 <option>size_reject</option>: A log line is written whenever a message is rejected because
63319 it is too big.
63320 </para>
63321 </listitem>
63322 <listitem>
63323 <para>
63324 <indexterm role="concept">
63325 <primary>log</primary>
63326 <secondary>frozen messages; skipped</secondary>
63327 </indexterm>
63328 <indexterm role="concept">
63329 <primary>frozen messages</primary>
63330 <secondary>logging skipping</secondary>
63331 </indexterm>
63332 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
63333 queue run because it is frozen or because another process is already delivering
63334 it.
63335 <indexterm role="concept">
63336 <primary><quote>spool file is locked</quote></primary>
63337 </indexterm>
63338 The message that is written is <quote>spool file is locked</quote>.
63339 </para>
63340 </listitem>
63341 <listitem>
63342 <para>
63343 <indexterm role="concept">
63344 <primary>log</primary>
63345 <secondary>smtp confirmation</secondary>
63346 </indexterm>
63347 <indexterm role="concept">
63348 <primary>SMTP</primary>
63349 <secondary>logging confirmation</secondary>
63350 </indexterm>
63351 <indexterm role="concept">
63352 <primary>LMTP</primary>
63353 <secondary>logging confirmation</secondary>
63354 </indexterm>
63355 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
63356 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
63357 A number of MTAs (including Exim) return an identifying string in this
63358 response.
63359 </para>
63360 </listitem>
63361 <listitem>
63362 <para>
63363 <indexterm role="concept">
63364 <primary>log</primary>
63365 <secondary>SMTP connections</secondary>
63366 </indexterm>
63367 <indexterm role="concept">
63368 <primary>SMTP</primary>
63369 <secondary>logging connections</secondary>
63370 </indexterm>
63371 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
63372 established or closed, unless the connection is from a host that matches
63373 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
63374 only when the closure is unexpected.) This applies to connections from local
63375 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
63376 dropped in the middle of a message, a log line is always written, whether or
63377 not this selector is set, but otherwise nothing is written at the start and end
63378 of connections unless this selector is enabled.
63379 </para>
63380 <para>
63381 For TCP/IP connections to an Exim daemon, the current number of connections is
63382 included in the log message for each new connection, but note that the count is
63383 reset if the daemon is restarted.
63384 Also, because connections are closed (and the closure is logged) in
63385 subprocesses, the count may not include connections that have been closed but
63386 whose termination the daemon has not yet noticed. Thus, while it is possible to
63387 match up the opening and closing of connections in the log, the value of the
63388 logged counts may not be entirely accurate.
63389 </para>
63390 </listitem>
63391 <listitem>
63392 <para>
63393 <indexterm role="concept">
63394 <primary>log</primary>
63395 <secondary>SMTP transaction; incomplete</secondary>
63396 </indexterm>
63397 <indexterm role="concept">
63398 <primary>SMTP</primary>
63399 <secondary>logging incomplete transactions</secondary>
63400 </indexterm>
63401 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
63402 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
63403 and the message sender plus any accepted recipients are included in the log
63404 line. This can provide evidence of dictionary attacks.
63405 </para>
63406 </listitem>
63407 <listitem>
63408 <para>
63409 <indexterm role="concept">
63410 <primary>log</primary>
63411 <secondary>non-MAIL SMTP sessions</secondary>
63412 </indexterm>
63413 <indexterm role="concept">
63414 <primary>MAIL</primary>
63415 <secondary>logging session without</secondary>
63416 </indexterm>
63417 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
63418 connection terminates without having issued a MAIL command. This includes both
63419 the case when the connection is dropped, and the case when QUIT is used. It
63420 does not include cases where the connection is rejected right at the start (by
63421 an ACL, or because there are too many connections, or whatever). These cases
63422 already have their own log lines.
63423 </para>
63424 <para>
63425 The log line that is written contains the identity of the client in the usual
63426 way, followed by D= and a time, which records the duration of the connection.
63427 If the connection was authenticated, this fact is logged exactly as it is for
63428 an incoming message, with an A= item. If the connection was encrypted, CV=,
63429 DN=, and X= items may appear as they do for an incoming message, controlled by
63430 the same logging options.
63431 </para>
63432 <para>
63433 Finally, if any SMTP commands were issued during the connection, a C= item
63434 is added to the line, listing the commands that were used. For example,
63435 </para>
63436 <literallayout class="monospaced">
63437 C=EHLO,QUIT
63438 </literallayout>
63439 <para>
63440 shows that the client issued QUIT straight after EHLO. If there were fewer
63441 than 20 commands, they are all listed. If there were more than 20 commands,
63442 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
63443 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
63444 have been aborted before 20 non-mail commands are processed.
63445 </para>
63446 </listitem>
63447 <listitem>
63448 <para>
63449 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
63450 colon-separated, is appended to the A= item for a message arrival or delivery
63451 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
63452 was accepted or used.
63453 </para>
63454 </listitem>
63455 <listitem>
63456 <para>
63457 <indexterm role="concept">
63458 <primary>log</primary>
63459 <secondary>SMTP protocol error</secondary>
63460 </indexterm>
63461 <indexterm role="concept">
63462 <primary>SMTP</primary>
63463 <secondary>logging protocol error</secondary>
63464 </indexterm>
63465 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
63466 encountered. Exim does not have perfect detection of all protocol errors
63467 because of transmission delays and the use of pipelining. If PIPELINING has
63468 been advertised to a client, an Exim server assumes that the client will use
63469 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
63470 received after rejecting MAIL) as protocol errors.
63471 </para>
63472 </listitem>
63473 <listitem>
63474 <para>
63475 <indexterm role="concept">
63476 <primary>SMTP</primary>
63477 <secondary>logging syntax errors</secondary>
63478 </indexterm>
63479 <indexterm role="concept">
63480 <primary>SMTP</primary>
63481 <secondary>syntax errors; logging</secondary>
63482 </indexterm>
63483 <indexterm role="concept">
63484 <primary>SMTP</primary>
63485 <secondary>unknown command; logging</secondary>
63486 </indexterm>
63487 <indexterm role="concept">
63488 <primary>log</primary>
63489 <secondary>unknown SMTP command</secondary>
63490 </indexterm>
63491 <indexterm role="concept">
63492 <primary>log</primary>
63493 <secondary>SMTP syntax error</secondary>
63494 </indexterm>
63495 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
63496 encountered. An unrecognized command is treated as a syntax error. For an
63497 external connection, the host identity is given; for an internal connection
63498 using <option>-bs</option> the sender identification (normally the calling user) is given.
63499 </para>
63500 </listitem>
63501 <listitem>
63502 <para>
63503 <indexterm role="concept">
63504 <primary>log</primary>
63505 <secondary>subject</secondary>
63506 </indexterm>
63507 <indexterm role="concept">
63508 <primary>subject, logging</primary>
63509 </indexterm>
63510 <option>subject</option>: The subject of the message is added to the arrival log line,
63511 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
63512 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
63513 specifies whether characters with values greater than 127 should be logged
63514 unchanged, or whether they should be rendered as escape sequences.
63515 </para>
63516 </listitem>
63517 <listitem>
63518 <para>
63519 <indexterm role="concept">
63520 <primary>log</primary>
63521 <secondary>certificate verification</secondary>
63522 </indexterm>
63523 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
63524 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
63525 verified, and <literal>CV=no</literal> if not.
63526 </para>
63527 </listitem>
63528 <listitem>
63529 <para>
63530 <indexterm role="concept">
63531 <primary>log</primary>
63532 <secondary>TLS cipher</secondary>
63533 </indexterm>
63534 <indexterm role="concept">
63535 <primary>TLS</primary>
63536 <secondary>logging cipher</secondary>
63537 </indexterm>
63538 <option>tls_cipher</option>: When a message is sent or received over an encrypted
63539 connection, the cipher suite used is added to the log line, preceded by X=.
63540 </para>
63541 </listitem>
63542 <listitem>
63543 <para>
63544 <indexterm role="concept">
63545 <primary>log</primary>
63546 <secondary>TLS peer DN</secondary>
63547 </indexterm>
63548 <indexterm role="concept">
63549 <primary>TLS</primary>
63550 <secondary>logging peer DN</secondary>
63551 </indexterm>
63552 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
63553 connection, and a certificate is supplied by the remote host, the peer DN is
63554 added to the log line, preceded by DN=.
63555 </para>
63556 </listitem>
63557 <listitem>
63558 <para>
63559 <indexterm role="concept">
63560 <primary>log</primary>
63561 <secondary>TLS SNI</secondary>
63562 </indexterm>
63563 <indexterm role="concept">
63564 <primary>TLS</primary>
63565 <secondary>logging SNI</secondary>
63566 </indexterm>
63567 <option>tls_sni</option>: When a message is received over an encrypted connection, and
63568 the remote host provided the Server Name Indication extension, the SNI is
63569 added to the log line, preceded by SNI=.
63570 </para>
63571 </listitem>
63572 <listitem>
63573 <para>
63574 <indexterm role="concept">
63575 <primary>log</primary>
63576 <secondary>DNS failure in list</secondary>
63577 </indexterm>
63578 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
63579 result of a list match is failure because a DNS lookup failed.
63580 </para>
63581 </listitem>
63582 </itemizedlist>
63583 </section>
63584 <section id="SECID260">
63585 <title>Message log</title>
63586 <para>
63587 <indexterm role="concept">
63588 <primary>message</primary>
63589 <secondary>log file for</secondary>
63590 </indexterm>
63591 <indexterm role="concept">
63592 <primary>log</primary>
63593 <secondary>message log; description of</secondary>
63594 </indexterm>
63595 <indexterm role="concept">
63596 <primary><filename>msglog</filename> directory</primary>
63597 </indexterm>
63598 <indexterm role="option">
63599 <primary><option>preserve_message_logs</option></primary>
63600 </indexterm>
63601 In addition to the general log files, Exim writes a log file for each message
63602 that it handles. The names of these per-message logs are the message ids, and
63603 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
63604 message log contains copies of the log lines that apply to the message. This
63605 makes it easier to inspect the status of an individual message without having
63606 to search the main log. A message log is deleted when processing of the message
63607 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
63608 only with great care because they can fill up your disk very quickly.
63609 </para>
63610 <para>
63611 On a heavily loaded system, it may be desirable to disable the use of
63612 per-message logs, in order to reduce disk I/O. This can be done by setting the
63613 <option>message_logs</option> option false.
63614 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
63615 </para>
63616 </section>
63617 </chapter>
63618
63619 <chapter id="CHAPutils">
63620 <title>Exim utilities</title>
63621 <para>
63622 <indexterm role="concept" id="IIDutils" class="startofrange">
63623 <primary>utilities</primary>
63624 </indexterm>
63625 A number of utility scripts and programs are supplied with Exim and are
63626 described in this chapter. There is also the Exim Monitor, which is covered in
63627 the next chapter. The utilities described here are:
63628 </para>
63629 <informaltable frame="none">
63630 <tgroup cols="3" colsep="0" rowsep="0">
63631 <colspec colwidth="7*" align="left"/>
63632 <colspec colwidth="15*" align="left"/>
63633 <colspec colwidth="40*" align="left"/>
63634 <tbody>
63635 <row>
63636 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
63637 <entry><emphasis>exiwhat</emphasis></entry>
63638 <entry>list what Exim processes are doing</entry>
63639 </row>
63640 <row>
63641 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
63642 <entry><emphasis>exiqgrep</emphasis></entry>
63643 <entry>grep the queue</entry>
63644 </row>
63645 <row>
63646 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
63647 <entry><emphasis>exiqsumm</emphasis></entry>
63648 <entry>summarize the queue</entry>
63649 </row>
63650 <row>
63651 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
63652 <entry><emphasis>exigrep</emphasis></entry>
63653 <entry>search the main log</entry>
63654 </row>
63655 <row>
63656 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
63657 <entry><emphasis>exipick</emphasis></entry>
63658 <entry>select messages on various criteria</entry>
63659 </row>
63660 <row>
63661 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
63662 <entry><emphasis>exicyclog</emphasis></entry>
63663 <entry>cycle (rotate) log files</entry>
63664 </row>
63665 <row>
63666 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
63667 <entry><emphasis>eximstats</emphasis></entry>
63668 <entry>extract statistics from the log</entry>
63669 </row>
63670 <row>
63671 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
63672 <entry><emphasis>exim_checkaccess</emphasis></entry>
63673 <entry>check address acceptance from given IP</entry>
63674 </row>
63675 <row>
63676 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
63677 <entry><emphasis>exim_dbmbuild</emphasis></entry>
63678 <entry>build a DBM file</entry>
63679 </row>
63680 <row>
63681 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
63682 <entry><emphasis>exinext</emphasis></entry>
63683 <entry>extract retry information</entry>
63684 </row>
63685 <row>
63686 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63687 <entry><emphasis>exim_dumpdb</emphasis></entry>
63688 <entry>dump a hints database</entry>
63689 </row>
63690 <row>
63691 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63692 <entry><emphasis>exim_tidydb</emphasis></entry>
63693 <entry>clean up a hints database</entry>
63694 </row>
63695 <row>
63696 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
63697 <entry><emphasis>exim_fixdb</emphasis></entry>
63698 <entry>patch a hints database</entry>
63699 </row>
63700 <row>
63701 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
63702 <entry><emphasis>exim_lock</emphasis></entry>
63703 <entry>lock a mailbox file</entry>
63704 </row>
63705 </tbody>
63706 </tgroup>
63707 </informaltable>
63708 <para>
63709 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
63710 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
63711 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
63712 </para>
63713 <section id="SECTfinoutwha">
63714 <title>Finding out what Exim processes are doing (exiwhat)</title>
63715 <para>
63716 <indexterm role="concept">
63717 <primary><emphasis>exiwhat</emphasis></primary>
63718 </indexterm>
63719 <indexterm role="concept">
63720 <primary>process, querying</primary>
63721 </indexterm>
63722 <indexterm role="concept">
63723 <primary>SIGUSR1</primary>
63724 </indexterm>
63725 On operating systems that can restart a system call after receiving a signal
63726 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
63727 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
63728 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
63729 processes it can find, having first emptied the file. It then waits for one
63730 second to allow the Exim processes to react before displaying the results. In
63731 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
63732 send the signal to the Exim processes, so it is normally run as root.
63733 </para>
63734 <para>
63735 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
63736 use by system administrators. It is not sensible, for example, to set up a
63737 script that sends SIGUSR1 signals to Exim processes at short intervals.
63738 </para>
63739 <para>
63740 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
63741 varies in different operating systems. Not only are different options used,
63742 but the format of the output is different. For this reason, there are some
63743 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
63744 it doesn&#x2019;t seem to be working for you, check the following compile-time
63745 options:
63746 </para>
63747 <literallayout>
63748 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
63749 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
63750 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
63751 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
63752 </literallayout>
63753 <para>
63754 An example of typical output from <emphasis>exiwhat</emphasis> is
63755 </para>
63756 <literallayout class="monospaced">
63757 164 daemon: -q1h, listening on port 25
63758 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
63759 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
63760   [10.19.42.42] (editor@ref.example)
63761 10592 handling incoming call from [192.168.243.242]
63762 10628 accepting a local non-SMTP message
63763 </literallayout>
63764 <para>
63765 The first number in the output line is the process number. The third line has
63766 been split here, in order to fit it on the page.
63767 </para>
63768 </section>
63769 <section id="SECTgreptheque">
63770 <title>Selective queue listing (exiqgrep)</title>
63771 <para>
63772 <indexterm role="concept">
63773 <primary><emphasis>exiqgrep</emphasis></primary>
63774 </indexterm>
63775 <indexterm role="concept">
63776 <primary>queue</primary>
63777 <secondary>grepping</secondary>
63778 </indexterm>
63779 This utility is a Perl script contributed by Matt Hubbard. It runs
63780 </para>
63781 <literallayout class="monospaced">
63782 exim -bpu
63783 </literallayout>
63784 <para>
63785 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
63786 </para>
63787 <literallayout class="monospaced">
63788 exim -bp
63789 </literallayout>
63790 <para>
63791 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
63792 contain alternate exim configuration the queue management might be using.
63793 </para>
63794 <para>
63795 to obtain a queue listing, and then greps the output to select messages 
63796 that match given criteria. The following selection options are available:
63797 </para>
63798 <variablelist>
63799 <varlistentry>
63800 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63801 <listitem>
63802 <para>
63803 Match the sender address using a case-insensitive search. The field that is
63804 tested is enclosed in angle brackets, so you can test for bounce messages with
63805 </para>
63806 <literallayout class="monospaced">
63807 exiqgrep -f '^&lt;&gt;$'
63808 </literallayout>
63809 </listitem></varlistentry>
63810 <varlistentry>
63811 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63812 <listitem>
63813 <para>
63814 Match a recipient address using a case-insensitve search. The field that is
63815 tested is not enclosed in angle brackets.
63816 </para>
63817 </listitem></varlistentry>
63818 <varlistentry>
63819 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
63820 <listitem>
63821 <para>
63822 Match against the size field.
63823 </para>
63824 </listitem></varlistentry>
63825 <varlistentry>
63826 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63827 <listitem>
63828 <para>
63829 Match messages that are younger than the given time.
63830 </para>
63831 </listitem></varlistentry>
63832 <varlistentry>
63833 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
63834 <listitem>
63835 <para>
63836 Match messages that are older than the given time.
63837 </para>
63838 </listitem></varlistentry>
63839 <varlistentry>
63840 <term><emphasis role="bold">-z</emphasis></term>
63841 <listitem>
63842 <para>
63843 Match only frozen messages.
63844 </para>
63845 </listitem></varlistentry>
63846 <varlistentry>
63847 <term><emphasis role="bold">-x</emphasis></term>
63848 <listitem>
63849 <para>
63850 Match only non-frozen messages.
63851 </para>
63852 </listitem></varlistentry>
63853 </variablelist>
63854 <para>
63855 The following options control the format of the output:
63856 </para>
63857 <variablelist>
63858 <varlistentry>
63859 <term><emphasis role="bold">-c</emphasis></term>
63860 <listitem>
63861 <para>
63862 Display only the count of matching messages.
63863 </para>
63864 </listitem></varlistentry>
63865 <varlistentry>
63866 <term><emphasis role="bold">-l</emphasis></term>
63867 <listitem>
63868 <para>
63869 Long format &ndash; display the full message information as output by Exim. This is
63870 the default.
63871 </para>
63872 </listitem></varlistentry>
63873 <varlistentry>
63874 <term><emphasis role="bold">-i</emphasis></term>
63875 <listitem>
63876 <para>
63877 Display message ids only.
63878 </para>
63879 </listitem></varlistentry>
63880 <varlistentry>
63881 <term><emphasis role="bold">-b</emphasis></term>
63882 <listitem>
63883 <para>
63884 Brief format &ndash; one line per message.
63885 </para>
63886 </listitem></varlistentry>
63887 <varlistentry>
63888 <term><emphasis role="bold">-R</emphasis></term>
63889 <listitem>
63890 <para>
63891 Display messages in reverse order.
63892 </para>
63893 </listitem></varlistentry>
63894 <varlistentry>
63895 <term><emphasis role="bold">-a</emphasis></term>
63896 <listitem>
63897 <para>
63898 Include delivered recipients in queue listing.
63899 </para>
63900 </listitem></varlistentry>
63901 </variablelist>
63902 <para>
63903 There is one more option, <option>-h</option>, which outputs a list of options.
63904 </para>
63905 </section>
63906 <section id="SECTsumtheque">
63907 <title>Summarizing the queue (exiqsumm)</title>
63908 <para>
63909 <indexterm role="concept">
63910 <primary><emphasis>exiqsumm</emphasis></primary>
63911 </indexterm>
63912 <indexterm role="concept">
63913 <primary>queue</primary>
63914 <secondary>summary</secondary>
63915 </indexterm>
63916 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
63917 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
63918 running a command such as
63919 </para>
63920 <literallayout class="monospaced">
63921 exim -bp | exiqsumm
63922 </literallayout>
63923 <para>
63924 The output consists of one line for each domain that has messages waiting for
63925 it, as in the following example:
63926 </para>
63927 <literallayout class="monospaced">
63928 3   2322   74m   66m  msn.com.example
63929 </literallayout>
63930 <para>
63931 Each line lists the number of pending deliveries for a domain, their total
63932 volume, and the length of time that the oldest and the newest messages have
63933 been waiting. Note that the number of pending deliveries is greater than the
63934 number of messages when messages have more than one recipient.
63935 </para>
63936 <para>
63937 A summary line is output at the end. By default the output is sorted on the
63938 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
63939 the output to be sorted by oldest message and by count of messages,
63940 respectively. There are also three options that split the messages for each
63941 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
63942 separates frozen messages, and <option>-s</option> separates messages according to their
63943 sender.
63944 </para>
63945 <para>
63946 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
63947 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
63948 generated by aliasing or forwarding are included (unless the <option>one_time</option>
63949 option of the <command>redirect</command> router has been used to convert them into <quote>top
63950 level</quote> addresses).
63951 </para>
63952 </section>
63953 <section id="SECTextspeinf">
63954 <title>Extracting specific information from the log (exigrep)</title>
63955 <para>
63956 <indexterm role="concept">
63957 <primary><emphasis>exigrep</emphasis></primary>
63958 </indexterm>
63959 <indexterm role="concept">
63960 <primary>log</primary>
63961 <secondary>extracts; grepping for</secondary>
63962 </indexterm>
63963 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
63964 files for entries that match a given pattern. When it finds a match, it
63965 extracts all the log entries for the relevant message, not just those that
63966 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
63967 given message, or all mail for a given user, or for a given host, for example.
63968 The input files can be in Exim log format or syslog format.
63969 If a matching log line is not associated with a specific message, it is
63970 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
63971 </para>
63972 <literallayout revisionflag="changed">
63973 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-M] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
63974 </literallayout>
63975 <para>
63976 If no log file names are given on the command line, the standard input is read.
63977 </para>
63978 <para>
63979 The <option>-t</option> argument specifies a number of seconds. It adds an additional
63980 condition for message selection. Messages that are complete are shown only if
63981 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
63982 </para>
63983 <para>
63984 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
63985 makes it case-sensitive. This may give a performance improvement when searching
63986 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
63987 option; with <option>-I</option> they do not. In both cases it is possible to change the
63988 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
63989 </para>
63990 <para>
63991 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
63992 pattern as standing for themselves. Otherwise the pattern must be a Perl
63993 regular expression.
63994 </para>
63995 <para>
63996 The <option>-v</option> option inverts the matching condition. That is, a line is selected
63997 if it does <emphasis>not</emphasis> match the pattern.
63998 </para>
63999 <para revisionflag="changed">
64000 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
64001 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
64002 normally.
64003 </para>
64004 <para revisionflag="changed">
64005 Example of <option>-M</option>:
64006 user_a sends a message to user_b, which generates a bounce back to user_b. If
64007 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
64008 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
64009 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
64010 when searching for <quote>user_a</quote> will show both messages since the bounce is
64011 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
64012 search term.
64013 </para>
64014 <para>
64015 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
64016 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
64017 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
64018 </para>
64019 </section>
64020 <section id="SECTexipick">
64021 <title>Selecting messages by various criteria (exipick)</title>
64022 <para>
64023 <indexterm role="concept">
64024 <primary><emphasis>exipick</emphasis></primary>
64025 </indexterm>
64026 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
64027 lists messages from the queue according to a variety of criteria. For details
64028 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
64029 <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
64030 the <option>--help</option> option.
64031 </para>
64032 </section>
64033 <section id="SECTcyclogfil">
64034 <title>Cycling log files (exicyclog)</title>
64035 <para>
64036 <indexterm role="concept">
64037 <primary>log</primary>
64038 <secondary>cycling local files</secondary>
64039 </indexterm>
64040 <indexterm role="concept">
64041 <primary>cycling logs</primary>
64042 </indexterm>
64043 <indexterm role="concept">
64044 <primary><emphasis>exicyclog</emphasis></primary>
64045 </indexterm>
64046 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
64047 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
64048 you are using log files with datestamps in their names (see section
64049 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
64050 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
64051 There are two command line options for <emphasis>exicyclog</emphasis>:
64052 </para>
64053 <itemizedlist>
64054 <listitem>
64055 <para>
64056 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
64057 default that is set when Exim is built. The default default is 10.
64058 </para>
64059 </listitem>
64060 <listitem>
64061 <para>
64062 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
64063 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
64064 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
64065 configuration.
64066 </para>
64067 </listitem>
64068 </itemizedlist>
64069 <para>
64070 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
64071 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
64072 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
64073 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
64074 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
64075 logs are handled similarly.
64076 </para>
64077 <para>
64078 If the limit is greater than 99, the script uses 3-digit numbers such as
64079 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
64080 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
64081 any existing log files.
64082 </para>
64083 <para>
64084 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
64085 the end are deleted. All files with numbers greater than 01 are compressed,
64086 using a compression command which is configured by the COMPRESS_COMMAND
64087 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
64088 root <option>crontab</option> entry of the form
64089 </para>
64090 <literallayout class="monospaced">
64091 1 0 * * * su exim -c /usr/exim/bin/exicyclog
64092 </literallayout>
64093 <para>
64094 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
64095 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
64096 </para>
64097 </section>
64098 <section id="SECTmailstat">
64099 <title>Mail statistics (eximstats)</title>
64100 <para>
64101 <indexterm role="concept">
64102 <primary>statistics</primary>
64103 </indexterm>
64104 <indexterm role="concept">
64105 <primary><emphasis>eximstats</emphasis></primary>
64106 </indexterm>
64107 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
64108 information from log files. The output is either plain text, or HTML.
64109 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
64110 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
64111 </para>
64112 <para>
64113 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
64114 latest version is the result of some extensive revision by Steve Campbell. A
64115 lot of information is given by default, but there are options for suppressing
64116 various parts of it. Following any options, the arguments to the script are a
64117 list of files, which should be main log files. For example:
64118 </para>
64119 <literallayout class="monospaced">
64120 eximstats -nr /var/spool/exim/log/mainlog.01
64121 </literallayout>
64122 <para>
64123 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
64124 messages received from or delivered to various hosts. The information is sorted
64125 both by message count and by volume, and the top fifty hosts in each category
64126 are listed on the standard output. Similar information, based on email
64127 addresses or domains instead of hosts can be requested by means of various
64128 options. For messages delivered and received locally, similar statistics are
64129 also produced per user.
64130 </para>
64131 <para>
64132 The output also includes total counts and statistics about delivery errors, and
64133 histograms showing the number of messages received and deliveries made in each
64134 hour of the day. A delivery with more than one address in its envelope (for
64135 example, an SMTP transaction with more than one RCPT command) is counted
64136 as a single delivery by <emphasis>eximstats</emphasis>.
64137 </para>
64138 <para>
64139 Though normally more deliveries than receipts are reported (as messages may
64140 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
64141 messages received than delivered, even though the queue is empty at the start
64142 and end of the period in question. If an incoming message contains no valid
64143 recipients, no deliveries are recorded for it. A bounce message is handled as
64144 an entirely separate message.
64145 </para>
64146 <para>
64147 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
64148 of messages received and deliveries made, and the number of hosts involved in
64149 each case. It also outputs the number of messages that were delayed (that is,
64150 not completely delivered at the first attempt), and the number that had at
64151 least one address that failed.
64152 </para>
64153 <para>
64154 The remainder of the output is in sections that can be independently disabled
64155 or modified by various options. It consists of a summary of deliveries by
64156 transport, histograms of messages received and delivered per time interval
64157 (default per hour), information about the time messages spent on the queue,
64158 a list of relayed messages, lists of the top fifty sending hosts, local
64159 senders, destination hosts, and destination local users by count and by volume,
64160 and a list of delivery errors that occurred.
64161 </para>
64162 <para>
64163 The relay information lists messages that were actually relayed, that is, they
64164 came from a remote host and were directly delivered to some other remote host,
64165 without being processed (for example, for aliasing or forwarding) locally.
64166 </para>
64167 <para>
64168 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
64169 outputs. These are documented in the Perl script itself, and can be extracted
64170 by running the command <command>perldoc</command> on the script. For example:
64171 </para>
64172 <literallayout class="monospaced">
64173 perldoc /usr/exim/bin/eximstats
64174 </literallayout>
64175 </section>
64176 <section id="SECTcheckaccess">
64177 <title>Checking access policy (exim_checkaccess)</title>
64178 <para>
64179 <indexterm role="concept">
64180 <primary><emphasis>exim_checkaccess</emphasis></primary>
64181 </indexterm>
64182 <indexterm role="concept">
64183 <primary>policy control</primary>
64184 <secondary>checking access</secondary>
64185 </indexterm>
64186 <indexterm role="concept">
64187 <primary>checking access</primary>
64188 </indexterm>
64189 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
64190 debugging output, in order to check what Exim is doing when it is applying
64191 policy controls to incoming SMTP mail. However, not everybody is sufficiently
64192 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
64193 sometimes you just want to answer the question <quote>Does this address have
64194 access?</quote> without bothering with any further details.
64195 </para>
64196 <para>
64197 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
64198 two arguments, an IP address and an email address:
64199 </para>
64200 <literallayout class="monospaced">
64201 exim_checkaccess 10.9.8.7 A.User@a.domain.example
64202 </literallayout>
64203 <para>
64204 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
64205 given email address would be accepted in a RCPT command in a TCP/IP
64206 connection from the host with the given IP address. The output of the utility
64207 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
64208 </para>
64209 <literallayout class="monospaced">
64210 Rejected:
64211 550 Relay not permitted
64212 </literallayout>
64213 <para>
64214 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
64215 for the MAIL command, but you can change this by providing additional
64216 options. These are passed directly to the Exim command. For example, to specify
64217 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
64218 you can use:
64219 </para>
64220 <literallayout class="monospaced">
64221 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
64222                  -f himself@there.example
64223 </literallayout>
64224 <para>
64225 Note that these additional Exim command line items must be given after the two
64226 mandatory arguments.
64227 </para>
64228 <para>
64229 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
64230 while running its checks. You can run checks that include callouts by using
64231 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
64232 </para>
64233 </section>
64234 <section id="SECTdbmbuild">
64235 <title>Making DBM files (exim_dbmbuild)</title>
64236 <para>
64237 <indexterm role="concept">
64238 <primary>DBM</primary>
64239 <secondary>building dbm files</secondary>
64240 </indexterm>
64241 <indexterm role="concept">
64242 <primary>building DBM files</primary>
64243 </indexterm>
64244 <indexterm role="concept">
64245 <primary><emphasis>exim_dbmbuild</emphasis></primary>
64246 </indexterm>
64247 <indexterm role="concept">
64248 <primary>lower casing</primary>
64249 </indexterm>
64250 <indexterm role="concept">
64251 <primary>binary zero</primary>
64252 <secondary>in lookup key</secondary>
64253 </indexterm>
64254 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
64255 the format used by the <command>lsearch</command> lookup (see section
64256 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
64257 names as keys and the remainder of the information as data. The lower-casing
64258 can be prevented by calling the program with the <option>-nolc</option> option.
64259 </para>
64260 <para>
64261 A terminating zero is included as part of the key string. This is expected by
64262 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
64263 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
64264 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
64265 files.
64266 </para>
64267 <para>
64268 The program requires two arguments: the name of the input file (which can be a
64269 single hyphen to indicate the standard input), and the name of the output file.
64270 It creates the output under a temporary name, and then renames it if all went
64271 well.
64272 </para>
64273 <para>
64274 <indexterm role="concept">
64275 <primary>USE_DB</primary>
64276 </indexterm>
64277 If the native DB interface is in use (USE_DB is set in a compile-time
64278 configuration file &ndash; this is common in free versions of Unix) the two file
64279 names must be different, because in this mode the Berkeley DB functions create
64280 a single output file using exactly the name given. For example,
64281 </para>
64282 <literallayout class="monospaced">
64283 exim_dbmbuild /etc/aliases /etc/aliases.db
64284 </literallayout>
64285 <para>
64286 reads the system alias file and creates a DBM version of it in
64287 <filename>/etc/aliases.db</filename>.
64288 </para>
64289 <para>
64290 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
64291 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
64292 environment, the suffixes are added to the second argument of
64293 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
64294 when the Berkeley functions are used in compatibility mode (though this is not
64295 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
64296 </para>
64297 <para>
64298 If a duplicate key is encountered, the program outputs a warning, and when it
64299 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
64300 option is used. By default, only the first of a set of duplicates is used &ndash;
64301 this makes it compatible with <command>lsearch</command> lookups. There is an option
64302 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
64303 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
64304 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
64305 return code is 2.
64306 </para>
64307 </section>
64308 <section id="SECTfinindret">
64309 <title>Finding individual retry times (exinext)</title>
64310 <para>
64311 <indexterm role="concept">
64312 <primary>retry</primary>
64313 <secondary>times</secondary>
64314 </indexterm>
64315 <indexterm role="concept">
64316 <primary><emphasis>exinext</emphasis></primary>
64317 </indexterm>
64318 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
64319 fish specific information out of the retry database. Given a mail domain (or a
64320 complete address), it looks up the hosts for that domain, and outputs any retry
64321 information for the hosts or for the domain. At present, the retry information
64322 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
64323 output. For example:
64324 </para>
64325 <literallayout class="monospaced">
64326 $ exinext piglet@milne.fict.example
64327 kanga.milne.example:192.168.8.1 error 146: Connection refused
64328   first failed: 21-Feb-1996 14:57:34
64329   last tried:   21-Feb-1996 14:57:34
64330   next try at:  21-Feb-1996 15:02:34
64331 roo.milne.example:192.168.8.3 error 146: Connection refused
64332   first failed: 20-Jan-1996 13:12:08
64333   last tried:   21-Feb-1996 11:42:03
64334   next try at:  21-Feb-1996 19:42:03
64335   past final cutoff time
64336 </literallayout>
64337 <para>
64338 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
64339 will give any retry information for that local part in your default domain.
64340 A message id can be used to obtain retry information pertaining to a specific
64341 message. This exists only when an attempt to deliver a message to a remote host
64342 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
64343 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
64344 run very often.
64345 </para>
64346 <para>
64347 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
64348 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
64349 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
64350 configuration file, and the second sets macros for use within the configuration
64351 file. These features are mainly to help in testing, but might also be useful in
64352 environments where more than one configuration file is in use.
64353 </para>
64354 </section>
64355 <section id="SECThindatmai">
64356 <title>Hints database maintenance</title>
64357 <para>
64358 <indexterm role="concept">
64359 <primary>hints database</primary>
64360 <secondary>maintenance</secondary>
64361 </indexterm>
64362 <indexterm role="concept">
64363 <primary>maintaining Exim&#x2019;s hints database</primary>
64364 </indexterm>
64365 Three utility programs are provided for maintaining the DBM files that Exim
64366 uses to contain its delivery hint information. Each program requires two
64367 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
64368 second is the name of the database it is to operate on. These are as follows:
64369 </para>
64370 <itemizedlist>
64371 <listitem>
64372 <para>
64373 <emphasis>retry</emphasis>: the database of retry information
64374 </para>
64375 </listitem>
64376 <listitem>
64377 <para>
64378 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
64379 for remote hosts
64380 </para>
64381 </listitem>
64382 <listitem>
64383 <para>
64384 <emphasis>callout</emphasis>: the callout cache
64385 </para>
64386 </listitem>
64387 <listitem>
64388 <para>
64389 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
64390 </para>
64391 </listitem>
64392 <listitem>
64393 <para>
64394 <emphasis>misc</emphasis>: other hints data
64395 </para>
64396 </listitem>
64397 </itemizedlist>
64398 <para>
64399 The <emphasis>misc</emphasis> database is used for
64400 </para>
64401 <itemizedlist>
64402 <listitem>
64403 <para>
64404 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
64405 </para>
64406 </listitem>
64407 <listitem>
64408 <para>
64409 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
64410 <command>smtp</command> transport)
64411 </para>
64412 </listitem>
64413 </itemizedlist>
64414 </section>
64415 <section id="SECID261">
64416 <title>exim_dumpdb</title>
64417 <para>
64418 <indexterm role="concept">
64419 <primary><emphasis>exim_dumpdb</emphasis></primary>
64420 </indexterm>
64421 The entire contents of a database are written to the standard output by the
64422 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
64423 spool and database names. For example, to dump the retry database:
64424 </para>
64425 <literallayout class="monospaced">
64426 exim_dumpdb /var/spool/exim retry
64427 </literallayout>
64428 <para>
64429 Two lines of output are produced for each entry:
64430 </para>
64431 <literallayout class="monospaced">
64432 T:mail.ref.example:192.168.242.242 146 77 Connection refused
64433 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
64434 </literallayout>
64435 <para>
64436 The first item on the first line is the key of the record. It starts with one
64437 of the letters R, or T, depending on whether it refers to a routing or
64438 transport retry. For a local delivery, the next part is the local address; for
64439 a remote delivery it is the name of the remote host, followed by its failing IP
64440 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
64441 transport). If the remote port is not the standard one (port 25), it is added
64442 to the IP address. Then there follows an error code, an additional error code,
64443 and a textual description of the error.
64444 </para>
64445 <para>
64446 The three times on the second line are the time of first failure, the time of
64447 the last delivery attempt, and the computed time for the next attempt. The line
64448 ends with an asterisk if the cutoff time for the last retry rule has been
64449 exceeded.
64450 </para>
64451 <para>
64452 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
64453 consists of a host name followed by a list of ids for messages that are or were
64454 waiting to be delivered to that host. If there are a very large number for any
64455 one host, continuation records, with a sequence number added to the host name,
64456 may be seen. The data in these records is often out of date, because a message
64457 may be routed to several alternative hosts, and Exim makes no effort to keep
64458 cross-references.
64459 </para>
64460 </section>
64461 <section id="SECID262">
64462 <title>exim_tidydb</title>
64463 <para>
64464 <indexterm role="concept">
64465 <primary><emphasis>exim_tidydb</emphasis></primary>
64466 </indexterm>
64467 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
64468 database. If run with no options, it removes all records that are more than 30
64469 days old. The age is calculated from the date and time that the record was last
64470 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
64471 since the first delivery failure. Information about a host that has been down
64472 for more than 30 days will remain in the database, provided that the record is
64473 updated sufficiently often.
64474 </para>
64475 <para>
64476 The cutoff date can be altered by means of the <option>-t</option> option, which must be
64477 followed by a time. For example, to remove all records older than a week from
64478 the retry database:
64479 </para>
64480 <literallayout class="monospaced">
64481 exim_tidydb -t 7d /var/spool/exim retry
64482 </literallayout>
64483 <para>
64484 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
64485 message ids. In the former these appear as data in records keyed by host &ndash;
64486 they were messages that were waiting for that host &ndash; and in the latter they
64487 are the keys for retry information for messages that have suffered certain
64488 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
64489 message ids in database records are those of messages that are still on the
64490 queue. Message ids for messages that no longer exist are removed from
64491 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
64492 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
64493 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
64494 whenever it removes information from the database.
64495 </para>
64496 <para>
64497 Certain records are automatically removed by Exim when they are no longer
64498 needed, but others are not. For example, if all the MX hosts for a domain are
64499 down, a retry record is created for each one. If the primary MX host comes back
64500 first, its record is removed when Exim successfully delivers to it, but the
64501 records for the others remain because Exim has not tried to use those hosts.
64502 </para>
64503 <para>
64504 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
64505 hints databases. You should do this at a quiet time of day, because it requires
64506 a database to be locked (and therefore inaccessible to Exim) while it does its
64507 work. Removing records from a DBM file does not normally make the file smaller,
64508 but all the common DBM libraries are able to re-use the space that is released.
64509 After an initial phase of increasing in size, the databases normally reach a
64510 point at which they no longer get any bigger, as long as they are regularly
64511 tidied.
64512 </para>
64513 <para>
64514 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
64515 databases is likely to keep on increasing.
64516 </para>
64517 </section>
64518 <section id="SECID263">
64519 <title>exim_fixdb</title>
64520 <para>
64521 <indexterm role="concept">
64522 <primary><emphasis>exim_fixdb</emphasis></primary>
64523 </indexterm>
64524 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
64525 Its main use is for testing Exim, but it might also be occasionally useful for
64526 getting round problems in a live system. It has no options, and its interface
64527 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
64528 key of a database record can then be entered, and the data for that record is
64529 displayed.
64530 </para>
64531 <para>
64532 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
64533 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
64534 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
64535 data for individual fields can be changed by typing the field number followed
64536 by new data, for example:
64537 </para>
64538 <literallayout class="monospaced">
64539 &gt; 4 951102:1000
64540 </literallayout>
64541 <para>
64542 resets the time of the next delivery attempt. Time values are given as a
64543 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
64544 used as optional separators.
64545 </para>
64546 </section>
64547 <section id="SECTmailboxmaint">
64548 <title>Mailbox maintenance (exim_lock)</title>
64549 <para>
64550 <indexterm role="concept">
64551 <primary>mailbox</primary>
64552 <secondary>maintenance</secondary>
64553 </indexterm>
64554 <indexterm role="concept">
64555 <primary><emphasis>exim_lock</emphasis></primary>
64556 </indexterm>
64557 <indexterm role="concept">
64558 <primary>locking mailboxes</primary>
64559 </indexterm>
64560 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
64561 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
64562 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
64563 a user agent while investigating a problem. The utility requires the name of
64564 the file as its first argument. If the locking is successful, the second
64565 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
64566 second argument, the value of the SHELL environment variable is used; if this
64567 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
64568 is unlocked and the utility ends. The following options are available:
64569 </para>
64570 <variablelist>
64571 <varlistentry>
64572 <term><option>-fcntl</option></term>
64573 <listitem>
64574 <para>
64575 Use <function>fcntl()</function> locking on the open mailbox.
64576 </para>
64577 </listitem></varlistentry>
64578 <varlistentry>
64579 <term><option>-flock</option></term>
64580 <listitem>
64581 <para>
64582 Use <function>flock()</function> locking on the open mailbox, provided the operating system
64583 supports it.
64584 </para>
64585 </listitem></varlistentry>
64586 <varlistentry>
64587 <term><option>-interval</option></term>
64588 <listitem>
64589 <para>
64590 This must be followed by a number, which is a number of seconds; it sets the
64591 interval to sleep between retries (default 3).
64592 </para>
64593 </listitem></varlistentry>
64594 <varlistentry>
64595 <term><option>-lockfile</option></term>
64596 <listitem>
64597 <para>
64598 Create a lock file before opening the mailbox.
64599 </para>
64600 </listitem></varlistentry>
64601 <varlistentry>
64602 <term><option>-mbx</option></term>
64603 <listitem>
64604 <para>
64605 Lock the mailbox using MBX rules.
64606 </para>
64607 </listitem></varlistentry>
64608 <varlistentry>
64609 <term><option>-q</option></term>
64610 <listitem>
64611 <para>
64612 Suppress verification output.
64613 </para>
64614 </listitem></varlistentry>
64615 <varlistentry>
64616 <term><option>-retries</option></term>
64617 <listitem>
64618 <para>
64619 This must be followed by a number; it sets the number of times to try to get
64620 the lock (default 10).
64621 </para>
64622 </listitem></varlistentry>
64623 <varlistentry>
64624 <term><option>-restore_time</option></term>
64625 <listitem>
64626 <para>
64627 This option causes <option>exim_lock</option> to restore the modified and read times to the
64628 locked file before exiting. This allows you to access a locked mailbox (for
64629 example, to take a backup copy) without disturbing the times that the user
64630 subsequently sees.
64631 </para>
64632 </listitem></varlistentry>
64633 <varlistentry>
64634 <term><option>-timeout</option></term>
64635 <listitem>
64636 <para>
64637 This must be followed by a number, which is a number of seconds; it sets a
64638 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
64639 default), a non-blocking call is used.
64640 </para>
64641 </listitem></varlistentry>
64642 <varlistentry>
64643 <term><option>-v</option></term>
64644 <listitem>
64645 <para>
64646 Generate verbose output.
64647 </para>
64648 </listitem></varlistentry>
64649 </variablelist>
64650 <para>
64651 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
64652 default is to create a lock file and also to use <function>fcntl()</function> locking on the
64653 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
64654 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
64655 requires that the directory containing the file be writeable. Locking by lock
64656 file does not last for ever; Exim assumes that a lock file is expired if it is
64657 more than 30 minutes old.
64658 </para>
64659 <para>
64660 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
64661 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
64662 to be taken out on the open mailbox, and an exclusive lock on the file
64663 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
64664 number of the mailbox file. When the locking is released, if an exclusive lock
64665 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
64666 </para>
64667 <para>
64668 The default output contains verification of the locking that takes place. The
64669 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
64670 suppresses all output except error messages.
64671 </para>
64672 <para>
64673 A command such as
64674 </para>
64675 <literallayout class="monospaced">
64676 exim_lock /var/spool/mail/spqr
64677 </literallayout>
64678 <para>
64679 runs an interactive shell while the file is locked, whereas
64680 </para>
64681 <literallayout>
64682 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
64683 &lt;<emphasis>some commands</emphasis>&gt;
64684 <literal>End</literal>
64685 </literallayout>
64686 <para>
64687 runs a specific non-interactive sequence of commands while the file is locked,
64688 suppressing all verification output. A single command can be run by a command
64689 such as
64690 </para>
64691 <literallayout class="monospaced">
64692 exim_lock -q /var/spool/mail/spqr \
64693   "cp /var/spool/mail/spqr /some/where"
64694 </literallayout>
64695 <para>
64696 Note that if a command is supplied, it must be entirely contained within the
64697 second argument &ndash; hence the quotes.
64698 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
64699 </para>
64700 </section>
64701 </chapter>
64702
64703 <chapter id="CHAPeximon">
64704 <title>The Exim monitor</title>
64705 <para>
64706 <indexterm role="concept" id="IIDeximon" class="startofrange">
64707 <primary>Exim monitor</primary>
64708 <secondary>description</secondary>
64709 </indexterm>
64710 <indexterm role="concept">
64711 <primary>X-windows</primary>
64712 </indexterm>
64713 <indexterm role="concept">
64714 <primary><emphasis>eximon</emphasis></primary>
64715 </indexterm>
64716 <indexterm role="concept">
64717 <primary>Local/eximon.conf</primary>
64718 </indexterm>
64719 <indexterm role="concept">
64720 <primary><filename>exim_monitor/EDITME</filename></primary>
64721 </indexterm>
64722 The Exim monitor is an application which displays in an X window information
64723 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
64724 perform certain operations on messages from this GUI interface; however all
64725 such facilities are also available from the command line, and indeed, the
64726 monitor itself makes use of the command line to perform any actions requested.
64727 </para>
64728 <section id="SECID264">
64729 <title>Running the monitor</title>
64730 <para>
64731 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
64732 script that sets up a number of environment variables, and then runs the
64733 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
64734 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
64735 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
64736 parameters are for.
64737 </para>
64738 <para>
64739 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
64740 a particular invocation by setting up environment variables of the same names,
64741 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
64742 </para>
64743 <literallayout class="monospaced">
64744 EXIMON_LOG_DEPTH=400 eximon
64745 </literallayout>
64746 <para>
64747 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
64748 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
64749 overrides the Exim log file configuration. This makes it possible to have
64750 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
64751 syslog messages are routed to a file on the local host.
64752 </para>
64753 <para>
64754 X resources can be used to change the appearance of the window in the normal
64755 way. For example, a resource setting of the form
64756 </para>
64757 <literallayout class="monospaced">
64758 Eximon*background: gray94
64759 </literallayout>
64760 <para>
64761 changes the colour of the background to light grey rather than white. The
64762 stripcharts are drawn with both the data lines and the reference lines in
64763 black. This means that the reference lines are not visible when on top of the
64764 data. However, their colour can be changed by setting a resource called
64765 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
64766 For example, if your X server is running Unix, you could set up lighter
64767 reference lines in the stripcharts by obeying
64768 </para>
64769 <literallayout class="monospaced">
64770 xrdb -merge &lt;&lt;End
64771 Eximon*highlight: gray
64772 End
64773 </literallayout>
64774 <para>
64775 <indexterm role="concept">
64776 <primary>admin user</primary>
64777 </indexterm>
64778 In order to see the contents of messages on the queue, and to operate on them,
64779 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
64780 </para>
64781 <para>
64782 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
64783 contain X11 resource parameters interpreted by the X11 library.  In addition,
64784 if the first parameter starts with the string "gdb" then it is removed and the
64785 binary is invoked under gdb (the parameter is used as the gdb command-name, so
64786 versioned variants of gdb can be invoked).
64787 </para>
64788 <para>
64789 The monitor&#x2019;s window is divided into three parts. The first contains one or
64790 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
64791 main log file, and the third is a display of the queue of messages awaiting
64792 delivery, with two more action buttons. The following sections describe these
64793 different parts of the display.
64794 </para>
64795 </section>
64796 <section id="SECID265">
64797 <title>The stripcharts</title>
64798 <para>
64799 <indexterm role="concept">
64800 <primary>stripchart</primary>
64801 </indexterm>
64802 The first stripchart is always a count of messages on the queue. Its name can
64803 be configured by setting QUEUE_STRIPCHART_NAME in the
64804 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
64805 configuration script by regular expression matches on log file entries, making
64806 it possible to display, for example, counts of messages delivered to certain
64807 hosts or using certain transports. The supplied defaults display counts of
64808 received and delivered messages, and of local and SMTP deliveries. The default
64809 period between stripchart updates is one minute; this can be adjusted by a
64810 parameter in the <filename>Local/eximon.conf</filename> file.
64811 </para>
64812 <para>
64813 The stripchart displays rescale themselves automatically as the value they are
64814 displaying changes. There are always 10 horizontal lines in each chart; the
64815 title string indicates the value of each division when it is greater than one.
64816 For example, <quote>x2</quote> means that each division represents a value of 2.
64817 </para>
64818 <para>
64819 It is also possible to have a stripchart which shows the percentage fullness of
64820 a particular disk partition, which is useful when local deliveries are confined
64821 to a single partition.
64822 </para>
64823 <para>
64824 <indexterm role="concept">
64825 <primary><option>statvfs</option> function</primary>
64826 </indexterm>
64827 This relies on the availability of the <function>statvfs()</function> function or equivalent in
64828 the operating system. Most, but not all versions of Unix that support Exim have
64829 this. For this particular stripchart, the top of the chart always represents
64830 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
64831 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
64832 <filename>Local/eximon.conf</filename> file.
64833 </para>
64834 </section>
64835 <section id="SECID266">
64836 <title>Main action buttons</title>
64837 <para>
64838 <indexterm role="concept">
64839 <primary>size</primary>
64840 <secondary>of monitor window</secondary>
64841 </indexterm>
64842 <indexterm role="concept">
64843 <primary>Exim monitor</primary>
64844 <secondary>window size</secondary>
64845 </indexterm>
64846 <indexterm role="concept">
64847 <primary>window size</primary>
64848 </indexterm>
64849 Below the stripcharts there is an action button for quitting the monitor. Next
64850 to this is another button marked <quote>Size</quote>. They are placed here so that
64851 shrinking the window to its default minimum size leaves just the queue count
64852 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
64853 the window to expand to its maximum size, unless it is already at the maximum,
64854 in which case it is reduced to its minimum.
64855 </para>
64856 <para>
64857 When expanding to the maximum, if the window cannot be fully seen where it
64858 currently is, it is moved back to where it was the last time it was at full
64859 size. When it is expanding from its minimum size, the old position is
64860 remembered, and next time it is reduced to the minimum it is moved back there.
64861 </para>
64862 <para>
64863 The idea is that you can keep a reduced window just showing one or two
64864 stripcharts at a convenient place on your screen, easily expand it to show
64865 the full window when required, and just as easily put it back to what it was.
64866 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
64867 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
64868 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
64869 </para>
64870 <para>
64871 Normally, the monitor starts up with the window at its full size, but it can be
64872 built so that it starts up with the window at its smallest size, by setting
64873 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
64874 </para>
64875 </section>
64876 <section id="SECID267">
64877 <title>The log display</title>
64878 <para>
64879 <indexterm role="concept">
64880 <primary>log</primary>
64881 <secondary>tail of; in monitor</secondary>
64882 </indexterm>
64883 The second section of the window is an area in which a display of the tail of
64884 the main log is maintained.
64885 To save space on the screen, the timestamp on each log line is shortened by
64886 removing the date and, if <option>log_timezone</option> is set, the timezone.
64887 The log tail is not available when the only destination for logging data is
64888 syslog, unless the syslog lines are routed to a local file whose name is passed
64889 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
64890 </para>
64891 <para>
64892 The log sub-window has a scroll bar at its lefthand side which can be used to
64893 move back to look at earlier text, and the up and down arrow keys also have a
64894 scrolling effect. The amount of log that is kept depends on the setting of
64895 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
64896 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
64897 much more efficient than throwing it away line by line. The sub-window also has
64898 a horizontal scroll bar for accessing the ends of long log lines. This is the
64899 only means of horizontal scrolling; the right and left arrow keys are not
64900 available. Text can be cut from this part of the window using the mouse in the
64901 normal way. The size of this subwindow is controlled by parameters in the
64902 configuration file <filename>Local/eximon.conf</filename>.
64903 </para>
64904 <para>
64905 Searches of the text in the log window can be carried out by means of the ^R
64906 and ^S keystrokes, which default to a reverse and a forward search,
64907 respectively. The search covers only the text that is displayed in the window.
64908 It cannot go further back up the log.
64909 </para>
64910 <para>
64911 The point from which the search starts is indicated by a caret marker. This is
64912 normally at the end of the text in the window, but can be positioned explicitly
64913 by pointing and clicking with the left mouse button, and is moved automatically
64914 by a successful search. If new text arrives in the window when it is scrolled
64915 back, the caret remains where it is, but if the window is not scrolled back,
64916 the caret is moved to the end of the new text.
64917 </para>
64918 <para>
64919 Pressing ^R or ^S pops up a window into which the search text can be typed.
64920 There are buttons for selecting forward or reverse searching, for carrying out
64921 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
64922 happens and the window remains so that further searches can be done. If the
64923 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
64924 ^C is typed the search is cancelled.
64925 </para>
64926 <para>
64927 The searching facility is implemented using the facilities of the Athena text
64928 widget. By default this pops up a window containing both <quote>search</quote> and
64929 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
64930 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
64931 However, the linkers in BSDI and HP-UX seem unable to handle an externally
64932 provided version of <option>TextPop</option> when the remaining parts of the text widget
64933 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
64934 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
64935 on these systems, at the expense of having unwanted items in the search popup
64936 window.
64937 </para>
64938 </section>
64939 <section id="SECID268">
64940 <title>The queue display</title>
64941 <para>
64942 <indexterm role="concept">
64943 <primary>queue</primary>
64944 <secondary>display in monitor</secondary>
64945 </indexterm>
64946 The bottom section of the monitor window contains a list of all messages that
64947 are on the queue, which includes those currently being received or delivered,
64948 as well as those awaiting delivery. The size of this subwindow is controlled by
64949 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
64950 at which it is updated is controlled by another parameter in the same file &ndash;
64951 the default is 5 minutes, since queue scans can be quite expensive. However,
64952 there is an <quote>Update</quote> action button just above the display which can be used
64953 to force an update of the queue display at any time.
64954 </para>
64955 <para>
64956 When a host is down for some time, a lot of pending mail can build up for it,
64957 and this can make it hard to deal with other messages on the queue. To help
64958 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
64959 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
64960 type anything in here and press <quote>Return</quote>, the text is added to a chain of
64961 such texts, and if every undelivered address in a message matches at least one
64962 of the texts, the message is not displayed.
64963 </para>
64964 <para>
64965 If there is an address that does not match any of the texts, all the addresses
64966 are displayed as normal. The matching happens on the ends of addresses so, for
64967 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
64968 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
64969 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
64970 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
64971 a hide request is automatically cancelled after one hour.
64972 </para>
64973 <para>
64974 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
64975 else to the monitor window. For this reason, if you want to cut text from the
64976 queue display to use in the dialogue box, you have to do the cutting before
64977 pressing the <quote>Hide</quote> button.
64978 </para>
64979 <para>
64980 The queue display contains, for each unhidden queued message, the length of
64981 time it has been on the queue, the size of the message, the message id, the
64982 message sender, and the first undelivered recipient, all on one line. If it is
64983 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
64984 recipient to which the message has not yet been delivered, subsequent ones are
64985 listed on additional lines, up to a maximum configured number, following which
64986 an ellipsis is displayed. Recipients that have already received the message are
64987 not shown.
64988 </para>
64989 <para>
64990 <indexterm role="concept">
64991 <primary>frozen messages</primary>
64992 <secondary>display</secondary>
64993 </indexterm>
64994 If a message is frozen, an asterisk is displayed at the left-hand side.
64995 </para>
64996 <para>
64997 The queue display has a vertical scroll bar, and can also be scrolled by means
64998 of the arrow keys. Text can be cut from it using the mouse in the normal way.
64999 The text searching facilities, as described above for the log window, are also
65000 available, but the caret is always moved to the end of the text when the queue
65001 display is updated.
65002 </para>
65003 </section>
65004 <section id="SECID269">
65005 <title>The queue menu</title>
65006 <para>
65007 <indexterm role="concept">
65008 <primary>queue</primary>
65009 <secondary>menu in monitor</secondary>
65010 </indexterm>
65011 If the <option>shift</option> key is held down and the left button is clicked when the mouse
65012 pointer is over the text for any message, an action menu pops up, and the first
65013 line of the queue display for the message is highlighted. This does not affect
65014 any selected text.
65015 </para>
65016 <para>
65017 If you want to use some other event for popping up the menu, you can set the
65018 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
65019 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
65020 value set in this parameter is a standard X event description. For example, to
65021 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
65022 </para>
65023 <literallayout class="monospaced">
65024 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
65025 </literallayout>
65026 <para>
65027 The title of the menu is the message id, and it contains entries which act as
65028 follows:
65029 </para>
65030 <itemizedlist>
65031 <listitem>
65032 <para>
65033 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
65034 in a new text window.
65035 </para>
65036 </listitem>
65037 <listitem>
65038 <para>
65039 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
65040 information and headers is displayed in a new text window. See chapter
65041 <xref linkend="CHAPspool"/> for a description of the format of spool files.
65042 </para>
65043 </listitem>
65044 <listitem>
65045 <para>
65046 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
65047 displayed in a new text window. There is a default limit of 20,000 bytes to the
65048 amount of data displayed. This can be changed by setting the BODY_MAX
65049 option at compile time, or the EXIMON_BODY_MAX option at run time.
65050 </para>
65051 </listitem>
65052 <listitem>
65053 <para>
65054 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
65055 delivery of the message. This causes an automatic thaw if the message is
65056 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
65057 a new text window. The delivery is run in a separate process, to avoid holding
65058 up the monitor while the delivery proceeds.
65059 </para>
65060 </listitem>
65061 <listitem>
65062 <para>
65063 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
65064 that the message be frozen.
65065 </para>
65066 </listitem>
65067 <listitem>
65068 <para>
65069 <indexterm role="concept">
65070 <primary>thawing messages</primary>
65071 </indexterm>
65072 <indexterm role="concept">
65073 <primary>unfreezing messages</primary>
65074 </indexterm>
65075 <indexterm role="concept">
65076 <primary>frozen messages</primary>
65077 <secondary>thawing</secondary>
65078 </indexterm>
65079 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
65080 that the message be thawed.
65081 </para>
65082 </listitem>
65083 <listitem>
65084 <para>
65085 <indexterm role="concept">
65086 <primary>delivery</primary>
65087 <secondary>forcing failure</secondary>
65088 </indexterm>
65089 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
65090 that Exim gives up trying to deliver the message. A bounce message is generated
65091 for any remaining undelivered addresses.
65092 </para>
65093 </listitem>
65094 <listitem>
65095 <para>
65096 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
65097 that the message be deleted from the system without generating a bounce
65098 message.
65099 </para>
65100 </listitem>
65101 <listitem>
65102 <para>
65103 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
65104 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
65105 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
65106 Otherwise it must be entered as a fully qualified address. Pressing RETURN
65107 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
65108 additional recipient be added to the message, unless the entry box is empty, in
65109 which case no action is taken.
65110 </para>
65111 </listitem>
65112 <listitem>
65113 <para>
65114 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
65115 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
65116 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
65117 Otherwise it must be entered as a fully qualified address. Pressing RETURN
65118 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
65119 recipient address as already delivered, unless the entry box is empty, in which
65120 case no action is taken.
65121 </para>
65122 </listitem>
65123 <listitem>
65124 <para>
65125 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
65126 mark all recipient addresses as already delivered.
65127 </para>
65128 </listitem>
65129 <listitem>
65130 <para>
65131 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
65132 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
65133 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
65134 in which case no action is taken. If you want to set an empty sender (as in
65135 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
65136 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
65137 the address is qualified with that domain.
65138 </para>
65139 </listitem>
65140 </itemizedlist>
65141 <para>
65142 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
65143 other cases when a call to Exim is made, if there is any output from Exim (in
65144 particular, if the command fails) a window containing the command and the
65145 output is displayed. Otherwise, the results of the action are normally apparent
65146 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
65147 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
65148 if no output is generated.
65149 </para>
65150 <para>
65151 The queue display is automatically updated for actions such as freezing and
65152 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
65153 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
65154 force an update of the display after one of these actions.
65155 </para>
65156 <para>
65157 In any text window that is displayed as result of a menu action, the normal
65158 cut-and-paste facility is available, and searching can be carried out using ^R
65159 and ^S, as described above for the log tail window.
65160 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
65161 </para>
65162 </section>
65163 </chapter>
65164
65165 <chapter id="CHAPsecurity">
65166 <title>Security considerations</title>
65167 <para>
65168 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
65169 <primary>security</primary>
65170 <secondary>discussion of</secondary>
65171 </indexterm>
65172 This chapter discusses a number of issues concerned with security, some of
65173 which are also covered in other parts of this manual.
65174 </para>
65175 <para>
65176 For reasons that this author does not understand, some people have promoted
65177 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
65178 existence of this chapter in the documentation. However, the intent of the
65179 chapter is simply to describe the way Exim works in relation to certain
65180 security concerns, not to make any specific claims about the effectiveness of
65181 its security as compared with other MTAs.
65182 </para>
65183 <para>
65184 What follows is a description of the way Exim is supposed to be. Best efforts
65185 have been made to try to ensure that the code agrees with the theory, but an
65186 absence of bugs can never be guaranteed. Any that are reported will get fixed
65187 as soon as possible.
65188 </para>
65189 <section id="SECID286">
65190 <title>Building a more <quote>hardened</quote> Exim</title>
65191 <para>
65192 <indexterm role="concept">
65193 <primary>security</primary>
65194 <secondary>build-time features</secondary>
65195 </indexterm>
65196 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
65197 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
65198 Exim administrator who does not have the root password, or by someone who has
65199 penetrated the Exim (but not the root) account. These options are as follows:
65200 </para>
65201 <itemizedlist>
65202 <listitem>
65203 <para>
65204 ALT_CONFIG_PREFIX can be set to a string that is required to match the
65205 start of any file names used with the <option>-C</option> option. When it is set, these file
65206 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
65207 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
65208 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
65209 default setting for <option>ALT_CONFIG_PREFIX</option>.
65210 </para>
65211 <para>
65212 If the permitted configuration files are confined to a directory to
65213 which only root has access, this guards against someone who has broken
65214 into the Exim account from running a privileged Exim with an arbitrary
65215 configuration file, and using it to break into other accounts.
65216 </para>
65217 </listitem>
65218 <listitem>
65219 <para>
65220 If a non-trusted configuration file (i.e. not the default configuration file
65221 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
65222 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
65223 the next item), then root privilege is retained only if the caller of Exim is
65224 root. This locks out the possibility of testing a configuration using <option>-C</option>
65225 right through message reception and delivery, even if the caller is root. The
65226 reception works, but by that time, Exim is running as the Exim user, so when
65227 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
65228 privilege to be lost. However, root can test reception and delivery using two
65229 separate commands.
65230 </para>
65231 </listitem>
65232 <listitem>
65233 <para>
65234 The WHITELIST_D_MACROS build option declares some macros to be safe to override
65235 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
65236 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
65237 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
65238 the restrictive side.  Requiring build-time selection of safe macros is onerous
65239 but this option is intended solely as a transition mechanism to permit
65240 previously-working configurations to continue to work after release 4.73.
65241 </para>
65242 </listitem>
65243 <listitem>
65244 <para>
65245 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
65246 is disabled.
65247 </para>
65248 </listitem>
65249 <listitem>
65250 <para>
65251 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
65252 never to be used for any deliveries. This is like the <option>never_users</option> runtime
65253 option, but it cannot be overridden; the runtime option adds additional users
65254 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
65255 is permitted to modify the runtime file from using Exim as a way to get root.
65256 </para>
65257 </listitem>
65258 </itemizedlist>
65259 </section>
65260 <section id="SECID270">
65261 <title>Root privilege</title>
65262 <para>
65263 <indexterm role="concept">
65264 <primary>setuid</primary>
65265 </indexterm>
65266 <indexterm role="concept">
65267 <primary>root privilege</primary>
65268 </indexterm>
65269 The Exim binary is normally setuid to root, which means that it gains root
65270 privilege (runs as root) when it starts execution. In some special cases (for
65271 example, when the daemon is not in use and there are no local deliveries), it
65272 may be possible to run Exim setuid to some user other than root. This is
65273 discussed in the next section. However, in most installations, root privilege
65274 is required for two things:
65275 </para>
65276 <itemizedlist>
65277 <listitem>
65278 <para>
65279 To set up a socket connected to the standard SMTP port (25) when initialising
65280 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
65281 not required.
65282 </para>
65283 </listitem>
65284 <listitem>
65285 <para>
65286 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
65287 perform local deliveries as the receiving user or as specified in the
65288 configuration.
65289 </para>
65290 </listitem>
65291 </itemizedlist>
65292 <para>
65293 It is not necessary to be root to do any of the other things Exim does, such as
65294 receiving messages and delivering them externally over SMTP, and it is
65295 obviously more secure if Exim does not run as root except when necessary.
65296 For this reason, a user and group for Exim to use must be defined in
65297 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
65298 group</quote>. Their values can be changed by the run time configuration, though this
65299 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
65300 <emphasis>mail</emphasis> or another user name altogether.
65301 </para>
65302 <para>
65303 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
65304 abdication; the process cannot regain root afterwards. Prior to release 4.00,
65305 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
65306 </para>
65307 <para>
65308 After a new Exim process has interpreted its command line options, it changes
65309 uid and gid in the following cases:
65310 </para>
65311 <itemizedlist>
65312 <listitem>
65313 <para>
65314 <indexterm role="option">
65315 <primary><option>-C</option></primary>
65316 </indexterm>
65317 <indexterm role="option">
65318 <primary><option>-D</option></primary>
65319 </indexterm>
65320 If the <option>-C</option> option is used to specify an alternate configuration file, or if
65321 the <option>-D</option> option is used to define macro values for the configuration, and the
65322 calling process is not running as root, the uid and gid are changed to those of
65323 the calling process.
65324 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
65325 option may not be used at all.
65326 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
65327 can be supplied if the calling process is running as root, the Exim run-time
65328 user or CONFIGURE_OWNER, if defined.
65329 </para>
65330 </listitem>
65331 <listitem>
65332 <para>
65333 <indexterm role="option">
65334 <primary><option>-be</option></primary>
65335 </indexterm>
65336 <indexterm role="option">
65337 <primary><option>-bf</option></primary>
65338 </indexterm>
65339 <indexterm role="option">
65340 <primary><option>-bF</option></primary>
65341 </indexterm>
65342 If the expansion test option (<option>-be</option>) or one of the filter testing options
65343 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
65344 calling process.
65345 </para>
65346 </listitem>
65347 <listitem>
65348 <para>
65349 If the process is not a daemon process or a queue runner process or a delivery
65350 process or a process for testing address routing (started with <option>-bt</option>), the
65351 uid and gid are changed to the Exim user and group. This means that Exim always
65352 runs under its own uid and gid when receiving messages. This also applies when
65353 testing address verification
65354 <indexterm role="option">
65355 <primary><option>-bv</option></primary>
65356 </indexterm>
65357 <indexterm role="option">
65358 <primary><option>-bh</option></primary>
65359 </indexterm>
65360 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
65361 option).
65362 </para>
65363 </listitem>
65364 <listitem>
65365 <para>
65366 For a daemon, queue runner, delivery, or address testing process, the uid
65367 remains as root at this stage, but the gid is changed to the Exim group.
65368 </para>
65369 </listitem>
65370 </itemizedlist>
65371 <para>
65372 The processes that initially retain root privilege behave as follows:
65373 </para>
65374 <itemizedlist>
65375 <listitem>
65376 <para>
65377 A daemon process changes the gid to the Exim group and the uid to the Exim
65378 user after setting up one or more listening sockets. The <function>initgroups()</function>
65379 function is called, so that if the Exim user is in any additional groups, they
65380 will be used during message reception.
65381 </para>
65382 </listitem>
65383 <listitem>
65384 <para>
65385 A queue runner process retains root privilege throughout its execution. Its
65386 job is to fork a controlled sequence of delivery processes.
65387 </para>
65388 </listitem>
65389 <listitem>
65390 <para>
65391 A delivery process retains root privilege throughout most of its execution,
65392 but any actual deliveries (that is, the transports themselves) are run in
65393 subprocesses which always change to a non-root uid and gid. For local
65394 deliveries this is typically the uid and gid of the owner of the mailbox; for
65395 remote deliveries, the Exim uid and gid are used. Once all the delivery
65396 subprocesses have been run, a delivery process changes to the Exim uid and gid
65397 while doing post-delivery tidying up such as updating the retry database and
65398 generating bounce and warning messages.
65399 </para>
65400 <para>
65401 While the recipient addresses in a message are being routed, the delivery
65402 process runs as root. However, if a user&#x2019;s filter file has to be processed,
65403 this is done in a subprocess that runs under the individual user&#x2019;s uid and
65404 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
65405 </para>
65406 </listitem>
65407 <listitem>
65408 <para>
65409 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
65410 the routing is done in the same environment as a message delivery.
65411 </para>
65412 </listitem>
65413 </itemizedlist>
65414 </section>
65415 <section id="SECTrunexiwitpri">
65416 <title>Running Exim without privilege</title>
65417 <para>
65418 <indexterm role="concept">
65419 <primary>privilege, running without</primary>
65420 </indexterm>
65421 <indexterm role="concept">
65422 <primary>unprivileged running</primary>
65423 </indexterm>
65424 <indexterm role="concept">
65425 <primary>root privilege</primary>
65426 <secondary>running without</secondary>
65427 </indexterm>
65428 Some installations like to run Exim in an unprivileged state for more of its
65429 operation, for added security. Support for this mode of operation is provided
65430 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
65431 gid are changed to the Exim user and group at the start of a delivery process
65432 (and also queue runner and address testing processes). This means that address
65433 routing is no longer run as root, and the deliveries themselves cannot change
65434 to any other uid.
65435 </para>
65436 <para>
65437 <indexterm role="concept">
65438 <primary>SIGHUP</primary>
65439 </indexterm>
65440 <indexterm role="concept">
65441 <primary>daemon</primary>
65442 <secondary>restarting</secondary>
65443 </indexterm>
65444 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
65445 that the daemon can still be started in the usual way, and it can respond
65446 correctly to SIGHUP because the re-invocation regains root privilege.
65447 </para>
65448 <para>
65449 An alternative approach is to make Exim setuid to the Exim user and also setgid
65450 to the Exim group. If you do this, the daemon must be started from a root
65451 process. (Calling Exim from a root process makes it behave in the way it does
65452 when it is setuid root.) However, the daemon cannot restart itself after a
65453 SIGHUP signal because it cannot regain privilege.
65454 </para>
65455 <para>
65456 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
65457 stops Exim from trying to re-invoke itself to do a delivery after a message has
65458 been received. Such a re-invocation is a waste of resources because it has no
65459 effect.
65460 </para>
65461 <para>
65462 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
65463 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
65464 to the Exim user seems a clean approach, but there is one complication:
65465 </para>
65466 <para>
65467 In this style of operation, Exim is running with the real uid and gid set to
65468 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
65469 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
65470 that is, the real uid/gid should be reset to the effective values so as to
65471 discard any privileges that the caller may have. While some operating systems
65472 have a function that permits this action for a non-root effective uid, quite a
65473 number of them do not. Because of this lack of standardization, Exim does not
65474 address this problem at this time.
65475 </para>
65476 <para>
65477 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
65478 is to keep the Exim binary setuid to root, and to set
65479 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
65480 be used in the most straightforward way.
65481 </para>
65482 <para>
65483 If you configure Exim not to run delivery processes as root, there are a
65484 number of restrictions on what you can do:
65485 </para>
65486 <itemizedlist>
65487 <listitem>
65488 <para>
65489 You can deliver only as the Exim user/group. You should  explicitly use the
65490 <option>user</option> and <option>group</option> options to override routers or local transports that
65491 normally deliver as the recipient. This makes sure that configurations that
65492 work in this mode function the same way in normal mode. Any implicit or
65493 explicit specification of another user causes an error.
65494 </para>
65495 </listitem>
65496 <listitem>
65497 <para>
65498 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
65499 not worthwhile to include them in the configuration.
65500 </para>
65501 </listitem>
65502 <listitem>
65503 <para>
65504 Users who wish to use <filename>.forward</filename> would have to make their home directory and
65505 the file itself accessible to the Exim user. Pipe and append-to-file entries,
65506 and their equivalents in Exim filters, cannot be used. While they could be
65507 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
65508 </para>
65509 </listitem>
65510 <listitem>
65511 <para>
65512 Unless the local user mailboxes are all owned by the Exim user (possible in
65513 some POP3 or IMAP-only environments):
65514 </para>
65515 <orderedlist numeration="arabic">
65516 <listitem>
65517 <para>
65518 They must be owned by the Exim group and be writeable by that group. This
65519 implies you must set <option>mode</option> in the appendfile configuration, as well as the
65520 mode of the mailbox files themselves.
65521 </para>
65522 </listitem>
65523 <listitem>
65524 <para>
65525 You must set <option>no_check_owner</option>, since most or all of the files will not be
65526 owned by the Exim user.
65527 </para>
65528 </listitem>
65529 <listitem>
65530 <para>
65531 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
65532 on a newly created mailbox when unprivileged. This also implies that new
65533 mailboxes need to be created manually.
65534 </para>
65535 </listitem>
65536 </orderedlist>
65537 </listitem>
65538 </itemizedlist>
65539 <para>
65540 These restrictions severely restrict what can be done in local deliveries.
65541 However, there are no restrictions on remote deliveries. If you are running a
65542 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
65543 gives more security at essentially no cost.
65544 </para>
65545 <para>
65546 If you are using the <option>mua_wrapper</option> facility (see chapter
65547 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
65548 </para>
65549 </section>
65550 <section id="SECID271">
65551 <title>Delivering to local files</title>
65552 <para>
65553 Full details of the checks applied by <command>appendfile</command> before it writes to a file
65554 are given in chapter <xref linkend="CHAPappendfile"/>.
65555 </para>
65556 </section>
65557 <section id="SECTsecconslocalcmds">
65558 <title>Running local commands</title>
65559 <para>
65560 <indexterm role="concept">
65561 <primary>security</primary>
65562 <secondary>local commands</secondary>
65563 </indexterm>
65564 <indexterm role="concept">
65565 <primary>security</primary>
65566 <secondary>command injection attacks</secondary>
65567 </indexterm>
65568 There are a number of ways in which an administrator can configure Exim to run
65569 commands based upon received, untrustworthy, data. Further, in some
65570 configurations a user who can control a <filename>.forward</filename> file can also arrange to
65571 run commands. Configuration to check includes, but is not limited to:
65572 </para>
65573 <itemizedlist>
65574 <listitem>
65575 <para>
65576 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
65577 injection may be possible with this option present. It is dangerous and should
65578 be used only with considerable caution. Consider constraints which whitelist
65579 allowed characters in a variable which is to be used in a pipe transport that
65580 has <option>use_shell</option> enabled.
65581 </para>
65582 </listitem>
65583 <listitem>
65584 <para>
65585 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
65586 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
65587 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
65588 hub to which ordinary users do not have shell access, but home directories are
65589 NFS mounted (for instance) then administrators should review the list of these
65590 forbid options available, and should bear in mind that the options that may
65591 need forbidding can change as new features are added between releases.
65592 </para>
65593 </listitem>
65594 <listitem>
65595 <para>
65596 The <option>${run...}</option> expansion item does not use a shell by default, but
65597 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
65598 Such invocations should be viewed with prejudicial suspicion.
65599 </para>
65600 </listitem>
65601 <listitem>
65602 <para>
65603 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
65604 taint checking might apply to their usage.
65605 </para>
65606 </listitem>
65607 <listitem>
65608 <para>
65609 Use of <option>${expand...}</option> is somewhat analagous to shell&#x2019;s eval builtin and
65610 administrators are well advised to view its use with suspicion, in case (for
65611 instance) it allows a local-part to contain embedded Exim directives.
65612 </para>
65613 </listitem>
65614 <listitem>
65615 <para>
65616 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
65617 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
65618 each can reference arbitrary lists and files, rather than just being a list
65619 of opaque strings.
65620 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
65621 real-world security vulnerabilities caused by its use with untrustworthy data
65622 injected in, for SQL injection attacks.
65623 Consider the use of the <option>inlisti</option> expansion condition instead.
65624 </para>
65625 </listitem>
65626 </itemizedlist>
65627 </section>
65628 <section id="SECTsecconfdata">
65629 <title>Trust in configuration data</title>
65630 <para>
65631 <indexterm role="concept">
65632 <primary>security</primary>
65633 <secondary>data sources</secondary>
65634 </indexterm>
65635 <indexterm role="concept">
65636 <primary>security</primary>
65637 <secondary>regular expressions</secondary>
65638 </indexterm>
65639 <indexterm role="concept">
65640 <primary>regular expressions</primary>
65641 <secondary>security</secondary>
65642 </indexterm>
65643 <indexterm role="concept">
65644 <primary>PCRE</primary>
65645 <secondary>security</secondary>
65646 </indexterm>
65647 If configuration data for Exim can come from untrustworthy sources, there
65648 are some issues to be aware of:
65649 </para>
65650 <itemizedlist>
65651 <listitem>
65652 <para>
65653 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
65654 </para>
65655 </listitem>
65656 <listitem>
65657 <para>
65658 Letting untrusted data provide a regular expression is unwise.
65659 </para>
65660 </listitem>
65661 <listitem>
65662 <para>
65663 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
65664 data may result in pathological behaviour within PCRE.  Be aware of what
65665 "backtracking" means and consider options for being more strict with a regular
65666 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
65667 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
65668 possessive quantifiers or just not using regular expressions against untrusted
65669 data.
65670 </para>
65671 </listitem>
65672 <listitem>
65673 <para>
65674 It can be important to correctly use <option>${quote:...}</option>,
65675 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
65676 items to ensure that data is correctly constructed.
65677 </para>
65678 </listitem>
65679 <listitem>
65680 <para>
65681 Some lookups might return multiple results, even though normal usage is only
65682 expected to yield one result.
65683 </para>
65684 </listitem>
65685 </itemizedlist>
65686 </section>
65687 <section id="SECID272">
65688 <title>IPv4 source routing</title>
65689 <para>
65690 <indexterm role="concept">
65691 <primary>source routing</primary>
65692 <secondary>in IP packets</secondary>
65693 </indexterm>
65694 <indexterm role="concept">
65695 <primary>IP source routing</primary>
65696 </indexterm>
65697 Many operating systems suppress IP source-routed packets in the kernel, but
65698 some cannot be made to do this, so Exim does its own check. It logs incoming
65699 IPv4 source-routed TCP calls, and then drops them. Things are all different in
65700 IPv6. No special checking is currently done.
65701 </para>
65702 </section>
65703 <section id="SECID273">
65704 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
65705 <para>
65706 Support for these SMTP commands is disabled by default. If required, they can
65707 be enabled by defining suitable ACLs.
65708 </para>
65709 </section>
65710 <section id="SECID274">
65711 <title>Privileged users</title>
65712 <para>
65713 <indexterm role="concept">
65714 <primary>trusted users</primary>
65715 </indexterm>
65716 <indexterm role="concept">
65717 <primary>admin user</primary>
65718 </indexterm>
65719 <indexterm role="concept">
65720 <primary>privileged user</primary>
65721 </indexterm>
65722 <indexterm role="concept">
65723 <primary>user</primary>
65724 <secondary>trusted</secondary>
65725 </indexterm>
65726 <indexterm role="concept">
65727 <primary>user</primary>
65728 <secondary>admin</secondary>
65729 </indexterm>
65730 Exim recognizes two sets of users with special privileges. Trusted users are
65731 able to submit new messages to Exim locally, but supply their own sender
65732 addresses and information about a sending host. For other users submitting
65733 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
65734 permit a remote host to be specified.
65735 </para>
65736 <para>
65737 <indexterm role="option">
65738 <primary><option>-f</option></primary>
65739 </indexterm>
65740 However, an untrusted user is permitted to use the <option>-f</option> command line option
65741 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
65742 message should not cause an error report. This affects the message&#x2019;s envelope,
65743 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
65744 permitted to use specific forms of address with the <option>-f</option> option by setting
65745 the <option>untrusted_set_sender</option> option.
65746 </para>
65747 <para>
65748 Trusted users are used to run processes that receive mail messages from some
65749 other mail domain and pass them on to Exim for delivery either locally, or over
65750 the Internet. Exim trusts a caller that is running as root, as the Exim user,
65751 as any user listed in the <option>trusted_users</option> configuration option, or under any
65752 group listed in the <option>trusted_groups</option> option.
65753 </para>
65754 <para>
65755 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
65756 can freeze or thaw messages, cause them to be returned to their senders, remove
65757 them entirely, or modify them in various ways. In addition, admin users can run
65758 the Exim monitor and see all the information it is capable of providing, which
65759 includes the contents of files on the spool.
65760 </para>
65761 <para>
65762 <indexterm role="option">
65763 <primary><option>-M</option></primary>
65764 </indexterm>
65765 <indexterm role="option">
65766 <primary><option>-q</option></primary>
65767 </indexterm>
65768 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
65769 delivery of messages on its queue is restricted to admin users. This
65770 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
65771 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
65772 queue is also restricted to admin users. This restriction can be relaxed by
65773 setting <option>no_queue_list_requires_admin</option>.
65774 </para>
65775 <para>
65776 Exim recognizes an admin user if the calling process is running as root or as
65777 the Exim user or if any of the groups associated with the calling process is
65778 the Exim group. It is not necessary actually to be running under the Exim
65779 group. However, if admin users who are not root or the Exim user are to access
65780 the contents of files on the spool via the Exim monitor (which runs
65781 unprivileged), Exim must be built to allow group read access to its spool
65782 files.
65783 </para>
65784 </section>
65785 <section id="SECID275">
65786 <title>Spool files</title>
65787 <para>
65788 <indexterm role="concept">
65789 <primary>spool directory</primary>
65790 <secondary>files</secondary>
65791 </indexterm>
65792 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
65793 set to the Exim group. The mode for spool files is defined in the
65794 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
65795 any user who is a member of the Exim group can access these files.
65796 </para>
65797 </section>
65798 <section id="SECID276">
65799 <title>Use of argv[0]</title>
65800 <para>
65801 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
65802 of specific strings, Exim assumes certain options. For example, calling Exim
65803 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
65804 to calling it with the option <option>-bS</option>. There are no security implications in
65805 this.
65806 </para>
65807 </section>
65808 <section id="SECID277">
65809 <title>Use of %f formatting</title>
65810 <para>
65811 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
65812 are actually stored in integer variables as 1000 times the load average.
65813 Consequently, their range is limited and so therefore is the length of the
65814 converted output.
65815 </para>
65816 </section>
65817 <section id="SECID278">
65818 <title>Embedded Exim path</title>
65819 <para>
65820 Exim uses its own path name, which is embedded in the code, only when it needs
65821 to re-exec in order to regain root privilege. Therefore, it is not root when it
65822 does so. If some bug allowed the path to get overwritten, it would lead to an
65823 arbitrary program&#x2019;s being run as exim, not as root.
65824 </para>
65825 </section>
65826 <section id="SECTdynmoddir">
65827 <title>Dynamic module directory</title>
65828 <para>
65829 Any dynamically loadable modules must be installed into the directory
65830 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
65831 loading it.
65832 </para>
65833 </section>
65834 <section id="SECID279">
65835 <title>Use of sprintf()</title>
65836 <para>
65837 <indexterm role="concept">
65838 <primary><function>sprintf()</function></primary>
65839 </indexterm>
65840 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
65841 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
65842 The intermediate formatting is done into a large fixed buffer by a function
65843 that runs through the format string itself, and checks the length of each
65844 conversion before performing it, thus preventing buffer overruns.
65845 </para>
65846 <para>
65847 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
65848 the output buffer is known to be sufficiently long to contain the converted
65849 string.
65850 </para>
65851 </section>
65852 <section id="SECID280">
65853 <title>Use of debug_printf() and log_write()</title>
65854 <para>
65855 Arbitrary strings are passed to both these functions, but they do their
65856 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
65857 the format string itself, and checks the length of each conversion.
65858 </para>
65859 </section>
65860 <section id="SECID281">
65861 <title>Use of strcat() and strcpy()</title>
65862 <para>
65863 These are used only in cases where the output buffer is known to be large
65864 enough to hold the result.
65865 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
65866 </para>
65867 </section>
65868 </chapter>
65869
65870 <chapter id="CHAPspool">
65871 <title>Format of spool files</title>
65872 <para>
65873 <indexterm role="concept" id="IIDforspo1" class="startofrange">
65874 <primary>format</primary>
65875 <secondary>spool files</secondary>
65876 </indexterm>
65877 <indexterm role="concept" id="IIDforspo2" class="startofrange">
65878 <primary>spool directory</primary>
65879 <secondary>format of files</secondary>
65880 </indexterm>
65881 <indexterm role="concept" id="IIDforspo3" class="startofrange">
65882 <primary>spool files</primary>
65883 <secondary>format of</secondary>
65884 </indexterm>
65885 <indexterm role="concept">
65886 <primary>spool files</primary>
65887 <secondary>editing</secondary>
65888 </indexterm>
65889 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
65890 followed by -D and -H, respectively. The data portion of the message is kept in
65891 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
65892 kept in the -H file, whose format is described in this chapter. Each of these
65893 two files contains the final component of its own name as its first line. This
65894 is insurance against disk crashes where the directory is lost but the files
65895 themselves are recoverable.
65896 </para>
65897 <para>
65898 Some people are tempted into editing -D files in order to modify messages. You
65899 need to be extremely careful if you do this; it is not recommended and you are
65900 on your own if you do it. Here are some of the pitfalls:
65901 </para>
65902 <itemizedlist>
65903 <listitem>
65904 <para>
65905 You must ensure that Exim does not try to deliver the message while you are
65906 fiddling with it. The safest way is to take out a write lock on the -D file,
65907 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
65908 place, the lock will be retained. If you write a new file and rename it, the
65909 lock will be lost at the instant of rename.
65910 </para>
65911 </listitem>
65912 <listitem>
65913 <para>
65914 <indexterm role="variable">
65915 <primary><varname>$body_linecount</varname></primary>
65916 </indexterm>
65917 If you change the number of lines in the file, the value of
65918 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
65919 present, this value is not used by Exim, but there is no guarantee that this
65920 will always be the case.
65921 </para>
65922 </listitem>
65923 <listitem>
65924 <para>
65925 If the message is in MIME format, you must take care not to break it.
65926 </para>
65927 </listitem>
65928 <listitem>
65929 <para>
65930 If the message is cryptographically signed, any change will invalidate the
65931 signature.
65932 </para>
65933 </listitem>
65934 </itemizedlist>
65935 <para>
65936 All in all, modifying -D files is fraught with danger.
65937 </para>
65938 <para>
65939 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
65940 its subdirectories when <option>split_spool_directory</option> is set). These are journal
65941 files, used to record addresses to which the message has been delivered during
65942 the course of a delivery attempt. If there are still undelivered recipients at
65943 the end, the -H file is updated, and the -J file is deleted. If, however, there
65944 is some kind of crash (for example, a power outage) before this happens, the -J
65945 file remains in existence. When Exim next processes the message, it notices the
65946 -J file and uses it to update the -H file before starting the next delivery
65947 attempt.
65948 </para>
65949 <section id="SECID282">
65950 <title>Format of the -H file</title>
65951 <para>
65952 <indexterm role="concept">
65953 <primary>uid (user id)</primary>
65954 <secondary>in spool file</secondary>
65955 </indexterm>
65956 <indexterm role="concept">
65957 <primary>gid (group id)</primary>
65958 <secondary>in spool file</secondary>
65959 </indexterm>
65960 The second line of the -H file contains the login name for the uid of the
65961 process that called Exim to read the message, followed by the numerical uid and
65962 gid. For a locally generated message, this is normally the user who sent the
65963 message. For a message received over TCP/IP via the daemon, it is
65964 normally the Exim user.
65965 </para>
65966 <para>
65967 The third line of the file contains the address of the message&#x2019;s sender as
65968 transmitted in the envelope, contained in angle brackets. The sender address is
65969 empty for bounce messages. For incoming SMTP mail, the sender address is given
65970 in the MAIL command. For locally generated mail, the sender address is
65971 created by Exim from the login name of the current user and the configured
65972 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
65973 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
65974 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
65975 </para>
65976 <para>
65977 The fourth line contains two numbers. The first is the time that the message
65978 was received, in the conventional Unix form &ndash; the number of seconds since the
65979 start of the epoch. The second number is a count of the number of messages
65980 warning of delayed delivery that have been sent to the sender.
65981 </para>
65982 <para>
65983 There follow a number of lines starting with a hyphen. These can appear in any
65984 order, and are omitted when not relevant:
65985 </para>
65986 <variablelist>
65987 <varlistentry>
65988 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
65989 <listitem>
65990 <para>
65991 This item is obsolete, and is not generated from Exim release 4.61 onwards;
65992 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
65993 recognized, to provide backward compatibility. In the old format, a line of
65994 this form is present for every ACL variable that is not empty. The number
65995 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
65996 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
65997 the data string for the variable. The string itself starts at the beginning of
65998 the next line, and is followed by a newline character. It may contain internal
65999 newlines.
66000 </para>
66001 </listitem></varlistentry>
66002 <varlistentry>
66003 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
66004 <listitem>
66005 <para>
66006 A line of this form is present for every ACL connection variable that is
66007 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
66008 The length is the length of the data string for the variable. The string itself
66009 starts at the beginning of the next line, and is followed by a newline
66010 character. It may contain internal newlines.
66011 </para>
66012 </listitem></varlistentry>
66013 <varlistentry>
66014 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
66015 <listitem>
66016 <para>
66017 A line of this form is present for every ACL message variable that is defined.
66018 Note that there is a space between <option>-aclm</option> and the rest of the name. The
66019 length is the length of the data string for the variable. The string itself
66020 starts at the beginning of the next line, and is followed by a newline
66021 character. It may contain internal newlines.
66022 </para>
66023 </listitem></varlistentry>
66024 <varlistentry>
66025 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
66026 <listitem>
66027 <para>
66028 This is present if, when the message was received over SMTP, the value of
66029 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
66030 </para>
66031 </listitem></varlistentry>
66032 <varlistentry>
66033 <term><option>-allow_unqualified_recipient</option></term>
66034 <listitem>
66035 <para>
66036 This is present if unqualified recipient addresses are permitted in header
66037 lines (to stop such addresses from being qualified if rewriting occurs at
66038 transport time). Local messages that were input using <option>-bnq</option> and remote
66039 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
66040 </para>
66041 </listitem></varlistentry>
66042 <varlistentry>
66043 <term><option>-allow_unqualified_sender</option></term>
66044 <listitem>
66045 <para>
66046 This is present if unqualified sender addresses are permitted in header lines
66047 (to stop such addresses from being qualified if rewriting occurs at transport
66048 time). Local messages that were input using <option>-bnq</option> and remote messages from
66049 hosts that match <option>sender_unqualified_hosts</option> set this flag.
66050 </para>
66051 </listitem></varlistentry>
66052 <varlistentry>
66053 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66054 <listitem>
66055 <para>
66056 The id information for a message received on an authenticated SMTP connection
66057 &ndash; the value of the <varname>$authenticated_id</varname> variable.
66058 </para>
66059 </listitem></varlistentry>
66060 <varlistentry>
66061 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
66062 <listitem>
66063 <para>
66064 The address of an authenticated sender &ndash; the value of the
66065 <varname>$authenticated_sender</varname> variable.
66066 </para>
66067 </listitem></varlistentry>
66068 <varlistentry>
66069 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66070 <listitem>
66071 <para>
66072 This records the number of lines in the body of the message, and is always
66073 present.
66074 </para>
66075 </listitem></varlistentry>
66076 <varlistentry>
66077 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66078 <listitem>
66079 <para>
66080 This records the number of binary zero bytes in the body of the message, and is
66081 present if the number is greater than zero.
66082 </para>
66083 </listitem></varlistentry>
66084 <varlistentry>
66085 <term><option>-deliver_firsttime</option></term>
66086 <listitem>
66087 <para>
66088 This is written when a new message is first added to the spool. When the spool
66089 file is updated after a deferral, it is omitted.
66090 </para>
66091 </listitem></varlistentry>
66092 <varlistentry>
66093 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
66094 <listitem>
66095 <para>
66096 <indexterm role="concept">
66097 <primary>frozen messages</primary>
66098 <secondary>spool data</secondary>
66099 </indexterm>
66100 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
66101 </para>
66102 </listitem></varlistentry>
66103 <varlistentry>
66104 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66105 <listitem>
66106 <para>
66107 This records the host name as specified by a remote host in a HELO or EHLO
66108 command.
66109 </para>
66110 </listitem></varlistentry>
66111 <varlistentry>
66112 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
66113 <listitem>
66114 <para>
66115 This records the IP address of the host from which the message was received and
66116 the remote port number that was used. It is omitted for locally generated
66117 messages.
66118 </para>
66119 </listitem></varlistentry>
66120 <varlistentry>
66121 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66122 <listitem>
66123 <para>
66124 If the message was received on an authenticated SMTP connection, this records
66125 the name of the authenticator &ndash; the value of the
66126 <varname>$sender_host_authenticated</varname> variable.
66127 </para>
66128 </listitem></varlistentry>
66129 <varlistentry>
66130 <term><option>-host_lookup_failed</option></term>
66131 <listitem>
66132 <para>
66133 This is present if an attempt to look up the sending host&#x2019;s name from its IP
66134 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
66135 </para>
66136 </listitem></varlistentry>
66137 <varlistentry>
66138 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66139 <listitem>
66140 <para>
66141 <indexterm role="concept">
66142 <primary>reverse DNS lookup</primary>
66143 </indexterm>
66144 <indexterm role="concept">
66145 <primary>DNS</primary>
66146 <secondary>reverse lookup</secondary>
66147 </indexterm>
66148 This records the name of the remote host from which the message was received,
66149 if the host name was looked up from the IP address when the message was being
66150 received. It is not present if no reverse lookup was done.
66151 </para>
66152 </listitem></varlistentry>
66153 <varlistentry>
66154 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
66155 <listitem>
66156 <para>
66157 For locally submitted messages, this records the login of the originating user,
66158 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
66159 ident value. For messages received over TCP/IP, this records the ident string
66160 supplied by the remote host, if any.
66161 </para>
66162 </listitem></varlistentry>
66163 <varlistentry>
66164 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
66165 <listitem>
66166 <para>
66167 This records the IP address of the local interface and the port number through
66168 which a message was received from a remote host. It is omitted for locally
66169 generated messages.
66170 </para>
66171 </listitem></varlistentry>
66172 <varlistentry>
66173 <term><option>-local</option></term>
66174 <listitem>
66175 <para>
66176 The message is from a local sender.
66177 </para>
66178 </listitem></varlistentry>
66179 <varlistentry>
66180 <term><option>-localerror</option></term>
66181 <listitem>
66182 <para>
66183 The message is a locally-generated bounce message.
66184 </para>
66185 </listitem></varlistentry>
66186 <varlistentry>
66187 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
66188 <listitem>
66189 <para>
66190 This records the data string that was returned by the <function>local_scan()</function> function
66191 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
66192 variable. It is omitted if no data was returned.
66193 </para>
66194 </listitem></varlistentry>
66195 <varlistentry>
66196 <term><option>-manual_thaw</option></term>
66197 <listitem>
66198 <para>
66199 The message was frozen but has been thawed manually, that is, by an explicit
66200 Exim command rather than via the auto-thaw process.
66201 </para>
66202 </listitem></varlistentry>
66203 <varlistentry>
66204 <term><option>-N</option></term>
66205 <listitem>
66206 <para>
66207 A testing delivery process was started using the <option>-N</option> option to suppress any
66208 actual deliveries, but delivery was deferred. At any further delivery attempts,
66209 <option>-N</option> is assumed.
66210 </para>
66211 </listitem></varlistentry>
66212 <varlistentry>
66213 <term><option>-received_protocol</option></term>
66214 <listitem>
66215 <para>
66216 This records the value of the <varname>$received_protocol</varname> variable, which contains
66217 the name of the protocol by which the message was received.
66218 </para>
66219 </listitem></varlistentry>
66220 <varlistentry>
66221 <term><option>-sender_set_untrusted</option></term>
66222 <listitem>
66223 <para>
66224 The envelope sender of this message was set by an untrusted local caller (used
66225 to ensure that the caller is displayed in queue listings).
66226 </para>
66227 </listitem></varlistentry>
66228 <varlistentry>
66229 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
66230 <listitem>
66231 <para>
66232 If a message was scanned by SpamAssassin, this is present. It records the value
66233 of <varname>$spam_score_int</varname>.
66234 </para>
66235 </listitem></varlistentry>
66236 <varlistentry>
66237 <term><option>-tls_certificate_verified</option></term>
66238 <listitem>
66239 <para>
66240 A TLS certificate was received from the client that sent this message, and the
66241 certificate was verified by the server.
66242 </para>
66243 </listitem></varlistentry>
66244 <varlistentry>
66245 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
66246 <listitem>
66247 <para>
66248 When the message was received over an encrypted connection, this records the
66249 name of the cipher suite that was used.
66250 </para>
66251 </listitem></varlistentry>
66252 <varlistentry>
66253 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
66254 <listitem>
66255 <para>
66256 When the message was received over an encrypted connection, and a certificate
66257 was received from the client, this records the Distinguished Name from that
66258 certificate.
66259 </para>
66260 </listitem></varlistentry>
66261 </variablelist>
66262 <para>
66263 Following the options there is a list of those addresses to which the message
66264 is not to be delivered. This set of addresses is initialized from the command
66265 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
66266 is set; otherwise it starts out empty. Whenever a successful delivery is made,
66267 the address is added to this set. The addresses are kept internally as a
66268 balanced binary tree, and it is a representation of that tree which is written
66269 to the spool file. If an address is expanded via an alias or forward file, the
66270 original address is added to the tree when deliveries to all its child
66271 addresses are complete.
66272 </para>
66273 <para>
66274 If the tree is empty, there is a single line in the spool file containing just
66275 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
66276 Y or N, followed by an address. The address is the value for the node of the
66277 tree, and the letters indicate whether the node has a left branch and/or a
66278 right branch attached to it, respectively. If branches exist, they immediately
66279 follow. Here is an example of a three-node tree:
66280 </para>
66281 <literallayout class="monospaced">
66282 YY darcy@austen.fict.example
66283 NN alice@wonderland.fict.example
66284 NN editor@thesaurus.ref.example
66285 </literallayout>
66286 <para>
66287 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
66288 This is a simple list, preceded by a count. It includes all the original
66289 recipients of the message, including those to whom the message has already been
66290 delivered. In the simplest case, the list contains one address per line. For
66291 example:
66292 </para>
66293 <literallayout class="monospaced">
66294 4
66295 editor@thesaurus.ref.example
66296 darcy@austen.fict.example
66297 rdo@foundation
66298 alice@wonderland.fict.example
66299 </literallayout>
66300 <para>
66301 However, when a child address has been added to the top-level addresses as a
66302 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
66303 line is of the following form:
66304 </para>
66305 <literallayout>
66306 &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;
66307 </literallayout>
66308 <para>
66309 The 01 flag bit indicates the presence of the three other fields that follow
66310 the top-level address. Other bits may be used in future to support additional
66311 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
66312 original parent of the <quote>one time</quote> address. The first two fields are the
66313 envelope sender that is associated with this address and its length. If the
66314 length is zero, there is no special envelope sender (there are then two space
66315 characters in the line). A non-empty field can arise from a <command>redirect</command> router
66316 that has an <option>errors_to</option> setting.
66317 </para>
66318 <para>
66319 A blank line separates the envelope and status information from the headers
66320 which follow. A header may occupy several lines of the file, and to save effort
66321 when reading it in, each header is preceded by a number and an identifying
66322 character. The number is the number of characters in the header, including any
66323 embedded newlines and the terminating newline. The character is one of the
66324 following:
66325 </para>
66326 <informaltable frame="none">
66327 <tgroup cols="2" colsep="0" rowsep="0">
66328 <colspec colwidth="50pt" align="left"/>
66329 <colspec colwidth="254pt" align="left"/>
66330 <tbody>
66331 <row>
66332 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
66333 <entry>header in which Exim has no special interest</entry>
66334 </row>
66335 <row>
66336 <entry><literal>B</literal></entry>
66337 <entry><emphasis>Bcc:</emphasis> header</entry>
66338 </row>
66339 <row>
66340 <entry><literal>C</literal></entry>
66341 <entry><emphasis>Cc:</emphasis> header</entry>
66342 </row>
66343 <row>
66344 <entry><literal>F</literal></entry>
66345 <entry><emphasis>From:</emphasis> header</entry>
66346 </row>
66347 <row>
66348 <entry><literal>I</literal></entry>
66349 <entry><emphasis>Message-id:</emphasis> header</entry>
66350 </row>
66351 <row>
66352 <entry><literal>P</literal></entry>
66353 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
66354 </row>
66355 <row>
66356 <entry><literal>R</literal></entry>
66357 <entry><emphasis>Reply-To:</emphasis> header</entry>
66358 </row>
66359 <row>
66360 <entry><literal>S</literal></entry>
66361 <entry><emphasis>Sender:</emphasis> header</entry>
66362 </row>
66363 <row>
66364 <entry><literal>T</literal></entry>
66365 <entry><emphasis>To:</emphasis> header</entry>
66366 </row>
66367 <row>
66368 <entry><literal>*</literal></entry>
66369 <entry>replaced or deleted header</entry>
66370 </row>
66371 </tbody>
66372 </tgroup>
66373 </informaltable>
66374 <para>
66375 Deleted or replaced (rewritten) headers remain in the spool file for debugging
66376 purposes. They are not transmitted when the message is delivered. Here is a
66377 typical set of headers:
66378 </para>
66379 <literallayout class="monospaced">
66380 111P Received: by hobbit.fict.example with local (Exim 4.00)
66381 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
66382 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
66383 038* X-rewrote-sender: bb@hobbit.fict.example
66384 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
66385 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
66386 099* To: alice@wonderland.fict.example, rdo@foundation,
66387 darcy@austen.fict.example, editor@thesaurus.ref.example
66388 104T To: alice@wonderland.fict.example, rdo@foundation.example,
66389 darcy@austen.fict.example, editor@thesaurus.ref.example
66390 038  Date: Fri, 11 May 2001 10:28:59 +0100
66391 </literallayout>
66392 <para>
66393 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
66394 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
66395 unqualified domain <emphasis>foundation</emphasis>.
66396 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
66397 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
66398 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
66399 </para>
66400 </section>
66401 </chapter>
66402
66403 <chapter id="CHAPdkim">
66404 <title>Support for DKIM (DomainKeys Identified Mail)</title>
66405 <titleabbrev>DKIM Support</titleabbrev>
66406 <para>
66407 <indexterm role="concept">
66408 <primary>DKIM</primary>
66409 </indexterm>
66410 </para>
66411 <para>
66412 DKIM is a mechanism by which messages sent by some entity can be provably
66413 linked to a domain which that entity controls.  It permits reputation to
66414 be tracked on a per-domain basis, rather than merely upon source IP address.
66415 DKIM is documented in RFC 4871.
66416 </para>
66417 <para>
66418 Since version 4.70, DKIM support is compiled into Exim by default. It can be
66419 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
66420 </para>
66421 <para>
66422 Exim&#x2019;s DKIM implementation allows to
66423 </para>
66424 <orderedlist numeration="arabic">
66425 <listitem>
66426 <para>
66427 Sign outgoing messages: This function is implemented in the SMTP transport.
66428 It can co-exist with all other Exim features
66429 (including transport filters)
66430 except cutthrough delivery.
66431 </para>
66432 </listitem>
66433 <listitem>
66434 <para>
66435 Verify signatures in incoming messages: This is implemented by an additional
66436 ACL (acl_smtp_dkim), which can be called several times per message, with
66437 different signature contexts.
66438 </para>
66439 </listitem>
66440 </orderedlist>
66441 <para>
66442 In typical Exim style, the verification implementation does not include any
66443 default "policy". Instead it enables you to build your own policy using
66444 Exim&#x2019;s standard controls.
66445 </para>
66446 <para>
66447 Please note that verification of DKIM signatures in incoming mail is turned
66448 on by default for logging purposes. For each signature in incoming email,
66449 exim will log a line displaying the most important signature details, and the
66450 signature status. Here is an example (with line-breaks added for clarity):
66451 </para>
66452 <literallayout class="monospaced">
66453 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
66454     d=facebookmail.com s=q1-2009b
66455     c=relaxed/relaxed a=rsa-sha1
66456     i=@facebookmail.com t=1252484542 [verification succeeded]
66457 </literallayout>
66458 <para>
66459 You might want to turn off DKIM verification processing entirely for internal
66460 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
66461 control modifier. This should typically be done in the RCPT ACL, at points
66462 where you accept mail from relay sources (internal hosts or authenticated
66463 senders).
66464 </para>
66465 <section id="SECID513">
66466 <title>Signing outgoing messages</title>
66467 <para>
66468 <indexterm role="concept">
66469 <primary>DKIM</primary>
66470 <secondary>signing</secondary>
66471 </indexterm>
66472 </para>
66473 <para>
66474 Signing is implemented by setting private options on the SMTP transport.
66475 These options take (expandable) strings as arguments.
66476 </para>
66477 <para>
66478 <indexterm role="option">
66479 <primary><option>dkim_domain</option></primary>
66480 </indexterm>
66481 </para>
66482 <informaltable frame="all">
66483 <tgroup cols="4" colsep="0" rowsep="0">
66484 <colspec colwidth="8*" align="left"/>
66485 <colspec colwidth="6*" align="center"/>
66486 <colspec colwidth="6*" align="center"/>
66487 <colspec colwidth="6*" align="right"/>
66488 <tbody>
66489 <row>
66490 <entry><option>dkim_domain</option></entry>
66491 <entry>Use: <emphasis>smtp</emphasis></entry>
66492 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66493 <entry>Default: <emphasis>unset</emphasis></entry>
66494 </row>
66495 </tbody>
66496 </tgroup>
66497 </informaltable>
66498 <para>
66499 MANDATORY:
66500 The domain you want to sign with. The result of this expanded
66501 option is put into the <option>$dkim_domain</option> expansion variable.
66502 </para>
66503 <para>
66504 <indexterm role="option">
66505 <primary><option>dkim_selector</option></primary>
66506 </indexterm>
66507 </para>
66508 <informaltable frame="all">
66509 <tgroup cols="4" colsep="0" rowsep="0">
66510 <colspec colwidth="8*" align="left"/>
66511 <colspec colwidth="6*" align="center"/>
66512 <colspec colwidth="6*" align="center"/>
66513 <colspec colwidth="6*" align="right"/>
66514 <tbody>
66515 <row>
66516 <entry><option>dkim_selector</option></entry>
66517 <entry>Use: <emphasis>smtp</emphasis></entry>
66518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66519 <entry>Default: <emphasis>unset</emphasis></entry>
66520 </row>
66521 </tbody>
66522 </tgroup>
66523 </informaltable>
66524 <para>
66525 MANDATORY:
66526 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
66527 variable to look up a matching selector. The result is put in the expansion
66528 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
66529 option along with <option>$dkim_domain</option>.
66530 </para>
66531 <para>
66532 <indexterm role="option">
66533 <primary><option>dkim_private_key</option></primary>
66534 </indexterm>
66535 </para>
66536 <informaltable frame="all">
66537 <tgroup cols="4" colsep="0" rowsep="0">
66538 <colspec colwidth="8*" align="left"/>
66539 <colspec colwidth="6*" align="center"/>
66540 <colspec colwidth="6*" align="center"/>
66541 <colspec colwidth="6*" align="right"/>
66542 <tbody>
66543 <row>
66544 <entry><option>dkim_private_key</option></entry>
66545 <entry>Use: <emphasis>smtp</emphasis></entry>
66546 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66547 <entry>Default: <emphasis>unset</emphasis></entry>
66548 </row>
66549 </tbody>
66550 </tgroup>
66551 </informaltable>
66552 <para>
66553 MANDATORY:
66554 This sets the private key to use. You can use the <option>$dkim_domain</option> and
66555 <option>$dkim_selector</option> expansion variables to determine the private key to use.
66556 The result can either
66557 </para>
66558 <itemizedlist>
66559 <listitem>
66560 <para>
66561 be a valid RSA private key in ASCII armor, including line breaks.
66562 </para>
66563 </listitem>
66564 <listitem>
66565 <para>
66566 start with a slash, in which case it is treated as a file that contains
66567 the private key.
66568 </para>
66569 </listitem>
66570 <listitem>
66571 <para>
66572 be "0", "false" or the empty string, in which case the message will not
66573 be signed. This case will not result in an error, even if <option>dkim_strict</option>
66574 is set.
66575 </para>
66576 </listitem>
66577 </itemizedlist>
66578 <para>
66579 <indexterm role="option">
66580 <primary><option>dkim_canon</option></primary>
66581 </indexterm>
66582 </para>
66583 <informaltable frame="all">
66584 <tgroup cols="4" colsep="0" rowsep="0">
66585 <colspec colwidth="8*" align="left"/>
66586 <colspec colwidth="6*" align="center"/>
66587 <colspec colwidth="6*" align="center"/>
66588 <colspec colwidth="6*" align="right"/>
66589 <tbody>
66590 <row>
66591 <entry><option>dkim_canon</option></entry>
66592 <entry>Use: <emphasis>smtp</emphasis></entry>
66593 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66594 <entry>Default: <emphasis>unset</emphasis></entry>
66595 </row>
66596 </tbody>
66597 </tgroup>
66598 </informaltable>
66599 <para>
66600 OPTIONAL:
66601 This option sets the canonicalization method used when signing a message.
66602 The DKIM RFC currently supports two methods: "simple" and "relaxed".
66603 The option defaults to "relaxed" when unset. Note: the current implementation
66604 only supports using the same canonicalization method for both headers and body.
66605 </para>
66606 <para>
66607 <indexterm role="option">
66608 <primary><option>dkim_strict</option></primary>
66609 </indexterm>
66610 </para>
66611 <informaltable frame="all">
66612 <tgroup cols="4" colsep="0" rowsep="0">
66613 <colspec colwidth="8*" align="left"/>
66614 <colspec colwidth="6*" align="center"/>
66615 <colspec colwidth="6*" align="center"/>
66616 <colspec colwidth="6*" align="right"/>
66617 <tbody>
66618 <row>
66619 <entry><option>dkim_strict</option></entry>
66620 <entry>Use: <emphasis>smtp</emphasis></entry>
66621 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66622 <entry>Default: <emphasis>unset</emphasis></entry>
66623 </row>
66624 </tbody>
66625 </tgroup>
66626 </informaltable>
66627 <para>
66628 OPTIONAL:
66629 This  option  defines  how  Exim  behaves  when  signing a message that
66630 should be signed fails for some reason.  When the expansion evaluates to
66631 either "1" or "true", Exim will defer. Otherwise Exim will send the message
66632 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
66633 variables here.
66634 </para>
66635 <para>
66636 <indexterm role="option">
66637 <primary><option>dkim_sign_headers</option></primary>
66638 </indexterm>
66639 </para>
66640 <informaltable frame="all">
66641 <tgroup cols="4" colsep="0" rowsep="0">
66642 <colspec colwidth="8*" align="left"/>
66643 <colspec colwidth="6*" align="center"/>
66644 <colspec colwidth="6*" align="center"/>
66645 <colspec colwidth="6*" align="right"/>
66646 <tbody>
66647 <row>
66648 <entry><option>dkim_sign_headers</option></entry>
66649 <entry>Use: <emphasis>smtp</emphasis></entry>
66650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
66651 <entry>Default: <emphasis>unset</emphasis></entry>
66652 </row>
66653 </tbody>
66654 </tgroup>
66655 </informaltable>
66656 <para>
66657 OPTIONAL:
66658 When set, this option must expand to (or be specified as) a colon-separated
66659 list of header names. Headers with these names will be included in the message
66660 signature. When unspecified, the header names recommended in RFC4871 will be
66661 used.
66662 </para>
66663 </section>
66664 <section id="SECID514">
66665 <title>Verifying DKIM signatures in incoming mail</title>
66666 <para>
66667 <indexterm role="concept">
66668 <primary>DKIM</primary>
66669 <secondary>verification</secondary>
66670 </indexterm>
66671 </para>
66672 <para>
66673 Verification of DKIM signatures in incoming email is implemented via the
66674 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
66675 syntactically(!) correct signature in the incoming message.
66676 A missing ACL definition defaults to accept.
66677 If any ACL call does not acccept, the message is not accepted.
66678 If a cutthrough delivery was in progress for the message it is
66679 summarily dropped (having wasted the transmission effort).
66680 </para>
66681 <para>
66682 To evaluate the signature in the ACL a large number of expansion variables
66683 containing the signature status and its details are set up during the
66684 runtime of the ACL.
66685 </para>
66686 <para>
66687 Calling the ACL only for existing signatures is not sufficient to build
66688 more advanced policies. For that reason, the global option
66689 <option>dkim_verify_signers</option>, and a global expansion variable
66690 <option>$dkim_signers</option> exist.
66691 </para>
66692 <para>
66693 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
66694 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
66695 called. It is expanded when the message has been received. At this point,
66696 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
66697 list of signer domains and identities for the message. When
66698 <option>dkim_verify_signers</option> is not specified in the main configuration,
66699 it defaults as:
66700 </para>
66701 <literallayout class="monospaced">
66702 dkim_verify_signers = $dkim_signers
66703 </literallayout>
66704 <para>
66705 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
66706 DKIM signature in the message. Current DKIM verifiers may want to explicitly
66707 call the ACL for known domains or identities. This would be achieved as follows:
66708 </para>
66709 <literallayout class="monospaced">
66710 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
66711 </literallayout>
66712 <para>
66713 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
66714 and "ebay.com", plus all domains and identities that have signatures in the message.
66715 You can also be more creative in constructing your policy. For example:
66716 </para>
66717 <literallayout class="monospaced">
66718 dkim_verify_signers = $sender_address_domain:$dkim_signers
66719 </literallayout>
66720 <para>
66721 If a domain or identity is listed several times in the (expanded) value of
66722 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
66723 </para>
66724 <para>
66725 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
66726 available (from most to least important):
66727 </para>
66728 <variablelist>
66729 <varlistentry>
66730 <term><option>$dkim_cur_signer</option></term>
66731 <listitem>
66732 <para>
66733 The signer that is being evaluated in this ACL run. This can be a domain or
66734 an identity. This is one of the list items from the expanded main option
66735 <option>dkim_verify_signers</option> (see above).
66736 </para>
66737 </listitem></varlistentry>
66738 <varlistentry>
66739 <term><option>$dkim_verify_status</option></term>
66740 <listitem>
66741 <para>
66742 A string describing the general status of the signature. One of
66743 </para>
66744 <itemizedlist>
66745 <listitem>
66746 <para>
66747 <option>none</option>: There is no signature in the message for the current domain or
66748 identity (as reflected by <option>$dkim_cur_signer</option>).
66749 </para>
66750 </listitem>
66751 <listitem>
66752 <para>
66753 <option>invalid</option>: The signature could not be verified due to a processing error.
66754 More detail is available in <option>$dkim_verify_reason</option>.
66755 </para>
66756 </listitem>
66757 <listitem>
66758 <para>
66759 <option>fail</option>: Verification of the signature failed.  More detail is
66760 available in <option>$dkim_verify_reason</option>.
66761 </para>
66762 </listitem>
66763 <listitem>
66764 <para>
66765 <option>pass</option>: The signature passed verification. It is valid.
66766 </para>
66767 </listitem>
66768 </itemizedlist>
66769 </listitem></varlistentry>
66770 <varlistentry>
66771 <term><option>$dkim_verify_reason</option></term>
66772 <listitem>
66773 <para>
66774 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
66775 "fail" or "invalid". One of
66776 </para>
66777 <itemizedlist>
66778 <listitem>
66779 <para>
66780 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
66781 key for the domain could not be retrieved. This may be a temporary problem.
66782 </para>
66783 </listitem>
66784 <listitem>
66785 <para>
66786 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
66787 record for the domain is syntactically invalid.
66788 </para>
66789 </listitem>
66790 <listitem>
66791 <para>
66792 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
66793 body hash does not match the one specified in the signature header. This
66794 means that the message body was modified in transit.
66795 </para>
66796 </listitem>
66797 <listitem>
66798 <para>
66799 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
66800 could not be verified. This may mean that headers were modified,
66801 re-written or otherwise changed in a way which is incompatible with
66802 DKIM verification. It may of course also mean that the signature is forged.
66803 </para>
66804 </listitem>
66805 </itemizedlist>
66806 </listitem></varlistentry>
66807 <varlistentry>
66808 <term><option>$dkim_domain</option></term>
66809 <listitem>
66810 <para>
66811 The signing domain. IMPORTANT: This variable is only populated if there is
66812 an actual signature in the message for the current domain or identity (as
66813 reflected by <option>$dkim_cur_signer</option>).
66814 </para>
66815 </listitem></varlistentry>
66816 <varlistentry>
66817 <term><option>$dkim_identity</option></term>
66818 <listitem>
66819 <para>
66820 The signing identity, if present. IMPORTANT: This variable is only populated
66821 if there is an actual signature in the message for the current domain or
66822 identity (as reflected by <option>$dkim_cur_signer</option>).
66823 </para>
66824 </listitem></varlistentry>
66825 <varlistentry>
66826 <term><option>$dkim_selector</option></term>
66827 <listitem>
66828 <para>
66829 The key record selector string.
66830 </para>
66831 </listitem></varlistentry>
66832 <varlistentry>
66833 <term><option>$dkim_algo</option></term>
66834 <listitem>
66835 <para>
66836 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
66837 </para>
66838 </listitem></varlistentry>
66839 <varlistentry>
66840 <term><option>$dkim_canon_body</option></term>
66841 <listitem>
66842 <para>
66843 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66844 </para>
66845 </listitem></varlistentry>
66846 <varlistentry>
66847 <term><option>dkim_canon_headers</option></term>
66848 <listitem>
66849 <para>
66850 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
66851 </para>
66852 </listitem></varlistentry>
66853 <varlistentry>
66854 <term><option>$dkim_copiedheaders</option></term>
66855 <listitem>
66856 <para>
66857 A transcript of headers and their values which are included in the signature
66858 (copied from the &#x2019;z=&#x2019; tag of the signature).
66859 </para>
66860 </listitem></varlistentry>
66861 <varlistentry>
66862 <term><option>$dkim_bodylength</option></term>
66863 <listitem>
66864 <para>
66865 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
66866 limit was set by the signer, "9999999999999" is returned. This makes sure
66867 that this variable always expands to an integer value.
66868 </para>
66869 </listitem></varlistentry>
66870 <varlistentry>
66871 <term><option>$dkim_created</option></term>
66872 <listitem>
66873 <para>
66874 UNIX timestamp reflecting the date and time when the signature was created.
66875 When this was not specified by the signer, "0" is returned.
66876 </para>
66877 </listitem></varlistentry>
66878 <varlistentry>
66879 <term><option>$dkim_expires</option></term>
66880 <listitem>
66881 <para>
66882 UNIX timestamp reflecting the date and time when the signer wants the
66883 signature to be treated as "expired". When this was not specified by the
66884 signer, "9999999999999" is returned. This makes it possible to do useful
66885 integer size comparisons against this value.
66886 </para>
66887 </listitem></varlistentry>
66888 <varlistentry>
66889 <term><option>$dkim_headernames</option></term>
66890 <listitem>
66891 <para>
66892 A colon-separated list of names of headers included in the signature.
66893 </para>
66894 </listitem></varlistentry>
66895 <varlistentry>
66896 <term><option>$dkim_key_testing</option></term>
66897 <listitem>
66898 <para>
66899 "1" if the key record has the "testing" flag set, "0" if not.
66900 </para>
66901 </listitem></varlistentry>
66902 <varlistentry>
66903 <term><option>$dkim_key_nosubdomains</option></term>
66904 <listitem>
66905 <para>
66906 "1" if the key record forbids subdomaining, "0" otherwise.
66907 </para>
66908 </listitem></varlistentry>
66909 <varlistentry>
66910 <term><option>$dkim_key_srvtype</option></term>
66911 <listitem>
66912 <para>
66913 Service type (tag s=) from the key record. Defaults to "*" if not specified
66914 in the key record.
66915 </para>
66916 </listitem></varlistentry>
66917 <varlistentry>
66918 <term><option>$dkim_key_granularity</option></term>
66919 <listitem>
66920 <para>
66921 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
66922 in the key record.
66923 </para>
66924 </listitem></varlistentry>
66925 <varlistentry>
66926 <term><option>$dkim_key_notes</option></term>
66927 <listitem>
66928 <para>
66929 Notes from the key record (tag n=).
66930 </para>
66931 </listitem></varlistentry>
66932 </variablelist>
66933 <para>
66934 In addition, two ACL conditions are provided:
66935 </para>
66936 <variablelist>
66937 <varlistentry>
66938 <term><option>dkim_signers</option></term>
66939 <listitem>
66940 <para>
66941 ACL condition that checks a colon-separated list of domains or identities
66942 for a match against the domain or identity that the ACL is currently verifying
66943 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
66944 verb to a group of domains or identities. For example:
66945 </para>
66946 <literallayout class="monospaced">
66947 # Warn when Mail purportedly from GMail has no signature at all
66948 warn log_message = GMail sender without DKIM signature
66949      sender_domains = gmail.com
66950      dkim_signers = gmail.com
66951      dkim_status = none
66952 </literallayout>
66953 </listitem></varlistentry>
66954 <varlistentry>
66955 <term><option>dkim_status</option></term>
66956 <listitem>
66957 <para>
66958 ACL condition that checks a colon-separated list of possible DKIM verification
66959 results against the actual result of verification. This is typically used
66960 to restrict an ACL verb to a list of verification outcomes, for example:
66961 </para>
66962 <literallayout class="monospaced">
66963 deny message = Mail from Paypal with invalid/missing signature
66964      sender_domains = paypal.com:paypal.de
66965      dkim_signers = paypal.com:paypal.de
66966      dkim_status = none:invalid:fail
66967 </literallayout>
66968 <para>
66969 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
66970 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
66971 for more information of what they mean.
66972 </para>
66973 </listitem></varlistentry>
66974 </variablelist>
66975 </section>
66976 </chapter>
66977
66978 <chapter id="CHID13">
66979 <title>Adding new drivers or lookup types</title>
66980 <titleabbrev>Adding drivers or lookups</titleabbrev>
66981 <para>
66982 <indexterm role="concept">
66983 <primary>adding drivers</primary>
66984 </indexterm>
66985 <indexterm role="concept">
66986 <primary>new drivers, adding</primary>
66987 </indexterm>
66988 <indexterm role="concept">
66989 <primary>drivers</primary>
66990 <secondary>adding new</secondary>
66991 </indexterm>
66992 The following actions have to be taken in order to add a new router, transport,
66993 authenticator, or lookup type to Exim:
66994 </para>
66995 <orderedlist numeration="arabic">
66996 <listitem>
66997 <para>
66998 Choose a name for the driver or lookup type that does not conflict with any
66999 existing name; I will use <quote>newdriver</quote> in what follows.
67000 </para>
67001 </listitem>
67002 <listitem>
67003 <para>
67004 Add to <filename>src/EDITME</filename> the line:
67005 </para>
67006 <literallayout>
67007 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
67008 </literallayout>
67009 <para>
67010 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
67011 code is not to be included in the binary by default, comment this line out. You
67012 should also add any relevant comments about the driver or lookup type.
67013 </para>
67014 </listitem>
67015 <listitem>
67016 <para>
67017 Add to <filename>src/config.h.defaults</filename> the line:
67018 </para>
67019 <literallayout class="monospaced">
67020 #define &lt;type&gt;_NEWDRIVER
67021 </literallayout>
67022 </listitem>
67023 <listitem>
67024 <para>
67025 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
67026 and create a table entry as is done for all the other drivers and lookup types.
67027 </para>
67028 </listitem>
67029 <listitem>
67030 <para>
67031 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
67032 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
67033 Add your <literal>NEWDRIVER</literal> to that list.
67034 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
67035 simple form that most lookups have.
67036 </para>
67037 </listitem>
67038 <listitem>
67039 <para>
67040 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
67041 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
67042 driver or lookup type and add it to the definition of OBJ.
67043 </para>
67044 </listitem>
67045 <listitem>
67046 <para>
67047 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
67048 <filename>src</filename>.
67049 </para>
67050 </listitem>
67051 <listitem>
67052 <para>
67053 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
67054 as for other drivers and lookups.
67055 </para>
67056 </listitem>
67057 </orderedlist>
67058 <para>
67059 Then all you need to do is write the code! A good way to start is to make a
67060 proforma by copying an existing module of the same type, globally changing all
67061 occurrences of the name, and cutting out most of the code. Note that any
67062 options you create must be listed in alphabetical order, because the tables are
67063 searched using a binary chop procedure.
67064 </para>
67065 <para>
67066 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
67067 the interface that is expected.
67068 </para>
67069 <?sdop
67070   format="newpage"
67071   foot_right_recto="&chaptertitle;"
67072   foot_right_verso="&chaptertitle;"
67073 ?>
67074 </chapter>
67075
67076 <index role="option">
67077 <title>Options index</title>
67078 </index>
67079
67080 <index role="variable">
67081 <title>Variables index</title>
67082 </index>
67083
67084 <index role="concept">
67085 <title>Concept index</title>
67086 </index>
67087
67088 </book>