chg: mention CVE for 3.97.1
[exim-website.git] / docbook / 4.82.1 / 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 26 May 2014
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.82.1</revnumber>
22 <date>26 May 2014</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2013
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.82.1 of Exim.
206 Substantive changes from the 4.80 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 revisionflag="changed">
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 revisionflag="changed">
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 <phrase revisionflag="changed">Note that cutthrough delivery is classed as a recipient verification for this purpose.</phrase>
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 <phrase revisionflag="changed">Again, cutthrough delivery counts as a verification.</phrase>
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.82.1</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.82.1-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 revisionflag="changed">
3699 <term><option>-Ac</option></term>
3700 <term><option>-Am</option></term>
3701 <listitem>
3702 <para revisionflag="changed">
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 revisionflag="changed">
4177 <term><option>-bI:help</option></term>
4178 <listitem>
4179 <para revisionflag="changed">
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 revisionflag="changed">
4194 <term><option>-bI:dscp</option></term>
4195 <listitem>
4196 <para revisionflag="changed">
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 revisionflag="changed">
4209 <term><option>-bI:sieve</option></term>
4210 <listitem>
4211 <para revisionflag="changed">
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 revisionflag="changed">
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 </para>
5387 <para revisionflag="changed">
5388 This option is equivalent to an ACL applying:
5389 </para>
5390 <literallayout class="monospaced" revisionflag="changed">
5391 control = suppress_local_fixups
5392 </literallayout>
5393 <para revisionflag="changed">
5394 for every message received.  Note that Sendmail will complain about such
5395 bad formatting, where Exim silently just does not fix it up.  This may change
5396 in future.
5397 </para>
5398 <para revisionflag="changed">
5399 As this affects audit information, the caller must be a trusted user to use
5400 this option.
5401 </para>
5402 </listitem></varlistentry>
5403 <varlistentry>
5404 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5405 <listitem>
5406 <para>
5407 <indexterm role="option">
5408 <primary><option>-h</option></primary>
5409 </indexterm>
5410 <indexterm role="concept">
5411 <primary>Sendmail compatibility</primary>
5412 <secondary><option>-h</option> option ignored</secondary>
5413 </indexterm>
5414 This option is accepted for compatibility with Sendmail, but has no effect. (In
5415 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5416 headers.)
5417 </para>
5418 </listitem></varlistentry>
5419 <varlistentry>
5420 <term><option>-i</option></term>
5421 <listitem>
5422 <para>
5423 <indexterm role="option">
5424 <primary><option>-i</option></primary>
5425 </indexterm>
5426 <indexterm role="concept">
5427 <primary>Solaris</primary>
5428 <secondary><emphasis>mail</emphasis> command</secondary>
5429 </indexterm>
5430 <indexterm role="concept">
5431 <primary>dot</primary>
5432 <secondary>in incoming non-SMTP message</secondary>
5433 </indexterm>
5434 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5435 line by itself should not terminate an incoming, non-SMTP message. I can find
5436 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5437 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5438 </para>
5439 </listitem></varlistentry>
5440 <varlistentry revisionflag="changed">
5441 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5442 <listitem>
5443 <para revisionflag="changed">
5444 <indexterm role="option">
5445 <primary><option>-L</option></primary>
5446 </indexterm>
5447 <indexterm role="concept">
5448 <primary>syslog</primary>
5449 <secondary>process name; set with flag</secondary>
5450 </indexterm>
5451 This option is equivalent to setting <option>syslog_processname</option> in the config
5452 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5453 Its use is restricted to administrators.  The configuration file has to be
5454 read and parsed, to determine access rights, before this is set and takes
5455 effect, so early configuration file errors will not honour this flag.
5456 </para>
5457 <para revisionflag="changed">
5458 The tag should not be longer than 32 characters.
5459 </para>
5460 </listitem></varlistentry>
5461 <varlistentry>
5462 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5463 <listitem>
5464 <para>
5465 <indexterm role="option">
5466 <primary><option>-M</option></primary>
5467 </indexterm>
5468 <indexterm role="concept">
5469 <primary>forcing delivery</primary>
5470 </indexterm>
5471 <indexterm role="concept">
5472 <primary>delivery</primary>
5473 <secondary>forcing attempt</secondary>
5474 </indexterm>
5475 <indexterm role="concept">
5476 <primary>frozen messages</primary>
5477 <secondary>forcing delivery</secondary>
5478 </indexterm>
5479 This option requests Exim to run a delivery attempt on each message in turn. If
5480 any of the messages are frozen, they are automatically thawed before the
5481 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5482 and <option>hold_domains</option> are ignored.
5483 </para>
5484 <para>
5485 Retry
5486 <indexterm role="concept">
5487 <primary>hints database</primary>
5488 <secondary>overriding retry hints</secondary>
5489 </indexterm>
5490 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5491 the normal retry time has not yet been reached. This option requires the caller
5492 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5493 which can be set false to relax this restriction (and also the same requirement
5494 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5495 </para>
5496 <para>
5497 The deliveries happen synchronously, that is, the original Exim process does
5498 not terminate until all the delivery attempts have finished. No output is
5499 produced unless there is a serious error. If you want to see what is happening,
5500 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5501 </para>
5502 </listitem></varlistentry>
5503 <varlistentry>
5504 <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>
5505 <listitem>
5506 <para>
5507 <indexterm role="option">
5508 <primary><option>-Mar</option></primary>
5509 </indexterm>
5510 <indexterm role="concept">
5511 <primary>message</primary>
5512 <secondary>adding recipients</secondary>
5513 </indexterm>
5514 <indexterm role="concept">
5515 <primary>recipient</primary>
5516 <secondary>adding</secondary>
5517 </indexterm>
5518 This option requests Exim to add the addresses to the list of recipients of the
5519 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5520 id, and the remaining ones must be email addresses. However, if the message is
5521 active (in the middle of a delivery attempt), it is not altered. This option
5522 can be used only by an admin user.
5523 </para>
5524 </listitem></varlistentry>
5525 <varlistentry>
5526 <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>
5527 <listitem>
5528 <para>
5529 <indexterm role="option">
5530 <primary><option>-MC</option></primary>
5531 </indexterm>
5532 <indexterm role="concept">
5533 <primary>SMTP</primary>
5534 <secondary>passed connection</secondary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>SMTP</primary>
5538 <secondary>multiple deliveries</secondary>
5539 </indexterm>
5540 <indexterm role="concept">
5541 <primary>multiple SMTP deliveries</primary>
5542 </indexterm>
5543 This option is not intended for use by external callers. It is used internally
5544 by Exim to invoke another instance of itself to deliver a waiting message using
5545 an existing SMTP connection, which is passed as the standard input. Details are
5546 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5547 must be root or the Exim user in order to use it.
5548 </para>
5549 </listitem></varlistentry>
5550 <varlistentry>
5551 <term><option>-MCA</option></term>
5552 <listitem>
5553 <para>
5554 <indexterm role="option">
5555 <primary><option>-MCA</option></primary>
5556 </indexterm>
5557 This option is not intended for use by external callers. It is used internally
5558 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5559 connection to the remote host has been authenticated.
5560 </para>
5561 </listitem></varlistentry>
5562 <varlistentry>
5563 <term><option>-MCP</option></term>
5564 <listitem>
5565 <para>
5566 <indexterm role="option">
5567 <primary><option>-MCP</option></primary>
5568 </indexterm>
5569 This option is not intended for use by external callers. It is used internally
5570 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5571 which Exim is connected supports pipelining.
5572 </para>
5573 </listitem></varlistentry>
5574 <varlistentry>
5575 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5576 <listitem>
5577 <para>
5578 <indexterm role="option">
5579 <primary><option>-MCQ</option></primary>
5580 </indexterm>
5581 This option is not intended for use by external callers. It is used internally
5582 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5583 started by a queue runner. It passes on the process id of the queue runner,
5584 together with the file descriptor number of an open pipe. Closure of the pipe
5585 signals the final completion of the sequence of processes that are passing
5586 messages through the same SMTP connection.
5587 </para>
5588 </listitem></varlistentry>
5589 <varlistentry>
5590 <term><option>-MCS</option></term>
5591 <listitem>
5592 <para>
5593 <indexterm role="option">
5594 <primary><option>-MCS</option></primary>
5595 </indexterm>
5596 This option is not intended for use by external callers. It is used internally
5597 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5598 SMTP SIZE option should be used on messages delivered down the existing
5599 connection.
5600 </para>
5601 </listitem></varlistentry>
5602 <varlistentry>
5603 <term><option>-MCT</option></term>
5604 <listitem>
5605 <para>
5606 <indexterm role="option">
5607 <primary><option>-MCT</option></primary>
5608 </indexterm>
5609 This option is not intended for use by external callers. It is used internally
5610 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5611 host to which Exim is connected supports TLS encryption.
5612 </para>
5613 </listitem></varlistentry>
5614 <varlistentry>
5615 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5616 <listitem>
5617 <para>
5618 <indexterm role="option">
5619 <primary><option>-Mc</option></primary>
5620 </indexterm>
5621 <indexterm role="concept">
5622 <primary>hints database</primary>
5623 <secondary>not overridden by <option>-Mc</option></secondary>
5624 </indexterm>
5625 <indexterm role="concept">
5626 <primary>delivery</primary>
5627 <secondary>manually started &ndash; not forced</secondary>
5628 </indexterm>
5629 This option requests Exim to run a delivery attempt on each message in turn,
5630 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5631 that are found. This option is not very useful to external callers. It is
5632 provided mainly for internal use by Exim when it needs to re-invoke itself in
5633 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5634 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5635 respects retry times and other options such as <option>hold_domains</option> that are
5636 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5637 If you want to run a specific delivery as if in a queue run, you should use
5638 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5639 and other deliveries is made in one or two places.
5640 </para>
5641 </listitem></varlistentry>
5642 <varlistentry>
5643 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5644 <listitem>
5645 <para>
5646 <indexterm role="option">
5647 <primary><option>-Mes</option></primary>
5648 </indexterm>
5649 <indexterm role="concept">
5650 <primary>message</primary>
5651 <secondary>changing sender</secondary>
5652 </indexterm>
5653 <indexterm role="concept">
5654 <primary>sender</primary>
5655 <secondary>changing</secondary>
5656 </indexterm>
5657 This option requests Exim to change the sender address in the message to the
5658 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5659 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5660 be a message id, and the second one an email address. However, if the message
5661 is active (in the middle of a delivery attempt), its status is not altered.
5662 This option can be used only by an admin user.
5663 </para>
5664 </listitem></varlistentry>
5665 <varlistentry>
5666 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5667 <listitem>
5668 <para>
5669 <indexterm role="option">
5670 <primary><option>-Mf</option></primary>
5671 </indexterm>
5672 <indexterm role="concept">
5673 <primary>freezing messages</primary>
5674 </indexterm>
5675 <indexterm role="concept">
5676 <primary>message</primary>
5677 <secondary>manually freezing</secondary>
5678 </indexterm>
5679 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5680 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5681 either manually or as a result of the <option>auto_thaw</option> configuration option.
5682 However, if any of the messages are active (in the middle of a delivery
5683 attempt), their status is not altered. This option can be used only by an admin
5684 user.
5685 </para>
5686 </listitem></varlistentry>
5687 <varlistentry>
5688 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5689 <listitem>
5690 <para>
5691 <indexterm role="option">
5692 <primary><option>-Mg</option></primary>
5693 </indexterm>
5694 <indexterm role="concept">
5695 <primary>giving up on messages</primary>
5696 </indexterm>
5697 <indexterm role="concept">
5698 <primary>message</primary>
5699 <secondary>abandoning delivery attempts</secondary>
5700 </indexterm>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>abandoning further attempts</secondary>
5704 </indexterm>
5705 This option requests Exim to give up trying to deliver the listed messages,
5706 including any that are frozen. However, if any of the messages are active,
5707 their status is not altered. For non-bounce messages, a delivery error message
5708 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5709 Bounce messages are just discarded. This option can be used only by an admin
5710 user.
5711 </para>
5712 </listitem></varlistentry>
5713 <varlistentry>
5714 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5715 <listitem>
5716 <para>
5717 <indexterm role="option">
5718 <primary><option>-Mmad</option></primary>
5719 </indexterm>
5720 <indexterm role="concept">
5721 <primary>delivery</primary>
5722 <secondary>cancelling all</secondary>
5723 </indexterm>
5724 This option requests Exim to mark all the recipient addresses in the messages
5725 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5726 message is active (in the middle of a delivery attempt), its status is not
5727 altered. This option can be used only by an admin user.
5728 </para>
5729 </listitem></varlistentry>
5730 <varlistentry>
5731 <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>
5732 <listitem>
5733 <para>
5734 <indexterm role="option">
5735 <primary><option>-Mmd</option></primary>
5736 </indexterm>
5737 <indexterm role="concept">
5738 <primary>delivery</primary>
5739 <secondary>cancelling by address</secondary>
5740 </indexterm>
5741 <indexterm role="concept">
5742 <primary>recipient</primary>
5743 <secondary>removing</secondary>
5744 </indexterm>
5745 <indexterm role="concept">
5746 <primary>removing recipients</primary>
5747 </indexterm>
5748 This option requests Exim to mark the given addresses as already delivered
5749 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5750 the remaining ones must be email addresses. These are matched to recipient
5751 addresses in the message in a case-sensitive manner. If the message is active
5752 (in the middle of a delivery attempt), its status is not altered. This option
5753 can be used only by an admin user.
5754 </para>
5755 </listitem></varlistentry>
5756 <varlistentry>
5757 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5758 <listitem>
5759 <para>
5760 <indexterm role="option">
5761 <primary><option>-Mrm</option></primary>
5762 </indexterm>
5763 <indexterm role="concept">
5764 <primary>removing messages</primary>
5765 </indexterm>
5766 <indexterm role="concept">
5767 <primary>abandoning mail</primary>
5768 </indexterm>
5769 <indexterm role="concept">
5770 <primary>message</primary>
5771 <secondary>manually discarding</secondary>
5772 </indexterm>
5773 This option requests Exim to remove the given messages from the queue. No
5774 bounce messages are sent; each message is simply forgotten. However, if any of
5775 the messages are active, their status is not altered. This option can be used
5776 only by an admin user or by the user who originally caused the message to be
5777 placed on the queue.
5778 </para>
5779 </listitem></varlistentry>
5780 <varlistentry>
5781 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5782 <listitem>
5783 <para>
5784 <indexterm role="option">
5785 <primary><option>-Mset</option></primary>
5786 </indexterm>
5787 <indexterm role="concept">
5788 <primary>testing</primary>
5789 <secondary>string expansion</secondary>
5790 </indexterm>
5791 <indexterm role="concept">
5792 <primary>expansion</primary>
5793 <secondary>testing</secondary>
5794 </indexterm>
5795 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5796 string expansions). Exim loads the given message from its spool before doing
5797 the test expansions, thus setting message-specific variables such as
5798 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5799 available. This feature is provided to make it easier to test expansions that
5800 make use of these variables. However, this option can be used only by an admin
5801 user. See also <option>-bem</option>.
5802 </para>
5803 </listitem></varlistentry>
5804 <varlistentry>
5805 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5806 <listitem>
5807 <para>
5808 <indexterm role="option">
5809 <primary><option>-Mt</option></primary>
5810 </indexterm>
5811 <indexterm role="concept">
5812 <primary>thawing messages</primary>
5813 </indexterm>
5814 <indexterm role="concept">
5815 <primary>unfreezing messages</primary>
5816 </indexterm>
5817 <indexterm role="concept">
5818 <primary>frozen messages</primary>
5819 <secondary>thawing</secondary>
5820 </indexterm>
5821 <indexterm role="concept">
5822 <primary>message</primary>
5823 <secondary>thawing frozen</secondary>
5824 </indexterm>
5825 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5826 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5827 messages are active, their status is not altered. This option can be used only
5828 by an admin user.
5829 </para>
5830 </listitem></varlistentry>
5831 <varlistentry>
5832 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5833 <listitem>
5834 <para>
5835 <indexterm role="option">
5836 <primary><option>-Mvb</option></primary>
5837 </indexterm>
5838 <indexterm role="concept">
5839 <primary>listing</primary>
5840 <secondary>message body</secondary>
5841 </indexterm>
5842 <indexterm role="concept">
5843 <primary>message</primary>
5844 <secondary>listing body of</secondary>
5845 </indexterm>
5846 This option causes the contents of the message body (-D) spool file to be
5847 written to the standard output. This option can be used only by an admin user.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-Mvc</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>message</primary>
5859 <secondary>listing in RFC 2822 format</secondary>
5860 </indexterm>
5861 <indexterm role="concept">
5862 <primary>listing</primary>
5863 <secondary>message in RFC 2822 format</secondary>
5864 </indexterm>
5865 This option causes a copy of the complete message (header lines plus body) to
5866 be written to the standard output in RFC 2822 format. This option can be used
5867 only by an admin user.
5868 </para>
5869 </listitem></varlistentry>
5870 <varlistentry>
5871 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5872 <listitem>
5873 <para>
5874 <indexterm role="option">
5875 <primary><option>-Mvh</option></primary>
5876 </indexterm>
5877 <indexterm role="concept">
5878 <primary>listing</primary>
5879 <secondary>message headers</secondary>
5880 </indexterm>
5881 <indexterm role="concept">
5882 <primary>header lines</primary>
5883 <secondary>listing</secondary>
5884 </indexterm>
5885 <indexterm role="concept">
5886 <primary>message</primary>
5887 <secondary>listing header lines</secondary>
5888 </indexterm>
5889 This option causes the contents of the message headers (-H) spool file to be
5890 written to the standard output. This option can be used only by an admin user.
5891 </para>
5892 </listitem></varlistentry>
5893 <varlistentry>
5894 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5895 <listitem>
5896 <para>
5897 <indexterm role="option">
5898 <primary><option>-Mvl</option></primary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>listing</primary>
5902 <secondary>message log</secondary>
5903 </indexterm>
5904 <indexterm role="concept">
5905 <primary>message</primary>
5906 <secondary>listing message log</secondary>
5907 </indexterm>
5908 This option causes the contents of the message log spool file to be written to
5909 the standard output. This option can be used only by an admin user.
5910 </para>
5911 </listitem></varlistentry>
5912 <varlistentry>
5913 <term><option>-m</option></term>
5914 <listitem>
5915 <para>
5916 <indexterm role="option">
5917 <primary><option>-m</option></primary>
5918 </indexterm>
5919 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5920 treats it that way too.
5921 </para>
5922 </listitem></varlistentry>
5923 <varlistentry>
5924 <term><option>-N</option></term>
5925 <listitem>
5926 <para>
5927 <indexterm role="option">
5928 <primary><option>-N</option></primary>
5929 </indexterm>
5930 <indexterm role="concept">
5931 <primary>debugging</primary>
5932 <secondary><option>-N</option> option</secondary>
5933 </indexterm>
5934 <indexterm role="concept">
5935 <primary>debugging</primary>
5936 <secondary>suppressing delivery</secondary>
5937 </indexterm>
5938 This is a debugging option that inhibits delivery of a message at the transport
5939 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5940 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5941 had successfully done so. However, it does not make any updates to the retry
5942 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5943 than <quote>=&gt;</quote>.
5944 </para>
5945 <para>
5946 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5947 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5948 words, an ordinary user can use it only when supplying an incoming message to
5949 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5950 address may be deferred because of a configuration problem on a transport, or a
5951 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5952 the message, and applies to any subsequent delivery attempts that may happen
5953 for that message.
5954 </para>
5955 </listitem></varlistentry>
5956 <varlistentry revisionflag="changed">
5957 <term><option>-n</option></term>
5958 <listitem>
5959 <para revisionflag="changed">
5960 <indexterm role="option">
5961 <primary><option>-n</option></primary>
5962 </indexterm>
5963 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
5964 For normal modes of operation, it is ignored by Exim.
5965 When combined with <option>-bP</option> it suppresses the name of an option from being output.
5966 </para>
5967 </listitem></varlistentry>
5968 <varlistentry>
5969 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5970 <listitem>
5971 <para>
5972 <indexterm role="option">
5973 <primary><option>-O</option></primary>
5974 </indexterm>
5975 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5976 Exim.
5977 </para>
5978 </listitem></varlistentry>
5979 <varlistentry>
5980 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5981 <listitem>
5982 <para>
5983 <indexterm role="option">
5984 <primary><option>-oA</option></primary>
5985 </indexterm>
5986 <indexterm role="concept">
5987 <primary>Sendmail compatibility</primary>
5988 <secondary><option>-oA</option> option</secondary>
5989 </indexterm>
5990 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5991 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5992 description above.
5993 </para>
5994 </listitem></varlistentry>
5995 <varlistentry>
5996 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5997 <listitem>
5998 <para>
5999 <indexterm role="option">
6000 <primary><option>-oB</option></primary>
6001 </indexterm>
6002 <indexterm role="concept">
6003 <primary>SMTP</primary>
6004 <secondary>passed connection</secondary>
6005 </indexterm>
6006 <indexterm role="concept">
6007 <primary>SMTP</primary>
6008 <secondary>multiple deliveries</secondary>
6009 </indexterm>
6010 <indexterm role="concept">
6011 <primary>multiple SMTP deliveries</primary>
6012 </indexterm>
6013 This is a debugging option which limits the maximum number of messages that can
6014 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6015 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6016 </para>
6017 </listitem></varlistentry>
6018 <varlistentry>
6019 <term><option>-odb</option></term>
6020 <listitem>
6021 <para>
6022 <indexterm role="option">
6023 <primary><option>-odb</option></primary>
6024 </indexterm>
6025 <indexterm role="concept">
6026 <primary>background delivery</primary>
6027 </indexterm>
6028 <indexterm role="concept">
6029 <primary>delivery</primary>
6030 <secondary>in the background</secondary>
6031 </indexterm>
6032 This option applies to all modes in which Exim accepts incoming messages,
6033 including the listening daemon. It requests <quote>background</quote> delivery of such
6034 messages, which means that the accepting process automatically starts a
6035 delivery process for each message received, but does not wait for the delivery
6036 processes to finish.
6037 </para>
6038 <para>
6039 When all the messages have been received, the reception process exits,
6040 leaving the delivery processes to finish in their own time. The standard output
6041 and error streams are closed at the start of each delivery process.
6042 This is the default action if none of the <option>-od</option> options are present.
6043 </para>
6044 <para>
6045 If one of the queueing options in the configuration file
6046 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6047 overrides it if <option>queue_only_override</option> is set true, which is the default
6048 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6049 </para>
6050 </listitem></varlistentry>
6051 <varlistentry>
6052 <term><option>-odf</option></term>
6053 <listitem>
6054 <para>
6055 <indexterm role="option">
6056 <primary><option>-odf</option></primary>
6057 </indexterm>
6058 <indexterm role="concept">
6059 <primary>foreground delivery</primary>
6060 </indexterm>
6061 <indexterm role="concept">
6062 <primary>delivery</primary>
6063 <secondary>in the foreground</secondary>
6064 </indexterm>
6065 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6066 accepted a locally-generated message. (For the daemon it is exactly the same as
6067 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6068 and Exim waits for it to complete before proceeding.
6069 </para>
6070 <para>
6071 The original Exim reception process does not finish until the delivery
6072 process for the final message has ended. The standard error stream is left open
6073 during deliveries.
6074 </para>
6075 <para>
6076 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6077 false and one of the queueing options in the configuration file is in effect.
6078 </para>
6079 <para>
6080 If there is a temporary delivery error during foreground delivery, the
6081 message is left on the queue for later delivery, and the original reception
6082 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6083 restricted configuration that never queues messages.
6084 </para>
6085 </listitem></varlistentry>
6086 <varlistentry>
6087 <term><option>-odi</option></term>
6088 <listitem>
6089 <para>
6090 <indexterm role="option">
6091 <primary><option>-odi</option></primary>
6092 </indexterm>
6093 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6094 Sendmail.
6095 </para>
6096 </listitem></varlistentry>
6097 <varlistentry>
6098 <term><option>-odq</option></term>
6099 <listitem>
6100 <para>
6101 <indexterm role="option">
6102 <primary><option>-odq</option></primary>
6103 </indexterm>
6104 <indexterm role="concept">
6105 <primary>non-immediate delivery</primary>
6106 </indexterm>
6107 <indexterm role="concept">
6108 <primary>delivery</primary>
6109 <secondary>suppressing immediate</secondary>
6110 </indexterm>
6111 <indexterm role="concept">
6112 <primary>queueing incoming messages</primary>
6113 </indexterm>
6114 This option applies to all modes in which Exim accepts incoming messages,
6115 including the listening daemon. It specifies that the accepting process should
6116 not automatically start a delivery process for each message received. Messages
6117 are placed on the queue, and remain there until a subsequent queue runner
6118 process encounters them. There are several configuration options (such as
6119 <option>queue_only</option>) that can be used to queue incoming messages under certain
6120 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6121 forces queueing.
6122 </para>
6123 </listitem></varlistentry>
6124 <varlistentry>
6125 <term><option>-odqs</option></term>
6126 <listitem>
6127 <para>
6128 <indexterm role="option">
6129 <primary><option>-odqs</option></primary>
6130 </indexterm>
6131 <indexterm role="concept">
6132 <primary>SMTP</primary>
6133 <secondary>delaying delivery</secondary>
6134 </indexterm>
6135 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6136 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6137 <option>queue_only_override</option> is false and one of the queueing options in the
6138 configuration file is in effect.
6139 </para>
6140 <para>
6141 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6142 message, in the background by default, but in the foreground if <option>-odi</option> is
6143 also present. The recipient addresses are routed, and local deliveries are done
6144 in the normal way. However, if any SMTP deliveries are required, they are not
6145 done at this time, so the message remains on the queue until a subsequent queue
6146 runner process encounters it. Because routing was done, Exim knows which
6147 messages are waiting for which hosts, and so a number of messages for the same
6148 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6149 configuration option has the same effect for specific domains. See also the
6150 <option>-qq</option> option.
6151 </para>
6152 </listitem></varlistentry>
6153 <varlistentry>
6154 <term><option>-oee</option></term>
6155 <listitem>
6156 <para>
6157 <indexterm role="option">
6158 <primary><option>-oee</option></primary>
6159 </indexterm>
6160 <indexterm role="concept">
6161 <primary>error</primary>
6162 <secondary>reporting</secondary>
6163 </indexterm>
6164 If an error is detected while a non-SMTP message is being received (for
6165 example, a malformed address), the error is reported to the sender in a mail
6166 message.
6167 </para>
6168 <para>
6169 <indexterm role="concept">
6170 <primary>return code</primary>
6171 <secondary>for <option>-oee</option></secondary>
6172 </indexterm>
6173 Provided
6174 this error message is successfully sent, the Exim receiving process
6175 exits with a return code of zero. If not, the return code is 2 if the problem
6176 is that the original message has no recipients, or 1 for any other error.
6177 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6178 </para>
6179 </listitem></varlistentry>
6180 <varlistentry>
6181 <term><option>-oem</option></term>
6182 <listitem>
6183 <para>
6184 <indexterm role="option">
6185 <primary><option>-oem</option></primary>
6186 </indexterm>
6187 <indexterm role="concept">
6188 <primary>error</primary>
6189 <secondary>reporting</secondary>
6190 </indexterm>
6191 <indexterm role="concept">
6192 <primary>return code</primary>
6193 <secondary>for <option>-oem</option></secondary>
6194 </indexterm>
6195 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6196 return code, whether or not the error message was successfully sent.
6197 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6198 </para>
6199 </listitem></varlistentry>
6200 <varlistentry>
6201 <term><option>-oep</option></term>
6202 <listitem>
6203 <para>
6204 <indexterm role="option">
6205 <primary><option>-oep</option></primary>
6206 </indexterm>
6207 <indexterm role="concept">
6208 <primary>error</primary>
6209 <secondary>reporting</secondary>
6210 </indexterm>
6211 If an error is detected while a non-SMTP message is being received, the
6212 error is reported by writing a message to the standard error file (stderr).
6213 <indexterm role="concept">
6214 <primary>return code</primary>
6215 <secondary>for <option>-oep</option></secondary>
6216 </indexterm>
6217 The return code is 1 for all errors.
6218 </para>
6219 </listitem></varlistentry>
6220 <varlistentry>
6221 <term><option>-oeq</option></term>
6222 <listitem>
6223 <para>
6224 <indexterm role="option">
6225 <primary><option>-oeq</option></primary>
6226 </indexterm>
6227 <indexterm role="concept">
6228 <primary>error</primary>
6229 <secondary>reporting</secondary>
6230 </indexterm>
6231 This option is supported for compatibility with Sendmail, but has the same
6232 effect as <option>-oep</option>.
6233 </para>
6234 </listitem></varlistentry>
6235 <varlistentry>
6236 <term><option>-oew</option></term>
6237 <listitem>
6238 <para>
6239 <indexterm role="option">
6240 <primary><option>-oew</option></primary>
6241 </indexterm>
6242 <indexterm role="concept">
6243 <primary>error</primary>
6244 <secondary>reporting</secondary>
6245 </indexterm>
6246 This option is supported for compatibility with Sendmail, but has the same
6247 effect as <option>-oem</option>.
6248 </para>
6249 </listitem></varlistentry>
6250 <varlistentry>
6251 <term><option>-oi</option></term>
6252 <listitem>
6253 <para>
6254 <indexterm role="option">
6255 <primary><option>-oi</option></primary>
6256 </indexterm>
6257 <indexterm role="concept">
6258 <primary>dot</primary>
6259 <secondary>in incoming non-SMTP message</secondary>
6260 </indexterm>
6261 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6262 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6263 single dot does terminate, though Exim does no special processing for other
6264 lines that start with a dot. This option is set by default if Exim is called as
6265 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6266 </para>
6267 </listitem></varlistentry>
6268 <varlistentry>
6269 <term><option>-oitrue</option></term>
6270 <listitem>
6271 <para>
6272 <indexterm role="option">
6273 <primary><option>-oitrue</option></primary>
6274 </indexterm>
6275 This option is treated as synonymous with <option>-oi</option>.
6276 </para>
6277 </listitem></varlistentry>
6278 <varlistentry>
6279 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6280 <listitem>
6281 <para>
6282 <indexterm role="option">
6283 <primary><option>-oMa</option></primary>
6284 </indexterm>
6285 <indexterm role="concept">
6286 <primary>sender</primary>
6287 <secondary>host address, specifying for local message</secondary>
6288 </indexterm>
6289 A number of options starting with <option>-oM</option> can be used to set values associated
6290 with remote hosts on locally-submitted messages (that is, messages not received
6291 over TCP/IP). These options can be used by any caller in conjunction with the
6292 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6293 other circumstances, they are ignored unless the caller is trusted.
6294 </para>
6295 <para>
6296 The <option>-oMa</option> option sets the sender host address. This may include a port
6297 number at the end, after a full stop (period). For example:
6298 </para>
6299 <literallayout class="monospaced">
6300 exim -bs -oMa 10.9.8.7.1234
6301 </literallayout>
6302 <para>
6303 An alternative syntax is to enclose the IP address in square brackets,
6304 followed by a colon and the port number:
6305 </para>
6306 <literallayout class="monospaced">
6307 exim -bs -oMa [10.9.8.7]:1234
6308 </literallayout>
6309 <para>
6310 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6311 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6312 are present on the command line, the sender host IP address is taken from
6313 whichever one is last.
6314 </para>
6315 </listitem></varlistentry>
6316 <varlistentry>
6317 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6318 <listitem>
6319 <para>
6320 <indexterm role="option">
6321 <primary><option>-oMaa</option></primary>
6322 </indexterm>
6323 <indexterm role="concept">
6324 <primary>authentication</primary>
6325 <secondary>name, specifying for local message</secondary>
6326 </indexterm>
6327 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6328 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6329 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6330 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6331 authenticated SMTP session without actually using the SMTP AUTH command.
6332 </para>
6333 </listitem></varlistentry>
6334 <varlistentry>
6335 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6336 <listitem>
6337 <para>
6338 <indexterm role="option">
6339 <primary><option>-oMai</option></primary>
6340 </indexterm>
6341 <indexterm role="concept">
6342 <primary>authentication</primary>
6343 <secondary>id, specifying for local message</secondary>
6344 </indexterm>
6345 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6346 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6347 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6348 where there is no default) for messages from local sources. See chapter
6349 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6350 </para>
6351 </listitem></varlistentry>
6352 <varlistentry>
6353 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6354 <listitem>
6355 <para>
6356 <indexterm role="option">
6357 <primary><option>-oMas</option></primary>
6358 </indexterm>
6359 <indexterm role="concept">
6360 <primary>authentication</primary>
6361 <secondary>sender, specifying for local message</secondary>
6362 </indexterm>
6363 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6364 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6365 overrides the sender address that is created from the caller&#x2019;s login id for
6366 messages from local sources, except when <option>-bh</option> is used, when there is no
6367 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6368 specified on a MAIL command overrides this value. See chapter
6369 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6370 </para>
6371 </listitem></varlistentry>
6372 <varlistentry>
6373 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6374 <listitem>
6375 <para>
6376 <indexterm role="option">
6377 <primary><option>-oMi</option></primary>
6378 </indexterm>
6379 <indexterm role="concept">
6380 <primary>interface</primary>
6381 <secondary>address, specifying for local message</secondary>
6382 </indexterm>
6383 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6384 option sets the IP interface address value. A port number may be included,
6385 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6386 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6387 </para>
6388 </listitem></varlistentry>
6389 <varlistentry>
6390 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6391 <listitem>
6392 <para>
6393 <indexterm role="option">
6394 <primary><option>-oMr</option></primary>
6395 </indexterm>
6396 <indexterm role="concept">
6397 <primary>protocol, specifying for local message</primary>
6398 </indexterm>
6399 <indexterm role="variable">
6400 <primary><varname>$received_protocol</varname></primary>
6401 </indexterm>
6402 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6403 option sets the received protocol value that is stored in
6404 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6405 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6406 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6407 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6408 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6409 be set by <option>-oMr</option>.
6410 </para>
6411 </listitem></varlistentry>
6412 <varlistentry>
6413 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6414 <listitem>
6415 <para>
6416 <indexterm role="option">
6417 <primary><option>-oMs</option></primary>
6418 </indexterm>
6419 <indexterm role="concept">
6420 <primary>sender</primary>
6421 <secondary>host name, specifying for local message</secondary>
6422 </indexterm>
6423 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6424 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6425 present, Exim does not attempt to look up a host name from an IP address; it
6426 uses the name it is given.
6427 </para>
6428 </listitem></varlistentry>
6429 <varlistentry>
6430 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6431 <listitem>
6432 <para>
6433 <indexterm role="option">
6434 <primary><option>-oMt</option></primary>
6435 </indexterm>
6436 <indexterm role="concept">
6437 <primary>sender</primary>
6438 <secondary>ident string, specifying for local message</secondary>
6439 </indexterm>
6440 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6441 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6442 local callers is the login id of the calling process, except when <option>-bh</option> is
6443 used, when there is no default.
6444 </para>
6445 </listitem></varlistentry>
6446 <varlistentry>
6447 <term><option>-om</option></term>
6448 <listitem>
6449 <para>
6450 <indexterm role="option">
6451 <primary><option>-om</option></primary>
6452 </indexterm>
6453 <indexterm role="concept">
6454 <primary>Sendmail compatibility</primary>
6455 <secondary><option>-om</option> option ignored</secondary>
6456 </indexterm>
6457 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6458 message should receive a copy of the message if the sender appears in an alias
6459 expansion. Exim always does this, so the option does nothing.
6460 </para>
6461 </listitem></varlistentry>
6462 <varlistentry>
6463 <term><option>-oo</option></term>
6464 <listitem>
6465 <para>
6466 <indexterm role="option">
6467 <primary><option>-oo</option></primary>
6468 </indexterm>
6469 <indexterm role="concept">
6470 <primary>Sendmail compatibility</primary>
6471 <secondary><option>-oo</option> option ignored</secondary>
6472 </indexterm>
6473 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6474 whatever that means.
6475 </para>
6476 </listitem></varlistentry>
6477 <varlistentry>
6478 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6479 <listitem>
6480 <para>
6481 <indexterm role="option">
6482 <primary><option>-oP</option></primary>
6483 </indexterm>
6484 <indexterm role="concept">
6485 <primary>pid (process id)</primary>
6486 <secondary>of daemon</secondary>
6487 </indexterm>
6488 <indexterm role="concept">
6489 <primary>daemon</primary>
6490 <secondary>process id (pid)</secondary>
6491 </indexterm>
6492 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6493 value. The option specifies the file to which the process id of the daemon is
6494 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6495 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6496 because in those cases, the normal pid file is not used.
6497 </para>
6498 </listitem></varlistentry>
6499 <varlistentry>
6500 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6501 <listitem>
6502 <para>
6503 <indexterm role="option">
6504 <primary><option>-or</option></primary>
6505 </indexterm>
6506 <indexterm role="concept">
6507 <primary>timeout</primary>
6508 <secondary>for non-SMTP input</secondary>
6509 </indexterm>
6510 This option sets a timeout value for incoming non-SMTP messages. If it is not
6511 set, Exim will wait forever for the standard input. The value can also be set
6512 by the <option>receive_timeout</option> option. The format used for specifying times is
6513 described in section <xref linkend="SECTtimeformat"/>.
6514 </para>
6515 </listitem></varlistentry>
6516 <varlistentry>
6517 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6518 <listitem>
6519 <para>
6520 <indexterm role="option">
6521 <primary><option>-os</option></primary>
6522 </indexterm>
6523 <indexterm role="concept">
6524 <primary>timeout</primary>
6525 <secondary>for SMTP input</secondary>
6526 </indexterm>
6527 <indexterm role="concept">
6528 <primary>SMTP</primary>
6529 <secondary>input timeout</secondary>
6530 </indexterm>
6531 This option sets a timeout value for incoming SMTP messages. The timeout
6532 applies to each SMTP command and block of data. The value can also be set by
6533 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6534 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6535 </para>
6536 </listitem></varlistentry>
6537 <varlistentry>
6538 <term><option>-ov</option></term>
6539 <listitem>
6540 <para>
6541 <indexterm role="option">
6542 <primary><option>-ov</option></primary>
6543 </indexterm>
6544 This option has exactly the same effect as <option>-v</option>.
6545 </para>
6546 </listitem></varlistentry>
6547 <varlistentry>
6548 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6549 <listitem>
6550 <para>
6551 <indexterm role="option">
6552 <primary><option>-oX</option></primary>
6553 </indexterm>
6554 <indexterm role="concept">
6555 <primary>TCP/IP</primary>
6556 <secondary>setting listening ports</secondary>
6557 </indexterm>
6558 <indexterm role="concept">
6559 <primary>TCP/IP</primary>
6560 <secondary>setting listening interfaces</secondary>
6561 </indexterm>
6562 <indexterm role="concept">
6563 <primary>port</primary>
6564 <secondary>receiving TCP/IP</secondary>
6565 </indexterm>
6566 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6567 is also given. It controls which ports and interfaces the daemon uses. Details
6568 of the syntax, and how it interacts with configuration file options, are given
6569 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6570 file is written unless <option>-oP</option> is also present to specify a pid file name.
6571 </para>
6572 </listitem></varlistentry>
6573 <varlistentry>
6574 <term><option>-pd</option></term>
6575 <listitem>
6576 <para>
6577 <indexterm role="option">
6578 <primary><option>-pd</option></primary>
6579 </indexterm>
6580 <indexterm role="concept">
6581 <primary>Perl</primary>
6582 <secondary>starting the interpreter</secondary>
6583 </indexterm>
6584 This option applies when an embedded Perl interpreter is linked with Exim (see
6585 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6586 option, forcing the starting of the interpreter to be delayed until it is
6587 needed.
6588 </para>
6589 </listitem></varlistentry>
6590 <varlistentry>
6591 <term><option>-ps</option></term>
6592 <listitem>
6593 <para>
6594 <indexterm role="option">
6595 <primary><option>-ps</option></primary>
6596 </indexterm>
6597 <indexterm role="concept">
6598 <primary>Perl</primary>
6599 <secondary>starting the interpreter</secondary>
6600 </indexterm>
6601 This option applies when an embedded Perl interpreter is linked with Exim (see
6602 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6603 option, forcing the starting of the interpreter to occur as soon as Exim is
6604 started.
6605 </para>
6606 </listitem></varlistentry>
6607 <varlistentry>
6608 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6609 <listitem>
6610 <para>
6611 <indexterm role="option">
6612 <primary><option>-p</option></primary>
6613 </indexterm>
6614 For compatibility with Sendmail, this option is equivalent to
6615 </para>
6616 <literallayout>
6617 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6618 </literallayout>
6619 <para>
6620 It sets the incoming protocol and host name (for trusted callers). The
6621 host name and its colon can be omitted when only the protocol is to be set.
6622 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6623 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6624 or <literal>s</literal> using this option (but that does not seem a real limitation).
6625 </para>
6626 </listitem></varlistentry>
6627 <varlistentry>
6628 <term><option>-q</option></term>
6629 <listitem>
6630 <para>
6631 <indexterm role="option">
6632 <primary><option>-q</option></primary>
6633 </indexterm>
6634 <indexterm role="concept">
6635 <primary>queue runner</primary>
6636 <secondary>starting manually</secondary>
6637 </indexterm>
6638 This option is normally restricted to admin users. However, there is a
6639 configuration option called <option>prod_requires_admin</option> which can be set false to
6640 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6641 and <option>-S</option> options).
6642 </para>
6643 <para>
6644 <indexterm role="concept">
6645 <primary>queue runner</primary>
6646 <secondary>description of operation</secondary>
6647 </indexterm>
6648 The <option>-q</option> option starts one queue runner process. This scans the queue of
6649 waiting messages, and runs a delivery process for each one in turn. It waits
6650 for each delivery process to finish before starting the next one. A delivery
6651 process may not actually do any deliveries if the retry times for the addresses
6652 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6653 </para>
6654 <para>
6655 If
6656 <indexterm role="concept">
6657 <primary>SMTP</primary>
6658 <secondary>passed connection</secondary>
6659 </indexterm>
6660 <indexterm role="concept">
6661 <primary>SMTP</primary>
6662 <secondary>multiple deliveries</secondary>
6663 </indexterm>
6664 <indexterm role="concept">
6665 <primary>multiple SMTP deliveries</primary>
6666 </indexterm>
6667 the delivery process spawns other processes to deliver other messages down
6668 passed SMTP connections, the queue runner waits for these to finish before
6669 proceeding.
6670 </para>
6671 <para>
6672 When all the queued messages have been considered, the original queue runner
6673 process terminates. In other words, a single pass is made over the waiting
6674 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6675 this to be repeated periodically.
6676 </para>
6677 <para>
6678 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6679 random, but it is likely to be different each time, which is all that matters.
6680 If one particular message screws up a remote MTA, other messages to the same
6681 MTA have a chance of getting through if they get tried first.
6682 </para>
6683 <para>
6684 It is possible to cause the messages to be processed in lexical message id
6685 order, which is essentially the order in which they arrived, by setting the
6686 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6687 </para>
6688 </listitem></varlistentry>
6689 <varlistentry>
6690 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6691 <listitem>
6692 <para>
6693 The <option>-q</option> option may be followed by one or more flag letters that change its
6694 behaviour. They are all optional, but if more than one is present, they must
6695 appear in the correct order. Each flag is described in a separate item below.
6696 </para>
6697 </listitem></varlistentry>
6698 <varlistentry>
6699 <term><option>-qq...</option></term>
6700 <listitem>
6701 <para>
6702 <indexterm role="option">
6703 <primary><option>-qq</option></primary>
6704 </indexterm>
6705 <indexterm role="concept">
6706 <primary>queue</primary>
6707 <secondary>double scanning</secondary>
6708 </indexterm>
6709 <indexterm role="concept">
6710 <primary>queue</primary>
6711 <secondary>routing</secondary>
6712 </indexterm>
6713 <indexterm role="concept">
6714 <primary>routing</primary>
6715 <secondary>whole queue before delivery</secondary>
6716 </indexterm>
6717 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6718 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6719 every domain. Addresses are routed, local deliveries happen, but no remote
6720 transports are run.
6721 </para>
6722 <para>
6723 <indexterm role="concept">
6724 <primary>hints database</primary>
6725 <secondary>remembering routing</secondary>
6726 </indexterm>
6727 The hints database that remembers which messages are waiting for specific hosts
6728 is updated, as if delivery to those hosts had been deferred. After this is
6729 complete, a second, normal queue scan happens, with routing and delivery taking
6730 place as normal. Messages that are routed to the same host should mostly be
6731 delivered down a single SMTP
6732 <indexterm role="concept">
6733 <primary>SMTP</primary>
6734 <secondary>passed connection</secondary>
6735 </indexterm>
6736 <indexterm role="concept">
6737 <primary>SMTP</primary>
6738 <secondary>multiple deliveries</secondary>
6739 </indexterm>
6740 <indexterm role="concept">
6741 <primary>multiple SMTP deliveries</primary>
6742 </indexterm>
6743 connection because of the hints that were set up during the first queue scan.
6744 This option may be useful for hosts that are connected to the Internet
6745 intermittently.
6746 </para>
6747 </listitem></varlistentry>
6748 <varlistentry>
6749 <term><option>-q[q]i...</option></term>
6750 <listitem>
6751 <para>
6752 <indexterm role="option">
6753 <primary><option>-qi</option></primary>
6754 </indexterm>
6755 <indexterm role="concept">
6756 <primary>queue</primary>
6757 <secondary>initial delivery</secondary>
6758 </indexterm>
6759 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6760 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6761 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6762 <option>-odq</option> and want a queue runner just to process the new messages.
6763 </para>
6764 </listitem></varlistentry>
6765 <varlistentry>
6766 <term><option>-q[q][i]f...</option></term>
6767 <listitem>
6768 <para>
6769 <indexterm role="option">
6770 <primary><option>-qf</option></primary>
6771 </indexterm>
6772 <indexterm role="concept">
6773 <primary>queue</primary>
6774 <secondary>forcing delivery</secondary>
6775 </indexterm>
6776 <indexterm role="concept">
6777 <primary>delivery</primary>
6778 <secondary>forcing in queue run</secondary>
6779 </indexterm>
6780 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6781 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6782 their retry times are tried.
6783 </para>
6784 </listitem></varlistentry>
6785 <varlistentry>
6786 <term><option>-q[q][i]ff...</option></term>
6787 <listitem>
6788 <para>
6789 <indexterm role="option">
6790 <primary><option>-qff</option></primary>
6791 </indexterm>
6792 <indexterm role="concept">
6793 <primary>frozen messages</primary>
6794 <secondary>forcing delivery</secondary>
6795 </indexterm>
6796 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6797 frozen or not.
6798 </para>
6799 </listitem></varlistentry>
6800 <varlistentry>
6801 <term><option>-q[q][i][f[f]]l</option></term>
6802 <listitem>
6803 <para>
6804 <indexterm role="option">
6805 <primary><option>-ql</option></primary>
6806 </indexterm>
6807 <indexterm role="concept">
6808 <primary>queue</primary>
6809 <secondary>local deliveries only</secondary>
6810 </indexterm>
6811 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6812 be done. If a message requires any remote deliveries, it remains on the queue
6813 for later delivery.
6814 </para>
6815 </listitem></varlistentry>
6816 <varlistentry>
6817 <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>
6818 <listitem>
6819 <para>
6820 <indexterm role="concept">
6821 <primary>queue</primary>
6822 <secondary>delivering specific messages</secondary>
6823 </indexterm>
6824 When scanning the queue, Exim can be made to skip over messages whose ids are
6825 lexically less than a given value by following the <option>-q</option> option with a
6826 starting message id. For example:
6827 </para>
6828 <literallayout class="monospaced">
6829 exim -q 0t5C6f-0000c8-00
6830 </literallayout>
6831 <para>
6832 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6833 second message id is given, messages whose ids are lexically greater than it
6834 are also skipped. If the same id is given twice, for example,
6835 </para>
6836 <literallayout class="monospaced">
6837 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6838 </literallayout>
6839 <para>
6840 just one delivery process is started, for that message. This differs from
6841 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6842 that it counts as a delivery from a queue run. Note that the selection
6843 mechanism does not affect the order in which the messages are scanned. There
6844 are also other ways of selecting specific sets of messages for delivery in a
6845 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6846 </para>
6847 </listitem></varlistentry>
6848 <varlistentry>
6849 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6850 <listitem>
6851 <para>
6852 <indexterm role="concept">
6853 <primary>queue runner</primary>
6854 <secondary>starting periodically</secondary>
6855 </indexterm>
6856 <indexterm role="concept">
6857 <primary>periodic queue running</primary>
6858 </indexterm>
6859 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6860 starting a queue runner process at intervals specified by the given time value
6861 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6862 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6863 single daemon process handles both functions. A common way of starting up a
6864 combined daemon at system boot time is to use a command such as
6865 </para>
6866 <literallayout class="monospaced">
6867 /usr/exim/bin/exim -bd -q30m
6868 </literallayout>
6869 <para>
6870 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6871 process every 30 minutes.
6872 </para>
6873 <para>
6874 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6875 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6876 </para>
6877 </listitem></varlistentry>
6878 <varlistentry>
6879 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6880 <listitem>
6881 <para>
6882 <indexterm role="option">
6883 <primary><option>-qR</option></primary>
6884 </indexterm>
6885 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6886 compatibility.
6887 </para>
6888 </listitem></varlistentry>
6889 <varlistentry>
6890 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6891 <listitem>
6892 <para>
6893 <indexterm role="option">
6894 <primary><option>-qS</option></primary>
6895 </indexterm>
6896 This option is synonymous with <option>-S</option>.
6897 </para>
6898 </listitem></varlistentry>
6899 <varlistentry>
6900 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6901 <listitem>
6902 <para>
6903 <indexterm role="option">
6904 <primary><option>-R</option></primary>
6905 </indexterm>
6906 <indexterm role="concept">
6907 <primary>queue runner</primary>
6908 <secondary>for specific recipients</secondary>
6909 </indexterm>
6910 <indexterm role="concept">
6911 <primary>delivery</primary>
6912 <secondary>to given domain</secondary>
6913 </indexterm>
6914 <indexterm role="concept">
6915 <primary>domain</primary>
6916 <secondary>delivery to</secondary>
6917 </indexterm>
6918 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6919 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6920 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6921 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6922 </para>
6923 <para>
6924 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6925 perform a single queue run, except that, when scanning the messages on the
6926 queue, Exim processes only those that have at least one undelivered recipient
6927 address containing the given string, which is checked in a case-independent
6928 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6929 regular expression; otherwise it is a literal string.
6930 </para>
6931 <para>
6932 If you want to do periodic queue runs for messages with specific recipients,
6933 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6934 </para>
6935 <literallayout class="monospaced">
6936 exim -q25m -R @special.domain.example
6937 </literallayout>
6938 <para>
6939 This example does a queue run for messages with recipients in the given domain
6940 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6941 applied to each queue run.
6942 </para>
6943 <para>
6944 Once a message is selected for delivery by this mechanism, all its addresses
6945 are processed. For the first selected message, Exim overrides any retry
6946 information and forces a delivery attempt for each undelivered address. This
6947 means that if delivery of any address in the first message is successful, any
6948 existing retry information is deleted, and so delivery attempts for that
6949 address in subsequently selected messages (which are processed without forcing)
6950 will run. However, if delivery of any address does not succeed, the retry
6951 information is updated, and in subsequently selected messages, the failing
6952 address will be skipped.
6953 </para>
6954 <para>
6955 <indexterm role="concept">
6956 <primary>frozen messages</primary>
6957 <secondary>forcing delivery</secondary>
6958 </indexterm>
6959 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6960 all selected messages, not just the first; frozen messages are included when
6961 <emphasis>ff</emphasis> is present.
6962 </para>
6963 <para>
6964 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6965 to a given domain after a host has been down for some time. When the SMTP
6966 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6967 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6968 an arbitrary command instead.
6969 </para>
6970 </listitem></varlistentry>
6971 <varlistentry>
6972 <term><option>-r</option></term>
6973 <listitem>
6974 <para>
6975 <indexterm role="option">
6976 <primary><option>-r</option></primary>
6977 </indexterm>
6978 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6979 </para>
6980 </listitem></varlistentry>
6981 <varlistentry>
6982 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6983 <listitem>
6984 <para>
6985 <indexterm role="option">
6986 <primary><option>-S</option></primary>
6987 </indexterm>
6988 <indexterm role="concept">
6989 <primary>delivery</primary>
6990 <secondary>from given sender</secondary>
6991 </indexterm>
6992 <indexterm role="concept">
6993 <primary>queue runner</primary>
6994 <secondary>for specific senders</secondary>
6995 </indexterm>
6996 This option acts like <option>-R</option> except that it checks the string against each
6997 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6998 conditions must be met for a message to be selected. If either of the options
6999 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7000 </para>
7001 </listitem></varlistentry>
7002 <varlistentry>
7003 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7004 <listitem>
7005 <para>
7006 <indexterm role="option">
7007 <primary><option>-Tqt</option></primary>
7008 </indexterm>
7009 This is an option that is exclusively for use by the Exim testing suite. It is not
7010 recognized when Exim is run normally. It allows for the setting up of explicit
7011 <quote>queue times</quote> so that various warning/retry features can be tested.
7012 </para>
7013 </listitem></varlistentry>
7014 <varlistentry>
7015 <term><option>-t</option></term>
7016 <listitem>
7017 <para>
7018 <indexterm role="option">
7019 <primary><option>-t</option></primary>
7020 </indexterm>
7021 <indexterm role="concept">
7022 <primary>recipient</primary>
7023 <secondary>extracting from header lines</secondary>
7024 </indexterm>
7025 <indexterm role="concept">
7026 <primary><emphasis>Bcc:</emphasis> header line</primary>
7027 </indexterm>
7028 <indexterm role="concept">
7029 <primary><emphasis>Cc:</emphasis> header line</primary>
7030 </indexterm>
7031 <indexterm role="concept">
7032 <primary><emphasis>To:</emphasis> header line</primary>
7033 </indexterm>
7034 When Exim is receiving a locally-generated, non-SMTP message on its standard
7035 input, the <option>-t</option> option causes the recipients of the message to be obtained
7036 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7037 from the command arguments. The addresses are extracted before any rewriting
7038 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7039 </para>
7040 <para>
7041 <indexterm role="concept">
7042 <primary>Sendmail compatibility</primary>
7043 <secondary><option>-t</option> option</secondary>
7044 </indexterm>
7045 If the command has any arguments, they specify addresses to which the message
7046 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7047 the recipients list obtained from the headers. This is compatible with Smail 3
7048 and in accordance with the documented behaviour of several versions of
7049 Sendmail, as described in man pages on a number of operating systems (e.g.
7050 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7051 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7052 Sendmail book documents it that way. Exim can be made to add argument addresses
7053 instead of subtracting them by setting the option
7054 <option>extract_addresses_remove_arguments</option> false.
7055 </para>
7056 <para>
7057 <indexterm role="concept">
7058 <primary><option>Resent-</option> header lines</primary>
7059 <secondary>with <option>-t</option></secondary>
7060 </indexterm>
7061 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7062 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7063 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7064 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7065 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7066 </para>
7067 <para>
7068 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7069 message is resent several times). The RFC also specifies that they should be
7070 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7071 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7072 nor indeed exactly what constitutes a <quote>set</quote>.
7073 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7074 are often added at the end of the header, and if a message is resent more than
7075 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7076 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7077 </para>
7078 </listitem></varlistentry>
7079 <varlistentry>
7080 <term><option>-ti</option></term>
7081 <listitem>
7082 <para>
7083 <indexterm role="option">
7084 <primary><option>-ti</option></primary>
7085 </indexterm>
7086 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7087 compatibility with Sendmail.
7088 </para>
7089 </listitem></varlistentry>
7090 <varlistentry>
7091 <term><option>-tls-on-connect</option></term>
7092 <listitem>
7093 <para>
7094 <indexterm role="option">
7095 <primary><option>-tls-on-connect</option></primary>
7096 </indexterm>
7097 <indexterm role="concept">
7098 <primary>TLS</primary>
7099 <secondary>use without STARTTLS</secondary>
7100 </indexterm>
7101 <indexterm role="concept">
7102 <primary>TLS</primary>
7103 <secondary>automatic start</secondary>
7104 </indexterm>
7105 This option is available when Exim is compiled with TLS support. It forces all
7106 incoming SMTP connections to behave as if the incoming port is listed in the
7107 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7108 <xref linkend="CHAPTLS"/> for further details.
7109 </para>
7110 </listitem></varlistentry>
7111 <varlistentry>
7112 <term><option>-U</option></term>
7113 <listitem>
7114 <para>
7115 <indexterm role="option">
7116 <primary><option>-U</option></primary>
7117 </indexterm>
7118 <indexterm role="concept">
7119 <primary>Sendmail compatibility</primary>
7120 <secondary><option>-U</option> option ignored</secondary>
7121 </indexterm>
7122 Sendmail uses this option for <quote>initial message submission</quote>, and its
7123 documentation states that in future releases, it may complain about
7124 syntactically invalid messages rather than fixing them when this flag is not
7125 set. Exim ignores this option.
7126 </para>
7127 </listitem></varlistentry>
7128 <varlistentry>
7129 <term><option>-v</option></term>
7130 <listitem>
7131 <para>
7132 <indexterm role="option">
7133 <primary><option>-v</option></primary>
7134 </indexterm>
7135 This option causes Exim to write information to the standard error stream,
7136 describing what it is doing. In particular, it shows the log lines for
7137 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7138 dialogue is shown. Some of the log lines shown may not actually be written to
7139 the log if the setting of <option>log_selector</option> discards them. Any relevant
7140 selectors are shown with each log line. If none are shown, the logging is
7141 unconditional.
7142 </para>
7143 </listitem></varlistentry>
7144 <varlistentry>
7145 <term><option>-x</option></term>
7146 <listitem>
7147 <para>
7148 <indexterm role="option">
7149 <primary><option>-x</option></primary>
7150 </indexterm>
7151 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7152 National Language Support extended characters in the body of the mail item</quote>).
7153 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7154 this option.
7155 </para>
7156 </listitem></varlistentry>
7157 <varlistentry revisionflag="changed">
7158 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7159 <listitem>
7160 <para revisionflag="changed">
7161 <indexterm role="option">
7162 <primary><option>-X</option></primary>
7163 </indexterm>
7164 This option is interpreted by Sendmail to cause debug information to be sent
7165 to the named file.  It is ignored by Exim.
7166 </para>
7167 </listitem></varlistentry>
7168 </variablelist>
7169 <para>
7170 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7171 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7172 </para>
7173 <!-- === End of command line options === -->
7174 </section>
7175 </chapter>
7176
7177 <chapter id="CHAPconf">
7178 <title>The Exim run time configuration file</title>
7179 <titleabbrev>The runtime configuration file</titleabbrev>
7180 <para>
7181 <indexterm role="concept">
7182 <primary>run time configuration</primary>
7183 </indexterm>
7184 <indexterm role="concept">
7185 <primary>configuration file</primary>
7186 <secondary>general description</secondary>
7187 </indexterm>
7188 <indexterm role="concept">
7189 <primary>CONFIGURE_FILE</primary>
7190 </indexterm>
7191 <indexterm role="concept">
7192 <primary>configuration file</primary>
7193 <secondary>errors in</secondary>
7194 </indexterm>
7195 <indexterm role="concept">
7196 <primary>error</primary>
7197 <secondary>in configuration file</secondary>
7198 </indexterm>
7199 <indexterm role="concept">
7200 <primary>return code</primary>
7201 <secondary>for bad configuration</secondary>
7202 </indexterm>
7203 Exim uses a single run time configuration file that is read whenever an Exim
7204 binary is executed. Note that in normal operation, this happens frequently,
7205 because Exim is designed to operate in a distributed manner, without central
7206 control.
7207 </para>
7208 <para>
7209 If a syntax error is detected while reading the configuration file, Exim
7210 writes a message on the standard error, and exits with a non-zero return code.
7211 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7212 errors can be detected at this time. The values of any expanded options are
7213 not checked until the expansion happens, even when the expansion does not
7214 actually alter the string.
7215 </para>
7216 <para>
7217 The name of the configuration file is compiled into the binary for security
7218 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7219 most configurations, this specifies a single file. However, it is permitted to
7220 give a colon-separated list of file names, in which case Exim uses the first
7221 existing file in the list.
7222 </para>
7223 <para>
7224 <indexterm role="concept">
7225 <primary>EXIM_USER</primary>
7226 </indexterm>
7227 <indexterm role="concept">
7228 <primary>EXIM_GROUP</primary>
7229 </indexterm>
7230 <indexterm role="concept">
7231 <primary>CONFIGURE_OWNER</primary>
7232 </indexterm>
7233 <indexterm role="concept">
7234 <primary>CONFIGURE_GROUP</primary>
7235 </indexterm>
7236 <indexterm role="concept">
7237 <primary>configuration file</primary>
7238 <secondary>ownership</secondary>
7239 </indexterm>
7240 <indexterm role="concept">
7241 <primary>ownership</primary>
7242 <secondary>configuration file</secondary>
7243 </indexterm>
7244 The run time configuration file must be owned by root or by the user that is
7245 specified at compile time by the CONFIGURE_OWNER option (if set). The
7246 configuration file must not be world-writeable, or group-writeable unless its
7247 group is the root group or the one specified at compile time by the
7248 CONFIGURE_GROUP option.
7249 </para>
7250 <para>
7251 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7252 to root, anybody who is able to edit the run time configuration file has an
7253 easy way to run commands as root. If you specify a user or group in the
7254 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7255 who are members of that group will trivially be able to obtain root privileges.
7256 </para>
7257 <para>
7258 Up to Exim version 4.72, the run time configuration file was also permitted to
7259 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7260 since it offered a simple privilege escalation for any attacker who managed to
7261 compromise the Exim user account.
7262 </para>
7263 <para>
7264 A default configuration file, which will work correctly in simple situations,
7265 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7266 defines just one file name, the installation process copies the default
7267 configuration to a new file of that name if it did not previously exist. If
7268 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7269 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7270 configuration.
7271 </para>
7272 <section id="SECID40">
7273 <title>Using a different configuration file</title>
7274 <para>
7275 <indexterm role="concept">
7276 <primary>configuration file</primary>
7277 <secondary>alternate</secondary>
7278 </indexterm>
7279 A one-off alternate configuration can be specified by the <option>-C</option> command line
7280 option, which may specify a single file or a list of files. However, when
7281 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7282 unless the argument for <option>-C</option> is identical to the built-in value from
7283 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7284 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7285 is useful mainly for checking the syntax of configuration files before
7286 installing them. No owner or group checks are done on a configuration file
7287 specified by <option>-C</option>, if root privilege has been dropped.
7288 </para>
7289 <para>
7290 Even the Exim user is not trusted to specify an arbitrary configuration file
7291 with the <option>-C</option> option to be used with root privileges, unless that file is
7292 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7293 testing a configuration using <option>-C</option> right through message reception and
7294 delivery, even if the caller is root. The reception works, but by that time,
7295 Exim is running as the Exim user, so when it re-execs to regain privilege for
7296 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7297 can test reception and delivery using two separate commands (one to put a
7298 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7299 <option>-M</option>).
7300 </para>
7301 <para>
7302 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7303 prefix string with which any file named in a <option>-C</option> command line option must
7304 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7305 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7306 name can be used with <option>-C</option>.
7307 </para>
7308 <para>
7309 One-off changes to a configuration can be specified by the <option>-D</option> command line
7310 option, which defines and overrides values for macros used inside the
7311 configuration file. However, like <option>-C</option>, the use of this option by a
7312 non-privileged user causes Exim to discard its root privilege.
7313 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7314 completely disabled, and its use causes an immediate error exit.
7315 </para>
7316 <para>
7317 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7318 to declare certain macro names trusted, such that root privilege will not
7319 necessarily be discarded.
7320 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7321 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7322 values are acceptable, then Exim will not give up root privilege if the caller
7323 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7324 transition mechanism and is expected to be removed in the future.  Acceptable
7325 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7326 </para>
7327 <para>
7328 Some sites may wish to use the same Exim binary on different machines that
7329 share a file system, but to use different configuration files on each machine.
7330 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7331 looks for a file whose name is the configuration file name followed by a dot
7332 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7333 file does not exist, the standard name is tried. This processing occurs for
7334 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7335 </para>
7336 <para>
7337 In some esoteric situations different versions of Exim may be run under
7338 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7339 help with this. See the comments in <filename>src/EDITME</filename> for details.
7340 </para>
7341 </section>
7342 <section id="SECTconffilfor">
7343 <title>Configuration file format</title>
7344 <para>
7345 <indexterm role="concept">
7346 <primary>configuration file</primary>
7347 <secondary>format of</secondary>
7348 </indexterm>
7349 <indexterm role="concept">
7350 <primary>format</primary>
7351 <secondary>configuration file</secondary>
7352 </indexterm>
7353 Exim&#x2019;s configuration file is divided into a number of different parts. General
7354 option settings must always appear at the start of the file. The other parts
7355 are all optional, and may appear in any order. Each part other than the first
7356 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7357 optional parts are:
7358 </para>
7359 <itemizedlist>
7360 <listitem>
7361 <para>
7362 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7363 <xref linkend="CHAPACL"/>).
7364 </para>
7365 </listitem>
7366 <listitem>
7367 <para>
7368 <indexterm role="concept">
7369 <primary>AUTH</primary>
7370 <secondary>configuration</secondary>
7371 </indexterm>
7372 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7373 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7374 </para>
7375 </listitem>
7376 <listitem>
7377 <para>
7378 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7379 addresses and determine how the message is to be delivered (see chapters
7380 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7381 </para>
7382 </listitem>
7383 <listitem>
7384 <para>
7385 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7386 define mechanisms for copying messages to destinations (see chapters
7387 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7388 </para>
7389 </listitem>
7390 <listitem>
7391 <para>
7392 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7393 If there is no retry section, or if it is empty (that is, no retry rules are
7394 defined), Exim will not retry deliveries. In this situation, temporary errors
7395 are treated the same as permanent errors. Retry rules are discussed in chapter
7396 <xref linkend="CHAPretry"/>.
7397 </para>
7398 </listitem>
7399 <listitem>
7400 <para>
7401 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7402 when new addresses are generated during delivery. Rewriting is discussed in
7403 chapter <xref linkend="CHAPrewrite"/>.
7404 </para>
7405 </listitem>
7406 <listitem>
7407 <para>
7408 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7409 want to use this feature, you must set
7410 </para>
7411 <literallayout class="monospaced">
7412 LOCAL_SCAN_HAS_OPTIONS=yes
7413 </literallayout>
7414 <para>
7415 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7416 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7417 </para>
7418 </listitem>
7419 </itemizedlist>
7420 <para>
7421 <indexterm role="concept">
7422 <primary>configuration file</primary>
7423 <secondary>leading white space in</secondary>
7424 </indexterm>
7425 <indexterm role="concept">
7426 <primary>configuration file</primary>
7427 <secondary>trailing white space in</secondary>
7428 </indexterm>
7429 <indexterm role="concept">
7430 <primary>white space</primary>
7431 <secondary>in configuration file</secondary>
7432 </indexterm>
7433 Leading and trailing white space in configuration lines is always ignored.
7434 </para>
7435 <para>
7436 Blank lines in the file, and lines starting with a # character (ignoring
7437 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7438 # character other than at the beginning of a line is not treated specially,
7439 and does not introduce a comment.
7440 </para>
7441 <para>
7442 Any non-comment line can be continued by ending it with a backslash. Note that
7443 the general rule for white space means that trailing white space after the
7444 backslash and leading white space at the start of continuation
7445 lines is ignored. Comment lines beginning with # (but not empty lines) may
7446 appear in the middle of a sequence of continuation lines.
7447 </para>
7448 <para>
7449 A convenient way to create a configuration file is to start from the
7450 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7451 change settings as required.
7452 </para>
7453 <para>
7454 The ACLs, retry rules, and rewriting rules have their own syntax which is
7455 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7456 respectively. The other parts of the configuration file have some syntactic
7457 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7458 onwards. Before that, the inclusion, macro, and conditional facilities are
7459 described.
7460 </para>
7461 </section>
7462 <section id="SECID41">
7463 <title>File inclusions in the configuration file</title>
7464 <para>
7465 <indexterm role="concept">
7466 <primary>inclusions in configuration file</primary>
7467 </indexterm>
7468 <indexterm role="concept">
7469 <primary>configuration file</primary>
7470 <secondary>including other files</secondary>
7471 </indexterm>
7472 <indexterm role="concept">
7473 <primary><literal>.include</literal> in configuration file</primary>
7474 </indexterm>
7475 <indexterm role="concept">
7476 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7477 </indexterm>
7478 You can include other files inside Exim&#x2019;s run time configuration file by
7479 using this syntax:
7480 </para>
7481 <literallayout>
7482 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7483 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7484 </literallayout>
7485 <para>
7486 on a line by itself. Double quotes round the file name are optional. If you use
7487 the first form, a configuration error occurs if the file does not exist; the
7488 second form does nothing for non-existent files. In all cases, an absolute file
7489 name is required.
7490 </para>
7491 <para>
7492 Includes may be nested to any depth, but remember that Exim reads its
7493 configuration file often, so it is a good idea to keep them to a minimum.
7494 If you change the contents of an included file, you must HUP the daemon,
7495 because an included file is read only when the configuration itself is read.
7496 </para>
7497 <para>
7498 The processing of inclusions happens early, at a physical line level, so, like
7499 comment lines, an inclusion can be used in the middle of an option setting,
7500 for example:
7501 </para>
7502 <literallayout class="monospaced">
7503 hosts_lookup = a.b.c \
7504                .include /some/file
7505 </literallayout>
7506 <para>
7507 Include processing happens after macro processing (see below). Its effect is to
7508 process the lines of the included file as if they occurred inline where the
7509 inclusion appears.
7510 </para>
7511 </section>
7512 <section id="SECTmacrodefs">
7513 <title>Macros in the configuration file</title>
7514 <para>
7515 <indexterm role="concept">
7516 <primary>macro</primary>
7517 <secondary>description of</secondary>
7518 </indexterm>
7519 <indexterm role="concept">
7520 <primary>configuration file</primary>
7521 <secondary>macros</secondary>
7522 </indexterm>
7523 If a line in the main part of the configuration (that is, before the first
7524 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7525 definition, and must be of the form
7526 </para>
7527 <literallayout>
7528 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7529 </literallayout>
7530 <para>
7531 The name must consist of letters, digits, and underscores, and need not all be
7532 in upper case, though that is recommended. The rest of the line, including any
7533 continuations, is the replacement text, and has leading and trailing white
7534 space removed. Quotes are not removed. The replacement text can never end with
7535 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7536 </para>
7537 <para>
7538 Macros may also be defined between router, transport, authenticator, or ACL
7539 definitions. They may not, however, be defined within an individual driver or
7540 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7541 </para>
7542 </section>
7543 <section id="SECID42">
7544 <title>Macro substitution</title>
7545 <para>
7546 Once a macro is defined, all subsequent lines in the file (and any included
7547 files) are scanned for the macro name; if there are several macros, the line is
7548 scanned for each in turn, in the order in which the macros are defined. The
7549 replacement text is not re-scanned for the current macro, though it is scanned
7550 for subsequently defined macros. For this reason, a macro name may not contain
7551 the name of a previously defined macro as a substring. You could, for example,
7552 define
7553 </para>
7554 <literallayout>
7555 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7556 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7557 </literallayout>
7558 <para>
7559 but putting the definitions in the opposite order would provoke a configuration
7560 error. Macro expansion is applied to individual physical lines from the file,
7561 before checking for line continuation or file inclusion (see above). If a line
7562 consists solely of a macro name, and the expansion of the macro is empty, the
7563 line is ignored. A macro at the start of a line may turn the line into a
7564 comment line or a <literal>.include</literal> line.
7565 </para>
7566 </section>
7567 <section id="SECID43">
7568 <title>Redefining macros</title>
7569 <para>
7570 Once defined, the value of a macro can be redefined later in the configuration
7571 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7572 <emphasis>=</emphasis>. For example:
7573 </para>
7574 <literallayout class="monospaced">
7575 MAC =  initial value
7576 ...
7577 MAC == updated value
7578 </literallayout>
7579 <para>
7580 Redefinition does not alter the order in which the macros are applied to the
7581 subsequent lines of the configuration file. It is still the same order in which
7582 the macros were originally defined. All that changes is the macro&#x2019;s value.
7583 Redefinition makes it possible to accumulate values. For example:
7584 </para>
7585 <literallayout class="monospaced">
7586 MAC =  initial value
7587 ...
7588 MAC == MAC and something added
7589 </literallayout>
7590 <para>
7591 This can be helpful in situations where the configuration file is built
7592 from a number of other files.
7593 </para>
7594 </section>
7595 <section id="SECID44">
7596 <title>Overriding macro values</title>
7597 <para>
7598 The values set for macros in the configuration file can be overridden by the
7599 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7600 used, unless called by root or the Exim user. A definition on the command line
7601 using the <option>-D</option> option causes all definitions and redefinitions within the
7602 file to be ignored.
7603 </para>
7604 </section>
7605 <section id="SECID45">
7606 <title>Example of macro usage</title>
7607 <para>
7608 As an example of macro usage, consider a configuration where aliases are looked
7609 up in a MySQL database. It helps to keep the file less cluttered if long
7610 strings such as SQL statements are defined separately as macros, for example:
7611 </para>
7612 <literallayout class="monospaced">
7613 ALIAS_QUERY = select mailbox from user where \
7614               login='${quote_mysql:$local_part}';
7615 </literallayout>
7616 <para>
7617 This can then be used in a <command>redirect</command> router setting like this:
7618 </para>
7619 <literallayout class="monospaced">
7620 data = ${lookup mysql{ALIAS_QUERY}}
7621 </literallayout>
7622 <para>
7623 In earlier versions of Exim macros were sometimes used for domain, host, or
7624 address lists. In Exim 4 these are handled better by named lists &ndash; see
7625 section <xref linkend="SECTnamedlists"/>.
7626 </para>
7627 </section>
7628 <section id="SECID46">
7629 <title>Conditional skips in the configuration file</title>
7630 <para>
7631 <indexterm role="concept">
7632 <primary>configuration file</primary>
7633 <secondary>conditional skips</secondary>
7634 </indexterm>
7635 <indexterm role="concept">
7636 <primary><literal>.ifdef</literal></primary>
7637 </indexterm>
7638 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7639 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7640 portions of the configuration file. The processing happens whenever the file is
7641 read (that is, when an Exim binary starts to run).
7642 </para>
7643 <para>
7644 The implementation is very simple. Instances of the first four directives must
7645 be followed by text that includes the names of one or macros. The condition
7646 that is tested is whether or not any macro substitution has taken place in the
7647 line. Thus:
7648 </para>
7649 <literallayout class="monospaced">
7650 .ifdef AAA
7651 message_size_limit = 50M
7652 .else
7653 message_size_limit = 100M
7654 .endif
7655 </literallayout>
7656 <para>
7657 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7658 otherwise. If there is more than one macro named on the line, the condition
7659 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7660 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7661 </para>
7662 <para>
7663 Although you can use a macro expansion to generate one of these directives,
7664 it is not very useful, because the condition <quote>there was a macro substitution
7665 in this line</quote> will always be true.
7666 </para>
7667 <para>
7668 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7669 to clarify complicated nestings.
7670 </para>
7671 </section>
7672 <section id="SECTcos">
7673 <title>Common option syntax</title>
7674 <para>
7675 <indexterm role="concept">
7676 <primary>common option syntax</primary>
7677 </indexterm>
7678 <indexterm role="concept">
7679 <primary>syntax of common options</primary>
7680 </indexterm>
7681 <indexterm role="concept">
7682 <primary>configuration file</primary>
7683 <secondary>common option syntax</secondary>
7684 </indexterm>
7685 For the main set of options, driver options, and <function>local_scan()</function> options,
7686 each setting is on a line by itself, and starts with a name consisting of
7687 lower-case letters and underscores. Many options require a data value, and in
7688 these cases the name must be followed by an equals sign (with optional white
7689 space) and then the value. For example:
7690 </para>
7691 <literallayout class="monospaced">
7692 qualify_domain = mydomain.example.com
7693 </literallayout>
7694 <para>
7695 <indexterm role="concept">
7696 <primary>hiding configuration option values</primary>
7697 </indexterm>
7698 <indexterm role="concept">
7699 <primary>configuration options</primary>
7700 <secondary>hiding value of</secondary>
7701 </indexterm>
7702 <indexterm role="concept">
7703 <primary>options</primary>
7704 <secondary>hiding value of</secondary>
7705 </indexterm>
7706 Some option settings may contain sensitive data, for example, passwords for
7707 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7708 line option to read these values, you can precede the option settings with the
7709 word <quote>hide</quote>. For example:
7710 </para>
7711 <literallayout class="monospaced">
7712 hide mysql_servers = localhost/users/admin/secret-password
7713 </literallayout>
7714 <para>
7715 For non-admin users, such options are displayed like this:
7716 </para>
7717 <literallayout class="monospaced">
7718 mysql_servers = &lt;value not displayable&gt;
7719 </literallayout>
7720 <para>
7721 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7722 all instances of the same driver.
7723 </para>
7724 <para>
7725 The following sections describe the syntax used for the different data types
7726 that are found in option settings.
7727 </para>
7728 </section>
7729 <section id="SECID47">
7730 <title>Boolean options</title>
7731 <para>
7732 <indexterm role="concept">
7733 <primary>format</primary>
7734 <secondary>boolean</secondary>
7735 </indexterm>
7736 <indexterm role="concept">
7737 <primary>boolean configuration values</primary>
7738 </indexterm>
7739 <indexterm role="option">
7740 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7741 </indexterm>
7742 <indexterm role="option">
7743 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7744 </indexterm>
7745 Options whose type is given as boolean are on/off switches. There are two
7746 different ways of specifying such options: with and without a data value. If
7747 the option name is specified on its own without data, the switch is turned on;
7748 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7749 boolean options may be followed by an equals sign and one of the words
7750 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7751 the following two settings have exactly the same effect:
7752 </para>
7753 <literallayout class="monospaced">
7754 queue_only
7755 queue_only = true
7756 </literallayout>
7757 <para>
7758 The following two lines also have the same (opposite) effect:
7759 </para>
7760 <literallayout class="monospaced">
7761 no_queue_only
7762 queue_only = false
7763 </literallayout>
7764 <para>
7765 You can use whichever syntax you prefer.
7766 </para>
7767 </section>
7768 <section id="SECID48">
7769 <title>Integer values</title>
7770 <para>
7771 <indexterm role="concept">
7772 <primary>integer configuration values</primary>
7773 </indexterm>
7774 <indexterm role="concept">
7775 <primary>format</primary>
7776 <secondary>integer</secondary>
7777 </indexterm>
7778 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7779 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7780 number is assumed. Otherwise, it is treated as an octal number unless it starts
7781 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7782 hexadecimal number.
7783 </para>
7784 <para>
7785 If an integer value is followed by the letter K, it is multiplied by 1024; if
7786 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7787 of integer option settings are output, values which are an exact multiple of
7788 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7789 and M. The printing style is independent of the actual input format that was
7790 used.
7791 </para>
7792 </section>
7793 <section id="SECID49">
7794 <title>Octal integer values</title>
7795 <para>
7796 <indexterm role="concept">
7797 <primary>integer format</primary>
7798 </indexterm>
7799 <indexterm role="concept">
7800 <primary>format</primary>
7801 <secondary>octal integer</secondary>
7802 </indexterm>
7803 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7804 interpreted as an octal number, whether or not it starts with the digit zero.
7805 Such options are always output in octal.
7806 </para>
7807 </section>
7808 <section id="SECID50">
7809 <title>Fixed point numbers</title>
7810 <para>
7811 <indexterm role="concept">
7812 <primary>fixed point configuration values</primary>
7813 </indexterm>
7814 <indexterm role="concept">
7815 <primary>format</primary>
7816 <secondary>fixed point</secondary>
7817 </indexterm>
7818 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7819 integer, optionally followed by a decimal point and up to three further digits.
7820 </para>
7821 </section>
7822 <section id="SECTtimeformat">
7823 <title>Time intervals</title>
7824 <para>
7825 <indexterm role="concept">
7826 <primary>time interval</primary>
7827 <secondary>specifying in configuration</secondary>
7828 </indexterm>
7829 <indexterm role="concept">
7830 <primary>format</primary>
7831 <secondary>time interval</secondary>
7832 </indexterm>
7833 A time interval is specified as a sequence of numbers, each followed by one of
7834 the following letters, with no intervening white space:
7835 </para>
7836 <informaltable frame="none">
7837 <tgroup cols="2" colsep="0" rowsep="0">
7838 <colspec colwidth="30pt" align="left"/>
7839 <colspec colwidth="254pt" align="left"/>
7840 <tbody>
7841 <row>
7842 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7843 <entry>seconds</entry>
7844 </row>
7845 <row>
7846 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
7847 <entry>minutes</entry>
7848 </row>
7849 <row>
7850 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
7851 <entry>hours</entry>
7852 </row>
7853 <row>
7854 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
7855 <entry>days</entry>
7856 </row>
7857 <row>
7858 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
7859 <entry>weeks</entry>
7860 </row>
7861 </tbody>
7862 </tgroup>
7863 </informaltable>
7864 <para>
7865 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7866 intervals are output in the same format. Exim does not restrict the values; it
7867 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7868 </para>
7869 </section>
7870 <section id="SECTstrings">
7871 <title>String values</title>
7872 <para>
7873 <indexterm role="concept">
7874 <primary>string</primary>
7875 <secondary>format of configuration values</secondary>
7876 </indexterm>
7877 <indexterm role="concept">
7878 <primary>format</primary>
7879 <secondary>string</secondary>
7880 </indexterm>
7881 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
7882 or without double-quotes. If it does not start with a double-quote, the value
7883 consists of the remainder of the line plus any continuation lines, starting at
7884 the first character after any leading white space, with trailing white space
7885 removed, and with no interpretation of the characters in the string. Because
7886 Exim removes comment lines (those beginning with #) at an early stage, they can
7887 appear in the middle of a multi-line string. The following two settings are
7888 therefore equivalent:
7889 </para>
7890 <literallayout class="monospaced">
7891 trusted_users = uucp:mail
7892 trusted_users = uucp:\
7893                 # This comment line is ignored
7894                 mail
7895 </literallayout>
7896 <para>
7897 <indexterm role="concept">
7898 <primary>string</primary>
7899 <secondary>quoted</secondary>
7900 </indexterm>
7901 <indexterm role="concept">
7902 <primary>escape characters in quoted strings</primary>
7903 </indexterm>
7904 If a string does start with a double-quote, it must end with a closing
7905 double-quote, and any backslash characters other than those used for line
7906 continuation are interpreted as escape characters, as follows:
7907 </para>
7908 <informaltable frame="none">
7909 <tgroup cols="2" colsep="0" rowsep="0">
7910 <colspec colwidth="100pt" align="left"/>
7911 <colspec colwidth="254pt" align="left"/>
7912 <tbody>
7913 <row>
7914 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
7915 <entry>single backslash</entry>
7916 </row>
7917 <row>
7918 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
7919 <entry>newline</entry>
7920 </row>
7921 <row>
7922 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
7923 <entry>carriage return</entry>
7924 </row>
7925 <row>
7926 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
7927 <entry>tab</entry>
7928 </row>
7929 <row>
7930 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7931 <entry>up to 3 octal digits specify one character</entry>
7932 </row>
7933 <row>
7934 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7935 <entry>up to 2 hexadecimal digits specify one character</entry>
7936 </row>
7937 </tbody>
7938 </tgroup>
7939 </informaltable>
7940 <para>
7941 If a backslash is followed by some other character, including a double-quote
7942 character, that character replaces the pair.
7943 </para>
7944 <para>
7945 Quoting is necessary only if you want to make use of the backslash escapes to
7946 insert special characters, or if you need to specify a value with leading or
7947 trailing spaces. These cases are rare, so quoting is almost never needed in
7948 current versions of Exim. In versions of Exim before 3.14, quoting was required
7949 in order to continue lines, so you may come across older configuration files
7950 and examples that apparently quote unnecessarily.
7951 </para>
7952 </section>
7953 <section id="SECID51">
7954 <title>Expanded strings</title>
7955 <para>
7956 <indexterm role="concept">
7957 <primary>expansion</primary>
7958 <secondary>definition of</secondary>
7959 </indexterm>
7960 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7961 by which means various parts of the string may be changed according to the
7962 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7963 is as just described; in particular, the handling of backslashes in quoted
7964 strings is done as part of the input process, before expansion takes place.
7965 However, backslash is also an escape character for the expander, so any
7966 backslashes that are required for that reason must be doubled if they are
7967 within a quoted configuration string.
7968 </para>
7969 </section>
7970 <section id="SECID52">
7971 <title>User and group names</title>
7972 <para>
7973 <indexterm role="concept">
7974 <primary>user name</primary>
7975 <secondary>format of</secondary>
7976 </indexterm>
7977 <indexterm role="concept">
7978 <primary>format</primary>
7979 <secondary>user name</secondary>
7980 </indexterm>
7981 <indexterm role="concept">
7982 <primary>groups</primary>
7983 <secondary>name format</secondary>
7984 </indexterm>
7985 <indexterm role="concept">
7986 <primary>format</primary>
7987 <secondary>group name</secondary>
7988 </indexterm>
7989 User and group names are specified as strings, using the syntax described
7990 above, but the strings are interpreted specially. A user or group name must
7991 either consist entirely of digits, or be a name that can be looked up using the
7992 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7993 </para>
7994 </section>
7995 <section id="SECTlistconstruct">
7996 <title>List construction</title>
7997 <para>
7998 <indexterm role="concept">
7999 <primary>list</primary>
8000 <secondary>syntax of in configuration</secondary>
8001 </indexterm>
8002 <indexterm role="concept">
8003 <primary>format</primary>
8004 <secondary>list item in configuration</secondary>
8005 </indexterm>
8006 <indexterm role="concept">
8007 <primary>string</primary>
8008 <secondary>list, definition of</secondary>
8009 </indexterm>
8010 The data for some configuration options is a list of items, with colon as the
8011 default separator. Many of these options are shown with type <quote>string list</quote> in
8012 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8013 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8014 are all the same; however, those other than <quote>string list</quote> are subject to
8015 particular kinds of interpretation, as described in chapter
8016 <xref linkend="CHAPdomhosaddlists"/>.
8017 </para>
8018 <para>
8019 In all these cases, the entire list is treated as a single string as far as the
8020 input syntax is concerned. The <option>trusted_users</option> setting in section
8021 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8022 in a list, it must be entered as two colons. Leading and trailing white space
8023 on each item in a list is ignored. This makes it possible to include items that
8024 start with a colon, and in particular, certain forms of IPv6 address. For
8025 example, the list
8026 </para>
8027 <literallayout class="monospaced">
8028 local_interfaces = 127.0.0.1 : ::::1
8029 </literallayout>
8030 <para>
8031 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8032 </para>
8033 <para>
8034 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8035 list items, it is not ignored when parsing the list. The space after the first
8036 colon in the example above is necessary. If it were not there, the list would
8037 be interpreted as the two items 127.0.0.1:: and 1.
8038 </para>
8039 </section>
8040 <section id="SECID53">
8041 <title>Changing list separators</title>
8042 <para>
8043 <indexterm role="concept">
8044 <primary>list separator</primary>
8045 <secondary>changing</secondary>
8046 </indexterm>
8047 <indexterm role="concept">
8048 <primary>IPv6</primary>
8049 <secondary>addresses in lists</secondary>
8050 </indexterm>
8051 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8052 introduced to allow the separator character to be changed. If a list begins
8053 with a left angle bracket, followed by any punctuation character, that
8054 character is used instead of colon as the list separator. For example, the list
8055 above can be rewritten to use a semicolon separator like this:
8056 </para>
8057 <literallayout class="monospaced">
8058 local_interfaces = &lt;; 127.0.0.1 ; ::1
8059 </literallayout>
8060 <para>
8061 This facility applies to all lists, with the exception of the list in
8062 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8063 confined to circumstances where they really are needed.
8064 </para>
8065 <para>
8066 <indexterm role="concept">
8067 <primary>list separator</primary>
8068 <secondary>newline as</secondary>
8069 </indexterm>
8070 <indexterm role="concept">
8071 <primary>newline</primary>
8072 <secondary>as list separator</secondary>
8073 </indexterm>
8074 It is also possible to use newline and other control characters (those with
8075 code values less than 32, plus DEL) as separators in lists. Such separators
8076 must be provided literally at the time the list is processed. For options that
8077 are string-expanded, you can write the separator using a normal escape
8078 sequence. This will be processed by the expander before the string is
8079 interpreted as a list. For example, if a newline-separated list of domains is
8080 generated by a lookup, you can process it directly by a line such as this:
8081 </para>
8082 <literallayout class="monospaced">
8083 domains = &lt;\n ${lookup mysql{.....}}
8084 </literallayout>
8085 <para>
8086 This avoids having to change the list separator in such data. You are unlikely
8087 to want to use a control character as a separator in an option that is not
8088 expanded, because the value is literal text. However, it can be done by giving
8089 the value in quotes. For example:
8090 </para>
8091 <literallayout class="monospaced">
8092 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8093 </literallayout>
8094 <para>
8095 Unlike printing character separators, which can be included in list items by
8096 doubling, it is not possible to include a control character as data when it is
8097 set as the separator. Two such characters in succession are interpreted as
8098 enclosing an empty list item.
8099 </para>
8100 </section>
8101 <section id="SECTempitelis">
8102 <title>Empty items in lists</title>
8103 <para>
8104 <indexterm role="concept">
8105 <primary>list</primary>
8106 <secondary>empty item in</secondary>
8107 </indexterm>
8108 An empty item at the end of a list is always ignored. In other words, trailing
8109 separator characters are ignored. Thus, the list in
8110 </para>
8111 <literallayout class="monospaced">
8112 senders = user@domain :
8113 </literallayout>
8114 <para>
8115 contains only a single item. If you want to include an empty string as one item
8116 in a list, it must not be the last item. For example, this list contains three
8117 items, the second of which is empty:
8118 </para>
8119 <literallayout class="monospaced">
8120 senders = user1@domain : : user2@domain
8121 </literallayout>
8122 <para>
8123 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8124 are interpreted as representing a single colon data character (and the list
8125 would then contain just one item). If you want to specify a list that contains
8126 just one, empty item, you can do it as in this example:
8127 </para>
8128 <literallayout class="monospaced">
8129 senders = :
8130 </literallayout>
8131 <para>
8132 In this case, the first item is empty, and the second is discarded because it
8133 is at the end of the list.
8134 </para>
8135 </section>
8136 <section id="SECTfordricon">
8137 <title>Format of driver configurations</title>
8138 <para>
8139 <indexterm role="concept">
8140 <primary>drivers</primary>
8141 <secondary>configuration format</secondary>
8142 </indexterm>
8143 There are separate parts in the configuration for defining routers, transports,
8144 and authenticators. In each part, you are defining a number of driver
8145 instances, each with its own set of options. Each driver instance is defined by
8146 a sequence of lines like this:
8147 </para>
8148 <literallayout>
8149 &lt;<emphasis>instance name</emphasis>&gt;:
8150   &lt;<emphasis>option</emphasis>&gt;
8151   ...
8152   &lt;<emphasis>option</emphasis>&gt;
8153 </literallayout>
8154 <para>
8155 In the following example, the instance name is <command>localuser</command>, and it is
8156 followed by three options settings:
8157 </para>
8158 <literallayout class="monospaced">
8159 localuser:
8160   driver = accept
8161   check_local_user
8162   transport = local_delivery
8163 </literallayout>
8164 <para>
8165 For each driver instance, you specify which Exim code module it uses &ndash; by the
8166 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8167 settings. For example, in the case of transports, if you want a transport to
8168 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8169 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8170 described in detail in its own separate chapter later in this manual.
8171 </para>
8172 <para>
8173 You can have several routers, transports, or authenticators that are based on
8174 the same underlying driver (each must have a different instance name).
8175 </para>
8176 <para>
8177 The order in which routers are defined is important, because addresses are
8178 passed to individual routers one by one, in order. The order in which
8179 transports are defined does not matter at all. The order in which
8180 authenticators are defined is used only when Exim, as a client, is searching
8181 them to find one that matches an authentication mechanism offered by the
8182 server.
8183 </para>
8184 <para>
8185 <indexterm role="concept">
8186 <primary>generic options</primary>
8187 </indexterm>
8188 <indexterm role="concept">
8189 <primary>options</primary>
8190 <secondary>generic &ndash; definition of</secondary>
8191 </indexterm>
8192 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8193 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8194 same type (that is, all routers, all transports or all authenticators). The
8195 <option>driver</option> option is a generic option that must appear in every definition.
8196 <indexterm role="concept">
8197 <primary>private options</primary>
8198 </indexterm>
8199 The private options are special for each driver, and none need appear, because
8200 they all have default values.
8201 </para>
8202 <para>
8203 The options may appear in any order, except that the <option>driver</option> option must
8204 precede any private options, since these depend on the particular driver. For
8205 this reason, it is recommended that <option>driver</option> always be the first option.
8206 </para>
8207 <para>
8208 Driver instance names, which are used for reference in log entries and
8209 elsewhere, can be any sequence of letters, digits, and underscores (starting
8210 with a letter) and must be unique among drivers of the same type. A router and
8211 a transport (for example) can each have the same name, but no two router
8212 instances can have the same name. The name of a driver instance should not be
8213 confused with the name of the underlying driver module. For example, the
8214 configuration lines:
8215 </para>
8216 <literallayout class="monospaced">
8217 remote_smtp:
8218   driver = smtp
8219 </literallayout>
8220 <para>
8221 create an instance of the <command>smtp</command> transport driver whose name is
8222 <command>remote_smtp</command>. The same driver code can be used more than once, with
8223 different instance names and different option settings each time. A second
8224 instance of the <command>smtp</command> transport, with different options, might be defined
8225 thus:
8226 </para>
8227 <literallayout class="monospaced">
8228 special_smtp:
8229   driver = smtp
8230   port = 1234
8231   command_timeout = 10s
8232 </literallayout>
8233 <para>
8234 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8235 these transport instances from routers, and these names would appear in log
8236 lines.
8237 </para>
8238 <para>
8239 Comment lines may be present in the middle of driver specifications. The full
8240 list of option settings for any particular driver instance, including all the
8241 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8242 option.
8243 </para>
8244 </section>
8245 </chapter>
8246
8247 <chapter id="CHAPdefconfil">
8248 <title>The default configuration file</title>
8249 <para>
8250 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8251 <primary>configuration file</primary>
8252 <secondary>default <quote>walk through</quote></secondary>
8253 </indexterm>
8254 <indexterm role="concept">
8255 <primary>default</primary>
8256 <secondary>configuration file <quote>walk through</quote></secondary>
8257 </indexterm>
8258 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8259 is sufficient for a host with simple mail requirements. As an introduction to
8260 the way Exim is configured, this chapter <quote>walks through</quote> the default
8261 configuration, giving brief explanations of the settings. Detailed descriptions
8262 of the options are given in subsequent chapters. The default configuration file
8263 itself contains extensive comments about ways you might want to modify the
8264 initial settings. However, note that there are many options that are not
8265 mentioned at all in the default configuration.
8266 </para>
8267 <section id="SECTdefconfmain">
8268 <title>Main configuration settings</title>
8269 <para>
8270 The main (global) configuration option settings must always come first in the
8271 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8272 the line
8273 </para>
8274 <literallayout class="monospaced">
8275 # primary_hostname =
8276 </literallayout>
8277 <para>
8278 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8279 to know the official, fully qualified name of your host, and this is where you
8280 can specify it. However, in most cases you do not need to set this option. When
8281 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8282 </para>
8283 <para>
8284 The first three non-comment configuration lines are as follows:
8285 </para>
8286 <literallayout class="monospaced">
8287 domainlist local_domains    = @
8288 domainlist relay_to_domains =
8289 hostlist   relay_from_hosts = 127.0.0.1
8290 </literallayout>
8291 <para>
8292 These are not, in fact, option settings. They are definitions of two named
8293 domain lists and one named host list. Exim allows you to give names to lists of
8294 domains, hosts, and email addresses, in order to make it easier to manage the
8295 configuration file (see section <xref linkend="SECTnamedlists"/>).
8296 </para>
8297 <para>
8298 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8299 later in the configuration to identify domains that are to be delivered
8300 on the local host.
8301 </para>
8302 <para>
8303 <indexterm role="concept">
8304 <primary>@ in a domain list</primary>
8305 </indexterm>
8306 There is just one item in this list, the string <quote>@</quote>. This is a special form
8307 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8308 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8309 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8310 the same configuration file can be used on different hosts.
8311 </para>
8312 <para>
8313 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8314 list itself is empty. Later in the configuration we will come to the part that
8315 controls mail relaying through the local host; it allows relaying to any
8316 domains in this list. By default, therefore, no relaying on the basis of a mail
8317 domain is permitted.
8318 </para>
8319 <para>
8320 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8321 used later in the configuration to permit relaying from any host or IP address
8322 that matches the list. The default contains just the IP address of the IPv4
8323 loopback interface, which means that processes on the local host are able to
8324 submit mail for relaying by sending it over TCP/IP to that interface. No other
8325 hosts are permitted to submit messages for relaying.
8326 </para>
8327 <para>
8328 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8329 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8330 and hosts that will be used in the controls that are specified later.
8331 </para>
8332 <para>
8333 The next two configuration lines are genuine option settings:
8334 </para>
8335 <literallayout class="monospaced">
8336 acl_smtp_rcpt = acl_check_rcpt
8337 acl_smtp_data = acl_check_data
8338 </literallayout>
8339 <para>
8340 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8341 during an incoming SMTP session for every recipient of a message (every RCPT
8342 command), and after the contents of the message have been received,
8343 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8344 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8345 section of the configuration. The RCPT ACL controls which recipients are
8346 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8347 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8348 contents of a message to be checked.
8349 </para>
8350 <para>
8351 Two commented-out option settings are next:
8352 </para>
8353 <literallayout class="monospaced">
8354 # av_scanner = clamd:/tmp/clamd
8355 # spamd_address = 127.0.0.1 783
8356 </literallayout>
8357 <para>
8358 These are example settings that can be used when Exim is compiled with the
8359 content-scanning extension. The first specifies the interface to the virus
8360 scanner, and the second specifies the interface to SpamAssassin. Further
8361 details are given in chapter <xref linkend="CHAPexiscan"/>.
8362 </para>
8363 <para>
8364 Three more commented-out option settings follow:
8365 </para>
8366 <literallayout class="monospaced">
8367 # tls_advertise_hosts = *
8368 # tls_certificate = /etc/ssl/exim.crt
8369 # tls_privatekey = /etc/ssl/exim.pem
8370 </literallayout>
8371 <para>
8372 These are example settings that can be used when Exim is compiled with
8373 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8374 first one specifies the list of clients that are allowed to use TLS when
8375 connecting to this server; in this case the wildcard means all clients. The
8376 other options specify where Exim should find its TLS certificate and private
8377 key, which together prove the server&#x2019;s identity to any clients that connect.
8378 More details are given in chapter <xref linkend="CHAPTLS"/>.
8379 </para>
8380 <para>
8381 Another two commented-out option settings follow:
8382 </para>
8383 <literallayout class="monospaced">
8384 # daemon_smtp_ports = 25 : 465 : 587
8385 # tls_on_connect_ports = 465
8386 </literallayout>
8387 <para>
8388 <indexterm role="concept">
8389 <primary>port</primary>
8390 <secondary>465 and 587</secondary>
8391 </indexterm>
8392 <indexterm role="concept">
8393 <primary>port</primary>
8394 <secondary>for message submission</secondary>
8395 </indexterm>
8396 <indexterm role="concept">
8397 <primary>message</primary>
8398 <secondary>submission, ports for</secondary>
8399 </indexterm>
8400 <indexterm role="concept">
8401 <primary>ssmtp protocol</primary>
8402 </indexterm>
8403 <indexterm role="concept">
8404 <primary>smtps protocol</primary>
8405 </indexterm>
8406 <indexterm role="concept">
8407 <primary>SMTP</primary>
8408 <secondary>ssmtp protocol</secondary>
8409 </indexterm>
8410 <indexterm role="concept">
8411 <primary>SMTP</primary>
8412 <secondary>smtps protocol</secondary>
8413 </indexterm>
8414 These options provide better support for roaming users who wish to use this
8415 server for message submission. They are not much use unless you have turned on
8416 TLS (as described in the previous paragraph) and authentication (about which
8417 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8418 on end-user networks, so RFC 4409 specifies that message submission should use
8419 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8420 configured to use port 587 correctly, so these settings also enable the
8421 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8422 <xref linkend="SECTsupobssmt"/>).
8423 </para>
8424 <para>
8425 Two more commented-out options settings follow:
8426 </para>
8427 <literallayout class="monospaced">
8428 # qualify_domain =
8429 # qualify_recipient =
8430 </literallayout>
8431 <para>
8432 The first of these specifies a domain that Exim uses when it constructs a
8433 complete email address from a local login name. This is often needed when Exim
8434 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8435 the value of <option>primary_hostname</option> is used. If you set both of these options,
8436 you can have different qualification domains for sender and recipient
8437 addresses. If you set only the first one, its value is used in both cases.
8438 </para>
8439 <para>
8440 <indexterm role="concept">
8441 <primary>domain literal</primary>
8442 <secondary>recognizing format</secondary>
8443 </indexterm>
8444 The following line must be uncommented if you want Exim to recognize
8445 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8446 (an IP address within square brackets) instead of a named domain.
8447 </para>
8448 <literallayout class="monospaced">
8449 # allow_domain_literals
8450 </literallayout>
8451 <para>
8452 The RFCs still require this form, but many people think that in the modern
8453 Internet it makes little sense to permit mail to be sent to specific hosts by
8454 quoting their IP addresses. This ancient format has been used by people who
8455 try to abuse hosts by using them for unwanted relaying. However, some
8456 people believe there are circumstances (for example, messages addressed to
8457 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8458 </para>
8459 <para>
8460 The next configuration line is a kind of trigger guard:
8461 </para>
8462 <literallayout class="monospaced">
8463 never_users = root
8464 </literallayout>
8465 <para>
8466 It specifies that no delivery must ever be run as the root user. The normal
8467 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8468 setting is a guard against slips in the configuration.
8469 The list of users specified by <option>never_users</option> is not, however, the complete
8470 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8471 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8472 contents of <option>never_users</option> are added to this list. By default
8473 FIXED_NEVER_USERS also specifies root.
8474 </para>
8475 <para>
8476 When a remote host connects to Exim in order to send mail, the only information
8477 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8478 line,
8479 </para>
8480 <literallayout class="monospaced">
8481 host_lookup = *
8482 </literallayout>
8483 <para>
8484 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8485 in order to get a host name. This improves the quality of the logging
8486 information, but if you feel it is too expensive, you can remove it entirely,
8487 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8488 Note that it is not always possible to find a host name from an IP address,
8489 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8490 unreachable.
8491 </para>
8492 <para>
8493 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8494 1413 (hence their names):
8495 </para>
8496 <literallayout class="monospaced">
8497 rfc1413_hosts = *
8498 rfc1413_query_timeout = 5s
8499 </literallayout>
8500 <para>
8501 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8502 You can limit the hosts to which these calls are made, or change the timeout
8503 that is used. If you set the timeout to zero, all ident calls are disabled.
8504 Although they are cheap and can provide useful information for tracing problem
8505 messages, some hosts and firewalls have problems with ident calls. This can
8506 result in a timeout instead of an immediate refused connection, leading to
8507 delays on starting up an incoming SMTP session.
8508 </para>
8509 <para>
8510 When Exim receives messages over SMTP connections, it expects all addresses to
8511 be fully qualified with a domain, as required by the SMTP definition. However,
8512 if you are running a server to which simple clients submit messages, you may
8513 find that they send unqualified addresses. The two commented-out options:
8514 </para>
8515 <literallayout class="monospaced">
8516 # sender_unqualified_hosts =
8517 # recipient_unqualified_hosts =
8518 </literallayout>
8519 <para>
8520 show how you can specify hosts that are permitted to send unqualified sender
8521 and recipient addresses, respectively.
8522 </para>
8523 <para>
8524 The <option>percent_hack_domains</option> option is also commented out:
8525 </para>
8526 <literallayout class="monospaced">
8527 # percent_hack_domains =
8528 </literallayout>
8529 <para>
8530 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8531 This is an almost obsolete form of explicit email routing. If you do not know
8532 anything about it, you can safely ignore this topic.
8533 </para>
8534 <para>
8535 The last two settings in the main part of the default configuration are
8536 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8537 message is frozen, Exim no longer continues to try to deliver it. Freezing
8538 occurs when a bounce message encounters a permanent failure because the sender
8539 address of the original message that caused the bounce is invalid, so the
8540 bounce cannot be delivered. This is probably the most common case, but there
8541 are also other conditions that cause freezing, and frozen messages are not
8542 always bounce messages.
8543 </para>
8544 <literallayout class="monospaced">
8545 ignore_bounce_errors_after = 2d
8546 timeout_frozen_after = 7d
8547 </literallayout>
8548 <para>
8549 The first of these options specifies that failing bounce messages are to be
8550 discarded after 2 days on the queue. The second specifies that any frozen
8551 message (whether a bounce message or not) is to be timed out (and discarded)
8552 after a week. In this configuration, the first setting ensures that no failing
8553 bounce message ever lasts a week.
8554 </para>
8555 </section>
8556 <section id="SECID54">
8557 <title>ACL configuration</title>
8558 <para>
8559 <indexterm role="concept">
8560 <primary>default</primary>
8561 <secondary>ACLs</secondary>
8562 </indexterm>
8563 <indexterm role="concept">
8564 <primary>access control lists (ACLs)</primary>
8565 <secondary>default configuration</secondary>
8566 </indexterm>
8567 In the default configuration, the ACL section follows the main configuration.
8568 It starts with the line
8569 </para>
8570 <literallayout class="monospaced">
8571 begin acl
8572 </literallayout>
8573 <para>
8574 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8575 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8576 and <option>acl_smtp_data</option> above.
8577 </para>
8578 <para>
8579 <indexterm role="concept">
8580 <primary>RCPT</primary>
8581 <secondary>ACL for</secondary>
8582 </indexterm>
8583 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8584 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8585 are considered in order, until the recipient address is either accepted or
8586 rejected. The RCPT command is then accepted or rejected, according to the
8587 result of the ACL processing.
8588 </para>
8589 <literallayout class="monospaced">
8590 acl_check_rcpt:
8591 </literallayout>
8592 <para>
8593 This line, consisting of a name terminated by a colon, marks the start of the
8594 ACL, and names it.
8595 </para>
8596 <literallayout class="monospaced">
8597 accept  hosts = :
8598 </literallayout>
8599 <para>
8600 This ACL statement accepts the recipient if the sending host matches the list.
8601 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8602 names or IP addresses. The presence of the colon puts an empty item in the
8603 list; Exim matches this only if the incoming message did not come from a remote
8604 host, because in that case, the remote hostname is empty. The colon is
8605 important. Without it, the list itself is empty, and can never match anything.
8606 </para>
8607 <para>
8608 What this statement is doing is to accept unconditionally all recipients in
8609 messages that are submitted by SMTP from local processes using the standard
8610 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8611 manner.
8612 </para>
8613 <literallayout class="monospaced">
8614 deny    message       = Restricted characters in address
8615         domains       = +local_domains
8616         local_parts   = ^[.] : ^.*[@%!/|]
8617
8618 deny    message       = Restricted characters in address
8619         domains       = !+local_domains
8620         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8621 </literallayout>
8622 <para>
8623 These statements are concerned with local parts that contain any of the
8624 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8625 Although these characters are entirely legal in local parts (in the case of
8626 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8627 in Internet mail addresses.
8628 </para>
8629 <para>
8630 The first three have in the past been associated with explicitly routed
8631 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8632 option). Addresses containing these characters are regularly tried by spammers
8633 in an attempt to bypass relaying restrictions, and also by open relay testing
8634 programs. Unless you really need them it is safest to reject these characters
8635 at this early stage. This configuration is heavy-handed in rejecting these
8636 characters for all messages it accepts from remote hosts. This is a deliberate
8637 policy of being as safe as possible.
8638 </para>
8639 <para>
8640 The first rule above is stricter, and is applied to messages that are addressed
8641 to one of the local domains handled by this host. This is implemented by the
8642 first condition, which restricts it to domains that are listed in the
8643 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8644 reference to a named list. In this configuration, there is just one domain in
8645 <emphasis>local_domains</emphasis>, but in general there may be many.
8646 </para>
8647 <para>
8648 The second condition on the first statement uses two regular expressions to
8649 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8650 or <quote>|</quote>. If you have local accounts that include these characters, you will
8651 have to modify this rule.
8652 </para>
8653 <para>
8654 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8655 allows them because they have been encountered in practice. (Consider the
8656 common convention of local parts constructed as
8657 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8658 the author of Exim, who has no second initial.) However, a local part starting
8659 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8660 file name (for example, for a mailing list). This is also true for local parts
8661 that contain slashes. A pipe symbol can also be troublesome if the local part
8662 is incorporated unthinkingly into a shell command line.
8663 </para>
8664 <para>
8665 The second rule above applies to all other domains, and is less strict. This
8666 allows your own users to send outgoing messages to sites that use slashes
8667 and vertical bars in their local parts. It blocks local parts that begin
8668 with a dot, slash, or vertical bar, but allows these characters within the
8669 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8670 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8671 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8672 </para>
8673 <literallayout class="monospaced">
8674 accept  local_parts   = postmaster
8675         domains       = +local_domains
8676 </literallayout>
8677 <para>
8678 This statement, which has two conditions, accepts an incoming address if the
8679 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8680 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8681 reference to a named list. In this configuration, there is just one domain in
8682 <emphasis>local_domains</emphasis>, but in general there may be many.
8683 </para>
8684 <para>
8685 The presence of this statement means that mail to postmaster is never blocked
8686 by any of the subsequent tests. This can be helpful while sorting out problems
8687 in cases where the subsequent tests are incorrectly denying access.
8688 </para>
8689 <literallayout class="monospaced">
8690 require verify        = sender
8691 </literallayout>
8692 <para>
8693 This statement requires the sender address to be verified before any subsequent
8694 ACL statement can be used. If verification fails, the incoming recipient
8695 address is refused. Verification consists of trying to route the address, to
8696 see if a bounce message could be delivered to it. In the case of remote
8697 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8698 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8699 discusses the details of address verification.
8700 </para>
8701 <literallayout class="monospaced">
8702 accept  hosts         = +relay_from_hosts
8703         control       = submission
8704 </literallayout>
8705 <para>
8706 This statement accepts the address if the message is coming from one of the
8707 hosts that are defined as being allowed to relay through this host. Recipient
8708 verification is omitted here, because in many cases the clients are dumb MUAs
8709 that do not cope well with SMTP error responses. For the same reason, the
8710 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8711 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8712 messages that are deficient in some way, for example, because they lack a
8713 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8714 probably add recipient verification here, and disable submission mode.
8715 </para>
8716 <literallayout class="monospaced">
8717 accept  authenticated = *
8718         control       = submission
8719 </literallayout>
8720 <para>
8721 This statement accepts the address if the client host has authenticated itself.
8722 Submission mode is again specified, on the grounds that such messages are most
8723 likely to come from MUAs. The default configuration does not define any
8724 authenticators, though it does include some nearly complete commented-out
8725 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8726 fact authenticate until you complete the authenticator definitions.
8727 </para>
8728 <literallayout class="monospaced">
8729 require message = relay not permitted
8730         domains = +local_domains : +relay_to_domains
8731 </literallayout>
8732 <para>
8733 This statement rejects the address if its domain is neither a local domain nor
8734 one of the domains for which this host is a relay.
8735 </para>
8736 <literallayout class="monospaced">
8737 require verify = recipient
8738 </literallayout>
8739 <para>
8740 This statement requires the recipient address to be verified; if verification
8741 fails, the address is rejected.
8742 </para>
8743 <literallayout class="monospaced">
8744 # deny    message     = rejected because $sender_host_address \
8745 #                       is in a black list at $dnslist_domain\n\
8746 #                       $dnslist_text
8747 #         dnslists    = black.list.example
8748 #
8749 # warn    dnslists    = black.list.example
8750 #         add_header  = X-Warning: $sender_host_address is in \
8751 #                       a black list at $dnslist_domain
8752 #         log_message = found in $dnslist_domain
8753 </literallayout>
8754 <para>
8755 These commented-out lines are examples of how you could configure Exim to check
8756 sending hosts against a DNS black list. The first statement rejects messages
8757 from blacklisted hosts, whereas the second just inserts a warning header
8758 line.
8759 </para>
8760 <literallayout class="monospaced">
8761 # require verify = csa
8762 </literallayout>
8763 <para>
8764 This commented-out line is an example of how you could turn on client SMTP
8765 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8766 records.
8767 </para>
8768 <literallayout class="monospaced">
8769 accept
8770 </literallayout>
8771 <para>
8772 The final statement in the first ACL unconditionally accepts any recipient
8773 address that has successfully passed all the previous tests.
8774 </para>
8775 <literallayout class="monospaced">
8776 acl_check_data:
8777 </literallayout>
8778 <para>
8779 This line marks the start of the second ACL, and names it. Most of the contents
8780 of this ACL are commented out:
8781 </para>
8782 <literallayout class="monospaced">
8783 # deny    malware   = *
8784 #         message   = This message contains a virus \
8785 #                     ($malware_name).
8786 </literallayout>
8787 <para>
8788 These lines are examples of how to arrange for messages to be scanned for
8789 viruses when Exim has been compiled with the content-scanning extension, and a
8790 suitable virus scanner is installed. If the message is found to contain a
8791 virus, it is rejected with the given custom error message.
8792 </para>
8793 <literallayout class="monospaced">
8794 # warn    spam      = nobody
8795 #         message   = X-Spam_score: $spam_score\n\
8796 #                     X-Spam_score_int: $spam_score_int\n\
8797 #                     X-Spam_bar: $spam_bar\n\
8798 #                     X-Spam_report: $spam_report
8799 </literallayout>
8800 <para>
8801 These lines are an example of how to arrange for messages to be scanned by
8802 SpamAssassin when Exim has been compiled with the content-scanning extension,
8803 and SpamAssassin has been installed. The SpamAssassin check is run with
8804 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8805 series of extra header line. In this case, the message is not rejected,
8806 whatever the spam score.
8807 </para>
8808 <literallayout class="monospaced">
8809 accept
8810 </literallayout>
8811 <para>
8812 This final line in the DATA ACL accepts the message unconditionally.
8813 </para>
8814 </section>
8815 <section id="SECID55">
8816 <title>Router configuration</title>
8817 <para>
8818 <indexterm role="concept">
8819 <primary>default</primary>
8820 <secondary>routers</secondary>
8821 </indexterm>
8822 <indexterm role="concept">
8823 <primary>routers</primary>
8824 <secondary>default</secondary>
8825 </indexterm>
8826 The router configuration comes next in the default configuration, introduced
8827 by the line
8828 </para>
8829 <literallayout class="monospaced">
8830 begin routers
8831 </literallayout>
8832 <para>
8833 Routers are the modules in Exim that make decisions about where to send
8834 messages. An address is passed to each router in turn, until it is either
8835 accepted, or failed. This means that the order in which you define the routers
8836 matters. Each router is fully described in its own chapter later in this
8837 manual. Here we give only brief overviews.
8838 </para>
8839 <literallayout class="monospaced">
8840 # domain_literal:
8841 #   driver = ipliteral
8842 #   domains = !+local_domains
8843 #   transport = remote_smtp
8844 </literallayout>
8845 <para>
8846 <indexterm role="concept">
8847 <primary>domain literal</primary>
8848 <secondary>default router</secondary>
8849 </indexterm>
8850 This router is commented out because the majority of sites do not want to
8851 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8852 you uncomment this router, you also need to uncomment the setting of
8853 <option>allow_domain_literals</option> in the main part of the configuration.
8854 </para>
8855 <literallayout class="monospaced">
8856 dnslookup:
8857   driver = dnslookup
8858   domains = ! +local_domains
8859   transport = remote_smtp
8860   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8861   no_more
8862 </literallayout>
8863 <para>
8864 The first uncommented router handles addresses that do not involve any local
8865 domains. This is specified by the line
8866 </para>
8867 <literallayout class="monospaced">
8868 domains = ! +local_domains
8869 </literallayout>
8870 <para>
8871 The <option>domains</option> option lists the domains to which this router applies, but the
8872 exclamation mark is a negation sign, so the router is used only for domains
8873 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8874 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8875 indicates that it is referring to a named list. Addresses in other domains are
8876 passed on to the following routers.
8877 </para>
8878 <para>
8879 The name of the router driver is <command>dnslookup</command>,
8880 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8881 the name of this router instance is the same as the name of the driver. The
8882 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8883 one of the driver modules that is in the Exim binary.
8884 </para>
8885 <para>
8886 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8887 DNS in order to obtain a list of hosts to which the address is routed. If the
8888 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8889 specified by the <option>transport</option> option. If the router does not find the domain
8890 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8891 the address fails and is bounced.
8892 </para>
8893 <para>
8894 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8895 be entirely ignored. This option is present because a number of cases have been
8896 encountered where MX records in the DNS point to host names
8897 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8898 Completely ignoring these IP addresses causes Exim to fail to route the
8899 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8900 continue to try to deliver the message periodically until the address timed
8901 out.
8902 </para>
8903 <literallayout class="monospaced">
8904 system_aliases:
8905   driver = redirect
8906   allow_fail
8907   allow_defer
8908   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8909 # user = exim
8910   file_transport = address_file
8911   pipe_transport = address_pipe
8912 </literallayout>
8913 <para>
8914 Control reaches this and subsequent routers only for addresses in the local
8915 domains. This router checks to see whether the local part is defined as an
8916 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8917 data that it looks up from that file. If no data is found for the local part,
8918 the value of the <option>data</option> option is empty, causing the address to be passed to
8919 the next router.
8920 </para>
8921 <para>
8922 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8923 often used. That is why it is referenced by from the default configuration
8924 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8925 <filename>Local/Makefile</filename> before building Exim.
8926 </para>
8927 <literallayout class="monospaced">
8928 userforward:
8929   driver = redirect
8930   check_local_user
8931 # local_part_suffix = +* : -*
8932 # local_part_suffix_optional
8933   file = $home/.forward
8934 # allow_filter
8935   no_verify
8936   no_expn
8937   check_ancestor
8938   file_transport = address_file
8939   pipe_transport = address_pipe
8940   reply_transport = address_reply
8941 </literallayout>
8942 <para>
8943 This is the most complicated router in the default configuration. It is another
8944 redirection router, but this time it is looking for forwarding data set up by
8945 individual users. The <option>check_local_user</option> setting specifies a check that the
8946 local part of the address is the login name of a local user. If it is not, the
8947 router is skipped. The two commented options that follow <option>check_local_user</option>,
8948 namely:
8949 </para>
8950 <literallayout class="monospaced">
8951 # local_part_suffix = +* : -*
8952 # local_part_suffix_optional
8953 </literallayout>
8954 <para>
8955 <indexterm role="variable">
8956 <primary><varname>$local_part_suffix</varname></primary>
8957 </indexterm>
8958 show how you can specify the recognition of local part suffixes. If the first
8959 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8960 by any sequence of characters, is removed from the local part and placed in the
8961 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8962 presence of a suffix in the local part is optional. When a suffix is present,
8963 the check for a local login uses the local part with the suffix removed.
8964 </para>
8965 <para>
8966 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8967 home directory is consulted. If it does not exist, or is empty, the router
8968 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8969 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8970 </para>
8971 <para>
8972 <indexterm role="concept">
8973 <primary>Sieve filter</primary>
8974 <secondary>enabling in default router</secondary>
8975 </indexterm>
8976 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8977 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8978 is commented out by default), the contents of the file are interpreted as a set
8979 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8980 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8981 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8982 </para>
8983 <para>
8984 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8985 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8986 There are two reasons for doing this:
8987 </para>
8988 <orderedlist numeration="arabic">
8989 <listitem>
8990 <para>
8991 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8992 checking an address for validity; it makes sense not to waste resources doing
8993 unnecessary work.
8994 </para>
8995 </listitem>
8996 <listitem>
8997 <para>
8998 More importantly, when Exim is verifying addresses or handling an EXPN
8999 command during an SMTP session, it is running as the Exim user, not as root.
9000 The group is the Exim group, and no additional groups are set up.
9001 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9002 this time.
9003 </para>
9004 </listitem>
9005 </orderedlist>
9006 <para>
9007 The setting of <option>check_ancestor</option> prevents the router from generating a new
9008 address that is the same as any previous address that was redirected. (This
9009 works round a problem concerning a bad interaction between aliasing and
9010 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9011 </para>
9012 <para>
9013 The final three option settings specify the transports that are to be used when
9014 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9015 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9016 </para>
9017 <literallayout class="monospaced">
9018 a.nother@elsewhere.example, /home/spqr/archive
9019 </literallayout>
9020 <para>
9021 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9022 transport.
9023 </para>
9024 <literallayout class="monospaced">
9025 localuser:
9026   driver = accept
9027   check_local_user
9028 # local_part_suffix = +* : -*
9029 # local_part_suffix_optional
9030   transport = local_delivery
9031 </literallayout>
9032 <para>
9033 The final router sets up delivery into local mailboxes, provided that the local
9034 part is the name of a local login, by accepting the address and assigning it to
9035 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9036 routers, so the address is bounced. The commented suffix settings fulfil the
9037 same purpose as they do for the <command>userforward</command> router.
9038 </para>
9039 </section>
9040 <section id="SECID56">
9041 <title>Transport configuration</title>
9042 <para>
9043 <indexterm role="concept">
9044 <primary>default</primary>
9045 <secondary>transports</secondary>
9046 </indexterm>
9047 <indexterm role="concept">
9048 <primary>transports</primary>
9049 <secondary>default</secondary>
9050 </indexterm>
9051 Transports define mechanisms for actually delivering messages. They operate
9052 only when referenced from routers, so the order in which they are defined does
9053 not matter. The transports section of the configuration starts with
9054 </para>
9055 <literallayout class="monospaced">
9056 begin transports
9057 </literallayout>
9058 <para>
9059 One remote transport and four local transports are defined.
9060 </para>
9061 <literallayout class="monospaced">
9062 remote_smtp:
9063   driver = smtp
9064 </literallayout>
9065 <para>
9066 This transport is used for delivering messages over SMTP connections. All its
9067 options are defaulted. The list of remote hosts comes from the router.
9068 </para>
9069 <literallayout class="monospaced">
9070 local_delivery:
9071   driver = appendfile
9072   file = /var/mail/$local_part
9073   delivery_date_add
9074   envelope_to_add
9075   return_path_add
9076 # group = mail
9077 # mode = 0660
9078 </literallayout>
9079 <para>
9080 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9081 traditional BSD mailbox format. By default it runs under the uid and gid of the
9082 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9083 directory. Some systems use the alternative approach of running mail deliveries
9084 under a particular group instead of using the sticky bit. The commented options
9085 show how this can be done.
9086 </para>
9087 <para>
9088 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9089 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9090 similarly-named options above.
9091 </para>
9092 <literallayout class="monospaced">
9093 address_pipe:
9094   driver = pipe
9095   return_output
9096 </literallayout>
9097 <para>
9098 This transport is used for handling deliveries to pipes that are generated by
9099 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9100 option specifies that any output generated by the pipe is to be returned to the
9101 sender.
9102 </para>
9103 <literallayout class="monospaced">
9104 address_file:
9105   driver = appendfile
9106   delivery_date_add
9107   envelope_to_add
9108   return_path_add
9109 </literallayout>
9110 <para>
9111 This transport is used for handling deliveries to files that are generated by
9112 redirection. The name of the file is not specified in this instance of
9113 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9114 </para>
9115 <literallayout class="monospaced">
9116 address_reply:
9117   driver = autoreply
9118 </literallayout>
9119 <para>
9120 This transport is used for handling automatic replies generated by users&#x2019;
9121 filter files.
9122 </para>
9123 </section>
9124 <section id="SECID57">
9125 <title>Default retry rule</title>
9126 <para>
9127 <indexterm role="concept">
9128 <primary>retry</primary>
9129 <secondary>default rule</secondary>
9130 </indexterm>
9131 <indexterm role="concept">
9132 <primary>default</primary>
9133 <secondary>retry rule</secondary>
9134 </indexterm>
9135 The retry section of the configuration file contains rules which affect the way
9136 Exim retries deliveries that cannot be completed at the first attempt. It is
9137 introduced by the line
9138 </para>
9139 <literallayout class="monospaced">
9140 begin retry
9141 </literallayout>
9142 <para>
9143 In the default configuration, there is just one rule, which applies to all
9144 errors:
9145 </para>
9146 <literallayout class="monospaced">
9147 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9148 </literallayout>
9149 <para>
9150 This causes any temporarily failing address to be retried every 15 minutes for
9151 2 hours, then at intervals starting at one hour and increasing by a factor of
9152 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9153 is not delivered after 4 days of temporary failure, it is bounced.
9154 </para>
9155 <para>
9156 If the retry section is removed from the configuration, or is empty (that is,
9157 if no retry rules are defined), Exim will not retry deliveries. This turns
9158 temporary errors into permanent errors.
9159 </para>
9160 </section>
9161 <section id="SECID58">
9162 <title>Rewriting configuration</title>
9163 <para>
9164 The rewriting section of the configuration, introduced by
9165 </para>
9166 <literallayout class="monospaced">
9167 begin rewrite
9168 </literallayout>
9169 <para>
9170 contains rules for rewriting addresses in messages as they arrive. There are no
9171 rewriting rules in the default configuration file.
9172 </para>
9173 </section>
9174 <section id="SECTdefconfauth">
9175 <title>Authenticators configuration</title>
9176 <para>
9177 <indexterm role="concept">
9178 <primary>AUTH</primary>
9179 <secondary>configuration</secondary>
9180 </indexterm>
9181 The authenticators section of the configuration, introduced by
9182 </para>
9183 <literallayout class="monospaced">
9184 begin authenticators
9185 </literallayout>
9186 <para>
9187 defines mechanisms for the use of the SMTP AUTH command. The default
9188 configuration file contains two commented-out example authenticators
9189 which support plaintext username/password authentication using the
9190 standard PLAIN mechanism and the traditional but non-standard LOGIN
9191 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9192 to support most MUA software.
9193 </para>
9194 <para>
9195 The example PLAIN authenticator looks like this:
9196 </para>
9197 <literallayout class="monospaced">
9198 #PLAIN:
9199 #  driver                  = plaintext
9200 #  server_set_id           = $auth2
9201 #  server_prompts          = :
9202 #  server_condition        = Authentication is not yet configured
9203 #  server_advertise_condition = ${if def:tls_in_cipher }
9204 </literallayout>
9205 <para>
9206 And the example LOGIN authenticator looks like this:
9207 </para>
9208 <literallayout class="monospaced">
9209 #LOGIN:
9210 #  driver                  = plaintext
9211 #  server_set_id           = $auth1
9212 #  server_prompts          = &lt;| Username: | Password:
9213 #  server_condition        = Authentication is not yet configured
9214 #  server_advertise_condition = ${if def:tls_in_cipher }
9215 </literallayout>
9216 <para>
9217 The <option>server_set_id</option> option makes Exim remember the authenticated username
9218 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9219 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9220 that it implements the details of the specific authentication mechanism,
9221 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9222 when Exim offers authentication to clients; in the examples, this is only
9223 when TLS or SSL has been started, so to enable the authenticators you also
9224 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9225 </para>
9226 <para>
9227 The <option>server_condition</option> setting defines how to verify that the username and
9228 password are correct. In the examples it just produces an error message.
9229 To make the authenticators work, you can use a string expansion
9230 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9231 </para>
9232 <para>
9233 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9234 usercode and password are in different positions.
9235 Chapter <xref linkend="CHAPplaintext"/> covers both.
9236 </para>
9237 <para>
9238 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9239 </para>
9240 </section>
9241 </chapter>
9242
9243 <chapter id="CHAPregexp">
9244 <title>Regular expressions</title>
9245 <para>
9246 <indexterm role="concept">
9247 <primary>regular expressions</primary>
9248 <secondary>library</secondary>
9249 </indexterm>
9250 <indexterm role="concept">
9251 <primary>PCRE</primary>
9252 </indexterm>
9253 Exim supports the use of regular expressions in many of its options. It
9254 uses the PCRE regular expression library; this provides regular expression
9255 matching that is compatible with Perl 5. The syntax and semantics of
9256 regular expressions is discussed in many Perl reference books, and also in
9257 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9258 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9259 </para>
9260 <para>
9261 The documentation for the syntax and semantics of the regular expressions that
9262 are supported by PCRE is included in the PCRE distribution, and no further
9263 description is included here. The PCRE functions are called from Exim using
9264 the default option settings (that is, with no PCRE options set), except that
9265 the PCRE_CASELESS option is set when the matching is required to be
9266 case-insensitive.
9267 </para>
9268 <para>
9269 In most cases, when a regular expression is required in an Exim configuration,
9270 it has to start with a circumflex, in order to distinguish it from plain text
9271 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9272 second item in the colon-separated list is a regular expression.
9273 </para>
9274 <literallayout class="monospaced">
9275 domains = a.b.c : ^\\d{3} : *.y.z : ...
9276 </literallayout>
9277 <para>
9278 The doubling of the backslash is required because of string expansion that
9279 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9280 of this issue, and a way of avoiding the need for doubling backslashes. The
9281 regular expression that is eventually used in this example contains just one
9282 backslash. The circumflex is included in the regular expression, and has the
9283 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9284 matched.
9285 </para>
9286 <para>
9287 There are, however, two cases where a circumflex is not required for the
9288 recognition of a regular expression: these are the <option>match</option> condition in a
9289 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9290 these cases, the relevant string is always treated as a regular expression; if
9291 it does not start with a circumflex, the expression is not anchored, and can
9292 match anywhere in the subject string.
9293 </para>
9294 <para>
9295 In all cases, if you want a regular expression to match at the end of a string,
9296 you must code the $ metacharacter to indicate this. For example:
9297 </para>
9298 <literallayout class="monospaced">
9299 domains = ^\\d{3}\\.example
9300 </literallayout>
9301 <para>
9302 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9303 You need to use:
9304 </para>
9305 <literallayout class="monospaced">
9306 domains = ^\\d{3}\\.example\$
9307 </literallayout>
9308 <para>
9309 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9310 $ is needed because string expansion also interprets dollar characters.
9311 </para>
9312 </chapter>
9313
9314 <chapter id="CHAPfdlookup">
9315 <title>File and database lookups</title>
9316 <para>
9317 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9318 <primary>file</primary>
9319 <secondary>lookups</secondary>
9320 </indexterm>
9321 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9322 <primary>database</primary>
9323 <secondary>lookups</secondary>
9324 </indexterm>
9325 <indexterm role="concept">
9326 <primary>lookup</primary>
9327 <secondary>description of</secondary>
9328 </indexterm>
9329 Exim can be configured to look up data in files or databases as it processes
9330 messages. Two different kinds of syntax are used:
9331 </para>
9332 <orderedlist numeration="arabic">
9333 <listitem>
9334 <para>
9335 A string that is to be expanded may contain explicit lookup requests. These
9336 cause parts of the string to be replaced by data that is obtained from the
9337 lookup. Lookups of this type are conditional expansion items. Different results
9338 can be defined for the cases of lookup success and failure. See chapter
9339 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9340 </para>
9341 </listitem>
9342 <listitem>
9343 <para>
9344 Lists of domains, hosts, and email addresses can contain lookup requests as a
9345 way of avoiding excessively long linear lists. In this case, the data that is
9346 returned by the lookup is often (but not always) discarded; whether the lookup
9347 succeeds or fails is what really counts. These kinds of list are described in
9348 chapter <xref linkend="CHAPdomhosaddlists"/>.
9349 </para>
9350 </listitem>
9351 </orderedlist>
9352 <para>
9353 String expansions, lists, and lookups interact with each other in such a way
9354 that there is no order in which to describe any one of them that does not
9355 involve references to the others. Each of these three chapters makes more sense
9356 if you have read the other two first. If you are reading this for the first
9357 time, be aware that some of it will make a lot more sense after you have read
9358 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9359 </para>
9360 <section id="SECID60">
9361 <title>Examples of different lookup syntax</title>
9362 <para>
9363 It is easy to confuse the two different kinds of lookup, especially as the
9364 lists that may contain the second kind are always expanded before being
9365 processed as lists. Therefore, they may also contain lookups of the first kind.
9366 Be careful to distinguish between the following two examples:
9367 </para>
9368 <literallayout class="monospaced">
9369 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9370 domains = lsearch;/some/file
9371 </literallayout>
9372 <para>
9373 The first uses a string expansion, the result of which must be a domain list.
9374 No strings have been specified for a successful or a failing lookup; the
9375 defaults in this case are the looked-up data and an empty string, respectively.
9376 The expansion takes place before the string is processed as a list, and the
9377 file that is searched could contain lines like this:
9378 </para>
9379 <literallayout class="monospaced">
9380 192.168.3.4: domain1:domain2:...
9381 192.168.1.9: domain3:domain4:...
9382 </literallayout>
9383 <para>
9384 When the lookup succeeds, the result of the expansion is a list of domains (and
9385 possibly other types of item that are allowed in domain lists).
9386 </para>
9387 <para>
9388 In the second example, the lookup is a single item in a domain list. It causes
9389 Exim to use a lookup to see if the domain that is being processed can be found
9390 in the file. The file could contains lines like this:
9391 </para>
9392 <literallayout class="monospaced">
9393 domain1:
9394 domain2:
9395 </literallayout>
9396 <para>
9397 Any data that follows the keys is not relevant when checking that the domain
9398 matches the list item.
9399 </para>
9400 <para>
9401 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9402 Consider a file containing lines like this:
9403 </para>
9404 <literallayout class="monospaced">
9405 192.168.5.6: lsearch;/another/file
9406 </literallayout>
9407 <para>
9408 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9409 first <option>domains</option> setting above generates the second setting, which therefore
9410 causes a second lookup to occur.
9411 </para>
9412 <para>
9413 The rest of this chapter describes the different lookup types that are
9414 available. Any of them can be used in any part of the configuration where a
9415 lookup is permitted.
9416 </para>
9417 </section>
9418 <section id="SECID61">
9419 <title>Lookup types</title>
9420 <para>
9421 <indexterm role="concept">
9422 <primary>lookup</primary>
9423 <secondary>types of</secondary>
9424 </indexterm>
9425 <indexterm role="concept">
9426 <primary>single-key lookup</primary>
9427 <secondary>definition of</secondary>
9428 </indexterm>
9429 Two different types of data lookup are implemented:
9430 </para>
9431 <itemizedlist>
9432 <listitem>
9433 <para>
9434 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9435 and a single key to search for. The key must be a non-empty string for the
9436 lookup to succeed. The lookup type determines how the file is searched.
9437 </para>
9438 </listitem>
9439 <listitem>
9440 <para>
9441 <indexterm role="concept">
9442 <primary>query-style lookup</primary>
9443 <secondary>definition of</secondary>
9444 </indexterm>
9445 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9446 key value is assumed by Exim for query-style lookups. You can use whichever
9447 Exim variables you need to construct the database query.
9448 </para>
9449 </listitem>
9450 </itemizedlist>
9451 <para>
9452 The code for each lookup type is in a separate source file that is included in
9453 the binary of Exim only if the corresponding compile-time option is set. The
9454 default settings in <filename>src/EDITME</filename> are:
9455 </para>
9456 <literallayout class="monospaced">
9457 LOOKUP_DBM=yes
9458 LOOKUP_LSEARCH=yes
9459 </literallayout>
9460 <para>
9461 which means that only linear searching and DBM lookups are included by default.
9462 For some types of lookup (e.g. SQL databases), you need to install appropriate
9463 libraries and header files before building Exim.
9464 </para>
9465 </section>
9466 <section id="SECTsinglekeylookups">
9467 <title>Single-key lookup types</title>
9468 <para>
9469 <indexterm role="concept">
9470 <primary>lookup</primary>
9471 <secondary>single-key types</secondary>
9472 </indexterm>
9473 <indexterm role="concept">
9474 <primary>single-key lookup</primary>
9475 <secondary>list of types</secondary>
9476 </indexterm>
9477 The following single-key lookup types are implemented:
9478 </para>
9479 <itemizedlist>
9480 <listitem>
9481 <para>
9482 <indexterm role="concept">
9483 <primary>cdb</primary>
9484 <secondary>description of</secondary>
9485 </indexterm>
9486 <indexterm role="concept">
9487 <primary>lookup</primary>
9488 <secondary>cdb</secondary>
9489 </indexterm>
9490 <indexterm role="concept">
9491 <primary>binary zero</primary>
9492 <secondary>in lookup key</secondary>
9493 </indexterm>
9494 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9495 string without a terminating binary zero. The cdb format is designed for
9496 indexed files that are read frequently and never updated, except by total
9497 re-creation. As such, it is particularly suitable for large files containing
9498 aliases or other indexed data referenced by an MTA. Information about cdb can
9499 be found in several places:
9500 </para>
9501 <literallayout>
9502 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9503 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9504 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9505 </literallayout>
9506 <para>
9507 A cdb distribution is not needed in order to build Exim with cdb support,
9508 because the code for reading cdb files is included directly in Exim itself.
9509 However, no means of building or testing cdb files is provided with Exim, so
9510 you need to obtain a cdb distribution in order to do this.
9511 </para>
9512 </listitem>
9513 <listitem>
9514 <para>
9515 <indexterm role="concept">
9516 <primary>DBM</primary>
9517 <secondary>lookup type</secondary>
9518 </indexterm>
9519 <indexterm role="concept">
9520 <primary>lookup</primary>
9521 <secondary>dbm</secondary>
9522 </indexterm>
9523 <indexterm role="concept">
9524 <primary>binary zero</primary>
9525 <secondary>in lookup key</secondary>
9526 </indexterm>
9527 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9528 DBM file by looking up the record with the given key. A terminating binary
9529 zero is included in the key that is passed to the DBM library. See section
9530 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9531 </para>
9532 <para>
9533 <indexterm role="concept">
9534 <primary>Berkeley DB library</primary>
9535 <secondary>file format</secondary>
9536 </indexterm>
9537 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9538 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9539 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9540 the DB_UNKNOWN option. This enables it to handle any of the types of database
9541 that the library supports, and can be useful for accessing DBM files created by
9542 other applications. (For earlier DB versions, DB_HASH is always used.)
9543 </para>
9544 </listitem>
9545 <listitem>
9546 <para>
9547 <indexterm role="concept">
9548 <primary>lookup</primary>
9549 <secondary>dbmjz</secondary>
9550 </indexterm>
9551 <indexterm role="concept">
9552 <primary>lookup</primary>
9553 <secondary>dbm &ndash; embedded NULs</secondary>
9554 </indexterm>
9555 <indexterm role="concept">
9556 <primary>sasldb2</primary>
9557 </indexterm>
9558 <indexterm role="concept">
9559 <primary>dbmjz lookup type</primary>
9560 </indexterm>
9561 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9562 interpreted as an Exim list; the elements of the list are joined together with
9563 ASCII NUL characters to form the lookup key.  An example usage would be to
9564 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9565 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9566 <command>cram_md5</command> authenticator.
9567 </para>
9568 </listitem>
9569 <listitem>
9570 <para>
9571 <indexterm role="concept">
9572 <primary>lookup</primary>
9573 <secondary>dbmnz</secondary>
9574 </indexterm>
9575 <indexterm role="concept">
9576 <primary>lookup</primary>
9577 <secondary>dbm &ndash; terminating zero</secondary>
9578 </indexterm>
9579 <indexterm role="concept">
9580 <primary>binary zero</primary>
9581 <secondary>in lookup key</secondary>
9582 </indexterm>
9583 <indexterm role="concept">
9584 <primary>Courier</primary>
9585 </indexterm>
9586 <indexterm role="concept">
9587 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9588 </indexterm>
9589 <indexterm role="concept">
9590 <primary>dbmnz lookup type</primary>
9591 </indexterm>
9592 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9593 is not included in the key that is passed to the DBM library. You may need this
9594 if you want to look up data in files that are created by or shared with some
9595 other application that does not use terminating zeros. For example, you need to
9596 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9597 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9598 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9599 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9600 </para>
9601 </listitem>
9602 <listitem>
9603 <para>
9604 <indexterm role="concept">
9605 <primary>lookup</primary>
9606 <secondary>dsearch</secondary>
9607 </indexterm>
9608 <indexterm role="concept">
9609 <primary>dsearch lookup type</primary>
9610 </indexterm>
9611 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9612 whose name is the key by calling the <function>lstat()</function> function. The key may not
9613 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9614 the lookup is the name of the entry, which may be a file, directory,
9615 symbolic link, or any other kind of directory entry. An example of how this
9616 lookup can be used to support virtual domains is given in section
9617 <xref linkend="SECTvirtualdomains"/>.
9618 </para>
9619 </listitem>
9620 <listitem>
9621 <para>
9622 <indexterm role="concept">
9623 <primary>lookup</primary>
9624 <secondary>iplsearch</secondary>
9625 </indexterm>
9626 <indexterm role="concept">
9627 <primary>iplsearch lookup type</primary>
9628 </indexterm>
9629 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9630 terminated by a colon or white space or the end of the line. The keys in the
9631 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9632 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9633 being interpreted as a key terminator. For example:
9634 </para>
9635 <literallayout class="monospaced">
9636 1.2.3.4:           data for 1.2.3.4
9637 192.168.0.0/16:    data for 192.168.0.0/16
9638 "abcd::cdab":      data for abcd::cdab
9639 "abcd:abcd::/32"   data for abcd:abcd::/32
9640 </literallayout>
9641 <para>
9642 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9643 file is searched linearly, using the CIDR masks where present, until a matching
9644 key is found. The first key that matches is used; there is no attempt to find a
9645 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9646 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9647 </para>
9648 <para>
9649 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9650 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9651 lookup types support only literal keys.
9652 </para>
9653 <para>
9654 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9655 the implicit key is the host&#x2019;s IP address rather than its name (see section
9656 <xref linkend="SECThoslispatsikey"/>).
9657 </para>
9658 </listitem>
9659 <listitem>
9660 <para>
9661 <indexterm role="concept">
9662 <primary>linear search</primary>
9663 </indexterm>
9664 <indexterm role="concept">
9665 <primary>lookup</primary>
9666 <secondary>lsearch</secondary>
9667 </indexterm>
9668 <indexterm role="concept">
9669 <primary>lsearch lookup type</primary>
9670 </indexterm>
9671 <indexterm role="concept">
9672 <primary>case sensitivity</primary>
9673 <secondary>in lsearch lookup</secondary>
9674 </indexterm>
9675 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9676 line beginning with the search key, terminated by a colon or white space or the
9677 end of the line. The search is case-insensitive; that is, upper and lower case
9678 letters are treated as the same. The first occurrence of the key that is found
9679 in the file is used.
9680 </para>
9681 <para>
9682 White space between the key and the colon is permitted. The remainder of the
9683 line, with leading and trailing white space removed, is the data. This can be
9684 continued onto subsequent lines by starting them with any amount of white
9685 space, but only a single space character is included in the data at such a
9686 junction. If the data begins with a colon, the key must be terminated by a
9687 colon, for example:
9688 </para>
9689 <literallayout class="monospaced">
9690 baduser:  :fail:
9691 </literallayout>
9692 <para>
9693 Empty lines and lines beginning with # are ignored, even if they occur in the
9694 middle of an item. This is the traditional textual format of alias files. Note
9695 that the keys in an <command>lsearch</command> file are literal strings. There is no
9696 wildcarding of any kind.
9697 </para>
9698 <para>
9699 <indexterm role="concept">
9700 <primary>lookup</primary>
9701 <secondary>lsearch &ndash; colons in keys</secondary>
9702 </indexterm>
9703 <indexterm role="concept">
9704 <primary>white space</primary>
9705 <secondary>in lsearch key</secondary>
9706 </indexterm>
9707 In most <command>lsearch</command> files, keys are not required to contain colons or #
9708 characters, or white space. However, if you need this feature, it is available.
9709 If a key begins with a doublequote character, it is terminated only by a
9710 matching quote (or end of line), and the normal escaping rules apply to its
9711 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9712 quoted keys (exactly as for unquoted keys). There is no special handling of
9713 quotes for the data part of an <command>lsearch</command> line.
9714 </para>
9715 </listitem>
9716 <listitem>
9717 <para>
9718 <indexterm role="concept">
9719 <primary>NIS lookup type</primary>
9720 </indexterm>
9721 <indexterm role="concept">
9722 <primary>lookup</primary>
9723 <secondary>NIS</secondary>
9724 </indexterm>
9725 <indexterm role="concept">
9726 <primary>binary zero</primary>
9727 <secondary>in lookup key</secondary>
9728 </indexterm>
9729 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9730 the given key, without a terminating binary zero. There is a variant called
9731 <command>nis0</command> which does include the terminating binary zero in the key. This is
9732 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9733 aliases; the full map names must be used.
9734 </para>
9735 </listitem>
9736 <listitem>
9737 <para>
9738 <indexterm role="concept">
9739 <primary>wildlsearch lookup type</primary>
9740 </indexterm>
9741 <indexterm role="concept">
9742 <primary>lookup</primary>
9743 <secondary>wildlsearch</secondary>
9744 </indexterm>
9745 <indexterm role="concept">
9746 <primary>nwildlsearch lookup type</primary>
9747 </indexterm>
9748 <indexterm role="concept">
9749 <primary>lookup</primary>
9750 <secondary>nwildlsearch</secondary>
9751 </indexterm>
9752 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9753 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9754 the file may be wildcarded. The difference between these two lookup types is
9755 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9756 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9757 </para>
9758 <para>
9759 <indexterm role="concept">
9760 <primary>case sensitivity</primary>
9761 <secondary>in (n)wildlsearch lookup</secondary>
9762 </indexterm>
9763 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9764 file that are regular expressions can be made case-sensitive by the use of
9765 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9766 </para>
9767 <orderedlist numeration="arabic">
9768 <listitem>
9769 <para>
9770 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9771 </para>
9772 <literallayout class="monospaced">
9773     *.a.b.c       data for anything.a.b.c
9774     *fish         data for anythingfish
9775 </literallayout>
9776 </listitem>
9777 <listitem>
9778 <para>
9779 The string may begin with a circumflex to indicate a regular expression. For
9780 example, for <command>wildlsearch</command>:
9781 </para>
9782 <literallayout class="monospaced">
9783     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9784 </literallayout>
9785 <para>
9786 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9787 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9788 string-expanded, the equivalent entry is:
9789 </para>
9790 <literallayout class="monospaced">
9791     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9792 </literallayout>
9793 <para>
9794 The case-insensitive flag is set at the start of compiling the regular
9795 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9796 For example, to make the entire pattern case-sensitive:
9797 </para>
9798 <literallayout class="monospaced">
9799     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9800 </literallayout>
9801 <para>
9802 If the regular expression contains white space or colon characters, you must
9803 either quote it (see <command>lsearch</command> above), or represent these characters in other
9804 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9805 colon. This may be easier than quoting, because if you quote, you have to
9806 escape all the backslashes inside the quotes.
9807 </para>
9808 <para>
9809 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9810 match for later use, because the results of all lookups are cached. If a lookup
9811 is repeated, the result is taken from the cache, and no actual pattern matching
9812 takes place. The values of all the numeric variables are unset after a
9813 <command>(n)wildlsearch</command> match.
9814 </para>
9815 </listitem>
9816 <listitem>
9817 <para>
9818 Although I cannot see it being of much use, the general matching function that
9819 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9820 lookup name terminated by a semicolon, and followed by lookup data. For
9821 example:
9822 </para>
9823 <literallayout class="monospaced">
9824     cdb;/some/file  data for keys that match the file
9825 </literallayout>
9826 <para>
9827 The data that is obtained from the nested lookup is discarded.
9828 </para>
9829 </listitem>
9830 </orderedlist>
9831 <para>
9832 Keys that do not match any of these patterns are interpreted literally. The
9833 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9834 be followed by optional colons.
9835 </para>
9836 <para>
9837 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9838 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9839 lookup types support only literal keys.
9840 </para>
9841 </listitem>
9842 </itemizedlist>
9843 </section>
9844 <section id="SECID62">
9845 <title>Query-style lookup types</title>
9846 <para>
9847 <indexterm role="concept">
9848 <primary>lookup</primary>
9849 <secondary>query-style types</secondary>
9850 </indexterm>
9851 <indexterm role="concept">
9852 <primary>query-style lookup</primary>
9853 <secondary>list of types</secondary>
9854 </indexterm>
9855 The supported query-style lookup types are listed below. Further details about
9856 many of them are given in later sections.
9857 </para>
9858 <itemizedlist>
9859 <listitem>
9860 <para>
9861 <indexterm role="concept">
9862 <primary>DNS</primary>
9863 <secondary>as a lookup type</secondary>
9864 </indexterm>
9865 <indexterm role="concept">
9866 <primary>lookup</primary>
9867 <secondary>DNS</secondary>
9868 </indexterm>
9869 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9870 are given in the supplied query. The resulting data is the contents of the
9871 records. See section <xref linkend="SECTdnsdb"/>.
9872 </para>
9873 </listitem>
9874 <listitem>
9875 <para>
9876 <indexterm role="concept">
9877 <primary>InterBase lookup type</primary>
9878 </indexterm>
9879 <indexterm role="concept">
9880 <primary>lookup</primary>
9881 <secondary>InterBase</secondary>
9882 </indexterm>
9883 <command>ibase</command>: This does a lookup in an InterBase database.
9884 </para>
9885 </listitem>
9886 <listitem>
9887 <para>
9888 <indexterm role="concept">
9889 <primary>LDAP</primary>
9890 <secondary>lookup type</secondary>
9891 </indexterm>
9892 <indexterm role="concept">
9893 <primary>lookup</primary>
9894 <secondary>LDAP</secondary>
9895 </indexterm>
9896 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9897 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9898 that permits values from multiple entries to be returned. A third variant
9899 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9900 any attribute values. See section <xref linkend="SECTldap"/>.
9901 </para>
9902 </listitem>
9903 <listitem>
9904 <para>
9905 <indexterm role="concept">
9906 <primary>MySQL</primary>
9907 <secondary>lookup type</secondary>
9908 </indexterm>
9909 <indexterm role="concept">
9910 <primary>lookup</primary>
9911 <secondary>MySQL</secondary>
9912 </indexterm>
9913 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9914 MySQL database. See section <xref linkend="SECTsql"/>.
9915 </para>
9916 </listitem>
9917 <listitem>
9918 <para>
9919 <indexterm role="concept">
9920 <primary>NIS+ lookup type</primary>
9921 </indexterm>
9922 <indexterm role="concept">
9923 <primary>lookup</primary>
9924 <secondary>NIS+</secondary>
9925 </indexterm>
9926 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9927 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9928 </para>
9929 </listitem>
9930 <listitem>
9931 <para>
9932 <indexterm role="concept">
9933 <primary>Oracle</primary>
9934 <secondary>lookup type</secondary>
9935 </indexterm>
9936 <indexterm role="concept">
9937 <primary>lookup</primary>
9938 <secondary>Oracle</secondary>
9939 </indexterm>
9940 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9941 Oracle database. See section <xref linkend="SECTsql"/>.
9942 </para>
9943 </listitem>
9944 <listitem>
9945 <para>
9946 <indexterm role="concept">
9947 <primary>lookup</primary>
9948 <secondary>passwd</secondary>
9949 </indexterm>
9950 <indexterm role="concept">
9951 <primary>passwd lookup type</primary>
9952 </indexterm>
9953 <indexterm role="concept">
9954 <primary><filename>/etc/passwd</filename></primary>
9955 </indexterm>
9956 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9957 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9958 success, the result string is the same as you would get from an <command>lsearch</command>
9959 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9960 password value. For example:
9961 </para>
9962 <literallayout class="monospaced">
9963 *:42:42:King Rat:/home/kr:/bin/bash
9964 </literallayout>
9965 </listitem>
9966 <listitem>
9967 <para>
9968 <indexterm role="concept">
9969 <primary>PostgreSQL lookup type</primary>
9970 </indexterm>
9971 <indexterm role="concept">
9972 <primary>lookup</primary>
9973 <secondary>PostgreSQL</secondary>
9974 </indexterm>
9975 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9976 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9977 </para>
9978 </listitem>
9979 <listitem>
9980 <para>
9981 <indexterm role="concept">
9982 <primary>sqlite lookup type</primary>
9983 </indexterm>
9984 <indexterm role="concept">
9985 <primary>lookup</primary>
9986 <secondary>sqlite</secondary>
9987 </indexterm>
9988 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9989 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9990 </para>
9991 </listitem>
9992 <listitem>
9993 <para>
9994 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9995 not likely to be useful in normal operation.
9996 </para>
9997 </listitem>
9998 <listitem>
9999 <para>
10000 <indexterm role="concept">
10001 <primary>whoson lookup type</primary>
10002 </indexterm>
10003 <indexterm role="concept">
10004 <primary>lookup</primary>
10005 <secondary>whoson</secondary>
10006 </indexterm>
10007 <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
10008 allows a server to check whether a particular (dynamically allocated) IP
10009 address is currently allocated to a known (trusted) user and, optionally, to
10010 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10011 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10012 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10013 <quote>POP before SMTP</quote> checking using ACL statements such as
10014 </para>
10015 <literallayout class="monospaced">
10016 require condition = \
10017   ${lookup whoson {$sender_host_address}{yes}{no}}
10018 </literallayout>
10019 <para>
10020 The query consists of a single IP address. The value returned is the name of
10021 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10022 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10023 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10024 </para>
10025 </listitem>
10026 </itemizedlist>
10027 </section>
10028 <section id="SECID63">
10029 <title>Temporary errors in lookups</title>
10030 <para>
10031 <indexterm role="concept">
10032 <primary>lookup</primary>
10033 <secondary>temporary error in</secondary>
10034 </indexterm>
10035 Lookup functions can return temporary error codes if the lookup cannot be
10036 completed. For example, an SQL or LDAP database might be unavailable. For this
10037 reason, it is not advisable to use a lookup that might do this for critical
10038 options such as a list of local domains.
10039 </para>
10040 <para>
10041 When a lookup cannot be completed in a router or transport, delivery
10042 of the message (to the relevant address) is deferred, as for any other
10043 temporary error. In other circumstances Exim may assume the lookup has failed,
10044 or may give up altogether.
10045 </para>
10046 </section>
10047 <section id="SECTdefaultvaluelookups">
10048 <title>Default values in single-key lookups</title>
10049 <para>
10050 <indexterm role="concept">
10051 <primary>wildcard lookups</primary>
10052 </indexterm>
10053 <indexterm role="concept">
10054 <primary>lookup</primary>
10055 <secondary>default values</secondary>
10056 </indexterm>
10057 <indexterm role="concept">
10058 <primary>lookup</primary>
10059 <secondary>wildcard</secondary>
10060 </indexterm>
10061 <indexterm role="concept">
10062 <primary>lookup</primary>
10063 <secondary>* added to type</secondary>
10064 </indexterm>
10065 <indexterm role="concept">
10066 <primary>default</primary>
10067 <secondary>in single-key lookups</secondary>
10068 </indexterm>
10069 In this context, a <quote>default value</quote> is a value specified by the administrator
10070 that is to be used if a lookup fails.
10071 </para>
10072 <para>
10073 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10074 lookups, the facilities of the query language must be used. An attempt to
10075 specify a default for a query-style lookup provokes an error.
10076 </para>
10077 <para>
10078 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10079 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10080 provide a default value. See also the section on partial matching below.
10081 </para>
10082 <para>
10083 <indexterm role="concept">
10084 <primary>*@ with single-key lookup</primary>
10085 </indexterm>
10086 <indexterm role="concept">
10087 <primary>lookup</primary>
10088 <secondary>*@ added to type</secondary>
10089 </indexterm>
10090 <indexterm role="concept">
10091 <primary>alias file</primary>
10092 <secondary>per-domain default</secondary>
10093 </indexterm>
10094 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10095 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10096 character, a second lookup is done with everything before the last @ replaced
10097 by *. This makes it possible to provide per-domain defaults in alias files
10098 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10099 take place because there is no @ in the key), <quote>*</quote> is looked up.
10100 For example, a <command>redirect</command> router might contain:
10101 </para>
10102 <literallayout class="monospaced">
10103 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10104 </literallayout>
10105 <para>
10106 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10107 looks up these keys, in this order:
10108 </para>
10109 <literallayout class="monospaced">
10110 jane@eyre.example
10111 *@eyre.example
10112 *
10113 </literallayout>
10114 <para>
10115 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10116 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10117 complete scan is done for each key, and only if it is not found at all does
10118 Exim move on to try the next key.
10119 </para>
10120 </section>
10121 <section id="SECTpartiallookup">
10122 <title>Partial matching in single-key lookups</title>
10123 <para>
10124 <indexterm role="concept">
10125 <primary>partial matching</primary>
10126 </indexterm>
10127 <indexterm role="concept">
10128 <primary>wildcard lookups</primary>
10129 </indexterm>
10130 <indexterm role="concept">
10131 <primary>lookup</primary>
10132 <secondary>partial matching</secondary>
10133 </indexterm>
10134 <indexterm role="concept">
10135 <primary>lookup</primary>
10136 <secondary>wildcard</secondary>
10137 </indexterm>
10138 <indexterm role="concept">
10139 <primary>asterisk</primary>
10140 <secondary>in search type</secondary>
10141 </indexterm>
10142 The normal operation of a single-key lookup is to search the file for an exact
10143 match with the given key. However, in a number of situations where domains are
10144 being looked up, it is useful to be able to do partial matching. In this case,
10145 information in the file that has a key starting with <quote>*.</quote> is matched by any
10146 domain that ends with the components that follow the full stop. For example, if
10147 a key in a DBM file is
10148 </para>
10149 <literallayout class="monospaced">
10150 *.dates.fict.example
10151 </literallayout>
10152 <para>
10153 then when partial matching is enabled this is matched by (amongst others)
10154 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10155 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10156 file.
10157 </para>
10158 <para>
10159 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10160 also not available for any lookup items in address lists (see section
10161 <xref linkend="SECTaddresslist"/>).
10162 </para>
10163 <para>
10164 Partial matching is implemented by doing a series of separate lookups using
10165 keys constructed by modifying the original subject key. This means that it can
10166 be used with any of the single-key lookup types, provided that
10167 partial matching keys
10168 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10169 Keys in the file that do not begin with the prefix are matched only by
10170 unmodified subject keys when partial matching is in use.
10171 </para>
10172 <para>
10173 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10174 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10175 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10176 is added at the start of the subject key, and it is looked up again. If that
10177 fails, further lookups are tried with dot-separated components removed from the
10178 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10179 remains.
10180 </para>
10181 <para>
10182 A minimum number of two non-* components are required. This can be adjusted
10183 by including a number before the hyphen in the search type. For example,
10184 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10185 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10186 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10187 up when the minimum number of non-* components is two:
10188 </para>
10189 <literallayout class="monospaced">
10190 2250.dates.fict.example
10191 *.2250.dates.fict.example
10192 *.dates.fict.example
10193 *.fict.example
10194 </literallayout>
10195 <para>
10196 As soon as one key in the sequence is successfully looked up, the lookup
10197 finishes.
10198 </para>
10199 <para>
10200 <indexterm role="concept">
10201 <primary>lookup</primary>
10202 <secondary>partial matching &ndash; changing prefix</secondary>
10203 </indexterm>
10204 <indexterm role="concept">
10205 <primary>prefix</primary>
10206 <secondary>for partial matching</secondary>
10207 </indexterm>
10208 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10209 changed. The motivation for this feature is to allow Exim to operate with file
10210 formats that are used by other MTAs. A different prefix can be supplied in
10211 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10212 </para>
10213 <literallayout class="monospaced">
10214 domains = partial(.)lsearch;/some/file
10215 </literallayout>
10216 <para>
10217 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10218 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10219 components is unchanged). The prefix may consist of any punctuation characters
10220 other than a closing parenthesis. It may be empty, for example:
10221 </para>
10222 <literallayout class="monospaced">
10223 domains = partial1()cdb;/some/file
10224 </literallayout>
10225 <para>
10226 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10227 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10228 </para>
10229 <para>
10230 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10231 just one non-wild component has failed, and the original key is shortened right
10232 down to the null string) depends on the prefix:
10233 </para>
10234 <itemizedlist>
10235 <listitem>
10236 <para>
10237 If the prefix has zero length, the whole lookup fails.
10238 </para>
10239 </listitem>
10240 <listitem>
10241 <para>
10242 If the prefix has length 1, a lookup for just the prefix is done. For
10243 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10244 </para>
10245 </listitem>
10246 <listitem>
10247 <para>
10248 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10249 remainder is looked up. With the default prefix, therefore, the final lookup is
10250 for <quote>*</quote> on its own.
10251 </para>
10252 </listitem>
10253 <listitem>
10254 <para>
10255 Otherwise, the whole prefix is looked up.
10256 </para>
10257 </listitem>
10258 </itemizedlist>
10259 <para>
10260 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10261 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10262 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10263 specified, adding <quote>*</quote> to the search type has no effect with the default
10264 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10265 lookups. However, there might be a use for lookup types such as
10266 <quote>partial0(.)lsearch*</quote>.
10267 </para>
10268 <para>
10269 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10270 in domain lists and the like. Partial matching works only in terms of
10271 dot-separated components; a key such as <literal>*fict.example</literal>
10272 in a database file is useless, because the asterisk in a partial matching
10273 subject key is always followed by a dot.
10274 </para>
10275 </section>
10276 <section id="SECID64">
10277 <title>Lookup caching</title>
10278 <para>
10279 <indexterm role="concept">
10280 <primary>lookup</primary>
10281 <secondary>caching</secondary>
10282 </indexterm>
10283 <indexterm role="concept">
10284 <primary>caching</primary>
10285 <secondary>lookup data</secondary>
10286 </indexterm>
10287 Exim caches all lookup results in order to avoid needless repetition of
10288 lookups. However, because (apart from the daemon) Exim operates as a collection
10289 of independent, short-lived processes, this caching applies only within a
10290 single Exim process. There is no inter-process lookup caching facility.
10291 </para>
10292 <para>
10293 For single-key lookups, Exim keeps the relevant files open in case there is
10294 another lookup that needs them. In some types of configuration this can lead to
10295 many files being kept open for messages with many recipients. To avoid hitting
10296 the operating system limit on the number of simultaneously open files, Exim
10297 closes the least recently used file when it needs to open more files than its
10298 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10299 </para>
10300 <para>
10301 The single-key lookup files are closed and the lookup caches are flushed at
10302 strategic points during delivery &ndash; for example, after all routing is
10303 complete.
10304 </para>
10305 </section>
10306 <section id="SECID65">
10307 <title>Quoting lookup data</title>
10308 <para>
10309 <indexterm role="concept">
10310 <primary>lookup</primary>
10311 <secondary>quoting</secondary>
10312 </indexterm>
10313 <indexterm role="concept">
10314 <primary>quoting</primary>
10315 <secondary>in lookups</secondary>
10316 </indexterm>
10317 When data from an incoming message is included in a query-style lookup, there
10318 is the possibility of special characters in the data messing up the syntax of
10319 the query. For example, a NIS+ query that contains
10320 </para>
10321 <literallayout class="monospaced">
10322 [name=$local_part]
10323 </literallayout>
10324 <para>
10325 will be broken if the local part happens to contain a closing square bracket.
10326 For NIS+, data can be enclosed in double quotes like this:
10327 </para>
10328 <literallayout class="monospaced">
10329 [name="$local_part"]
10330 </literallayout>
10331 <para>
10332 but this still leaves the problem of a double quote in the data. The rule for
10333 NIS+ is that double quotes must be doubled. Other lookup types have different
10334 rules, and to cope with the differing requirements, an expansion operator
10335 of the following form is provided:
10336 </para>
10337 <literallayout class="monospaced">
10338 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10339 </literallayout>
10340 <para>
10341 For example, the safest way to write the NIS+ query is
10342 </para>
10343 <literallayout class="monospaced">
10344 [name="${quote_nisplus:$local_part}"]
10345 </literallayout>
10346 <para>
10347 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10348 operator can be used for all lookup types, but has no effect for single-key
10349 lookups, since no quoting is ever needed in their key strings.
10350 </para>
10351 </section>
10352 <section id="SECTdnsdb">
10353 <title>More about dnsdb</title>
10354 <para>
10355 <indexterm role="concept">
10356 <primary>dnsdb lookup</primary>
10357 </indexterm>
10358 <indexterm role="concept">
10359 <primary>lookup</primary>
10360 <secondary>dnsdb</secondary>
10361 </indexterm>
10362 <indexterm role="concept">
10363 <primary>DNS</primary>
10364 <secondary>as a lookup type</secondary>
10365 </indexterm>
10366 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10367 of a record type and a domain name, separated by an equals sign. For example,
10368 an expansion string could contain:
10369 </para>
10370 <literallayout class="monospaced">
10371 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10372 </literallayout>
10373 <para>
10374 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10375 is used on its own as the result. If the lookup does not succeed, the
10376 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10377 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10378 </para>
10379 <para>
10380 The supported DNS record types are A, CNAME, MX, NS, PTR, SPF, SRV, and TXT,
10381 and, when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10382 configured). If no type is given, TXT is assumed. When the type is PTR,
10383 the data can be an IP address, written as normal; inversion and the addition of
10384 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10385 </para>
10386 <literallayout class="monospaced">
10387 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10388 </literallayout>
10389 <para>
10390 If the data for a PTR record is not a syntactically valid IP address, it is not
10391 altered and nothing is added.
10392 </para>
10393 <para>
10394 <indexterm role="concept">
10395 <primary>MX record</primary>
10396 <secondary>in <command>dnsdb</command> lookup</secondary>
10397 </indexterm>
10398 <indexterm role="concept">
10399 <primary>SRV record</primary>
10400 <secondary>in <command>dnsdb</command> lookup</secondary>
10401 </indexterm>
10402 For an MX lookup, both the preference value and the host name are returned for
10403 each record, separated by a space. For an SRV lookup, the priority, weight,
10404 port, and host name are returned for each record, separated by spaces.
10405 </para>
10406 <para>
10407 For any record type, if multiple records are found (or, for A6 lookups, if a
10408 single record leads to multiple addresses), the data is returned as a
10409 concatenation, with newline as the default separator. The order, of course,
10410 depends on the DNS resolver. You can specify a different separator character
10411 between multiple records by putting a right angle-bracket followed immediately
10412 by the new separator at the start of the query. For example:
10413 </para>
10414 <literallayout class="monospaced">
10415 ${lookup dnsdb{&gt;: a=host1.example}}
10416 </literallayout>
10417 <para>
10418 It is permitted to specify a space as the separator character. Further
10419 white space is ignored.
10420 </para>
10421 <para>
10422 <indexterm role="concept">
10423 <primary>TXT record</primary>
10424 <secondary>in <command>dnsdb</command> lookup</secondary>
10425 </indexterm>
10426 <indexterm role="concept">
10427 <primary>SPF record</primary>
10428 <secondary>in <command>dnsdb</command> lookup</secondary>
10429 </indexterm>
10430 For TXT records with multiple items of data, only the first item is returned,
10431 unless a separator for them is specified using a comma after the separator
10432 character followed immediately by the TXT record item separator. To concatenate
10433 items without a separator, use a semicolon instead. For SPF records the
10434 default behaviour is to concatenate multiple items without using a separator.
10435 </para>
10436 <literallayout class="monospaced">
10437 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10438 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10439 ${lookup dnsdb{spf=example.org}}
10440 </literallayout>
10441 <para>
10442 It is permitted to specify a space as the separator character. Further
10443 white space is ignored.
10444 </para>
10445 </section>
10446 <section id="SECID66">
10447 <title>Pseudo dnsdb record types</title>
10448 <para>
10449 <indexterm role="concept">
10450 <primary>MX record</primary>
10451 <secondary>in <command>dnsdb</command> lookup</secondary>
10452 </indexterm>
10453 By default, both the preference value and the host name are returned for
10454 each MX record, separated by a space. If you want only host names, you can use
10455 the pseudo-type MXH:
10456 </para>
10457 <literallayout class="monospaced">
10458 ${lookup dnsdb{mxh=a.b.example}}
10459 </literallayout>
10460 <para>
10461 In this case, the preference values are omitted, and just the host names are
10462 returned.
10463 </para>
10464 <para>
10465 <indexterm role="concept">
10466 <primary>name server for enclosing domain</primary>
10467 </indexterm>
10468 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10469 records on the given domain, but if none are found, it removes the first
10470 component of the domain name, and tries again. This process continues until NS
10471 records are found or there are no more components left (or there is a DNS
10472 error). In other words, it may return the name servers for a top-level domain,
10473 but it never returns the root name servers. If there are no NS records for the
10474 top-level domain, the lookup fails. Consider these examples:
10475 </para>
10476 <literallayout class="monospaced">
10477 ${lookup dnsdb{zns=xxx.quercite.com}}
10478 ${lookup dnsdb{zns=xxx.edu}}
10479 </literallayout>
10480 <para>
10481 Assuming that in each case there are no NS records for the full domain name,
10482 the first returns the name servers for <option>quercite.com</option>, and the second returns
10483 the name servers for <option>edu</option>.
10484 </para>
10485 <para>
10486 You should be careful about how you use this lookup because, unless the
10487 top-level domain does not exist, the lookup always returns some host names. The
10488 sort of use to which this might be put is for seeing if the name servers for a
10489 given domain are on a blacklist. You can probably assume that the name servers
10490 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10491 such a list.
10492 </para>
10493 <para>
10494 <indexterm role="concept">
10495 <primary>CSA</primary>
10496 <secondary>in <command>dnsdb</command> lookup</secondary>
10497 </indexterm>
10498 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10499 records according to the CSA rules, which are described in section
10500 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10501 not sufficient because of the extra parent domain search behaviour of CSA. The
10502 result of a successful lookup such as:
10503 </para>
10504 <literallayout class="monospaced">
10505 ${lookup dnsdb {csa=$sender_helo_name}}
10506 </literallayout>
10507 <para>
10508 has two space-separated fields: an authorization code and a target host name.
10509 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10510 authorization required but absent, or <quote>?</quote> for unknown.
10511 </para>
10512 <para revisionflag="changed">
10513 <indexterm role="concept">
10514 <primary>A+</primary>
10515 <secondary>in <command>dnsdb</command> lookup</secondary>
10516 </indexterm>
10517 The pseudo-type A+ performs an A6 lookup (if configured) followed by an AAAA
10518 and then an A lookup.  All results are returned; defer processing
10519 (see below) is handled separately for each lookup.  Example:
10520 </para>
10521 <literallayout class="monospaced" revisionflag="changed">
10522 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10523 </literallayout>
10524 </section>
10525 <section id="SECID67">
10526 <title>Multiple dnsdb lookups</title>
10527 <para>
10528 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10529 However, you can specify a list of domains or IP addresses in a single
10530 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10531 the default separator, but with the ability to change this. For example:
10532 </para>
10533 <literallayout class="monospaced">
10534 ${lookup dnsdb{one.domain.com:two.domain.com}}
10535 ${lookup dnsdb{a=one.host.com:two.host.com}}
10536 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10537 </literallayout>
10538 <para>
10539 In order to retain backwards compatibility, there is one special case: if
10540 the lookup type is PTR and no change of separator is specified, Exim looks
10541 to see if the rest of the string is precisely one IPv6 address. In this
10542 case, it does not treat it as a list.
10543 </para>
10544 <para>
10545 The data from each lookup is concatenated, with newline separators by default,
10546 in the same way that multiple DNS records for a single item are handled. A
10547 different separator can be specified, as described above.
10548 </para>
10549 <para>
10550 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10551 temporary DNS error for any of them, the behaviour is controlled by
10552 an optional keyword followed by a comma that may appear before the record
10553 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10554 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10555 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10556 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10557 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10558 error causes the whole lookup to defer only if none of the other lookups
10559 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10560 </para>
10561 <literallayout class="monospaced">
10562 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10563 ${lookup dnsdb{a=one.host.com:two.host.com}}
10564 </literallayout>
10565 <para>
10566 Thus, in the default case, as long as at least one of the DNS lookups
10567 yields some data, the lookup succeeds.
10568 </para>
10569 </section>
10570 <section id="SECTldap">
10571 <title>More about LDAP</title>
10572 <para>
10573 <indexterm role="concept">
10574 <primary>LDAP</primary>
10575 <secondary>lookup, more about</secondary>
10576 </indexterm>
10577 <indexterm role="concept">
10578 <primary>lookup</primary>
10579 <secondary>LDAP</secondary>
10580 </indexterm>
10581 <indexterm role="concept">
10582 <primary>Solaris</primary>
10583 <secondary>LDAP</secondary>
10584 </indexterm>
10585 The original LDAP implementation came from the University of Michigan; this has
10586 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10587 implementation comes from Netscape, and Solaris 7 and subsequent releases
10588 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10589 the lookup function level, their error handling is different. For this reason
10590 it is necessary to set a compile-time variable when building Exim with LDAP, to
10591 indicate which LDAP library is in use. One of the following should appear in
10592 your <filename>Local/Makefile</filename>:
10593 </para>
10594 <literallayout class="monospaced">
10595 LDAP_LIB_TYPE=UMICHIGAN
10596 LDAP_LIB_TYPE=OPENLDAP1
10597 LDAP_LIB_TYPE=OPENLDAP2
10598 LDAP_LIB_TYPE=NETSCAPE
10599 LDAP_LIB_TYPE=SOLARIS
10600 </literallayout>
10601 <para>
10602 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10603 same interface as the University of Michigan version.
10604 </para>
10605 <para>
10606 There are three LDAP lookup types in Exim. These behave slightly differently in
10607 the way they handle the results of a query:
10608 </para>
10609 <itemizedlist>
10610 <listitem>
10611 <para>
10612 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10613 gives an error.
10614 </para>
10615 </listitem>
10616 <listitem>
10617 <para>
10618 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10619 Distinguished Name that is returned rather than any attribute values.
10620 </para>
10621 </listitem>
10622 <listitem>
10623 <para>
10624 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10625 from all of them are returned.
10626 </para>
10627 </listitem>
10628 </itemizedlist>
10629 <para>
10630 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10631 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10632 the data returned by a successful lookup is described in the next section.
10633 First we explain how LDAP queries are coded.
10634 </para>
10635 </section>
10636 <section id="SECTforldaque">
10637 <title>Format of LDAP queries</title>
10638 <para>
10639 <indexterm role="concept">
10640 <primary>LDAP</primary>
10641 <secondary>query format</secondary>
10642 </indexterm>
10643 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10644 the configuration of a <command>redirect</command> router one might have this setting:
10645 </para>
10646 <literallayout class="monospaced">
10647 data = ${lookup ldap \
10648   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10649   c=UK?mailbox?base?}}
10650 </literallayout>
10651 <para>
10652 <indexterm role="concept">
10653 <primary>LDAP</primary>
10654 <secondary>with TLS</secondary>
10655 </indexterm>
10656 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10657 secure (encrypted) LDAP connections. The second of these ensures that an
10658 encrypted TLS connection is used.
10659 </para>
10660 <para>
10661 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10662 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10663 See the <option>ldap_start_tls</option> option.
10664 </para>
10665 </section>
10666 <section id="SECID68">
10667 <title>LDAP quoting</title>
10668 <para>
10669 <indexterm role="concept">
10670 <primary>LDAP</primary>
10671 <secondary>quoting</secondary>
10672 </indexterm>
10673 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10674 and the second because the LDAP query is represented as a URL. Furthermore,
10675 within an LDAP query, two different kinds of quoting are required. For this
10676 reason, there are two different LDAP-specific quoting operators.
10677 </para>
10678 <para>
10679 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10680 filter specifications. Conceptually, it first does the following conversions on
10681 the string:
10682 </para>
10683 <literallayout class="monospaced">
10684 *   =&gt;   \2A
10685 (   =&gt;   \28
10686 )   =&gt;   \29
10687 \   =&gt;   \5C
10688 </literallayout>
10689 <para>
10690 in accordance with RFC 2254. The resulting string is then quoted according
10691 to the rules for URLs, that is, all non-alphanumeric characters except
10692 </para>
10693 <literallayout class="monospaced">
10694 ! $ ' - . _ ( ) * +
10695 </literallayout>
10696 <para>
10697 are converted to their hex values, preceded by a percent sign. For example:
10698 </para>
10699 <literallayout class="monospaced">
10700 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10701 </literallayout>
10702 <para>
10703 yields
10704 </para>
10705 <literallayout class="monospaced">
10706 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10707 </literallayout>
10708 <para>
10709 Removing the URL quoting, this is (with a leading and a trailing space):
10710 </para>
10711 <literallayout class="monospaced">
10712 a\28bc\29\2A, a&lt;yz&gt;;
10713 </literallayout>
10714 <para>
10715 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10716 base DN specifications in queries. Conceptually, it first converts the string
10717 by inserting a backslash in front of any of the following characters:
10718 </para>
10719 <literallayout class="monospaced">
10720 , + " \ &lt; &gt; ;
10721 </literallayout>
10722 <para>
10723 It also inserts a backslash before any leading spaces or # characters, and
10724 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10725 is then quoted according to the rules for URLs. For example:
10726 </para>
10727 <literallayout class="monospaced">
10728 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10729 </literallayout>
10730 <para>
10731 yields
10732 </para>
10733 <literallayout class="monospaced">
10734 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10735 </literallayout>
10736 <para>
10737 Removing the URL quoting, this is (with a trailing space):
10738 </para>
10739 <literallayout class="monospaced">
10740 \ a(bc)*\, a\&lt;yz\&gt;\;\
10741 </literallayout>
10742 <para>
10743 There are some further comments about quoting in the section on LDAP
10744 authentication below.
10745 </para>
10746 </section>
10747 <section id="SECID69">
10748 <title>LDAP connections</title>
10749 <para>
10750 <indexterm role="concept">
10751 <primary>LDAP</primary>
10752 <secondary>connections</secondary>
10753 </indexterm>
10754 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10755 is in use, via a Unix domain socket. The example given above does not specify
10756 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10757 by starting it with
10758 </para>
10759 <literallayout class="monospaced">
10760 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10761 </literallayout>
10762 <para>
10763 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10764 used. When no server is specified in a query, a list of default servers is
10765 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10766 colon-separated list of servers which are tried in turn until one successfully
10767 handles a query, or there is a serious error. Successful handling either
10768 returns the requested data, or indicates that it does not exist. Serious errors
10769 are syntactical, or multiple values when only a single value is expected.
10770 Errors which cause the next server to be tried are connection failures, bind
10771 failures, and timeouts.
10772 </para>
10773 <para>
10774 For each server name in the list, a port number can be given. The standard way
10775 of specifying a host and port is to use a colon separator (RFC 1738). Because
10776 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10777 doubled. For example
10778 </para>
10779 <literallayout class="monospaced">
10780 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10781 </literallayout>
10782 <para>
10783 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10784 to the LDAP library with no server name, and the library&#x2019;s default (normally
10785 the local host) is used.
10786 </para>
10787 <para>
10788 If you are using the OpenLDAP library, you can connect to an LDAP server using
10789 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10790 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10791 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10792 not available.
10793 </para>
10794 <para>
10795 For this type of connection, instead of a host name for the server, a pathname
10796 for the socket is required, and the port number is not relevant. The pathname
10797 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10798 the query. In the former case, you can have settings such as
10799 </para>
10800 <literallayout class="monospaced">
10801 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10802 </literallayout>
10803 <para>
10804 When the pathname is given in the query, you have to escape the slashes as
10805 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10806 </para>
10807 <literallayout class="monospaced">
10808 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10809 </literallayout>
10810 <para>
10811 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10812 a pathname, it uses the Unix domain socket code, even if the query actually
10813 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10814 socket connection. This behaviour means that you can use a setting of
10815 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10816 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10817 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10818 backup host.
10819 </para>
10820 <para>
10821 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10822 specified, an error is diagnosed. However, if there are more items in
10823 <option>ldap_default_servers</option>, they are tried. In other words:
10824 </para>
10825 <itemizedlist>
10826 <listitem>
10827 <para>
10828 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10829 interface.
10830 </para>
10831 </listitem>
10832 <listitem>
10833 <para>
10834 Using <literal>ldapi</literal> with a host name causes an error.
10835 </para>
10836 </listitem>
10837 </itemizedlist>
10838 <para>
10839 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10840 <option>ldap_default_servers</option>, does whatever the library does by default.
10841 </para>
10842 </section>
10843 <section id="SECID70">
10844 <title>LDAP authentication and control information</title>
10845 <para>
10846 <indexterm role="concept">
10847 <primary>LDAP</primary>
10848 <secondary>authentication</secondary>
10849 </indexterm>
10850 The LDAP URL syntax provides no way of passing authentication and other control
10851 information to the server. To make this possible, the URL in an LDAP query may
10852 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10853 spaces. If a value contains spaces it must be enclosed in double quotes, and
10854 when double quotes are used, backslash is interpreted in the usual way inside
10855 them. The following names are recognized:
10856 </para>
10857 <literallayout>
10858 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10859 <literal>NETTIME    </literal>  set a timeout for a network operation
10860 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10861 <literal>PASS       </literal>  set the password, likewise
10862 <literal>REFERRALS  </literal>  set the referrals parameter
10863 <literal>SIZE       </literal>  set the limit for the number of entries returned
10864 <literal>TIME       </literal>  set the maximum waiting time for a query
10865 </literallayout>
10866 <para>
10867 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10868 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10869 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10870 library from trying to follow referrals issued by the LDAP server.
10871 </para>
10872 <para>
10873 The name CONNECT is an obsolete name for NETTIME, retained for
10874 backwards compatibility. This timeout (specified as a number of seconds) is
10875 enforced from the client end for operations that can be carried out over a
10876 network. Specifically, it applies to network connections and calls to the
10877 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10878 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10879 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10880 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10881 Netscape SDK; for OpenLDAP no action is taken.
10882 </para>
10883 <para>
10884 The TIME parameter (also a number of seconds) is passed to the server to
10885 set a server-side limit on the time taken to complete a search.
10886 </para>
10887 <para>
10888 Here is an example of an LDAP query in an Exim lookup that uses some of these
10889 values. This is a single line, folded to fit on the page:
10890 </para>
10891 <literallayout class="monospaced">
10892 ${lookup ldap
10893   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10894   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10895   {$value}fail}
10896 </literallayout>
10897 <para>
10898 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10899 any of the auxiliary data. Exim configuration settings that include lookups
10900 which contain password information should be preceded by <quote>hide</quote> to prevent
10901 non-admin users from using the <option>-bP</option> option to see their values.
10902 </para>
10903 <para>
10904 The auxiliary data items may be given in any order. The default is no
10905 connection timeout (the system timeout is used), no user or password, no limit
10906 on the number of entries returned, and no time limit on queries.
10907 </para>
10908 <para>
10909 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10910 removes any URL quoting that it may contain before passing it LDAP. Apparently
10911 some libraries do this for themselves, but some do not. Removing the URL
10912 quoting has two advantages:
10913 </para>
10914 <itemizedlist>
10915 <listitem>
10916 <para>
10917 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10918 DNs as with DNs inside actual queries.
10919 </para>
10920 </listitem>
10921 <listitem>
10922 <para>
10923 It permits spaces inside USER= DNs.
10924 </para>
10925 </listitem>
10926 </itemizedlist>
10927 <para>
10928 For example, a setting such as
10929 </para>
10930 <literallayout class="monospaced">
10931 USER=cn=${quote_ldap_dn:$1}
10932 </literallayout>
10933 <para>
10934 should work even if <varname>$1</varname> contains spaces.
10935 </para>
10936 <para>
10937 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10938 expansion operator, rather than the LDAP quote operators. The only reason this
10939 field needs quoting is to ensure that it conforms to the Exim syntax, which
10940 does not allow unquoted spaces. For example:
10941 </para>
10942 <literallayout class="monospaced">
10943 PASS=${quote:$3}
10944 </literallayout>
10945 <para>
10946 The LDAP authentication mechanism can be used to check passwords as part of
10947 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10948 <xref linkend="CHAPexpand"/>.
10949 </para>
10950 </section>
10951 <section id="SECID71">
10952 <title>Format of data returned by LDAP</title>
10953 <para>
10954 <indexterm role="concept">
10955 <primary>LDAP</primary>
10956 <secondary>returned data formats</secondary>
10957 </indexterm>
10958 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10959 as a sequence of values, for example
10960 </para>
10961 <literallayout class="monospaced">
10962 cn=manager, o=University of Cambridge, c=UK
10963 </literallayout>
10964 <para>
10965 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10966 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10967 the result between the data from different entries. It is possible for multiple
10968 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10969 you know that whatever values are returned all came from a single entry in the
10970 directory.
10971 </para>
10972 <para>
10973 In the common case where you specify a single attribute in your LDAP query, the
10974 result is not quoted, and does not contain the attribute name. If the attribute
10975 has multiple values, they are separated by commas.
10976 </para>
10977 <para>
10978 If you specify multiple attributes, the result contains space-separated, quoted
10979 strings, each preceded by the attribute name and an equals sign. Within the
10980 quotes, the quote character, backslash, and newline are escaped with
10981 backslashes, and commas are used to separate multiple values for the attribute.
10982 Apart from the escaping, the string within quotes takes the same form as the
10983 output when a single attribute is requested. Specifying no attributes is the
10984 same as specifying all of an entry&#x2019;s attributes.
10985 </para>
10986 <para>
10987 Here are some examples of the output format. The first line of each pair is an
10988 LDAP query, and the second is the data that is returned. The attribute called
10989 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10990 </para>
10991 <literallayout class="monospaced">
10992 ldap:///o=base?attr1?sub?(uid=fred)
10993 value1.1, value1.2
10994
10995 ldap:///o=base?attr2?sub?(uid=fred)
10996 value two
10997
10998 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10999 attr1="value1.1, value1.2" attr2="value two"
11000
11001 ldap:///o=base??sub?(uid=fred)
11002 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
11003 </literallayout>
11004 <para>
11005 The <option>extract</option> operator in string expansions can be used to pick out
11006 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
11007 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11008 results of LDAP lookups.
11009 </para>
11010 </section>
11011 <section id="SECTnisplus">
11012 <title>More about NIS+</title>
11013 <para>
11014 <indexterm role="concept">
11015 <primary>NIS+ lookup type</primary>
11016 </indexterm>
11017 <indexterm role="concept">
11018 <primary>lookup</primary>
11019 <secondary>NIS+</secondary>
11020 </indexterm>
11021 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11022 and field name. If this is given, the result of a successful query is the
11023 contents of the named field; otherwise the result consists of a concatenation
11024 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11025 values containing spaces are quoted. For example, the query
11026 </para>
11027 <literallayout class="monospaced">
11028 [name=mg1456],passwd.org_dir
11029 </literallayout>
11030 <para>
11031 might return the string
11032 </para>
11033 <literallayout class="monospaced">
11034 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11035 home=/home/mg1456 shell=/bin/bash shadow=""
11036 </literallayout>
11037 <para>
11038 (split over two lines here to fit on the page), whereas
11039 </para>
11040 <literallayout class="monospaced">
11041 [name=mg1456],passwd.org_dir:gcos
11042 </literallayout>
11043 <para>
11044 would just return
11045 </para>
11046 <literallayout class="monospaced">
11047 Martin Guerre
11048 </literallayout>
11049 <para>
11050 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11051 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11052 operator is to double any quote characters within the text.
11053 </para>
11054 </section>
11055 <section id="SECTsql">
11056 <title>SQL lookups</title>
11057 <para>
11058 <indexterm role="concept">
11059 <primary>SQL lookup types</primary>
11060 </indexterm>
11061 <indexterm role="concept">
11062 <primary>MySQL</primary>
11063 <secondary>lookup type</secondary>
11064 </indexterm>
11065 <indexterm role="concept">
11066 <primary>PostgreSQL lookup type</primary>
11067 </indexterm>
11068 <indexterm role="concept">
11069 <primary>lookup</primary>
11070 <secondary>MySQL</secondary>
11071 </indexterm>
11072 <indexterm role="concept">
11073 <primary>lookup</primary>
11074 <secondary>PostgreSQL</secondary>
11075 </indexterm>
11076 <indexterm role="concept">
11077 <primary>Oracle</primary>
11078 <secondary>lookup type</secondary>
11079 </indexterm>
11080 <indexterm role="concept">
11081 <primary>lookup</primary>
11082 <secondary>Oracle</secondary>
11083 </indexterm>
11084 <indexterm role="concept">
11085 <primary>InterBase lookup type</primary>
11086 </indexterm>
11087 <indexterm role="concept">
11088 <primary>lookup</primary>
11089 <secondary>InterBase</secondary>
11090 </indexterm>
11091 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
11092 databases. Queries for these databases contain SQL statements, so an example
11093 might be
11094 </para>
11095 <literallayout class="monospaced">
11096 ${lookup mysql{select mailbox from users where id='userx'}\
11097   {$value}fail}
11098 </literallayout>
11099 <para>
11100 If the result of the query contains more than one field, the data for each
11101 field in the row is returned, preceded by its name, so the result of
11102 </para>
11103 <literallayout class="monospaced">
11104 ${lookup pgsql{select home,name from users where id='userx'}\
11105   {$value}}
11106 </literallayout>
11107 <para>
11108 might be
11109 </para>
11110 <literallayout class="monospaced">
11111 home=/home/userx name="Mister X"
11112 </literallayout>
11113 <para>
11114 Empty values and values containing spaces are double quoted, with embedded
11115 quotes escaped by a backslash. If the result of the query contains just one
11116 field, the value is passed back verbatim, without a field name, for example:
11117 </para>
11118 <literallayout class="monospaced">
11119 Mister X
11120 </literallayout>
11121 <para>
11122 If the result of the query yields more than one row, it is all concatenated,
11123 with a newline between the data for each row.
11124 </para>
11125 </section>
11126 <section id="SECID72">
11127 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
11128 <para>
11129 <indexterm role="concept">
11130 <primary>MySQL</primary>
11131 <secondary>lookup type</secondary>
11132 </indexterm>
11133 <indexterm role="concept">
11134 <primary>PostgreSQL lookup type</primary>
11135 </indexterm>
11136 <indexterm role="concept">
11137 <primary>lookup</primary>
11138 <secondary>MySQL</secondary>
11139 </indexterm>
11140 <indexterm role="concept">
11141 <primary>lookup</primary>
11142 <secondary>PostgreSQL</secondary>
11143 </indexterm>
11144 <indexterm role="concept">
11145 <primary>Oracle</primary>
11146 <secondary>lookup type</secondary>
11147 </indexterm>
11148 <indexterm role="concept">
11149 <primary>lookup</primary>
11150 <secondary>Oracle</secondary>
11151 </indexterm>
11152 <indexterm role="concept">
11153 <primary>InterBase lookup type</primary>
11154 </indexterm>
11155 <indexterm role="concept">
11156 <primary>lookup</primary>
11157 <secondary>InterBase</secondary>
11158 </indexterm>
11159 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
11160 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
11161 option (as appropriate) must be set to a colon-separated list of server
11162 information.
11163 (For MySQL and PostgreSQL only, the global option need not be set if all
11164 queries contain their own server information &ndash; see section
11165 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
11166 items: host name, database name, user name, and password. In the case of
11167 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11168 name field is not used and should be empty. For example:
11169 </para>
11170 <literallayout class="monospaced">
11171 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11172 </literallayout>
11173 <para>
11174 Because password data is sensitive, you should always precede the setting with
11175 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11176 option. Here is an example where two MySQL servers are listed:
11177 </para>
11178 <literallayout class="monospaced">
11179 hide mysql_servers = localhost/users/root/secret:\
11180                      otherhost/users/root/othersecret
11181 </literallayout>
11182 <para>
11183 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11184 because this is a colon-separated list, the colon has to be doubled. For each
11185 query, these parameter groups are tried in order until a connection is made and
11186 a query is successfully processed. The result of a query may be that no data is
11187 found, but that is still a successful query. In other words, the list of
11188 servers provides a backup facility, not a list of different places to look.
11189 </para>
11190 <para>
11191 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11192 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11193 respectively, and the characters single-quote, double-quote, and backslash
11194 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
11195 addition, escapes the percent and underscore characters. This cannot be done
11196 for MySQL because these escapes are not recognized in contexts where these
11197 characters are not special.
11198 </para>
11199 </section>
11200 <section id="SECTspeserque">
11201 <title>Specifying the server in the query</title>
11202 <para>
11203 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
11204 it is possible to specify a list of servers with an individual query. This is
11205 done by starting the query with
11206 </para>
11207 <literallayout>
11208 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11209 </literallayout>
11210 <para>
11211 Each item in the list may take one of two forms:
11212 </para>
11213 <orderedlist numeration="arabic">
11214 <listitem>
11215 <para>
11216 If it contains no slashes it is assumed to be just a host name. The appropriate
11217 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11218 of the same name, and the remaining parameters (database, user, password) are
11219 taken from there.
11220 </para>
11221 </listitem>
11222 <listitem>
11223 <para>
11224 If it contains any slashes, it is taken as a complete parameter set.
11225 </para>
11226 </listitem>
11227 </orderedlist>
11228 <para>
11229 The list of servers is used in exactly the same way as the global list.
11230 Once a connection to a server has happened and a query has been
11231 successfully executed, processing of the lookup ceases.
11232 </para>
11233 <para>
11234 This feature is intended for use in master/slave situations where updates
11235 are occurring and you want to update the master rather than a slave. If the
11236 master is in the list as a backup for reading, you might have a global setting
11237 like this:
11238 </para>
11239 <literallayout class="monospaced">
11240 mysql_servers = slave1/db/name/pw:\
11241                 slave2/db/name/pw:\
11242                 master/db/name/pw
11243 </literallayout>
11244 <para>
11245 In an updating lookup, you could then write:
11246 </para>
11247 <literallayout class="monospaced">
11248 ${lookup mysql{servers=master; UPDATE ...} }
11249 </literallayout>
11250 <para>
11251 That query would then be sent only to the master server. If, on the other hand,
11252 the master is not to be used for reading, and so is not present in the global
11253 option, you can still update it by a query of this form:
11254 </para>
11255 <literallayout class="monospaced">
11256 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11257 </literallayout>
11258 </section>
11259 <section id="SECID73">
11260 <title>Special MySQL features</title>
11261 <para>
11262 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11263 causes a connection to the server on the local host by means of a Unix domain
11264 socket. An alternate socket can be specified in parentheses. The full syntax of
11265 each item in <option>mysql_servers</option> is:
11266 </para>
11267 <literallayout>
11268 &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;
11269 </literallayout>
11270 <para>
11271 Any of the three sub-parts of the first field can be omitted. For normal use on
11272 the local host it can be left blank or set to just <quote>localhost</quote>.
11273 </para>
11274 <para>
11275 No database need be supplied &ndash; but if it is absent here, it must be given in
11276 the queries.
11277 </para>
11278 <para>
11279 If a MySQL query is issued that does not request any data (an insert, update,
11280 or delete command), the result of the lookup is the number of rows affected.
11281 </para>
11282 <para>
11283 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11284 anything (for example, setting a field to the value it already has), the result
11285 is zero because no rows are affected.
11286 </para>
11287 </section>
11288 <section id="SECID74">
11289 <title>Special PostgreSQL features</title>
11290 <para>
11291 PostgreSQL lookups can also use Unix domain socket connections to the database.
11292 This is usually faster and costs less CPU time than a TCP/IP connection.
11293 However it can be used only if the mail server runs on the same machine as the
11294 database server. A configuration line for PostgreSQL via Unix domain sockets
11295 looks like this:
11296 </para>
11297 <literallayout class="monospaced">
11298 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11299 </literallayout>
11300 <para>
11301 In other words, instead of supplying a host name, a path to the socket is
11302 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11303 visually confused with the delimiters for the other server parameters.
11304 </para>
11305 <para>
11306 If a PostgreSQL query is issued that does not request any data (an insert,
11307 update, or delete command), the result of the lookup is the number of rows
11308 affected.
11309 </para>
11310 </section>
11311 <section id="SECTsqlite">
11312 <title>More about SQLite</title>
11313 <para>
11314 <indexterm role="concept">
11315 <primary>lookup</primary>
11316 <secondary>SQLite</secondary>
11317 </indexterm>
11318 <indexterm role="concept">
11319 <primary>sqlite lookup type</primary>
11320 </indexterm>
11321 SQLite is different to the other SQL lookups because a file name is required in
11322 addition to the SQL query. An SQLite database is a single file, and there is no
11323 daemon as in the other SQL databases. The interface to Exim requires the name
11324 of the file, as an absolute path, to be given at the start of the query. It is
11325 separated from the query by white space. This means that the path name cannot
11326 contain white space. Here is a lookup expansion example:
11327 </para>
11328 <literallayout class="monospaced">
11329 ${lookup sqlite {/some/thing/sqlitedb \
11330   select name from aliases where id='userx';}}
11331 </literallayout>
11332 <para>
11333 In a list, the syntax is similar. For example:
11334 </para>
11335 <literallayout class="monospaced">
11336 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11337    select * from relays where ip='$sender_host_address';
11338 </literallayout>
11339 <para>
11340 The only character affected by the <option>quote_sqlite</option> operator is a single
11341 quote, which it doubles.
11342 </para>
11343 <para>
11344 The SQLite library handles multiple simultaneous accesses to the database
11345 internally. Multiple readers are permitted, but only one process can
11346 update at once. Attempts to access the database while it is being updated
11347 are rejected after a timeout period, during which the SQLite library
11348 waits for the lock to be released. In Exim, the default timeout is set
11349 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11350 option.
11351 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11352 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11353 </para>
11354 </section>
11355 </chapter>
11356
11357 <chapter id="CHAPdomhosaddlists">
11358 <title>Domain, host, address, and local part lists</title>
11359 <titleabbrev>Domain, host, and address lists</titleabbrev>
11360 <para>
11361 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11362 <primary>lists of domains; hosts; etc.</primary>
11363 </indexterm>
11364 A number of Exim configuration options contain lists of domains, hosts,
11365 email addresses, or local parts. For example, the <option>hold_domains</option> option
11366 contains a list of domains whose delivery is currently suspended. These lists
11367 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11368 arguments to expansion conditions such as <option>match_domain</option>.
11369 </para>
11370 <para>
11371 Each item in one of these lists is a pattern to be matched against a domain,
11372 host, email address, or local part, respectively. In the sections below, the
11373 different types of pattern for each case are described, but first we cover some
11374 general facilities that apply to all four kinds of list.
11375 </para>
11376 <section id="SECID75">
11377 <title>Expansion of lists</title>
11378 <para>
11379 <indexterm role="concept">
11380 <primary>expansion</primary>
11381 <secondary>of lists</secondary>
11382 </indexterm>
11383 Each list is expanded as a single string before it is used. The result of
11384 expansion must be a list, possibly containing empty items, which is split up
11385 into separate items for matching. By default, colon is the separator character,
11386 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11387 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11388 discusses the way to specify empty list items.
11389 </para>
11390 <para>
11391 If the string expansion is forced to fail, Exim behaves as if the item it is
11392 testing (domain, host, address, or local part) is not in the list. Other
11393 expansion failures cause temporary errors.
11394 </para>
11395 <para>
11396 If an item in a list is a regular expression, backslashes, dollars and possibly
11397 other special characters in the expression must be protected against
11398 misinterpretation by the string expander. The easiest way to do this is to use
11399 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11400 expression should not be expanded. For example, in an ACL you might have:
11401 </para>
11402 <literallayout class="monospaced">
11403 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11404                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11405 </literallayout>
11406 <para>
11407 The first item is a regular expression that is protected from expansion by
11408 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11409 senders based on the receiving domain.
11410 </para>
11411 </section>
11412 <section id="SECID76">
11413 <title>Negated items in lists</title>
11414 <para>
11415 <indexterm role="concept">
11416 <primary>list</primary>
11417 <secondary>negation</secondary>
11418 </indexterm>
11419 <indexterm role="concept">
11420 <primary>negation</primary>
11421 <secondary>in lists</secondary>
11422 </indexterm>
11423 Items in a list may be positive or negative. Negative items are indicated by a
11424 leading exclamation mark, which may be followed by optional white space. A list
11425 defines a set of items (domains, etc). When Exim processes one of these lists,
11426 it is trying to find out whether a domain, host, address, or local part
11427 (respectively) is in the set that is defined by the list. It works like this:
11428 </para>
11429 <para>
11430 The list is scanned from left to right. If a positive item is matched, the
11431 subject that is being checked is in the set; if a negative item is matched, the
11432 subject is not in the set. If the end of the list is reached without the
11433 subject having matched any of the patterns, it is in the set if the last item
11434 was a negative one, but not if it was a positive one. For example, the list in
11435 </para>
11436 <literallayout class="monospaced">
11437 domainlist relay_to_domains = !a.b.c : *.b.c
11438 </literallayout>
11439 <para>
11440 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11441 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11442 list is positive. However, if the setting were
11443 </para>
11444 <literallayout class="monospaced">
11445 domainlist relay_to_domains = !a.b.c
11446 </literallayout>
11447 <para>
11448 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11449 list is negative. In other words, a list that ends with a negative item behaves
11450 as if it had an extra item <literal>:*</literal> on the end.
11451 </para>
11452 <para>
11453 Another way of thinking about positive and negative items in lists is to read
11454 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11455 item.
11456 </para>
11457 </section>
11458 <section id="SECTfilnamlis">
11459 <title>File names in lists</title>
11460 <para>
11461 <indexterm role="concept">
11462 <primary>list</primary>
11463 <secondary>file name in</secondary>
11464 </indexterm>
11465 If an item in a domain, host, address, or local part list is an absolute file
11466 name (beginning with a slash character), each line of the file is read and
11467 processed as if it were an independent item in the list, except that further
11468 file names are not allowed,
11469 and no expansion of the data from the file takes place.
11470 Empty lines in the file are ignored, and the file may also contain comment
11471 lines:
11472 </para>
11473 <itemizedlist>
11474 <listitem>
11475 <para>
11476 For domain and host lists, if a # character appears anywhere in a line of the
11477 file, it and all following characters are ignored.
11478 </para>
11479 </listitem>
11480 <listitem>
11481 <para>
11482 Because local parts may legitimately contain # characters, a comment in an
11483 address list or local part list file is recognized only if # is preceded by
11484 white space or the start of the line. For example:
11485 </para>
11486 <literallayout class="monospaced">
11487 not#comment@x.y.z   # but this is a comment
11488 </literallayout>
11489 </listitem>
11490 </itemizedlist>
11491 <para>
11492 Putting a file name in a list has the same effect as inserting each line of the
11493 file as an item in the list (blank lines and comments excepted). However, there
11494 is one important difference: the file is read each time the list is processed,
11495 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11496 </para>
11497 <para>
11498 If a file name is preceded by an exclamation mark, the sense of any match
11499 within the file is inverted. For example, if
11500 </para>
11501 <literallayout class="monospaced">
11502 hold_domains = !/etc/nohold-domains
11503 </literallayout>
11504 <para>
11505 and the file contains the lines
11506 </para>
11507 <literallayout class="monospaced">
11508 !a.b.c
11509 *.b.c
11510 </literallayout>
11511 <para>
11512 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11513 any domain matching <literal>*.b.c</literal> is not.
11514 </para>
11515 </section>
11516 <section id="SECID77">
11517 <title>An lsearch file is not an out-of-line list</title>
11518 <para>
11519 As will be described in the sections that follow, lookups can be used in lists
11520 to provide indexed methods of checking list membership. There has been some
11521 confusion about the way <command>lsearch</command> lookups work in lists. Because
11522 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11523 sometimes thought that it is allowed to contain wild cards and other kinds of
11524 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11525 always fixed strings, just as for any other single-key lookup type.
11526 </para>
11527 <para>
11528 If you want to use a file to contain wild-card patterns that form part of a
11529 list, just give the file name on its own, without a search type, as described
11530 in the previous section. You could also use the <command>wildlsearch</command> or
11531 <command>nwildlsearch</command>, but there is no advantage in doing this.
11532 </para>
11533 </section>
11534 <section id="SECTnamedlists">
11535 <title>Named lists</title>
11536 <para>
11537 <indexterm role="concept">
11538 <primary>named lists</primary>
11539 </indexterm>
11540 <indexterm role="concept">
11541 <primary>list</primary>
11542 <secondary>named</secondary>
11543 </indexterm>
11544 A list of domains, hosts, email addresses, or local parts can be given a name
11545 which is then used to refer to the list elsewhere in the configuration. This is
11546 particularly convenient if the same list is required in several different
11547 places. It also allows lists to be given meaningful names, which can improve
11548 the readability of the configuration. For example, it is conventional to define
11549 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11550 locally on a host, using a configuration line such as
11551 </para>
11552 <literallayout class="monospaced">
11553 domainlist local_domains = localhost:my.dom.example
11554 </literallayout>
11555 <para>
11556 Named lists are referenced by giving their name preceded by a plus sign, so,
11557 for example, a router that is intended to handle local domains would be
11558 configured with the line
11559 </para>
11560 <literallayout class="monospaced">
11561 domains = +local_domains
11562 </literallayout>
11563 <para>
11564 The first router in a configuration is often one that handles all domains
11565 except the local ones, using a configuration with a negated item like this:
11566 </para>
11567 <literallayout class="monospaced">
11568 dnslookup:
11569   driver = dnslookup
11570   domains = ! +local_domains
11571   transport = remote_smtp
11572   no_more
11573 </literallayout>
11574 <para>
11575 The four kinds of named list are created by configuration lines starting with
11576 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11577 respectively. Then there follows the name that you are defining, followed by an
11578 equals sign and the list itself. For example:
11579 </para>
11580 <literallayout class="monospaced">
11581 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
11582 addresslist bad_senders = cdb;/etc/badsenders
11583 </literallayout>
11584 <para>
11585 A named list may refer to other named lists:
11586 </para>
11587 <literallayout class="monospaced">
11588 domainlist  dom1 = first.example : second.example
11589 domainlist  dom2 = +dom1 : third.example
11590 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11591 </literallayout>
11592 <para>
11593 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11594 effect may not be what you intended, because the negation does not propagate
11595 out to the higher level. For example, consider:
11596 </para>
11597 <literallayout class="monospaced">
11598 domainlist  dom1 = !a.b
11599 domainlist  dom2 = +dom1 : *.b
11600 </literallayout>
11601 <para>
11602 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11603 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11604 means it matches the second list as well. The effect is not the same as
11605 </para>
11606 <literallayout class="monospaced">
11607 domainlist  dom2 = !a.b : *.b
11608 </literallayout>
11609 <para>
11610 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11611 referenced lists if you can.
11612 </para>
11613 <para>
11614 Named lists may have a performance advantage. When Exim is routing an
11615 address or checking an incoming message, it caches the result of tests on named
11616 lists. So, if you have a setting such as
11617 </para>
11618 <literallayout class="monospaced">
11619 domains = +local_domains
11620 </literallayout>
11621 <para>
11622 on several of your routers
11623 or in several ACL statements,
11624 the actual test is done only for the first one. However, the caching works only
11625 if there are no expansions within the list itself or any sublists that it
11626 references. In other words, caching happens only for lists that are known to be
11627 the same each time they are referenced.
11628 </para>
11629 <para>
11630 By default, there may be up to 16 named lists of each type. This limit can be
11631 extended by changing a compile-time variable. The use of domain and host lists
11632 is recommended for concepts such as local domains, relay domains, and relay
11633 hosts. The default configuration is set up like this.
11634 </para>
11635 </section>
11636 <section id="SECID78">
11637 <title>Named lists compared with macros</title>
11638 <para>
11639 <indexterm role="concept">
11640 <primary>list</primary>
11641 <secondary>named compared with macro</secondary>
11642 </indexterm>
11643 <indexterm role="concept">
11644 <primary>macro</primary>
11645 <secondary>compared with named list</secondary>
11646 </indexterm>
11647 At first sight, named lists might seem to be no different from macros in the
11648 configuration file. However, macros are just textual substitutions. If you
11649 write
11650 </para>
11651 <literallayout class="monospaced">
11652 ALIST = host1 : host2
11653 auth_advertise_hosts = !ALIST
11654 </literallayout>
11655 <para>
11656 it probably won&#x2019;t do what you want, because that is exactly the same as
11657 </para>
11658 <literallayout class="monospaced">
11659 auth_advertise_hosts = !host1 : host2
11660 </literallayout>
11661 <para>
11662 Notice that the second host name is not negated. However, if you use a host
11663 list, and write
11664 </para>
11665 <literallayout class="monospaced">
11666 hostlist alist = host1 : host2
11667 auth_advertise_hosts = ! +alist
11668 </literallayout>
11669 <para>
11670 the negation applies to the whole list, and so that is equivalent to
11671 </para>
11672 <literallayout class="monospaced">
11673 auth_advertise_hosts = !host1 : !host2
11674 </literallayout>
11675 </section>
11676 <section id="SECID79">
11677 <title>Named list caching</title>
11678 <para>
11679 <indexterm role="concept">
11680 <primary>list</primary>
11681 <secondary>caching of named</secondary>
11682 </indexterm>
11683 <indexterm role="concept">
11684 <primary>caching</primary>
11685 <secondary>named lists</secondary>
11686 </indexterm>
11687 While processing a message, Exim caches the result of checking a named list if
11688 it is sure that the list is the same each time. In practice, this means that
11689 the cache operates only if the list contains no $ characters, which guarantees
11690 that it will not change when it is expanded. Sometimes, however, you may have
11691 an expanded list that you know will be the same each time within a given
11692 message. For example:
11693 </para>
11694 <literallayout class="monospaced">
11695 domainlist special_domains = \
11696            ${lookup{$sender_host_address}cdb{/some/file}}
11697 </literallayout>
11698 <para>
11699 This provides a list of domains that depends only on the sending host&#x2019;s IP
11700 address. If this domain list is referenced a number of times (for example,
11701 in several ACL lines, or in several routers) the result of the check is not
11702 cached by default, because Exim does not know that it is going to be the
11703 same list each time.
11704 </para>
11705 <para>
11706 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11707 cache the result anyway. For example:
11708 </para>
11709 <literallayout class="monospaced">
11710 domainlist_cache special_domains = ${lookup{...
11711 </literallayout>
11712 <para>
11713 If you do this, you should be absolutely sure that caching is going to do
11714 the right thing in all cases. When in doubt, leave it out.
11715 </para>
11716 </section>
11717 <section id="SECTdomainlist">
11718 <title>Domain lists</title>
11719 <para>
11720 <indexterm role="concept">
11721 <primary>domain list</primary>
11722 <secondary>patterns for</secondary>
11723 </indexterm>
11724 <indexterm role="concept">
11725 <primary>list</primary>
11726 <secondary>domain list</secondary>
11727 </indexterm>
11728 Domain lists contain patterns that are to be matched against a mail domain.
11729 The following types of item may appear in domain lists:
11730 </para>
11731 <itemizedlist>
11732 <listitem>
11733 <para>
11734 <indexterm role="concept">
11735 <primary>primary host name</primary>
11736 </indexterm>
11737 <indexterm role="concept">
11738 <primary>host name</primary>
11739 <secondary>matched in domain list</secondary>
11740 </indexterm>
11741 <indexterm role="option">
11742 <primary><option>primary_hostname</option></primary>
11743 </indexterm>
11744 <indexterm role="concept">
11745 <primary>domain list</primary>
11746 <secondary>matching primary host name</secondary>
11747 </indexterm>
11748 <indexterm role="concept">
11749 <primary>@ in a domain list</primary>
11750 </indexterm>
11751 If a pattern consists of a single @ character, it matches the local host name,
11752 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11753 possible to use the same configuration file on several different hosts that
11754 differ only in their names.
11755 </para>
11756 </listitem>
11757 <listitem>
11758 <para>
11759 <indexterm role="concept">
11760 <primary>@[] in a domain list</primary>
11761 </indexterm>
11762 <indexterm role="concept">
11763 <primary>domain list</primary>
11764 <secondary>matching local IP interfaces</secondary>
11765 </indexterm>
11766 <indexterm role="concept">
11767 <primary>domain literal</primary>
11768 </indexterm>
11769 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11770 in square brackets (as in an email address that contains a domain literal), but
11771 only if that IP address is recognized as local for email routing purposes. The
11772 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11773 control which of a host&#x2019;s several IP addresses are treated as local.
11774 In today&#x2019;s Internet, the use of domain literals is controversial.
11775 </para>
11776 </listitem>
11777 <listitem>
11778 <para>
11779 <indexterm role="concept">
11780 <primary>@mx_any</primary>
11781 </indexterm>
11782 <indexterm role="concept">
11783 <primary>@mx_primary</primary>
11784 </indexterm>
11785 <indexterm role="concept">
11786 <primary>@mx_secondary</primary>
11787 </indexterm>
11788 <indexterm role="concept">
11789 <primary>domain list</primary>
11790 <secondary>matching MX pointers to local host</secondary>
11791 </indexterm>
11792 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11793 has an MX record pointing to the local host or to any host that is listed in
11794 <indexterm role="option">
11795 <primary><option>hosts_treat_as_local</option></primary>
11796 </indexterm>
11797 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11798 are similar, except that the first matches only when a primary MX target is the
11799 local host, and the second only when no primary MX target is the local host,
11800 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11801 preference value &ndash; there may of course be more than one of them.
11802 </para>
11803 <para>
11804 The MX lookup that takes place when matching a pattern of this type is
11805 performed with the resolver options for widening names turned off. Thus, for
11806 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11807 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11808 options of the <command>dnslookup</command> router for a discussion of domain widening.
11809 </para>
11810 <para>
11811 Sometimes you may want to ignore certain IP addresses when using one of these
11812 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11813 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11814 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11815 on a router). For example:
11816 </para>
11817 <literallayout class="monospaced">
11818 domains = @mx_any/ignore=127.0.0.1
11819 </literallayout>
11820 <para>
11821 This example matches any domain that has an MX record pointing to one of
11822 the local host&#x2019;s IP addresses other than 127.0.0.1.
11823 </para>
11824 <para>
11825 The list of IP addresses is in fact processed by the same code that processes
11826 host lists, so it may contain CIDR-coded network specifications and it may also
11827 contain negative items.
11828 </para>
11829 <para>
11830 Because the list of IP addresses is a sublist within a domain list, you have to
11831 be careful about delimiters if there is more than one address. Like any other
11832 list, the default delimiter can be changed. Thus, you might have:
11833 </para>
11834 <literallayout class="monospaced">
11835 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11836           an.other.domain : ...
11837 </literallayout>
11838 <para>
11839 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11840 involved, it is easiest to change the delimiter for the main list as well:
11841 </para>
11842 <literallayout class="monospaced">
11843 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11844           an.other.domain ? ...
11845 </literallayout>
11846 </listitem>
11847 <listitem>
11848 <para>
11849 <indexterm role="concept">
11850 <primary>asterisk</primary>
11851 <secondary>in domain list</secondary>
11852 </indexterm>
11853 <indexterm role="concept">
11854 <primary>domain list</primary>
11855 <secondary>asterisk in</secondary>
11856 </indexterm>
11857 <indexterm role="concept">
11858 <primary>domain list</primary>
11859 <secondary>matching <quote>ends with</quote></secondary>
11860 </indexterm>
11861 If a pattern starts with an asterisk, the remaining characters of the pattern
11862 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11863 domain lists differs from its use in partial matching lookups. In a domain
11864 list, the character following the asterisk need not be a dot, whereas partial
11865 matching works only in terms of dot-separated components. For example, a domain
11866 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11867 <emphasis>cipher.key.ex</emphasis>.
11868 </para>
11869 </listitem>
11870 <listitem>
11871 <para>
11872 <indexterm role="concept">
11873 <primary>regular expressions</primary>
11874 <secondary>in domain list</secondary>
11875 </indexterm>
11876 <indexterm role="concept">
11877 <primary>domain list</primary>
11878 <secondary>matching regular expression</secondary>
11879 </indexterm>
11880 If a pattern starts with a circumflex character, it is treated as a regular
11881 expression, and matched against the domain using a regular expression matching
11882 function. The circumflex is treated as part of the regular expression.
11883 Email domains are case-independent, so this regular expression match is by
11884 default case-independent, but you can make it case-dependent by starting it
11885 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11886 are given in chapter <xref linkend="CHAPregexp"/>.
11887 </para>
11888 <para>
11889 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11890 must escape any backslash and dollar characters in the regular expression, or
11891 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11892 it is not to be expanded (unless you really do want to build a regular
11893 expression by expansion, of course).
11894 </para>
11895 </listitem>
11896 <listitem>
11897 <para>
11898 <indexterm role="concept">
11899 <primary>lookup</primary>
11900 <secondary>in domain list</secondary>
11901 </indexterm>
11902 <indexterm role="concept">
11903 <primary>domain list</primary>
11904 <secondary>matching by lookup</secondary>
11905 </indexterm>
11906 If a pattern starts with the name of a single-key lookup type followed by a
11907 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11908 must be a file name in a suitable format for the lookup type. For example, for
11909 <quote>cdb;</quote> it must be an absolute path:
11910 </para>
11911 <literallayout class="monospaced">
11912 domains = cdb;/etc/mail/local_domains.cdb
11913 </literallayout>
11914 <para>
11915 The appropriate type of lookup is done on the file using the domain name as the
11916 key. In most cases, the data that is looked up is not used; Exim is interested
11917 only in whether or not the key is present in the file. However, when a lookup
11918 is used for the <option>domains</option> option on a router
11919 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11920 <varname>$domain_data</varname> variable and can be referred to in other router options or
11921 other statements in the same ACL.
11922 </para>
11923 </listitem>
11924 <listitem>
11925 <para>
11926 Any of the single-key lookup type names may be preceded by
11927 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11928 </para>
11929 <literallayout class="monospaced">
11930 domains = partial-dbm;/partial/domains
11931 </literallayout>
11932 <para>
11933 This causes partial matching logic to be invoked; a description of how this
11934 works is given in section <xref linkend="SECTpartiallookup"/>.
11935 </para>
11936 </listitem>
11937 <listitem>
11938 <para>
11939 <indexterm role="concept">
11940 <primary>asterisk</primary>
11941 <secondary>in lookup type</secondary>
11942 </indexterm>
11943 Any of the single-key lookup types may be followed by an asterisk. This causes
11944 a default lookup for a key consisting of a single asterisk to be done if the
11945 original lookup fails. This is not a useful feature when using a domain list to
11946 select particular domains (because any domain would match), but it might have
11947 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11948 expansion variable.
11949 </para>
11950 </listitem>
11951 <listitem>
11952 <para>
11953 If the pattern starts with the name of a query-style lookup type followed by a
11954 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11955 pattern must be an appropriate query for the lookup type, as described in
11956 chapter <xref linkend="CHAPfdlookup"/>. For example:
11957 </para>
11958 <literallayout class="monospaced">
11959 hold_domains = mysql;select domain from holdlist \
11960   where domain = '${quote_mysql:$domain}';
11961 </literallayout>
11962 <para>
11963 In most cases, the data that is looked up is not used (so for an SQL query, for
11964 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11965 whether or not the query succeeds. However, when a lookup is used for the
11966 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11967 variable and can be referred to in other options.
11968 </para>
11969 </listitem>
11970 <listitem>
11971 <para>
11972 <indexterm role="concept">
11973 <primary>domain list</primary>
11974 <secondary>matching literal domain name</secondary>
11975 </indexterm>
11976 If none of the above cases apply, a caseless textual comparison is made
11977 between the pattern and the domain.
11978 </para>
11979 </listitem>
11980 </itemizedlist>
11981 <para>
11982 Here is an example that uses several different kinds of pattern:
11983 </para>
11984 <literallayout class="monospaced">
11985 domainlist funny_domains = \
11986   @ : \
11987   lib.unseen.edu : \
11988   *.foundation.fict.example : \
11989   \N^[1-2]\d{3}\.fict\.example$\N : \
11990   partial-dbm;/opt/data/penguin/book : \
11991   nis;domains.byname : \
11992   nisplus;[name=$domain,status=local],domains.org_dir
11993 </literallayout>
11994 <para>
11995 There are obvious processing trade-offs among the various matching modes. Using
11996 an asterisk is faster than a regular expression, and listing a few names
11997 explicitly probably is too. The use of a file or database lookup is expensive,
11998 but may be the only option if hundreds of names are required. Because the
11999 patterns are tested in order, it makes sense to put the most commonly matched
12000 patterns earlier.
12001 </para>
12002 </section>
12003 <section id="SECThostlist">
12004 <title>Host lists</title>
12005 <para>
12006 <indexterm role="concept">
12007 <primary>host list</primary>
12008 <secondary>patterns in</secondary>
12009 </indexterm>
12010 <indexterm role="concept">
12011 <primary>list</primary>
12012 <secondary>host list</secondary>
12013 </indexterm>
12014 Host lists are used to control what remote hosts are allowed to do. For
12015 example, some hosts may be allowed to use the local host as a relay, and some
12016 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12017 two different ways, by name or by IP address. In a host list, some types of
12018 pattern are matched to a host name, and some are matched to an IP address.
12019 You need to be particularly careful with this when single-key lookups are
12020 involved, to ensure that the right value is being used as the key.
12021 </para>
12022 </section>
12023 <section id="SECID80">
12024 <title>Special host list patterns</title>
12025 <para>
12026 <indexterm role="concept">
12027 <primary>empty item in hosts list</primary>
12028 </indexterm>
12029 <indexterm role="concept">
12030 <primary>host list</primary>
12031 <secondary>empty string in</secondary>
12032 </indexterm>
12033 If a host list item is the empty string, it matches only when no remote host is
12034 involved. This is the case when a message is being received from a local
12035 process using SMTP on the standard input, that is, when a TCP/IP connection is
12036 not used.
12037 </para>
12038 <para>
12039 <indexterm role="concept">
12040 <primary>asterisk</primary>
12041 <secondary>in host list</secondary>
12042 </indexterm>
12043 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12044 the IP address nor the name is actually inspected.
12045 </para>
12046 </section>
12047 <section id="SECThoslispatip">
12048 <title>Host list patterns that match by IP address</title>
12049 <para>
12050 <indexterm role="concept">
12051 <primary>host list</primary>
12052 <secondary>matching IP addresses</secondary>
12053 </indexterm>
12054 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12055 the incoming address actually appears in the IPv6 host as
12056 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12057 list, it is converted into a traditional IPv4 address first. (Not all operating
12058 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12059 concerns.)
12060 </para>
12061 <para>
12062 The following types of pattern in a host list check the remote host by
12063 inspecting its IP address:
12064 </para>
12065 <itemizedlist>
12066 <listitem>
12067 <para>
12068 If the pattern is a plain domain name (not a regular expression, not starting
12069 with *, not a lookup of any kind), Exim calls the operating system function
12070 to find the associated IP address(es). Exim uses the newer
12071 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12072 This typically causes a forward DNS lookup of the name. The result is compared
12073 with the IP address of the subject host.
12074 </para>
12075 <para>
12076 If there is a temporary problem (such as a DNS timeout) with the host name
12077 lookup, a temporary error occurs. For example, if the list is being used in an
12078 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12079 temporary SMTP error code. If no IP address can be found for the host name,
12080 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12081 </para>
12082 </listitem>
12083 <listitem>
12084 <para>
12085 <indexterm role="concept">
12086 <primary>@ in a host list</primary>
12087 </indexterm>
12088 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12089 domain name, as just described.
12090 </para>
12091 </listitem>
12092 <listitem>
12093 <para>
12094 If the pattern is an IP address, it is matched against the IP address of the
12095 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12096 IPv6 addresses can be given in colon-separated format, but the colons have to
12097 be doubled so as not to be taken as item separators when the default list
12098 separator is used. IPv6 addresses are recognized even when Exim is compiled
12099 without IPv6 support. This means that if they appear in a host list on an
12100 IPv4-only host, Exim will not treat them as host names. They are just addresses
12101 that can never match a client host.
12102 </para>
12103 </listitem>
12104 <listitem>
12105 <para>
12106 <indexterm role="concept">
12107 <primary>@[] in a host list</primary>
12108 </indexterm>
12109 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12110 the local host. For example, if the local host is an IPv4 host with one
12111 interface address 10.45.23.56, these two ACL statements have the same effect:
12112 </para>
12113 <literallayout class="monospaced">
12114 accept hosts = 127.0.0.1 : 10.45.23.56
12115 accept hosts = @[]
12116 </literallayout>
12117 </listitem>
12118 <listitem>
12119 <para>
12120 <indexterm role="concept">
12121 <primary>CIDR notation</primary>
12122 </indexterm>
12123 If the pattern is an IP address followed by a slash and a mask length (for
12124 example 10.11.42.0/24), it is matched against the IP address of the subject
12125 host under the given mask. This allows, an entire network of hosts to be
12126 included (or excluded) by a single item. The mask uses CIDR notation; it
12127 specifies the number of address bits that must match, starting from the most
12128 significant end of the address.
12129 </para>
12130 <para>
12131 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12132 of a range of addresses. It is the number of bits in the network portion of the
12133 address. The above example specifies a 24-bit netmask, so it matches all 256
12134 addresses in the 10.11.42.0 network. An item such as
12135 </para>
12136 <literallayout class="monospaced">
12137 192.168.23.236/31
12138 </literallayout>
12139 <para>
12140 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12141 32 for an IPv4 address is the same as no mask at all; just a single address
12142 matches.
12143 </para>
12144 <para>
12145 Here is another example which shows an IPv4 and an IPv6 network:
12146 </para>
12147 <literallayout class="monospaced">
12148 recipient_unqualified_hosts = 192.168.0.0/16: \
12149                               3ffe::ffff::836f::::/48
12150 </literallayout>
12151 <para>
12152 The doubling of list separator characters applies only when these items
12153 appear inline in a host list. It is not required when indirecting via a file.
12154 For example:
12155 </para>
12156 <literallayout class="monospaced">
12157 recipient_unqualified_hosts = /opt/exim/unqualnets
12158 </literallayout>
12159 <para>
12160 could make use of a file containing
12161 </para>
12162 <literallayout class="monospaced">
12163 172.16.0.0/12
12164 3ffe:ffff:836f::/48
12165 </literallayout>
12166 <para>
12167 to have exactly the same effect as the previous example. When listing IPv6
12168 addresses inline, it is usually more convenient to use the facility for
12169 changing separator characters. This list contains the same two networks:
12170 </para>
12171 <literallayout class="monospaced">
12172 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12173                                  3ffe:ffff:836f::/48
12174 </literallayout>
12175 <para>
12176 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12177 list.
12178 </para>
12179 </listitem>
12180 </itemizedlist>
12181 </section>
12182 <section id="SECThoslispatsikey">
12183 <title>Host list patterns for single-key lookups by host address</title>
12184 <para>
12185 <indexterm role="concept">
12186 <primary>host list</primary>
12187 <secondary>lookup of IP address</secondary>
12188 </indexterm>
12189 When a host is to be identified by a single-key lookup of its complete IP
12190 address, the pattern takes this form:
12191 </para>
12192 <literallayout>
12193 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12194 </literallayout>
12195 <para>
12196 For example:
12197 </para>
12198 <literallayout class="monospaced">
12199 hosts_lookup = net-cdb;/hosts-by-ip.db
12200 </literallayout>
12201 <para>
12202 The text form of the IP address of the subject host is used as the lookup key.
12203 IPv6 addresses are converted to an unabbreviated form, using lower case
12204 letters, with dots as separators because colon is the key terminator in
12205 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12206 quoting the keys, but this is a facility that was added later.] The data
12207 returned by the lookup is not used.
12208 </para>
12209 <para>
12210 <indexterm role="concept">
12211 <primary>IP address</primary>
12212 <secondary>masking</secondary>
12213 </indexterm>
12214 <indexterm role="concept">
12215 <primary>host list</primary>
12216 <secondary>masked IP address</secondary>
12217 </indexterm>
12218 Single-key lookups can also be performed using masked IP addresses, using
12219 patterns of this form:
12220 </para>
12221 <literallayout>
12222 <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>
12223 </literallayout>
12224 <para>
12225 For example:
12226 </para>
12227 <literallayout class="monospaced">
12228 net24-dbm;/networks.db
12229 </literallayout>
12230 <para>
12231 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12232 length. A textual string is constructed from the masked value, followed by the
12233 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12234 is 192.168.34.6, the key that is looked up for the above example is
12235 <quote>192.168.34.0/24</quote>.
12236 </para>
12237 <para>
12238 When an IPv6 address is converted to a string, dots are normally used instead
12239 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12240 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12241 to quote keys was made available in <command>lsearch</command> files. However, the more
12242 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12243 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12244 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12245 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12246 addresses are always used.
12247 </para>
12248 <para>
12249 Ideally, it would be nice to tidy up this anomalous situation by changing to
12250 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12251 However, this would be an incompatible change that might break some existing
12252 configurations.
12253 </para>
12254 <para>
12255 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12256 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12257 the former case the key strings include the mask value, whereas in the latter
12258 case the IP address is used on its own.
12259 </para>
12260 </section>
12261 <section id="SECThoslispatnam">
12262 <title>Host list patterns that match by host name</title>
12263 <para>
12264 <indexterm role="concept">
12265 <primary>host</primary>
12266 <secondary>lookup failures</secondary>
12267 </indexterm>
12268 <indexterm role="concept">
12269 <primary>unknown host name</primary>
12270 </indexterm>
12271 <indexterm role="concept">
12272 <primary>host list</primary>
12273 <secondary>matching host name</secondary>
12274 </indexterm>
12275 There are several types of pattern that require Exim to know the name of the
12276 remote host. These are either wildcard patterns or lookups by name. (If a
12277 complete hostname is given without any wildcarding, it is used to find an IP
12278 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12279 above.)
12280 </para>
12281 <para>
12282 If the remote host name is not already known when Exim encounters one of these
12283 patterns, it has to be found from the IP address.
12284 Although many sites on the Internet are conscientious about maintaining reverse
12285 DNS data for their hosts, there are also many that do not do this.
12286 Consequently, a name cannot always be found, and this may lead to unwanted
12287 effects. Take care when configuring host lists with wildcarded name patterns.
12288 Consider what will happen if a name cannot be found.
12289 </para>
12290 <para>
12291 Because of the problems of determining host names from IP addresses, matching
12292 against host names is not as common as matching against IP addresses.
12293 </para>
12294 <para>
12295 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12296 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12297 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12298 are done can be changed by setting the <option>host_lookup_order</option> option. For
12299 security, once Exim has found one or more names, it looks up the IP addresses
12300 for these names and compares them with the IP address that it started with.
12301 Only those names whose IP addresses match are accepted. Any other names are
12302 discarded. If no names are left, Exim behaves as if the host name cannot be
12303 found. In the most common case there is only one name and one IP address.
12304 </para>
12305 <para>
12306 There are some options that control what happens if a host name cannot be
12307 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12308 </para>
12309 <para>
12310 <indexterm role="concept">
12311 <primary>host</primary>
12312 <secondary>alias for</secondary>
12313 </indexterm>
12314 <indexterm role="concept">
12315 <primary>alias for host</primary>
12316 </indexterm>
12317 As a result of aliasing, hosts may have more than one name. When processing any
12318 of the following types of pattern, all the host&#x2019;s names are checked:
12319 </para>
12320 <itemizedlist>
12321 <listitem>
12322 <para>
12323 <indexterm role="concept">
12324 <primary>asterisk</primary>
12325 <secondary>in host list</secondary>
12326 </indexterm>
12327 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12328 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12329 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12330 requirement. Other kinds of wildcarding require the use of a regular
12331 expression.
12332 </para>
12333 </listitem>
12334 <listitem>
12335 <para>
12336 <indexterm role="concept">
12337 <primary>regular expressions</primary>
12338 <secondary>in host list</secondary>
12339 </indexterm>
12340 <indexterm role="concept">
12341 <primary>host list</primary>
12342 <secondary>regular expression in</secondary>
12343 </indexterm>
12344 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12345 matched against the host name. Host names are case-independent, so this regular
12346 expression match is by default case-independent, but you can make it
12347 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12348 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12349 example,
12350 </para>
12351 <literallayout class="monospaced">
12352 ^(a|b)\.c\.d$
12353 </literallayout>
12354 <para>
12355 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12356 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12357 that backslash and dollar characters are not misinterpreted as part of the
12358 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12359 part of the string as non-expandable. For example:
12360 </para>
12361 <literallayout class="monospaced">
12362 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12363 </literallayout>
12364 <para>
12365 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12366 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12367 example. Without it, a match at the start of the host name is all that is
12368 required.
12369 </para>
12370 </listitem>
12371 </itemizedlist>
12372 </section>
12373 <section id="SECTbehipnot">
12374 <title>Behaviour when an IP address or name cannot be found</title>
12375 <para>
12376 <indexterm role="concept">
12377 <primary>host</primary>
12378 <secondary>lookup failures, permanent</secondary>
12379 </indexterm>
12380 While processing a host list, Exim may need to look up an IP address from a
12381 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12382 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12383 behaviour when it fails to find the information it is seeking is the same.
12384 </para>
12385 <para>
12386 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12387 apply to temporary DNS errors, whose handling is described in the next section.
12388 </para>
12389 <para>
12390 <indexterm role="concept">
12391 <primary><literal>+include_unknown</literal></primary>
12392 </indexterm>
12393 <indexterm role="concept">
12394 <primary><literal>+ignore_unknown</literal></primary>
12395 </indexterm>
12396 Exim parses a host list from left to right. If it encounters a permanent
12397 lookup failure in any item in the host list before it has found a match,
12398 Exim treats it as a failure and the default behavior is as if the host
12399 does not match the list. This may not always be what you want to happen.
12400 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12401 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12402 not recognized in an indirected file).
12403 </para>
12404 <itemizedlist>
12405 <listitem>
12406 <para>
12407 If any item that follows <literal>+include_unknown</literal> requires information that
12408 cannot found, Exim behaves as if the host does match the list. For example,
12409 </para>
12410 <literallayout class="monospaced">
12411 host_reject_connection = +include_unknown:*.enemy.ex
12412 </literallayout>
12413 <para>
12414 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12415 any hosts whose name it cannot find.
12416 </para>
12417 </listitem>
12418 <listitem>
12419 <para>
12420 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12421 be found, Exim ignores that item and proceeds to the rest of the list. For
12422 example:
12423 </para>
12424 <literallayout class="monospaced">
12425 accept hosts = +ignore_unknown : friend.example : \
12426                192.168.4.5
12427 </literallayout>
12428 <para>
12429 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12430 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12431 name can be found for 192.168.4.5, it is rejected.
12432 </para>
12433 </listitem>
12434 </itemizedlist>
12435 <para>
12436 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12437 list. The effect of each one lasts until the next, or until the end of the
12438 list.
12439 </para>
12440 <para revisionflag="changed">
12441 To explain the host/ip processing logic a different way for the same ACL:
12442 </para>
12443 <itemizedlist revisionflag="changed">
12444 <listitem>
12445 <para revisionflag="changed">
12446 If you have name lookups or wildcarded host names and
12447 IP addresses in the same host list, you should normally put the IP
12448 addresses first. For example, in an ACL you could have:
12449 </para>
12450 <literallayout class="monospaced" revisionflag="changed">
12451 accept hosts = 10.9.8.7 : *.friend.example
12452 </literallayout>
12453 <para revisionflag="changed">
12454 The reason you normally would order it this way lies in the
12455 left-to-right way that Exim processes lists.  It can test IP addresses
12456 without doing any DNS lookups, but when it reaches an item that requires
12457 a host name, it fails if it cannot find a host name to compare with the
12458 pattern. If the above list is given in the opposite order, the
12459 <option>accept</option> statement fails for a host whose name cannot be found, even
12460 if its IP address is 10.9.8.7.
12461 </para>
12462 </listitem>
12463 <listitem>
12464 <para revisionflag="changed">
12465 If you really do want to do the name check first, and still recognize the IP
12466 address, you can rewrite the ACL like this:
12467 </para>
12468 <literallayout class="monospaced" revisionflag="changed">
12469 accept hosts = *.friend.example
12470 accept hosts = 10.9.8.7
12471 </literallayout>
12472 <para revisionflag="changed">
12473 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12474 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12475 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12476 this section.
12477 </para>
12478 </listitem>
12479 </itemizedlist>
12480 </section>
12481 <section id="SECTtemdnserr">
12482 <title>Temporary DNS errors when looking up host information</title>
12483 <para>
12484 <indexterm role="concept">
12485 <primary>host</primary>
12486 <secondary>lookup failures, temporary</secondary>
12487 </indexterm>
12488 <indexterm role="concept">
12489 <primary><literal>+include_defer</literal></primary>
12490 </indexterm>
12491 <indexterm role="concept">
12492 <primary><literal>+ignore_defer</literal></primary>
12493 </indexterm>
12494 A temporary DNS lookup failure normally causes a defer action (except when
12495 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12496 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12497 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12498 section. These options should be used with care, probably only in non-critical
12499 host lists such as whitelists.
12500 </para>
12501 </section>
12502 <section id="SECThoslispatnamsk">
12503 <title>Host list patterns for single-key lookups by host name</title>
12504 <para>
12505 <indexterm role="concept">
12506 <primary>unknown host name</primary>
12507 </indexterm>
12508 <indexterm role="concept">
12509 <primary>host list</primary>
12510 <secondary>matching host name</secondary>
12511 </indexterm>
12512 If a pattern is of the form
12513 </para>
12514 <literallayout>
12515 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12516 </literallayout>
12517 <para>
12518 for example
12519 </para>
12520 <literallayout class="monospaced">
12521 dbm;/host/accept/list
12522 </literallayout>
12523 <para>
12524 a single-key lookup is performed, using the host name as its key. If the
12525 lookup succeeds, the host matches the item. The actual data that is looked up
12526 is not used.
12527 </para>
12528 <para>
12529 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12530 keys in the file, not IP addresses. If you want to do lookups based on IP
12531 addresses, you must precede the search type with <quote>net-</quote> (see section
12532 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12533 two items in the same list, one doing an address lookup and one doing a name
12534 lookup, both using the same file.
12535 </para>
12536 </section>
12537 <section id="SECID81">
12538 <title>Host list patterns for query-style lookups</title>
12539 <para>
12540 If a pattern is of the form
12541 </para>
12542 <literallayout>
12543 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
12544 </literallayout>
12545 <para>
12546 the query is obeyed, and if it succeeds, the host matches the item. The actual
12547 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12548 <varname>$sender_host_name</varname> can be used in the query. For example:
12549 </para>
12550 <literallayout class="monospaced">
12551 hosts_lookup = pgsql;\
12552   select ip from hostlist where ip='$sender_host_address'
12553 </literallayout>
12554 <para>
12555 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12556 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12557 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12558 operator.
12559 </para>
12560 <para>
12561 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12562 looks up the host name if it has not already done so. (See section
12563 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12564 </para>
12565 <para>
12566 Historical note: prior to release 4.30, Exim would always attempt to find a
12567 host name before running the query, unless the search type was preceded by
12568 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12569 still recognized for query-style lookups, but its presence or absence has no
12570 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12571 See section <xref linkend="SECThoslispatsikey"/>.)
12572 </para>
12573 </section>
12574 <section id="SECTmixwilhos">
12575 <title>Mixing wildcarded host names and addresses in host lists</title>
12576 <para>
12577 <indexterm role="concept">
12578 <primary>host list</primary>
12579 <secondary>mixing names and addresses in</secondary>
12580 </indexterm>
12581 If you have name lookups or wildcarded host names and IP addresses in the same
12582 host list, you should normally put the IP addresses first. For example, in an
12583 ACL you could have:
12584 </para>
12585 <literallayout class="monospaced">
12586 accept hosts = 10.9.8.7 : *.friend.example
12587 </literallayout>
12588 <para>
12589 The reason for this lies in the left-to-right way that Exim processes lists.
12590 It can test IP addresses without doing any DNS lookups, but when it reaches an
12591 item that requires a host name, it fails if it cannot find a host name to
12592 compare with the pattern. If the above list is given in the opposite order, the
12593 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12594 IP address is 10.9.8.7.
12595 </para>
12596 <para>
12597 If you really do want to do the name check first, and still recognize the IP
12598 address, you can rewrite the ACL like this:
12599 </para>
12600 <literallayout class="monospaced">
12601 accept hosts = *.friend.example
12602 accept hosts = 10.9.8.7
12603 </literallayout>
12604 <para>
12605 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12606 <xref linkend="CHAPACL"/> for details of ACLs.
12607 </para>
12608 </section>
12609 <section id="SECTaddresslist">
12610 <title>Address lists</title>
12611 <para>
12612 <indexterm role="concept">
12613 <primary>list</primary>
12614 <secondary>address list</secondary>
12615 </indexterm>
12616 <indexterm role="concept">
12617 <primary>address list</primary>
12618 <secondary>empty item</secondary>
12619 </indexterm>
12620 <indexterm role="concept">
12621 <primary>address list</primary>
12622 <secondary>patterns</secondary>
12623 </indexterm>
12624 Address lists contain patterns that are matched against mail addresses. There
12625 is one special case to be considered: the sender address of a bounce message is
12626 always empty. You can test for this by providing an empty item in an address
12627 list. For example, you can set up a router to process bounce messages by
12628 using this option setting:
12629 </para>
12630 <literallayout class="monospaced">
12631 senders = :
12632 </literallayout>
12633 <para>
12634 The presence of the colon creates an empty item. If you do not provide any
12635 data, the list is empty and matches nothing. The empty sender can also be
12636 detected by a regular expression that matches an empty string,
12637 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12638 </para>
12639 <para>
12640 Non-empty items in an address list can be straightforward email addresses. For
12641 example:
12642 </para>
12643 <literallayout class="monospaced">
12644 senders = jbc@askone.example : hs@anacreon.example
12645 </literallayout>
12646 <para>
12647 A certain amount of wildcarding is permitted. If a pattern contains an @
12648 character, but is not a regular expression and does not begin with a
12649 semicolon-terminated lookup type (described below), the local part of the
12650 subject address is compared with the local part of the pattern, which may start
12651 with an asterisk. If the local parts match, the domain is checked in exactly
12652 the same way as for a pattern in a domain list. For example, the domain can be
12653 wildcarded, refer to a named list, or be a lookup:
12654 </para>
12655 <literallayout class="monospaced">
12656 deny senders = *@*.spamming.site:\
12657                *@+hostile_domains:\
12658                bozo@partial-lsearch;/list/of/dodgy/sites:\
12659                *@dbm;/bad/domains.db
12660 </literallayout>
12661 <para>
12662 <indexterm role="concept">
12663 <primary>local part</primary>
12664 <secondary>starting with !</secondary>
12665 </indexterm>
12666 <indexterm role="concept">
12667 <primary>address list</primary>
12668 <secondary>local part starting with !</secondary>
12669 </indexterm>
12670 If a local part that begins with an exclamation mark is required, it has to be
12671 specified using a regular expression, because otherwise the exclamation mark is
12672 treated as a sign of negation, as is standard in lists.
12673 </para>
12674 <para>
12675 If a non-empty pattern that is not a regular expression or a lookup does not
12676 contain an @ character, it is matched against the domain part of the subject
12677 address. The only two formats that are recognized this way are a literal
12678 domain, or a domain pattern that starts with *. In both these cases, the effect
12679 is the same as if <literal>*@</literal> preceded the pattern. For example:
12680 </para>
12681 <literallayout class="monospaced">
12682 deny senders = enemy.domain : *.enemy.domain
12683 </literallayout>
12684 <para>
12685 The following kinds of more complicated address list pattern can match any
12686 address, including the empty address that is characteristic of bounce message
12687 senders:
12688 </para>
12689 <itemizedlist>
12690 <listitem>
12691 <para>
12692 <indexterm role="concept">
12693 <primary>regular expressions</primary>
12694 <secondary>in address list</secondary>
12695 </indexterm>
12696 <indexterm role="concept">
12697 <primary>address list</primary>
12698 <secondary>regular expression in</secondary>
12699 </indexterm>
12700 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12701 done against the complete address, with the pattern as the regular expression.
12702 You must take care that backslash and dollar characters are not misinterpreted
12703 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12704 to mark that part of the string as non-expandable. For example:
12705 </para>
12706 <literallayout class="monospaced">
12707 deny senders = \N^.*this.*@example\.com$\N : \
12708                \N^\d{8}.+@spamhaus.example$\N : ...
12709 </literallayout>
12710 <para>
12711 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12712 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12713 </para>
12714 </listitem>
12715 <listitem>
12716 <para>
12717 <indexterm role="concept">
12718 <primary>address list</primary>
12719 <secondary>lookup for complete address</secondary>
12720 </indexterm>
12721 Complete addresses can be looked up by using a pattern that starts with a
12722 lookup type terminated by a semicolon, followed by the data for the lookup. For
12723 example:
12724 </para>
12725 <literallayout class="monospaced">
12726 deny senders = cdb;/etc/blocked.senders : \
12727   mysql;select address from blocked where \
12728   address='${quote_mysql:$sender_address}'
12729 </literallayout>
12730 <para>
12731 Both query-style and single-key lookup types can be used. For a single-key
12732 lookup type, Exim uses the complete address as the key. However, empty keys are
12733 not supported for single-key lookups, so a match against the empty address
12734 always fails. This restriction does not apply to query-style lookups.
12735 </para>
12736 <para>
12737 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12738 cannot be used, and is ignored if specified, with an entry being written to the
12739 panic log.
12740 <indexterm role="concept">
12741 <primary>*@ with single-key lookup</primary>
12742 </indexterm>
12743 However, you can configure lookup defaults, as described in section
12744 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12745 default. For example, with this lookup:
12746 </para>
12747 <literallayout class="monospaced">
12748 accept senders = lsearch*@;/some/file
12749 </literallayout>
12750 <para>
12751 the file could contains lines like this:
12752 </para>
12753 <literallayout class="monospaced">
12754 user1@domain1.example
12755 *@domain2.example
12756 </literallayout>
12757 <para>
12758 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12759 that are tried is:
12760 </para>
12761 <literallayout class="monospaced">
12762 nimrod@jaeger.example
12763 *@jaeger.example
12764 *
12765 </literallayout>
12766 <para>
12767 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12768 would mean that every address matches, thus rendering the test useless.
12769 </para>
12770 <para>
12771 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12772 </para>
12773 <literallayout class="monospaced">
12774 deny recipients = dbm*@;/some/file
12775 deny recipients = *@dbm;/some/file
12776 </literallayout>
12777 <para>
12778 The first does a whole address lookup, with defaulting, as just described,
12779 because it starts with a lookup type. The second matches the local part and
12780 domain independently, as described in a bullet point below.
12781 </para>
12782 </listitem>
12783 </itemizedlist>
12784 <para>
12785 The following kinds of address list pattern can match only non-empty addresses.
12786 If the subject address is empty, a match against any of these pattern types
12787 always fails.
12788 </para>
12789 <itemizedlist>
12790 <listitem>
12791 <para>
12792 <indexterm role="concept">
12793 <primary>@@ with single-key lookup</primary>
12794 </indexterm>
12795 <indexterm role="concept">
12796 <primary>address list</primary>
12797 <secondary>@@ lookup type</secondary>
12798 </indexterm>
12799 <indexterm role="concept">
12800 <primary>address list</primary>
12801 <secondary>split local part and domain</secondary>
12802 </indexterm>
12803 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12804 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12805 split into a local part and a domain. The domain is looked up in the file. If
12806 it is not found, there is no match. If it is found, the data that is looked up
12807 from the file is treated as a colon-separated list of local part patterns, each
12808 of which is matched against the subject local part in turn.
12809 </para>
12810 <para>
12811 <indexterm role="concept">
12812 <primary>asterisk</primary>
12813 <secondary>in address list</secondary>
12814 </indexterm>
12815 The lookup may be a partial one, and/or one involving a search for a default
12816 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12817 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12818 even be further lookups. They may also be independently negated. For example,
12819 with
12820 </para>
12821 <literallayout class="monospaced">
12822 deny senders = @@dbm;/etc/reject-by-domain
12823 </literallayout>
12824 <para>
12825 the data from which the DBM file is built could contain lines like
12826 </para>
12827 <literallayout class="monospaced">
12828 baddomain.com:  !postmaster : *
12829 </literallayout>
12830 <para>
12831 to reject all senders except <option>postmaster</option> from that domain.
12832 </para>
12833 <para>
12834 <indexterm role="concept">
12835 <primary>local part</primary>
12836 <secondary>starting with !</secondary>
12837 </indexterm>
12838 If a local part that actually begins with an exclamation mark is required, it
12839 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12840 may be split over several lines by indenting the second and subsequent lines,
12841 but the separating colon must still be included at line breaks. White space
12842 surrounding the colons is ignored. For example:
12843 </para>
12844 <literallayout class="monospaced">
12845 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12846   spammer3 : spammer4
12847 </literallayout>
12848 <para>
12849 As in all colon-separated lists in Exim, a colon can be included in an item by
12850 doubling.
12851 </para>
12852 <para>
12853 If the last item in the list starts with a right angle-bracket, the remainder
12854 of the item is taken as a new key to look up in order to obtain a continuation
12855 list of local parts. The new key can be any sequence of characters. Thus one
12856 might have entries like
12857 </para>
12858 <literallayout class="monospaced">
12859 aol.com: spammer1 : spammer 2 : &gt;*
12860 xyz.com: spammer3 : &gt;*
12861 *:       ^\d{8}$
12862 </literallayout>
12863 <para>
12864 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12865 local parts for all domains, in addition to the specific local parts listed for
12866 each domain. Of course, using this feature costs another lookup each time a
12867 chain is followed, but the effort needed to maintain the data is reduced.
12868 </para>
12869 <para>
12870 <indexterm role="concept">
12871 <primary>loop</primary>
12872 <secondary>in lookups</secondary>
12873 </indexterm>
12874 It is possible to construct loops using this facility, and in order to catch
12875 them, the chains may be no more than fifty items long.
12876 </para>
12877 </listitem>
12878 <listitem>
12879 <para>
12880 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12881 lookup, but in this case, the chaining facility is not available. The lookup
12882 can only return a single list of local parts.
12883 </para>
12884 </listitem>
12885 </itemizedlist>
12886 <para>
12887 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12888 in these two examples:
12889 </para>
12890 <literallayout class="monospaced">
12891 senders = +my_list
12892 senders = *@+my_list
12893 </literallayout>
12894 <para>
12895 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12896 example it is a named domain list.
12897 </para>
12898 </section>
12899 <section id="SECTcasletadd">
12900 <title>Case of letters in address lists</title>
12901 <para>
12902 <indexterm role="concept">
12903 <primary>case of local parts</primary>
12904 </indexterm>
12905 <indexterm role="concept">
12906 <primary>address list</primary>
12907 <secondary>case forcing</secondary>
12908 </indexterm>
12909 <indexterm role="concept">
12910 <primary>case forcing in address lists</primary>
12911 </indexterm>
12912 Domains in email addresses are always handled caselessly, but for local parts
12913 case may be significant on some systems (see <option>caseful_local_part</option> for how
12914 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12915 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12916 blocking lists should be done in a case-independent manner. Since most address
12917 lists in Exim are used for this kind of control, Exim attempts to do this by
12918 default.
12919 </para>
12920 <para>
12921 The domain portion of an address is always lowercased before matching it to an
12922 address list. The local part is lowercased by default, and any string
12923 comparisons that take place are done caselessly. This means that the data in
12924 the address list itself, in files included as plain file names, and in any file
12925 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12926 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12927 works caselessly) must be in lower case, because these lookups are not
12928 case-independent.
12929 </para>
12930 <para>
12931 <indexterm role="concept">
12932 <primary><literal>+caseful</literal></primary>
12933 </indexterm>
12934 To allow for the possibility of caseful address list matching, if an item in
12935 an address list is the string <quote>+caseful</quote>, the original case of the local
12936 part is restored for any comparisons that follow, and string comparisons are no
12937 longer case-independent. This does not affect the domain, which remains in
12938 lower case. However, although independent matches on the domain alone are still
12939 performed caselessly, regular expressions that match against an entire address
12940 become case-sensitive after <quote>+caseful</quote> has been seen.
12941 </para>
12942 </section>
12943 <section id="SECTlocparlis">
12944 <title>Local part lists</title>
12945 <para>
12946 <indexterm role="concept">
12947 <primary>list</primary>
12948 <secondary>local part list</secondary>
12949 </indexterm>
12950 <indexterm role="concept">
12951 <primary>local part</primary>
12952 <secondary>list</secondary>
12953 </indexterm>
12954 Case-sensitivity in local part lists is handled in the same way as for address
12955 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12956 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12957 set false, the subject is lowercased and the matching is initially
12958 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12959 matching in the local part list, but not elsewhere in the router. If
12960 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12961 option is case-sensitive from the start.
12962 </para>
12963 <para>
12964 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12965 comments are handled in the same way as address lists &ndash; they are recognized
12966 only if the # is preceded by white space or the start of the line.
12967 Otherwise, local part lists are matched in the same way as domain lists, except
12968 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12969 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12970 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12971 types.
12972 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12973 </para>
12974 </section>
12975 </chapter>
12976
12977 <chapter id="CHAPexpand">
12978 <title>String expansions</title>
12979 <para>
12980 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12981 <primary>expansion</primary>
12982 <secondary>of strings</secondary>
12983 </indexterm>
12984 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12985 them are expanded every time they are used; others are expanded only once.
12986 </para>
12987 <para>
12988 When a string is being expanded it is copied verbatim from left to right except
12989 when a dollar or backslash character is encountered. A dollar specifies the
12990 start of a portion of the string that is interpreted and replaced as described
12991 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12992 escape character, as described in the following section.
12993 </para>
12994 <para>
12995 Whether a string is expanded depends upon the context.  Usually this is solely
12996 dependent upon the option for which a value is sought; in this documentation,
12997 options for which string expansion is performed are marked with &dagger; after
12998 the data type.  ACL rules always expand strings.  A couple of expansion
12999 conditions do not expand some of the brace-delimited branches, for security
13000 reasons.
13001 </para>
13002 <section id="SECTlittext">
13003 <title>Literal text in expanded strings</title>
13004 <para>
13005 <indexterm role="concept">
13006 <primary>expansion</primary>
13007 <secondary>including literal text</secondary>
13008 </indexterm>
13009 An uninterpreted dollar can be included in an expanded string by putting a
13010 backslash in front of it. A backslash can be used to prevent any special
13011 character being treated specially in an expansion, including backslash itself.
13012 If the string appears in quotes in the configuration file, two backslashes are
13013 required because the quotes themselves cause interpretation of backslashes when
13014 the string is read in (see section <xref linkend="SECTstrings"/>).
13015 </para>
13016 <para>
13017 <indexterm role="concept">
13018 <primary>expansion</primary>
13019 <secondary>non-expandable substrings</secondary>
13020 </indexterm>
13021 A portion of the string can specified as non-expandable by placing it between
13022 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13023 expressions, which often contain backslashes and dollar signs. For example:
13024 </para>
13025 <literallayout class="monospaced">
13026 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13027 </literallayout>
13028 <para>
13029 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13030 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13031 string.
13032 </para>
13033 </section>
13034 <section id="SECID82">
13035 <title>Character escape sequences in expanded strings</title>
13036 <para>
13037 <indexterm role="concept">
13038 <primary>expansion</primary>
13039 <secondary>escape sequences</secondary>
13040 </indexterm>
13041 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13042 expanded string is recognized as an escape sequence for the character newline,
13043 carriage return, or tab, respectively. A backslash followed by up to three
13044 octal digits is recognized as an octal encoding for a single character, and a
13045 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13046 encoding.
13047 </para>
13048 <para>
13049 These escape sequences are also recognized in quoted strings when they are read
13050 in. Their interpretation in expansions as well is useful for unquoted strings,
13051 and for other cases such as looked-up strings that are then expanded.
13052 </para>
13053 </section>
13054 <section id="SECID83">
13055 <title>Testing string expansions</title>
13056 <para>
13057 <indexterm role="concept">
13058 <primary>expansion</primary>
13059 <secondary>testing</secondary>
13060 </indexterm>
13061 <indexterm role="concept">
13062 <primary>testing</primary>
13063 <secondary>string expansion</secondary>
13064 </indexterm>
13065 <indexterm role="option">
13066 <primary><option>-be</option></primary>
13067 </indexterm>
13068 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13069 takes the command arguments, or lines from the standard input if there are no
13070 arguments, runs them through the string expansion code, and writes the results
13071 to the standard output. Variables based on configuration values are set up, but
13072 since no message is being processed, variables such as <varname>$local_part</varname> have no
13073 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13074 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13075 and <option>nhash</option>.
13076 </para>
13077 <para>
13078 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13079 instead runs under the uid and gid it was called with, to prevent users from
13080 using <option>-be</option> for reading files to which they do not have access.
13081 </para>
13082 <para>
13083 <indexterm role="option">
13084 <primary><option>-bem</option></primary>
13085 </indexterm>
13086 If you want to test expansions that include variables whose values are taken
13087 from a message, there are two other options that can be used. The <option>-bem</option>
13088 option is like <option>-be</option> except that it is followed by a file name. The file is
13089 read as a message before doing the test expansions. For example:
13090 </para>
13091 <literallayout class="monospaced">
13092 exim -bem /tmp/test.message '$h_subject:'
13093 </literallayout>
13094 <para>
13095 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13096 Exim message identifier. For example:
13097 </para>
13098 <literallayout class="monospaced">
13099 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13100 </literallayout>
13101 <para>
13102 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13103 is therefore restricted to admin users.
13104 </para>
13105 </section>
13106 <section id="SECTforexpfai">
13107 <title>Forced expansion failure</title>
13108 <para>
13109 <indexterm role="concept">
13110 <primary>expansion</primary>
13111 <secondary>forced failure</secondary>
13112 </indexterm>
13113 A number of expansions that are described in the following section have
13114 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13115 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13116 used depends on some condition that is evaluated as part of the expansion. If,
13117 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13118 the entire string expansion fails in a way that can be detected by the code
13119 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13120 its consequences depend on the circumstances. In some cases it is no different
13121 from any other expansion failure, but in others a different action may be
13122 taken. Such variations are mentioned in the documentation of the option that is
13123 being expanded.
13124 </para>
13125 </section>
13126 <section id="SECTexpansionitems">
13127 <title>Expansion items</title>
13128 <para>
13129 The following items are recognized in expanded strings. White space may be used
13130 between sub-items that are keywords or substrings enclosed in braces inside an
13131 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13132 white space is significant.
13133 </para>
13134 <variablelist>
13135 <varlistentry>
13136 <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>
13137 <listitem>
13138 <para>
13139 <indexterm role="concept">
13140 <primary>expansion</primary>
13141 <secondary>variables</secondary>
13142 </indexterm>
13143 Substitute the contents of the named variable, for example:
13144 </para>
13145 <literallayout class="monospaced">
13146 $local_part
13147 ${domain}
13148 </literallayout>
13149 <para>
13150 The second form can be used to separate the name from subsequent alphanumeric
13151 characters. This form (using braces) is available only for variables; it does
13152 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13153 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13154 given, the expansion fails.
13155 </para>
13156 </listitem></varlistentry>
13157 <varlistentry>
13158 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13159 <listitem>
13160 <para>
13161 <indexterm role="concept">
13162 <primary>expansion</primary>
13163 <secondary>operators</secondary>
13164 </indexterm>
13165 The string is first itself expanded, and then the operation specified by
13166 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13167 </para>
13168 <literallayout class="monospaced">
13169 ${lc:$local_part}
13170 </literallayout>
13171 <para>
13172 The string starts with the first character after the colon, which may be
13173 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13174 below. The operator notation is used for simple expansion items that have just
13175 one argument, because it reduces the number of braces and therefore makes the
13176 string easier to understand.
13177 </para>
13178 </listitem></varlistentry>
13179 <varlistentry>
13180 <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>
13181 <listitem>
13182 <para>
13183 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13184 expansion item below.
13185 </para>
13186 </listitem></varlistentry>
13187 <varlistentry revisionflag="changed">
13188 <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>
13189 <listitem>
13190 <para revisionflag="changed">
13191 <indexterm role="concept">
13192 <primary>expansion</primary>
13193 <secondary>calling an acl</secondary>
13194 </indexterm>
13195 <indexterm role="concept">
13196 <primary><option>acl</option></primary>
13197 <secondary>call from expansion</secondary>
13198 </indexterm>
13199 The name and zero to nine argument strings are first expanded separately.  The expanded
13200 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13201 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13202 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13203 and may use the variables; if another acl expansion is used the values
13204 are restored after it returns.  If the ACL sets
13205 a value using a "message =" modifier and returns accept or deny, the value becomes
13206 the result of the expansion.
13207 If no message is set and the ACL returns accept or deny
13208 the expansion result is an empty string.
13209 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13210 </para>
13211 </listitem></varlistentry>
13212 <varlistentry>
13213 <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>
13214 <listitem>
13215 <para>
13216 <indexterm role="concept">
13217 <primary><option>dlfunc</option></primary>
13218 </indexterm>
13219 This expansion dynamically loads and then calls a locally-written C function.
13220 This functionality is available only if Exim is compiled with
13221 </para>
13222 <literallayout class="monospaced">
13223 EXPAND_DLFUNC=yes
13224 </literallayout>
13225 <para>
13226 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13227 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13228 (but of course Exim does start new processes frequently).
13229 </para>
13230 <para>
13231 There may be from zero to eight arguments to the function. When compiling
13232 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13233 included. The Exim variables and functions that are defined by that API
13234 are also available for dynamically loaded functions. The function itself
13235 must have the following type:
13236 </para>
13237 <literallayout class="monospaced">
13238 int dlfunction(uschar **yield, int argc, uschar *argv[])
13239 </literallayout>
13240 <para>
13241 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13242 function should return one of the following values:
13243 </para>
13244 <para>
13245 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13246 into the expanded string that is being built.
13247 </para>
13248 <para>
13249 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13250 from <emphasis>yield</emphasis>, if it is set.
13251 </para>
13252 <para>
13253 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13254 taken from <emphasis>yield</emphasis> if it is set.
13255 </para>
13256 <para>
13257 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13258 </para>
13259 <para>
13260 When compiling a function that is to be used in this way with gcc,
13261 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13262 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13263 </para>
13264 </listitem></varlistentry>
13265 <varlistentry>
13266 <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>
13267 <listitem>
13268 <para>
13269 <indexterm role="concept">
13270 <primary>expansion</primary>
13271 <secondary>extracting substrings by key</secondary>
13272 </indexterm>
13273 <indexterm role="concept">
13274 <primary><option>extract</option></primary>
13275 <secondary>substrings by key</secondary>
13276 </indexterm>
13277 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13278 white space is removed from the key (but not from any of the strings). The key
13279 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
13280 form:
13281 </para>
13282 <literallayout>
13283 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13284 </literallayout>
13285 <para>
13286 <indexterm role="variable">
13287 <primary><varname>$value</varname></primary>
13288 </indexterm>
13289 where the equals signs and spaces (but not both) are optional. If any of the
13290 values contain white space, they must be enclosed in double quotes, and any
13291 values that are enclosed in double quotes are subject to escape processing as
13292 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13293 for the value that corresponds to the key. The search is case-insensitive. If
13294 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13295 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13296 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13297 is restored to any previous value it might have had.
13298 </para>
13299 <para>
13300 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13301 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13302 extracted is used. Thus, for example, these two expansions are identical, and
13303 yield <quote>2001</quote>:
13304 </para>
13305 <literallayout class="monospaced">
13306 ${extract{gid}{uid=1984 gid=2001}}
13307 ${extract{gid}{uid=1984 gid=2001}{$value}}
13308 </literallayout>
13309 <para>
13310 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13311 appear, for example:
13312 </para>
13313 <literallayout class="monospaced">
13314 ${extract{Z}{A=... B=...}{$value} fail }
13315 </literallayout>
13316 <para>
13317 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13318 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13319 </para>
13320 </listitem></varlistentry>
13321 <varlistentry>
13322 <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>
13323 <listitem>
13324 <para>
13325 <indexterm role="concept">
13326 <primary>expansion</primary>
13327 <secondary>extracting substrings by number</secondary>
13328 </indexterm>
13329 <indexterm role="concept">
13330 <primary><option>extract</option></primary>
13331 <secondary>substrings by number</secondary>
13332 </indexterm>
13333 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13334 apart from leading and trailing white space, which is ignored.
13335 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13336 behaves in the same way, except that, instead of extracting a named field, it
13337 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13338 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13339 &lt;<emphasis>string3</emphasis>&gt; as before.
13340 </para>
13341 <para>
13342 The fields in the string are separated by any one of the characters in the
13343 separator string. These may include space or tab characters.
13344 The first field is numbered one. If the number is negative, the fields are
13345 counted from the end of the string, with the rightmost one numbered -1. If the
13346 number given is zero, the entire string is returned. If the modulus of the
13347 number is greater than the number of fields in the string, the result is the
13348 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13349 provided. For example:
13350 </para>
13351 <literallayout class="monospaced">
13352 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13353 </literallayout>
13354 <para>
13355 yields <quote>42</quote>, and
13356 </para>
13357 <literallayout class="monospaced">
13358 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13359 </literallayout>
13360 <para>
13361 yields <quote>99</quote>. Two successive separators mean that the field between them is
13362 empty (for example, the fifth field above).
13363 </para>
13364 </listitem></varlistentry>
13365 <varlistentry>
13366 <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>
13367 <listitem>
13368 <para>
13369 <indexterm role="concept">
13370 <primary>list</primary>
13371 <secondary>selecting by condition</secondary>
13372 </indexterm>
13373 <indexterm role="concept">
13374 <primary>expansion</primary>
13375 <secondary>selecting from list by condition</secondary>
13376 </indexterm>
13377 <indexterm role="variable">
13378 <primary><varname>$item</varname></primary>
13379 </indexterm>
13380 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13381 default, but the separator can be changed in the usual way. For each item
13382 in this list, its value is place in <varname>$item</varname>, and then the condition is
13383 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13384 item in a new list; if the condition is false, the item is discarded. The
13385 separator used for the output list is the same as the one used for the
13386 input, but a separator setting is not included in the output. For example:
13387 </para>
13388 <literallayout class="monospaced">
13389 ${filter{a:b:c}{!eq{$item}{b}}
13390 </literallayout>
13391 <para>
13392 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13393 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13394 </para>
13395 </listitem></varlistentry>
13396 <varlistentry>
13397 <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>
13398 <listitem>
13399 <para>
13400 <indexterm role="concept">
13401 <primary>hash function</primary>
13402 <secondary>textual</secondary>
13403 </indexterm>
13404 <indexterm role="concept">
13405 <primary>expansion</primary>
13406 <secondary>textual hash</secondary>
13407 </indexterm>
13408 This is a textual hashing function, and was the first to be implemented in
13409 early versions of Exim. In current releases, there are other hashing functions
13410 (numeric, MD5, and SHA-1), which are described below.
13411 </para>
13412 <para>
13413 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13414 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13415 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13416 use the simpler operator notation that avoids some of the braces:
13417 </para>
13418 <literallayout class="monospaced">
13419 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13420 </literallayout>
13421 <para>
13422 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13423 or equal to the length of the string, the expansion item returns the string.
13424 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13425 function to the string. The new string consists of characters taken from the
13426 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13427 </para>
13428 <literallayout class="monospaced">
13429 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13430 </literallayout>
13431 <para>
13432 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13433 letters appear. For example:
13434 </para>
13435 <literallayout>
13436 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13437 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
13438 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
13439 </literallayout>
13440 </listitem></varlistentry>
13441 <varlistentry>
13442 <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>
13443 <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>
13444 <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>
13445 <listitem>
13446 <para>
13447 <indexterm role="concept">
13448 <primary>expansion</primary>
13449 <secondary>header insertion</secondary>
13450 </indexterm>
13451 <indexterm role="variable">
13452 <primary><varname>$header_</varname></primary>
13453 </indexterm>
13454 <indexterm role="variable">
13455 <primary><varname>$bheader_</varname></primary>
13456 </indexterm>
13457 <indexterm role="variable">
13458 <primary><varname>$rheader_</varname></primary>
13459 </indexterm>
13460 <indexterm role="concept">
13461 <primary>header lines</primary>
13462 <secondary>in expansion strings</secondary>
13463 </indexterm>
13464 <indexterm role="concept">
13465 <primary>header lines</primary>
13466 <secondary>character sets</secondary>
13467 </indexterm>
13468 <indexterm role="concept">
13469 <primary>header lines</primary>
13470 <secondary>decoding</secondary>
13471 </indexterm>
13472 Substitute the contents of the named message header line, for example
13473 </para>
13474 <literallayout class="monospaced">
13475 $header_reply-to:
13476 </literallayout>
13477 <para>
13478 The newline that terminates a header line is not included in the expansion, but
13479 internal newlines (caused by splitting the header line over several physical
13480 lines) may be present.
13481 </para>
13482 <para>
13483 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13484 the data in the header line is interpreted.
13485 </para>
13486 <itemizedlist>
13487 <listitem>
13488 <para>
13489 <indexterm role="concept">
13490 <primary>white space</primary>
13491 <secondary>in header lines</secondary>
13492 </indexterm>
13493 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13494 processing at all, and without the removal of leading and trailing white space.
13495 </para>
13496 </listitem>
13497 <listitem>
13498 <para>
13499 <indexterm role="concept">
13500 <primary>base64 encoding</primary>
13501 <secondary>in header lines</secondary>
13502 </indexterm>
13503 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13504 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13505 character set translation. If decoding of what looks superficially like a MIME
13506 <quote>word</quote> fails, the raw string is returned. If decoding
13507 <indexterm role="concept">
13508 <primary>binary zero</primary>
13509 <secondary>in header line</secondary>
13510 </indexterm>
13511 produces a binary zero character, it is replaced by a question mark &ndash; this is
13512 what Exim does for binary zeros that are actually received in header lines.
13513 </para>
13514 </listitem>
13515 <listitem>
13516 <para>
13517 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13518 standard character set. This is an attempt to produce the same string as would
13519 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
13520 returned. Translation is attempted only on operating systems that support the
13521 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13522 a system Makefile or in <filename>Local/Makefile</filename>.
13523 </para>
13524 </listitem>
13525 </itemizedlist>
13526 <para>
13527 In a filter file, the target character set for <option>header</option> can be specified by a
13528 command of the following form:
13529 </para>
13530 <literallayout class="monospaced">
13531 headers charset "UTF-8"
13532 </literallayout>
13533 <para>
13534 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13535 subsequently obeyed filter commands. In the absence of this command, the target
13536 character set in a filter is taken from the setting of the <option>headers_charset</option>
13537 option in the runtime configuration. The value of this option defaults to the
13538 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13539 ISO-8859-1.
13540 </para>
13541 <para>
13542 Header names follow the syntax of RFC 2822, which states that they may contain
13543 any printing characters except space and colon. Consequently, curly brackets
13544 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13545 if they were variables. Attempting to do so causes a syntax error.
13546 </para>
13547 <para>
13548 Only header lines that are common to all copies of a message are visible to
13549 this mechanism. These are the original header lines that are received with the
13550 message, and any that are added by an ACL statement or by a system
13551 filter. Header lines that are added to a particular copy of a message by a
13552 router or transport are not accessible.
13553 </para>
13554 <para>
13555 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13556 before the DATA ACL, because the header structure is not set up until the
13557 message is received. Header lines that are added in a RCPT ACL (for example)
13558 are saved until the message&#x2019;s incoming header lines are available, at which
13559 point they are added. When a DATA ACL is running, however, header lines added
13560 by earlier ACLs are visible.
13561 </para>
13562 <para>
13563 Upper case and lower case letters are synonymous in header names. If the
13564 following character is white space, the terminating colon may be omitted, but
13565 this is not recommended, because you may then forget it when it is needed. When
13566 white space terminates the header name, it is included in the expanded string.
13567 If the message does not contain the given header, the expansion item is
13568 replaced by an empty string. (See the <option>def</option> condition in section
13569 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13570 </para>
13571 <para>
13572 If there is more than one header with the same name, they are all concatenated
13573 to form the substitution string, up to a maximum length of 64K. Unless
13574 <option>rheader</option> is being used, leading and trailing white space is removed from
13575 each header before concatenation, and a completely empty header is ignored. A
13576 newline character is then inserted between non-empty headers, but there is no
13577 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13578 those headers that contain lists of addresses, a comma is also inserted at the
13579 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13580 </para>
13581 </listitem></varlistentry>
13582 <varlistentry>
13583 <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>
13584 <listitem>
13585 <para>
13586 <indexterm role="concept">
13587 <primary>expansion</primary>
13588 <secondary>hmac hashing</secondary>
13589 </indexterm>
13590 <indexterm role="concept">
13591 <primary><option>hmac</option></primary>
13592 </indexterm>
13593 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13594 shared secret and some text into a message authentication code, as specified in
13595 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13596 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13597 cryptographic hash, allowing for authentication that is not possible with MD5
13598 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13599 present. For example:
13600 </para>
13601 <literallayout class="monospaced">
13602 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13603 </literallayout>
13604 <para>
13605 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13606 produces:
13607 </para>
13608 <literallayout class="monospaced">
13609 dd97e3ba5d1a61b5006108f8c8252953
13610 </literallayout>
13611 <para>
13612 As an example of how this might be used, you might put in the main part of
13613 an Exim configuration:
13614 </para>
13615 <literallayout class="monospaced">
13616 SPAMSCAN_SECRET=cohgheeLei2thahw
13617 </literallayout>
13618 <para>
13619 In a router or a transport you could then have:
13620 </para>
13621 <literallayout class="monospaced">
13622 headers_add = \
13623   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13624   ${hmac{md5}{SPAMSCAN_SECRET}\
13625   {${primary_hostname},${message_exim_id},$h_message-id:}}
13626 </literallayout>
13627 <para>
13628 Then given a message, you can check where it was scanned by looking at the
13629 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13630 this header line is authentic by recomputing the authentication code from the
13631 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13632 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
13633 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13634 </para>
13635 </listitem></varlistentry>
13636 <varlistentry>
13637 <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>
13638 <listitem>
13639 <para>
13640 <indexterm role="concept">
13641 <primary>expansion</primary>
13642 <secondary>conditional</secondary>
13643 </indexterm>
13644 <indexterm role="concept">
13645 <primary><option>if</option>, expansion item</primary>
13646 </indexterm>
13647 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
13648 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
13649 in section <xref linkend="SECTexpcond"/> below. For example:
13650 </para>
13651 <literallayout class="monospaced">
13652 ${if eq {$local_part}{postmaster} {yes}{no} }
13653 </literallayout>
13654 <para>
13655 The second string need not be present; if it is not and the condition is not
13656 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13657 be present instead of the second string (without any curly brackets). In this
13658 case, the expansion is forced to fail if the condition is not true (see section
13659 <xref linkend="SECTforexpfai"/>).
13660 </para>
13661 <para>
13662 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13663 is true, and the empty string if the condition is false. This makes it less
13664 cumbersome to write custom ACL and router conditions. For example, instead of
13665 </para>
13666 <literallayout class="monospaced">
13667 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
13668 </literallayout>
13669 <para>
13670 you can use
13671 </para>
13672 <literallayout class="monospaced">
13673 condition = ${if &gt;{$acl_m4}{3}}
13674 </literallayout>
13675 </listitem></varlistentry>
13676 <varlistentry>
13677 <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>
13678 <listitem>
13679 <para>
13680 <indexterm role="concept">
13681 <primary>expansion</primary>
13682 <secondary>string truncation</secondary>
13683 </indexterm>
13684 <indexterm role="concept">
13685 <primary><option>length</option> expansion item</primary>
13686 </indexterm>
13687 The <option>length</option> item is used to extract the initial portion of a string. Both
13688 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13689 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13690 change when expanded, you can use the simpler operator notation that avoids
13691 some of the braces:
13692 </para>
13693 <literallayout class="monospaced">
13694 ${length_&lt;n&gt;:&lt;string&gt;}
13695 </literallayout>
13696 <para>
13697 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13698 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13699 <option>strlen</option>, which gives the length of a string.
13700 </para>
13701 </listitem></varlistentry>
13702 <varlistentry>
13703 <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>
13704 <listitem>
13705 <para>
13706 This is the first of one of two different types of lookup item, which are both
13707 described in the next item.
13708 </para>
13709 </listitem></varlistentry>
13710 <varlistentry>
13711 <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>
13712 <listitem>
13713 <para>
13714 <indexterm role="concept">
13715 <primary>expansion</primary>
13716 <secondary>lookup in</secondary>
13717 </indexterm>
13718 <indexterm role="concept">
13719 <primary>file</primary>
13720 <secondary>lookups</secondary>
13721 </indexterm>
13722 <indexterm role="concept">
13723 <primary>lookup</primary>
13724 <secondary>in expanded string</secondary>
13725 </indexterm>
13726 The two forms of lookup item specify data lookups in files and databases, as
13727 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13728 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13729 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13730 </para>
13731 <para>
13732 If there is any white space in a lookup item which is part of a filter command,
13733 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13734 other place where white space is significant, the lookup item must be enclosed
13735 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13736 out by the system administrator.
13737 </para>
13738 <para>
13739 <indexterm role="variable">
13740 <primary><varname>$value</varname></primary>
13741 </indexterm>
13742 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13743 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13744 lookup. Afterwards it reverts to the value it had previously (at the outer
13745 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13746 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13747 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13748 lookup, thus providing a mechanism for looking up a default value when the
13749 original lookup fails.
13750 </para>
13751 <para>
13752 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13753 data for the outer lookup while the parameters of the second lookup are
13754 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13755 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13756 appear, and in this case, if the lookup fails, the entire expansion is forced
13757 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13758 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13759 successful lookup, and nothing in the case of failure.
13760 </para>
13761 <para>
13762 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13763 search type in order to do partial matching, and * or *@ may follow a search
13764 type to request default lookups if the key does not match (see sections
13765 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13766 </para>
13767 <para>
13768 <indexterm role="concept">
13769 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13770 <secondary>in lookup expansion</secondary>
13771 </indexterm>
13772 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13773 and non-wild parts of the key during the expansion of the replacement text.
13774 They return to their previous values at the end of the lookup item.
13775 </para>
13776 <para>
13777 This example looks up the postmaster alias in the conventional alias file:
13778 </para>
13779 <literallayout class="monospaced">
13780 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13781 </literallayout>
13782 <para>
13783 This example uses NIS+ to look up the full name of the user corresponding to
13784 the local part of an address, forcing the expansion to fail if it is not found:
13785 </para>
13786 <literallayout class="monospaced">
13787 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13788   {$value}fail}
13789 </literallayout>
13790 </listitem></varlistentry>
13791 <varlistentry>
13792 <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>
13793 <listitem>
13794 <para>
13795 <indexterm role="concept">
13796 <primary>expansion</primary>
13797 <secondary>list creation</secondary>
13798 </indexterm>
13799 <indexterm role="variable">
13800 <primary><varname>$item</varname></primary>
13801 </indexterm>
13802 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
13803 default, but the separator can be changed in the usual way. For each item
13804 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
13805 expanded and added to the output as an item in a new list. The separator used
13806 for the output list is the same as the one used for the input, but a separator
13807 setting is not included in the output. For example:
13808 </para>
13809 <literallayout class="monospaced">
13810 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
13811 </literallayout>
13812 <para>
13813 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13814 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13815 and <emphasis role="bold">reduce</emphasis> expansion items.
13816 </para>
13817 </listitem></varlistentry>
13818 <varlistentry>
13819 <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>
13820 <listitem>
13821 <para>
13822 <indexterm role="concept">
13823 <primary>expansion</primary>
13824 <secondary>numeric hash</secondary>
13825 </indexterm>
13826 <indexterm role="concept">
13827 <primary>hash function</primary>
13828 <secondary>numeric</secondary>
13829 </indexterm>
13830 The three strings are expanded; the first two must yield numbers. Call them
13831 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13832 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13833 can use the simpler operator notation that avoids some of the braces:
13834 </para>
13835 <literallayout class="monospaced">
13836 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13837 </literallayout>
13838 <para>
13839 The second number is optional (in both notations). If there is only one number,
13840 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13841 processed by a div/mod hash function that returns two numbers, separated by a
13842 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13843 example,
13844 </para>
13845 <literallayout class="monospaced">
13846 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13847 </literallayout>
13848 <para>
13849 returns the string <quote>6/33</quote>.
13850 </para>
13851 </listitem></varlistentry>
13852 <varlistentry>
13853 <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>
13854 <listitem>
13855 <para>
13856 <indexterm role="concept">
13857 <primary>Perl</primary>
13858 <secondary>use in expanded string</secondary>
13859 </indexterm>
13860 <indexterm role="concept">
13861 <primary>expansion</primary>
13862 <secondary>calling Perl from</secondary>
13863 </indexterm>
13864 This item is available only if Exim has been built to include an embedded Perl
13865 interpreter. The subroutine name and the arguments are first separately
13866 expanded, and then the Perl subroutine is called with those arguments. No
13867 additional arguments need be given; the maximum number permitted, including the
13868 name of the subroutine, is nine.
13869 </para>
13870 <para>
13871 The return value of the subroutine is inserted into the expanded string, unless
13872 the return value is <option>undef</option>. In that case, the expansion fails in the same
13873 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13874 Whatever you return is evaluated in a scalar context. For example, if you
13875 return the name of a Perl vector, the return value is the size of the vector,
13876 not its contents.
13877 </para>
13878 <para>
13879 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13880 with the error message that was passed to <option>die</option>. More details of the embedded
13881 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13882 </para>
13883 <para>
13884 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13885 out the use of this expansion item in filter files.
13886 </para>
13887 </listitem></varlistentry>
13888 <varlistentry>
13889 <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>
13890 <listitem>
13891 <para>
13892 <indexterm role="concept">
13893 <primary><option>prvs</option> expansion item</primary>
13894 </indexterm>
13895 The first argument is a complete email address and the second is secret
13896 keystring. The third argument, specifying a key number, is optional. If absent,
13897 it defaults to 0. The result of the expansion is a prvs-signed email address,
13898 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13899 as part of a bounce address tag validation (BATV) scheme. For more discussion
13900 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13901 </para>
13902 </listitem></varlistentry>
13903 <varlistentry>
13904 <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>
13905 <listitem>
13906 <para>
13907 <indexterm role="concept">
13908 <primary><option>prvscheck</option> expansion item</primary>
13909 </indexterm>
13910 This expansion item is the complement of the <option>prvs</option> item. It is used for
13911 checking prvs-signed addresses. If the expansion of the first argument does not
13912 yield a syntactically valid prvs-signed address, the whole item expands to the
13913 empty string. When the first argument does expand to a syntactically valid
13914 prvs-signed address, the second argument is expanded, with the prvs-decoded
13915 version of the address and the key number extracted from the address in the
13916 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13917 </para>
13918 <para>
13919 These two variables can be used in the expansion of the second argument to
13920 retrieve the secret. The validity of the prvs-signed address is then checked
13921 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13922 which is empty for failure or <quote>1</quote> for success.
13923 </para>
13924 <para>
13925 The third argument is optional; if it is missing, it defaults to an empty
13926 string. This argument is now expanded. If the result is an empty string, the
13927 result of the expansion is the decoded version of the address. This is the case
13928 whether or not the signature was valid. Otherwise, the result of the expansion
13929 is the expansion of the third argument.
13930 </para>
13931 <para>
13932 All three variables can be used in the expansion of the third argument.
13933 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13934 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13935 </para>
13936 </listitem></varlistentry>
13937 <varlistentry>
13938 <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>
13939 <listitem>
13940 <para>
13941 <indexterm role="concept">
13942 <primary>expansion</primary>
13943 <secondary>inserting an entire file</secondary>
13944 </indexterm>
13945 <indexterm role="concept">
13946 <primary>file</primary>
13947 <secondary>inserting into expansion</secondary>
13948 </indexterm>
13949 <indexterm role="concept">
13950 <primary><option>readfile</option> expansion item</primary>
13951 </indexterm>
13952 The file name and end-of-line string are first expanded separately. The file is
13953 then read, and its contents replace the entire item. All newline characters in
13954 the file are replaced by the end-of-line string if it is present. Otherwise,
13955 newlines are left in the string.
13956 String expansion is not applied to the contents of the file. If you want this,
13957 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13958 the string expansion fails.
13959 </para>
13960 <para>
13961 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13962 locks out the use of this expansion item in filter files.
13963 </para>
13964 </listitem></varlistentry>
13965 <varlistentry>
13966 <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>
13967 <listitem>
13968 <para>
13969 <indexterm role="concept">
13970 <primary>expansion</primary>
13971 <secondary>inserting from a socket</secondary>
13972 </indexterm>
13973 <indexterm role="concept">
13974 <primary>socket, use of in expansion</primary>
13975 </indexterm>
13976 <indexterm role="concept">
13977 <primary><option>readsocket</option> expansion item</primary>
13978 </indexterm>
13979 This item inserts data from a Unix domain or Internet socket into the expanded
13980 string. The minimal way of using it uses just two arguments, as in these
13981 examples:
13982 </para>
13983 <literallayout class="monospaced">
13984 ${readsocket{/socket/name}{request string}}
13985 ${readsocket{inet:some.host:1234}{request string}}
13986 </literallayout>
13987 <para>
13988 For a Unix domain socket, the first substring must be the path to the socket.
13989 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13990 a host name or IP address, followed by a colon and a port, which can be a
13991 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13992 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13993 example:
13994 </para>
13995 <literallayout class="monospaced">
13996 ${readsocket{inet:[::1]:1234}{request string}}
13997 </literallayout>
13998 <para>
13999 Only a single host name may be given, but if looking it up yields more than
14000 one IP address, they are each tried in turn until a connection is made. For
14001 both kinds of socket, Exim makes a connection, writes the request string
14002 (unless it is an empty string) and reads from the socket until an end-of-file
14003 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14004 extend what can be done. Firstly, you can vary the timeout. For example:
14005 </para>
14006 <literallayout class="monospaced">
14007 ${readsocket{/socket/name}{request string}{3s}}
14008 </literallayout>
14009 <para>
14010 A fourth argument allows you to change any newlines that are in the data
14011 that is read, in the same way as for <option>readfile</option> (see above). This example
14012 turns them into spaces:
14013 </para>
14014 <literallayout class="monospaced">
14015 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14016 </literallayout>
14017 <para>
14018 As with all expansions, the substrings are expanded before the processing
14019 happens. Errors in these sub-expansions cause the expansion to fail. In
14020 addition, the following errors can occur:
14021 </para>
14022 <itemizedlist>
14023 <listitem>
14024 <para>
14025 Failure to create a socket file descriptor;
14026 </para>
14027 </listitem>
14028 <listitem>
14029 <para>
14030 Failure to connect the socket;
14031 </para>
14032 </listitem>
14033 <listitem>
14034 <para>
14035 Failure to write the request string;
14036 </para>
14037 </listitem>
14038 <listitem>
14039 <para>
14040 Timeout on reading from the socket.
14041 </para>
14042 </listitem>
14043 </itemizedlist>
14044 <para>
14045 By default, any of these errors causes the expansion to fail. However, if
14046 you supply a fifth substring, it is expanded and used when any of the above
14047 errors occurs. For example:
14048 </para>
14049 <literallayout class="monospaced">
14050 ${readsocket{/socket/name}{request string}{3s}{\n}\
14051   {socket failure}}
14052 </literallayout>
14053 <para>
14054 You can test for the existence of a Unix domain socket by wrapping this
14055 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14056 and the actual opening of the socket, so it is safer to use the fifth argument
14057 if you want to be absolutely sure of avoiding an expansion error for a
14058 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14059 </para>
14060 <para>
14061 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14062 locks out the use of this expansion item in filter files.
14063 </para>
14064 </listitem></varlistentry>
14065 <varlistentry>
14066 <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>
14067 <listitem>
14068 <para>
14069 <indexterm role="concept">
14070 <primary>expansion</primary>
14071 <secondary>reducing a list to a scalar</secondary>
14072 </indexterm>
14073 <indexterm role="concept">
14074 <primary>list</primary>
14075 <secondary>reducing to a scalar</secondary>
14076 </indexterm>
14077 <indexterm role="variable">
14078 <primary><varname>$value</varname></primary>
14079 </indexterm>
14080 <indexterm role="variable">
14081 <primary><varname>$item</varname></primary>
14082 </indexterm>
14083 This operation reduces a list to a single, scalar string. After expansion,
14084 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14085 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14086 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14087 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14088 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14089 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14090 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14091 number of ways. For example, to add up a list of numbers:
14092 </para>
14093 <literallayout class="monospaced">
14094 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14095 </literallayout>
14096 <para>
14097 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14098 can be found:
14099 </para>
14100 <literallayout class="monospaced">
14101 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14102 </literallayout>
14103 <para>
14104 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14105 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14106 expansion items.
14107 </para>
14108 </listitem></varlistentry>
14109 <varlistentry>
14110 <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>
14111 <listitem>
14112 <para>
14113 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14114 expansion item above.
14115 </para>
14116 </listitem></varlistentry>
14117 <varlistentry>
14118 <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>
14119 <listitem>
14120 <para>
14121 <indexterm role="concept">
14122 <primary>expansion</primary>
14123 <secondary>running a command</secondary>
14124 </indexterm>
14125 <indexterm role="concept">
14126 <primary><option>run</option> expansion item</primary>
14127 </indexterm>
14128 The command and its arguments are first expanded separately, and then the
14129 command is run in a separate process, but under the same uid and gid. As in
14130 other command executions from Exim, a shell is not used by default. If you want
14131 a shell, you must explicitly code it.
14132 </para>
14133 <para>
14134 The standard input for the command exists, but is empty. The standard output
14135 and standard error are set to the same file descriptor.
14136 <indexterm role="concept">
14137 <primary>return code</primary>
14138 <secondary>from <option>run</option> expansion</secondary>
14139 </indexterm>
14140 <indexterm role="variable">
14141 <primary><varname>$value</varname></primary>
14142 </indexterm>
14143 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14144 and replaces the entire item; during this expansion, the standard output/error
14145 from the command is in the variable <varname>$value</varname>. If the command fails,
14146 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14147 expansion, the standard output/error from the command is in the variable
14148 <varname>$value</varname>.
14149 </para>
14150 <para>
14151 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14152 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14153 command does not succeed. If both strings are omitted, the result is contents
14154 of the standard output/error on success, and nothing on failure.
14155 </para>
14156 <para revisionflag="changed">
14157 <indexterm role="variable">
14158 <primary><varname>$run_in_acl</varname></primary>
14159 </indexterm>
14160 The standard output/error of the command is put in the variable <varname>$value</varname>.
14161 In this ACL example, the output of a command is logged for the admin to
14162 troubleshoot:
14163 </para>
14164 <literallayout class="monospaced" revisionflag="changed">
14165 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14166       log_message  = Output of id: $value
14167 </literallayout>
14168 <para revisionflag="changed">
14169 If the command requires shell idioms, such as the &gt; redirect operator, the
14170 shell must be invoked directly, such as with:
14171 </para>
14172 <literallayout class="monospaced" revisionflag="changed">
14173 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14174 </literallayout>
14175 <para>
14176 <indexterm role="variable">
14177 <primary><varname>$runrc</varname></primary>
14178 </indexterm>
14179 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14180 remains set afterwards, so in a filter file you can do things like this:
14181 </para>
14182 <literallayout class="monospaced">
14183 if "${run{x y z}{}}$runrc" is 1 then ...
14184   elif $runrc is 2 then ...
14185   ...
14186 endif
14187 </literallayout>
14188 <para>
14189 If execution of the command fails (for example, the command does not exist),
14190 the return code is 127 &ndash; the same code that shells use for non-existent
14191 commands.
14192 </para>
14193 <para>
14194 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14195 option values are expanded, except for those preconditions whose order of
14196 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14197 by the expansion of one option, and use it in another.
14198 </para>
14199 <para>
14200 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14201 out the use of this expansion item in filter files.
14202 </para>
14203 </listitem></varlistentry>
14204 <varlistentry>
14205 <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>
14206 <listitem>
14207 <para>
14208 <indexterm role="concept">
14209 <primary>expansion</primary>
14210 <secondary>string substitution</secondary>
14211 </indexterm>
14212 <indexterm role="concept">
14213 <primary><option>sg</option> expansion item</primary>
14214 </indexterm>
14215 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14216 option; hence its name. However, unlike the Perl equivalent, Exim does not
14217 modify the subject string; instead it returns the modified string for insertion
14218 into the overall expansion. The item takes three arguments: the subject string,
14219 a regular expression, and a substitution string. For example:
14220 </para>
14221 <literallayout class="monospaced">
14222 ${sg{abcdefabcdef}{abc}{xyz}}
14223 </literallayout>
14224 <para>
14225 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14226 if any $ or \ characters are required in the regular expression or in the
14227 substitution string, they have to be escaped. For example:
14228 </para>
14229 <literallayout class="monospaced">
14230 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14231 </literallayout>
14232 <para>
14233 yields <quote>defabc</quote>, and
14234 </para>
14235 <literallayout class="monospaced">
14236 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14237 </literallayout>
14238 <para>
14239 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14240 the regular expression from string expansion.
14241 </para>
14242 </listitem></varlistentry>
14243 <varlistentry>
14244 <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>
14245 <listitem>
14246 <para>
14247 <indexterm role="concept">
14248 <primary><option>substr</option> expansion item</primary>
14249 </indexterm>
14250 <indexterm role="concept">
14251 <primary>substring extraction</primary>
14252 </indexterm>
14253 <indexterm role="concept">
14254 <primary>expansion</primary>
14255 <secondary>substring extraction</secondary>
14256 </indexterm>
14257 The three strings are expanded; the first two must yield numbers. Call them
14258 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14259 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14260 can use the simpler operator notation that avoids some of the braces:
14261 </para>
14262 <literallayout class="monospaced">
14263 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14264 </literallayout>
14265 <para>
14266 The second number is optional (in both notations).
14267 If it is absent in the simpler format, the preceding underscore must also be
14268 omitted.
14269 </para>
14270 <para>
14271 The <option>substr</option> item can be used to extract more general substrings than
14272 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14273 length required. For example
14274 </para>
14275 <literallayout class="monospaced">
14276 ${substr{3}{2}{$local_part}}
14277 </literallayout>
14278 <para>
14279 If the starting offset is greater than the string length the result is the
14280 null string; if the length plus starting offset is greater than the string
14281 length, the result is the right-hand part of the string, starting from the
14282 given offset. The first character in the string has offset zero.
14283 </para>
14284 <para>
14285 The <option>substr</option> expansion item can take negative offset values to count
14286 from the right-hand end of its operand. The last character is offset -1, the
14287 second-last is offset -2, and so on. Thus, for example,
14288 </para>
14289 <literallayout class="monospaced">
14290 ${substr{-5}{2}{1234567}}
14291 </literallayout>
14292 <para>
14293 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
14294 length of the string, the substring starts at the beginning of the string, and
14295 the length is reduced by the amount of overshoot. Thus, for example,
14296 </para>
14297 <literallayout class="monospaced">
14298 ${substr{-5}{2}{12}}
14299 </literallayout>
14300 <para>
14301 yields an empty string, but
14302 </para>
14303 <literallayout class="monospaced">
14304 ${substr{-3}{2}{12}}
14305 </literallayout>
14306 <para>
14307 yields <quote>1</quote>.
14308 </para>
14309 <para>
14310 When the second number is omitted from <option>substr</option>, the remainder of the string
14311 is taken if the offset is positive. If it is negative, all characters in the
14312 string preceding the offset point are taken. For example, an offset of -1 and
14313 no length, as in these semantically identical examples:
14314 </para>
14315 <literallayout class="monospaced">
14316 ${substr_-1:abcde}
14317 ${substr{-1}{abcde}}
14318 </literallayout>
14319 <para>
14320 yields all but the last character of the string, that is, <quote>abcd</quote>.
14321 </para>
14322 </listitem></varlistentry>
14323 <varlistentry>
14324 <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>
14325 <listitem>
14326 <para>
14327 <indexterm role="concept">
14328 <primary>expansion</primary>
14329 <secondary>character translation</secondary>
14330 </indexterm>
14331 <indexterm role="concept">
14332 <primary><option>tr</option> expansion item</primary>
14333 </indexterm>
14334 This item does single-character translation on its subject string. The second
14335 argument is a list of characters to be translated in the subject string. Each
14336 matching character is replaced by the corresponding character from the
14337 replacement list. For example
14338 </para>
14339 <literallayout class="monospaced">
14340 ${tr{abcdea}{ac}{13}}
14341 </literallayout>
14342 <para>
14343 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
14344 last occurrence is used. If the third string is shorter than the second, its
14345 last character is replicated. However, if it is empty, no translation takes
14346 place.
14347 </para>
14348 </listitem></varlistentry>
14349 </variablelist>
14350 </section>
14351 <section id="SECTexpop">
14352 <title>Expansion operators</title>
14353 <para>
14354 <indexterm role="concept">
14355 <primary>expansion</primary>
14356 <secondary>operators</secondary>
14357 </indexterm>
14358 For expansion items that perform transformations on a single argument string,
14359 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
14360 The substring is first expanded before the operation is applied to it. The
14361 following operations can be performed:
14362 </para>
14363 <variablelist>
14364 <varlistentry>
14365 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14366 <listitem>
14367 <para>
14368 <indexterm role="concept">
14369 <primary>expansion</primary>
14370 <secondary>RFC 2822 address handling</secondary>
14371 </indexterm>
14372 <indexterm role="concept">
14373 <primary><option>address</option> expansion item</primary>
14374 </indexterm>
14375 The string is interpreted as an RFC 2822 address, as it might appear in a
14376 header line, and the effective address is extracted from it. If the string does
14377 not parse successfully, the result is empty.
14378 </para>
14379 </listitem></varlistentry>
14380 <varlistentry>
14381 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14382 <listitem>
14383 <para>
14384 <indexterm role="concept">
14385 <primary>expansion</primary>
14386 <secondary>RFC 2822 address handling</secondary>
14387 </indexterm>
14388 <indexterm role="concept">
14389 <primary><option>addresses</option> expansion item</primary>
14390 </indexterm>
14391 The string (after expansion) is interpreted as a list of addresses in RFC
14392 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14393 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14394 result of the expansion is a colon-separated list, with appropriate
14395 doubling of colons should any happen to be present in the email addresses.
14396 Syntactically invalid RFC2822 address items are omitted from the output.
14397 </para>
14398 <para>
14399 It is possible to specify a character other than colon for the output
14400 separator by starting the string with &gt; followed by the new separator
14401 character. For example:
14402 </para>
14403 <literallayout class="monospaced">
14404 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
14405 </literallayout>
14406 <para>
14407 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14408 expansion item, which extracts the working address from a single RFC2822
14409 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14410 processing lists.
14411 </para>
14412 <para revisionflag="changed">
14413 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
14414 a strict interpretation of header line formatting.  Exim parses the bare,
14415 unquoted portion of an email address and if it finds a comma, treats it as an
14416 email address seperator. For the example header line:
14417 </para>
14418 <literallayout class="monospaced" revisionflag="changed">
14419 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
14420 </literallayout>
14421 <para revisionflag="changed">
14422 The first example below demonstrates that Q-encoded email addresses are parsed
14423 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
14424 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
14425 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
14426 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
14427 The third example shows that the presence of a comma is skipped when it is
14428 quoted.
14429 </para>
14430 <literallayout class="monospaced" revisionflag="changed">
14431 # exim -be '${addresses:From: \
14432 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
14433 user@example.com
14434 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
14435 Last:user@example.com
14436 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
14437 user@example.com
14438 </literallayout>
14439 </listitem></varlistentry>
14440 <varlistentry>
14441 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14442 <listitem>
14443 <para>
14444 <indexterm role="concept">
14445 <primary><option>base62</option> expansion item</primary>
14446 </indexterm>
14447 <indexterm role="concept">
14448 <primary>expansion</primary>
14449 <secondary>conversion to base 62</secondary>
14450 </indexterm>
14451 The string must consist entirely of decimal digits. The number is converted to
14452 base 62 and output as a string of six characters, including leading zeros. In
14453 the few operating environments where Exim uses base 36 instead of base 62 for
14454 its message identifiers (because those systems do not have case-sensitive file
14455 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14456 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14457 </para>
14458 </listitem></varlistentry>
14459 <varlistentry>
14460 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14461 <listitem>
14462 <para>
14463 <indexterm role="concept">
14464 <primary><option>base62d</option> expansion item</primary>
14465 </indexterm>
14466 <indexterm role="concept">
14467 <primary>expansion</primary>
14468 <secondary>conversion to base 62</secondary>
14469 </indexterm>
14470 The string must consist entirely of base-62 digits, or, in operating
14471 environments where Exim uses base 36 instead of base 62 for its message
14472 identifiers, base-36 digits. The number is converted to decimal and output as a
14473 string.
14474 </para>
14475 </listitem></varlistentry>
14476 <varlistentry>
14477 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14478 <listitem>
14479 <para>
14480 <indexterm role="concept">
14481 <primary>domain</primary>
14482 <secondary>extraction</secondary>
14483 </indexterm>
14484 <indexterm role="concept">
14485 <primary>expansion</primary>
14486 <secondary>domain extraction</secondary>
14487 </indexterm>
14488 The string is interpreted as an RFC 2822 address and the domain is extracted
14489 from it. If the string does not parse successfully, the result is empty.
14490 </para>
14491 </listitem></varlistentry>
14492 <varlistentry>
14493 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14494 <listitem>
14495 <para>
14496 <indexterm role="concept">
14497 <primary>expansion</primary>
14498 <secondary>escaping non-printing characters</secondary>
14499 </indexterm>
14500 <indexterm role="concept">
14501 <primary><option>escape</option> expansion item</primary>
14502 </indexterm>
14503 If the string contains any non-printing characters, they are converted to
14504 escape sequences starting with a backslash. Whether characters with the most
14505 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14506 is controlled by the <option>print_topbitchars</option> option.
14507 </para>
14508 </listitem></varlistentry>
14509 <varlistentry>
14510 <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>
14511 <listitem>
14512 <para>
14513 <indexterm role="concept">
14514 <primary>expansion</primary>
14515 <secondary>expression evaluation</secondary>
14516 </indexterm>
14517 <indexterm role="concept">
14518 <primary>expansion</primary>
14519 <secondary>arithmetic expression</secondary>
14520 </indexterm>
14521 <indexterm role="concept">
14522 <primary><option>eval</option> expansion item</primary>
14523 </indexterm>
14524 These items supports simple arithmetic and bitwise logical operations in
14525 expansion strings. The string (after expansion) must be a conventional
14526 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14527 logical operators, and parentheses. All operations are carried out using
14528 integer arithmetic. The operator priorities are as follows (the same as in the
14529 C programming language):
14530 </para>
14531 <informaltable frame="none">
14532 <tgroup cols="2" colsep="0" rowsep="0">
14533 <colspec colwidth="70pt" align="left"/>
14534 <colspec colwidth="300pt" align="left"/>
14535 <tbody>
14536 <row>
14537 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
14538 <entry>not (~), negate (-)</entry>
14539 </row>
14540 <row>
14541 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14542 <entry>multiply (*), divide (/), remainder (%)</entry>
14543 </row>
14544 <row>
14545 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14546 <entry>plus (+), minus (-)</entry>
14547 </row>
14548 <row>
14549 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14550 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
14551 </row>
14552 <row>
14553 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14554 <entry>and (&amp;)</entry>
14555 </row>
14556 <row>
14557 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
14558 <entry>xor (^)</entry>
14559 </row>
14560 <row>
14561 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
14562 <entry>or (|)</entry>
14563 </row>
14564 </tbody>
14565 </tgroup>
14566 </informaltable>
14567 <para>
14568 Binary operators with the same priority are evaluated from left to right. White
14569 space is permitted before or after operators.
14570 </para>
14571 <para>
14572 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14573 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14574 decimal, even if they start with a leading zero; hexadecimal numbers are not
14575 permitted. This can be useful when processing numbers extracted from dates or
14576 times, which often do have leading zeros.
14577 </para>
14578 <para>
14579 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
14580 or 1024*1024*1024,
14581 respectively. Negative numbers are supported. The result of the computation is
14582 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
14583 </para>
14584 <literallayout>
14585 <literal>${eval:1+1}            </literal>  yields 2
14586 <literal>${eval:1+2*3}          </literal>  yields 7
14587 <literal>${eval:(1+2)*3}        </literal>  yields 9
14588 <literal>${eval:2+42%5}         </literal>  yields 4
14589 <literal>${eval:0xc&amp;5}          </literal>  yields 4
14590 <literal>${eval:0xc|5}          </literal>  yields 13
14591 <literal>${eval:0xc^5}          </literal>  yields 9
14592 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
14593 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
14594 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
14595 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
14596 </literallayout>
14597 <para>
14598 As a more realistic example, in an ACL you might have
14599 </para>
14600 <literallayout class="monospaced">
14601 deny   message = Too many bad recipients
14602        condition =                    \
14603          ${if and {                   \
14604            {&gt;{$rcpt_count}{10}}       \
14605            {                          \
14606            &lt;                          \
14607              {$recipients_count}      \
14608              {${eval:$rcpt_count/2}}  \
14609            }                          \
14610          }{yes}{no}}
14611 </literallayout>
14612 <para>
14613 The condition is true if there have been more than 10 RCPT commands and
14614 fewer than half of them have resulted in a valid recipient.
14615 </para>
14616 </listitem></varlistentry>
14617 <varlistentry>
14618 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14619 <listitem>
14620 <para>
14621 <indexterm role="concept">
14622 <primary>expansion</primary>
14623 <secondary>re-expansion of substring</secondary>
14624 </indexterm>
14625 The <option>expand</option> operator causes a string to be expanded for a second time. For
14626 example,
14627 </para>
14628 <literallayout class="monospaced">
14629 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14630 </literallayout>
14631 <para>
14632 first looks up a string in a file while expanding the operand for <option>expand</option>,
14633 and then re-expands what it has found.
14634 </para>
14635 </listitem></varlistentry>
14636 <varlistentry>
14637 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14638 <listitem>
14639 <para>
14640 <indexterm role="concept">
14641 <primary>Unicode</primary>
14642 </indexterm>
14643 <indexterm role="concept">
14644 <primary>UTF-8</primary>
14645 <secondary>conversion from</secondary>
14646 </indexterm>
14647 <indexterm role="concept">
14648 <primary>expansion</primary>
14649 <secondary>UTF-8 conversion</secondary>
14650 </indexterm>
14651 <indexterm role="concept">
14652 <primary><option>from_utf8</option> expansion item</primary>
14653 </indexterm>
14654 The world is slowly moving towards Unicode, although there are no standards for
14655 email yet. However, other applications (including some databases) are starting
14656 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14657 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14658 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14659 the result is an undefined sequence of bytes.
14660 </para>
14661 <para>
14662 Unicode code points with values less than 256 are compatible with ASCII and
14663 ISO-8859-1 (also known as Latin-1).
14664 For example, character 169 is the copyright symbol in both cases, though the
14665 way it is encoded is different. In UTF-8, more than one byte is needed for
14666 characters with code values greater than 127, whereas ISO-8859-1 is a
14667 single-byte encoding (but thereby limited to 256 characters). This makes
14668 translation from UTF-8 to ISO-8859-1 straightforward.
14669 </para>
14670 </listitem></varlistentry>
14671 <varlistentry>
14672 <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>
14673 <listitem>
14674 <para>
14675 <indexterm role="concept">
14676 <primary>hash function</primary>
14677 <secondary>textual</secondary>
14678 </indexterm>
14679 <indexterm role="concept">
14680 <primary>expansion</primary>
14681 <secondary>textual hash</secondary>
14682 </indexterm>
14683 The <option>hash</option> operator is a simpler interface to the hashing function that can
14684 be used when the two parameters are fixed numbers (as opposed to strings that
14685 change when expanded). The effect is the same as
14686 </para>
14687 <literallayout class="monospaced">
14688 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14689 </literallayout>
14690 <para>
14691 See the description of the general <option>hash</option> item above for details. The
14692 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14693 </para>
14694 </listitem></varlistentry>
14695 <varlistentry>
14696 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14697 <listitem>
14698 <para>
14699 <indexterm role="concept">
14700 <primary>base64 encoding</primary>
14701 <secondary>conversion from hex</secondary>
14702 </indexterm>
14703 <indexterm role="concept">
14704 <primary>expansion</primary>
14705 <secondary>hex to base64</secondary>
14706 </indexterm>
14707 <indexterm role="concept">
14708 <primary><option>hex2b64</option> expansion item</primary>
14709 </indexterm>
14710 This operator converts a hex string into one that is base64 encoded. This can
14711 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14712 </para>
14713 </listitem></varlistentry>
14714 <varlistentry revisionflag="changed">
14715 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14716 <listitem>
14717 <para revisionflag="changed">
14718 <indexterm role="concept">
14719 <primary>quoting</primary>
14720 <secondary>hex-encoded unprintable characters</secondary>
14721 </indexterm>
14722 <indexterm role="concept">
14723 <primary><option>hexquote</option> expansion item</primary>
14724 </indexterm>
14725 This operator converts non-printable characters in a string into a hex
14726 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
14727 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
14728 byte value 127 is converted to <literal>\x7f</literal>.
14729 </para>
14730 </listitem></varlistentry>
14731 <varlistentry>
14732 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14733 <listitem>
14734 <para>
14735 <indexterm role="concept">
14736 <primary>case forcing in strings</primary>
14737 </indexterm>
14738 <indexterm role="concept">
14739 <primary>string</primary>
14740 <secondary>case forcing</secondary>
14741 </indexterm>
14742 <indexterm role="concept">
14743 <primary>lower casing</primary>
14744 </indexterm>
14745 <indexterm role="concept">
14746 <primary>expansion</primary>
14747 <secondary>case forcing</secondary>
14748 </indexterm>
14749 <indexterm role="concept">
14750 <primary><option>lc</option> expansion item</primary>
14751 </indexterm>
14752 This forces the letters in the string into lower-case, for example:
14753 </para>
14754 <literallayout class="monospaced">
14755 ${lc:$local_part}
14756 </literallayout>
14757 </listitem></varlistentry>
14758 <varlistentry>
14759 <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>
14760 <listitem>
14761 <para>
14762 <indexterm role="concept">
14763 <primary>expansion</primary>
14764 <secondary>string truncation</secondary>
14765 </indexterm>
14766 <indexterm role="concept">
14767 <primary><option>length</option> expansion item</primary>
14768 </indexterm>
14769 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14770 can be used when the parameter is a fixed number (as opposed to a string that
14771 changes when expanded). The effect is the same as
14772 </para>
14773 <literallayout class="monospaced">
14774 ${length{&lt;number&gt;}{&lt;string&gt;}}
14775 </literallayout>
14776 <para>
14777 See the description of the general <option>length</option> item above for details. Note that
14778 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14779 when <option>length</option> is used as an operator.
14780 </para>
14781 </listitem></varlistentry>
14782 <varlistentry revisionflag="changed">
14783 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14784 <listitem>
14785 <para revisionflag="changed">
14786 <indexterm role="concept">
14787 <primary>expansion</primary>
14788 <secondary>list item count</secondary>
14789 </indexterm>
14790 <indexterm role="concept">
14791 <primary>list</primary>
14792 <secondary>item count</secondary>
14793 </indexterm>
14794 <indexterm role="concept">
14795 <primary>list</primary>
14796 <secondary>count of items</secondary>
14797 </indexterm>
14798 <indexterm role="concept">
14799 <primary><option>listcount</option> expansion item</primary>
14800 </indexterm>
14801 The string is interpreted as a list and the number of items is returned.
14802 </para>
14803 </listitem></varlistentry>
14804 <varlistentry revisionflag="changed">
14805 <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>
14806 <listitem>
14807 <para revisionflag="changed">
14808 <indexterm role="concept">
14809 <primary>expansion</primary>
14810 <secondary>named list</secondary>
14811 </indexterm>
14812 <indexterm role="concept">
14813 <primary><option>listnamed</option> expansion item</primary>
14814 </indexterm>
14815 The name is interpreted as a named list and the content of the list is returned,
14816 expanding any referenced lists, re-quoting as needed for colon-separation.
14817 If the optional type is given it must be one of "a", "d", "h" or "l"
14818 and selects address-, domain-, host- or localpart- lists to search among respectively.
14819 Otherwise all types are searched in an undefined order and the first
14820 matching list is returned.
14821 </para>
14822 </listitem></varlistentry>
14823 <varlistentry>
14824 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14825 <listitem>
14826 <para>
14827 <indexterm role="concept">
14828 <primary>expansion</primary>
14829 <secondary>local part extraction</secondary>
14830 </indexterm>
14831 <indexterm role="concept">
14832 <primary><option>local_part</option> expansion item</primary>
14833 </indexterm>
14834 The string is interpreted as an RFC 2822 address and the local part is
14835 extracted from it. If the string does not parse successfully, the result is
14836 empty.
14837 </para>
14838 </listitem></varlistentry>
14839 <varlistentry>
14840 <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>
14841 <listitem>
14842 <para>
14843 <indexterm role="concept">
14844 <primary>masked IP address</primary>
14845 </indexterm>
14846 <indexterm role="concept">
14847 <primary>IP address</primary>
14848 <secondary>masking</secondary>
14849 </indexterm>
14850 <indexterm role="concept">
14851 <primary>CIDR notation</primary>
14852 </indexterm>
14853 <indexterm role="concept">
14854 <primary>expansion</primary>
14855 <secondary>IP address masking</secondary>
14856 </indexterm>
14857 <indexterm role="concept">
14858 <primary><option>mask</option> expansion item</primary>
14859 </indexterm>
14860 If the form of the string to be operated on is not an IP address followed by a
14861 slash and an integer (that is, a network address in CIDR notation), the
14862 expansion fails. Otherwise, this operator converts the IP address to binary,
14863 masks off the least significant bits according to the bit count, and converts
14864 the result back to text, with mask appended. For example,
14865 </para>
14866 <literallayout class="monospaced">
14867 ${mask:10.111.131.206/28}
14868 </literallayout>
14869 <para>
14870 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14871 be mostly used for looking up masked addresses in files, the result for an IPv6
14872 address uses dots to separate components instead of colons, because colon
14873 terminates a key string in lsearch files. So, for example,
14874 </para>
14875 <literallayout class="monospaced">
14876 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14877 </literallayout>
14878 <para>
14879 returns the string
14880 </para>
14881 <literallayout class="monospaced">
14882 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14883 </literallayout>
14884 <para>
14885 Letters in IPv6 addresses are always output in lower case.
14886 </para>
14887 </listitem></varlistentry>
14888 <varlistentry>
14889 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14890 <listitem>
14891 <para>
14892 <indexterm role="concept">
14893 <primary>MD5 hash</primary>
14894 </indexterm>
14895 <indexterm role="concept">
14896 <primary>expansion</primary>
14897 <secondary>MD5 hash</secondary>
14898 </indexterm>
14899 <indexterm role="concept">
14900 <primary><option>md5</option> expansion item</primary>
14901 </indexterm>
14902 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14903 as a 32-digit hexadecimal number, in which any letters are in lower case.
14904 </para>
14905 </listitem></varlistentry>
14906 <varlistentry>
14907 <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>
14908 <listitem>
14909 <para>
14910 <indexterm role="concept">
14911 <primary>expansion</primary>
14912 <secondary>numeric hash</secondary>
14913 </indexterm>
14914 <indexterm role="concept">
14915 <primary>hash function</primary>
14916 <secondary>numeric</secondary>
14917 </indexterm>
14918 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14919 that can be used when the two parameters are fixed numbers (as opposed to
14920 strings that change when expanded). The effect is the same as
14921 </para>
14922 <literallayout class="monospaced">
14923 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14924 </literallayout>
14925 <para>
14926 See the description of the general <option>nhash</option> item above for details.
14927 </para>
14928 </listitem></varlistentry>
14929 <varlistentry>
14930 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14931 <listitem>
14932 <para>
14933 <indexterm role="concept">
14934 <primary>quoting</primary>
14935 <secondary>in string expansions</secondary>
14936 </indexterm>
14937 <indexterm role="concept">
14938 <primary>expansion</primary>
14939 <secondary>quoting</secondary>
14940 </indexterm>
14941 <indexterm role="concept">
14942 <primary><option>quote</option> expansion item</primary>
14943 </indexterm>
14944 The <option>quote</option> operator puts its argument into double quotes if it
14945 is an empty string or
14946 contains anything other than letters, digits, underscores, dots, and hyphens.
14947 Any occurrences of double quotes and backslashes are escaped with a backslash.
14948 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14949 respectively For example,
14950 </para>
14951 <literallayout class="monospaced">
14952 ${quote:ab"*"cd}
14953 </literallayout>
14954 <para>
14955 becomes
14956 </para>
14957 <literallayout class="monospaced">
14958 "ab\"*\"cd"
14959 </literallayout>
14960 <para>
14961 The place where this is useful is when the argument is a substitution from a
14962 variable or a message header.
14963 </para>
14964 </listitem></varlistentry>
14965 <varlistentry>
14966 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14967 <listitem>
14968 <para>
14969 <indexterm role="concept">
14970 <primary><option>quote_local_part</option> expansion item</primary>
14971 </indexterm>
14972 This operator is like <option>quote</option>, except that it quotes the string only if
14973 required to do so by the rules of RFC 2822 for quoting local parts. For
14974 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14975 If you are creating a new email address from the contents of <varname>$local_part</varname>
14976 (or any other unknown data), you should always use this operator.
14977 </para>
14978 </listitem></varlistentry>
14979 <varlistentry>
14980 <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>
14981 <listitem>
14982 <para>
14983 <indexterm role="concept">
14984 <primary>quoting</primary>
14985 <secondary>lookup-specific</secondary>
14986 </indexterm>
14987 This operator applies lookup-specific quoting rules to the string. Each
14988 query-style lookup type has its own quoting rules which are described with
14989 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14990 </para>
14991 <literallayout class="monospaced">
14992 ${quote_ldap:two * two}
14993 </literallayout>
14994 <para>
14995 returns
14996 </para>
14997 <literallayout class="monospaced">
14998 two%20%5C2A%20two
14999 </literallayout>
15000 <para>
15001 For single-key lookup types, no quoting is ever necessary and this operator
15002 yields an unchanged string.
15003 </para>
15004 </listitem></varlistentry>
15005 <varlistentry>
15006 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15007 <listitem>
15008 <para>
15009 <indexterm role="concept">
15010 <primary>random number</primary>
15011 </indexterm>
15012 This operator returns a somewhat random number which is less than the
15013 supplied number and is at least 0.  The quality of this randomness depends
15014 on how Exim was built; the values are not suitable for keying material.
15015 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15016 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15017 for versions of GnuTLS with that function.
15018 Otherwise, the implementation may be arc4random(), random() seeded by
15019 srandomdev() or srandom(), or a custom implementation even weaker than
15020 random().
15021 </para>
15022 </listitem></varlistentry>
15023 <varlistentry>
15024 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15025 <listitem>
15026 <para>
15027 <indexterm role="concept">
15028 <primary>expansion</primary>
15029 <secondary>IP address</secondary>
15030 </indexterm>
15031 This operator reverses an IP address; for IPv4 addresses, the result is in
15032 dotted-quad decimal form, while for IPv6 addreses the result is in
15033 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15034 for DNS.  For example,
15035 </para>
15036 <literallayout class="monospaced">
15037 ${reverse_ip:192.0.2.4}
15038 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15039 </literallayout>
15040 <para>
15041 returns
15042 </para>
15043 <literallayout class="monospaced">
15044 4.2.0.192
15045 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
15046 </literallayout>
15047 </listitem></varlistentry>
15048 <varlistentry>
15049 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15050 <listitem>
15051 <para>
15052 <indexterm role="concept">
15053 <primary>expansion</primary>
15054 <secondary>RFC 2047</secondary>
15055 </indexterm>
15056 <indexterm role="concept">
15057 <primary>RFC 2047</primary>
15058 <secondary>expansion operator</secondary>
15059 </indexterm>
15060 <indexterm role="concept">
15061 <primary><option>rfc2047</option> expansion item</primary>
15062 </indexterm>
15063 This operator encodes text according to the rules of RFC 2047. This is an
15064 encoding that is used in header lines to encode non-ASCII characters. It is
15065 assumed that the input string is in the encoding specified by the
15066 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
15067 contains only characters in the range 33&ndash;126, and no instances of the
15068 characters
15069 </para>
15070 <literallayout class="monospaced">
15071 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15072 </literallayout>
15073 <para>
15074 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15075 string, using as many <quote>encoded words</quote> as necessary to encode all the
15076 characters.
15077 </para>
15078 </listitem></varlistentry>
15079 <varlistentry>
15080 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15081 <listitem>
15082 <para>
15083 <indexterm role="concept">
15084 <primary>expansion</primary>
15085 <secondary>RFC 2047</secondary>
15086 </indexterm>
15087 <indexterm role="concept">
15088 <primary>RFC 2047</primary>
15089 <secondary>decoding</secondary>
15090 </indexterm>
15091 <indexterm role="concept">
15092 <primary><option>rfc2047d</option> expansion item</primary>
15093 </indexterm>
15094 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15095 bytes are replaced by question marks. Characters are converted into the
15096 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15097 not recognized unless <option>check_rfc2047_length</option> is set false.
15098 </para>
15099 <para>
15100 <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
15101 access a header line, RFC 2047 decoding is done automatically. You do not need
15102 to use this operator as well.
15103 </para>
15104 </listitem></varlistentry>
15105 <varlistentry>
15106 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15107 <listitem>
15108 <para>
15109 <indexterm role="concept">
15110 <primary>quoting</primary>
15111 <secondary>in regular expressions</secondary>
15112 </indexterm>
15113 <indexterm role="concept">
15114 <primary>regular expressions</primary>
15115 <secondary>quoting</secondary>
15116 </indexterm>
15117 <indexterm role="concept">
15118 <primary><option>rxquote</option> expansion item</primary>
15119 </indexterm>
15120 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15121 characters in its argument. This is useful when substituting the values of
15122 variables or headers inside regular expressions.
15123 </para>
15124 </listitem></varlistentry>
15125 <varlistentry>
15126 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15127 <listitem>
15128 <para>
15129 <indexterm role="concept">
15130 <primary>SHA-1 hash</primary>
15131 </indexterm>
15132 <indexterm role="concept">
15133 <primary>expansion</primary>
15134 <secondary>SHA-1 hashing</secondary>
15135 </indexterm>
15136 <indexterm role="concept">
15137 <primary><option>sha2</option> expansion item</primary>
15138 </indexterm>
15139 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15140 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15141 </para>
15142 </listitem></varlistentry>
15143 <varlistentry>
15144 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15145 <listitem>
15146 <para>
15147 <indexterm role="concept">
15148 <primary>expansion</primary>
15149 <secondary>statting a file</secondary>
15150 </indexterm>
15151 <indexterm role="concept">
15152 <primary>file</primary>
15153 <secondary>extracting characteristics</secondary>
15154 </indexterm>
15155 <indexterm role="concept">
15156 <primary><option>stat</option> expansion item</primary>
15157 </indexterm>
15158 The string, after expansion, must be a file path. A call to the <function>stat()</function>
15159 function is made for this path. If <function>stat()</function> fails, an error occurs and the
15160 expansion fails. If it succeeds, the data from the stat replaces the item, as a
15161 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
15162 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
15163 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
15164 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
15165 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
15166 can extract individual fields using the <option>extract</option> expansion item.
15167 </para>
15168 <para>
15169 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
15170 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
15171 systems for files larger than 2GB.
15172 </para>
15173 </listitem></varlistentry>
15174 <varlistentry>
15175 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15176 <listitem>
15177 <para>
15178 <indexterm role="concept">
15179 <primary>expansion</primary>
15180 <secondary>base64 encoding</secondary>
15181 </indexterm>
15182 <indexterm role="concept">
15183 <primary>base64 encoding</primary>
15184 <secondary>in string expansion</secondary>
15185 </indexterm>
15186 <indexterm role="concept">
15187 <primary><option>str2b64</option> expansion item</primary>
15188 </indexterm>
15189 This operator converts a string into one that is base64 encoded.
15190 </para>
15191 </listitem></varlistentry>
15192 <varlistentry>
15193 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15194 <listitem>
15195 <para>
15196 <indexterm role="concept">
15197 <primary>expansion</primary>
15198 <secondary>string length</secondary>
15199 </indexterm>
15200 <indexterm role="concept">
15201 <primary>string</primary>
15202 <secondary>length in expansion</secondary>
15203 </indexterm>
15204 <indexterm role="concept">
15205 <primary><option>strlen</option> expansion item</primary>
15206 </indexterm>
15207 The item is replace by the length of the expanded string, expressed as a
15208 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
15209 </para>
15210 </listitem></varlistentry>
15211 <varlistentry>
15212 <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>
15213 <listitem>
15214 <para>
15215 <indexterm role="concept">
15216 <primary><option>substr</option> expansion item</primary>
15217 </indexterm>
15218 <indexterm role="concept">
15219 <primary>substring extraction</primary>
15220 </indexterm>
15221 <indexterm role="concept">
15222 <primary>expansion</primary>
15223 <secondary>substring expansion</secondary>
15224 </indexterm>
15225 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
15226 can be used when the two parameters are fixed numbers (as opposed to strings
15227 that change when expanded). The effect is the same as
15228 </para>
15229 <literallayout class="monospaced">
15230 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
15231 </literallayout>
15232 <para>
15233 See the description of the general <option>substr</option> item above for details. The
15234 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
15235 </para>
15236 </listitem></varlistentry>
15237 <varlistentry>
15238 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15239 <listitem>
15240 <para>
15241 <indexterm role="concept">
15242 <primary><option>time_eval</option> expansion item</primary>
15243 </indexterm>
15244 <indexterm role="concept">
15245 <primary>time interval</primary>
15246 <secondary>decoding</secondary>
15247 </indexterm>
15248 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
15249 seconds.
15250 </para>
15251 </listitem></varlistentry>
15252 <varlistentry>
15253 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15254 <listitem>
15255 <para>
15256 <indexterm role="concept">
15257 <primary><option>time_interval</option> expansion item</primary>
15258 </indexterm>
15259 <indexterm role="concept">
15260 <primary>time interval</primary>
15261 <secondary>formatting</secondary>
15262 </indexterm>
15263 The argument (after sub-expansion) must be a sequence of decimal digits that
15264 represents an interval of time as a number of seconds. It is converted into a
15265 number of larger units and output in Exim&#x2019;s normal time format, for example,
15266 <literal>1w3d4h2m6s</literal>.
15267 </para>
15268 </listitem></varlistentry>
15269 <varlistentry>
15270 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15271 <listitem>
15272 <para>
15273 <indexterm role="concept">
15274 <primary>case forcing in strings</primary>
15275 </indexterm>
15276 <indexterm role="concept">
15277 <primary>string</primary>
15278 <secondary>case forcing</secondary>
15279 </indexterm>
15280 <indexterm role="concept">
15281 <primary>upper casing</primary>
15282 </indexterm>
15283 <indexterm role="concept">
15284 <primary>expansion</primary>
15285 <secondary>case forcing</secondary>
15286 </indexterm>
15287 <indexterm role="concept">
15288 <primary><option>uc</option> expansion item</primary>
15289 </indexterm>
15290 This forces the letters in the string into upper-case.
15291 </para>
15292 </listitem></varlistentry>
15293 </variablelist>
15294 </section>
15295 <section id="SECTexpcond">
15296 <title>Expansion conditions</title>
15297 <para>
15298 <indexterm role="concept" id="IIDexpcond" class="startofrange">
15299 <primary>expansion</primary>
15300 <secondary>conditions</secondary>
15301 </indexterm>
15302 The following conditions are available for testing by the <option>${if</option> construct
15303 while expanding strings:
15304 </para>
15305 <variablelist>
15306 <varlistentry>
15307 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
15308 <listitem>
15309 <para>
15310 <indexterm role="concept">
15311 <primary>expansion</primary>
15312 <secondary>negating a condition</secondary>
15313 </indexterm>
15314 <indexterm role="concept">
15315 <primary>negation</primary>
15316 <secondary>in expansion condition</secondary>
15317 </indexterm>
15318 Preceding any condition with an exclamation mark negates the result of the
15319 condition.
15320 </para>
15321 </listitem></varlistentry>
15322 <varlistentry>
15323 <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>
15324 <listitem>
15325 <para>
15326 <indexterm role="concept">
15327 <primary>numeric comparison</primary>
15328 </indexterm>
15329 <indexterm role="concept">
15330 <primary>expansion</primary>
15331 <secondary>numeric comparison</secondary>
15332 </indexterm>
15333 There are a number of symbolic operators for doing numeric comparisons. They
15334 are:
15335 </para>
15336 <literallayout>
15337 <literal>=   </literal>   equal
15338 <literal>==  </literal>   equal
15339 <literal>&gt;   </literal>   greater
15340 <literal>&gt;=  </literal>   greater or equal
15341 <literal>&lt;   </literal>   less
15342 <literal>&lt;=  </literal>   less or equal
15343 </literallayout>
15344 <para>
15345 For example:
15346 </para>
15347 <literallayout class="monospaced">
15348 ${if &gt;{$message_size}{10M} ...
15349 </literallayout>
15350 <para>
15351 Note that the general negation operator provides for inequality testing. The
15352 two strings must take the form of optionally signed decimal integers,
15353 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
15354 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
15355 As a special case, the numerical value of an empty string is taken as
15356 zero.
15357 </para>
15358 <para>
15359 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
15360 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
15361 10M, not if 10M is larger than <varname>$message_size</varname>.
15362 </para>
15363 </listitem></varlistentry>
15364 <varlistentry revisionflag="changed">
15365 <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>
15366 <listitem>
15367 <para revisionflag="changed">
15368 <indexterm role="concept">
15369 <primary>expansion</primary>
15370 <secondary>calling an acl</secondary>
15371 </indexterm>
15372 <indexterm role="concept">
15373 <primary><option>acl</option></primary>
15374 <secondary>expansion condition</secondary>
15375 </indexterm>
15376 The name and zero to nine argument strings are first expanded separately.  The expanded
15377 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
15378 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
15379 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
15380 and may use the variables; if another acl expansion is used the values
15381 are restored after it returns.  If the ACL sets
15382 a value using a "message =" modifier the variable $value becomes
15383 the result of the expansion, otherwise it is empty.
15384 If the ACL returns accept the condition is true; if deny, false.
15385 If the ACL returns defer the result is a forced-fail.
15386 </para>
15387 </listitem></varlistentry>
15388 <varlistentry>
15389 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15390 <listitem>
15391 <para>
15392 <indexterm role="concept">
15393 <primary>expansion</primary>
15394 <secondary>boolean parsing</secondary>
15395 </indexterm>
15396 <indexterm role="concept">
15397 <primary><option>bool</option> expansion condition</primary>
15398 </indexterm>
15399 This condition turns a string holding a true or false representation into
15400 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
15401 (case-insensitively); also positive integer numbers map to true if non-zero,
15402 false if zero.
15403 An empty string is treated as false.
15404 Leading and trailing whitespace is ignored;
15405 thus a string consisting only of whitespace is false.
15406 All other string values will result in expansion failure.
15407 </para>
15408 <para>
15409 When combined with ACL variables, this expansion condition will let you
15410 make decisions in one place and act on those decisions in another place.
15411 For example:
15412 </para>
15413 <literallayout class="monospaced">
15414 ${if bool{$acl_m_privileged_sender} ...
15415 </literallayout>
15416 </listitem></varlistentry>
15417 <varlistentry>
15418 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15419 <listitem>
15420 <para>
15421 <indexterm role="concept">
15422 <primary>expansion</primary>
15423 <secondary>boolean parsing</secondary>
15424 </indexterm>
15425 <indexterm role="concept">
15426 <primary><option>bool_lax</option> expansion condition</primary>
15427 </indexterm>
15428 Like <option>bool</option>, this condition turns a string into a boolean state.  But
15429 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
15430 loose definition that the Router <option>condition</option> option uses.  The empty string
15431 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
15432 true.  Leading and trailing whitespace is ignored.
15433 </para>
15434 <para>
15435 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
15436 </para>
15437 </listitem></varlistentry>
15438 <varlistentry>
15439 <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>
15440 <listitem>
15441 <para>
15442 <indexterm role="concept">
15443 <primary>expansion</primary>
15444 <secondary>encrypted comparison</secondary>
15445 </indexterm>
15446 <indexterm role="concept">
15447 <primary>encrypted strings, comparing</primary>
15448 </indexterm>
15449 <indexterm role="concept">
15450 <primary><option>crypteq</option> expansion condition</primary>
15451 </indexterm>
15452 This condition is included in the Exim binary if it is built to support any
15453 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
15454 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
15455 included in the binary.
15456 </para>
15457 <para>
15458 The <option>crypteq</option> condition has two arguments. The first is encrypted and
15459 compared against the second, which is already encrypted. The second string may
15460 be in the LDAP form for storing encrypted strings, which starts with the
15461 encryption type in curly brackets, followed by the data. If the second string
15462 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
15463 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
15464 Typically this will be a field from a password file. An example of an encrypted
15465 string in LDAP form is:
15466 </para>
15467 <literallayout class="monospaced">
15468 {md5}CY9rzUYh03PK3k6DJie09g==
15469 </literallayout>
15470 <para>
15471 If such a string appears directly in an expansion, the curly brackets have to
15472 be quoted, because they are part of the expansion syntax. For example:
15473 </para>
15474 <literallayout class="monospaced">
15475 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
15476 </literallayout>
15477 <para>
15478 The following encryption types (whose names are matched case-independently) are
15479 supported:
15480 </para>
15481 <itemizedlist>
15482 <listitem>
15483 <para>
15484 <indexterm role="concept">
15485 <primary>MD5 hash</primary>
15486 </indexterm>
15487 <indexterm role="concept">
15488 <primary>base64 encoding</primary>
15489 <secondary>in encrypted password</secondary>
15490 </indexterm>
15491 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
15492 printable characters to compare with the remainder of the second string. If the
15493 length of the comparison string is 24, Exim assumes that it is base64 encoded
15494 (as in the above example). If the length is 32, Exim assumes that it is a
15495 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
15496 comparison fails.
15497 </para>
15498 </listitem>
15499 <listitem>
15500 <para>
15501 <indexterm role="concept">
15502 <primary>SHA-1 hash</primary>
15503 </indexterm>
15504 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15505 printable characters to compare with the remainder of the second string. If the
15506 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15507 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15508 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15509 </para>
15510 </listitem>
15511 <listitem>
15512 <para>
15513 <indexterm role="concept">
15514 <primary><function>crypt()</function></primary>
15515 </indexterm>
15516 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15517 only the first eight characters of the password. However, in modern operating
15518 systems this is no longer true, and in many cases the entire password is used,
15519 whatever its length.
15520 </para>
15521 </listitem>
15522 <listitem>
15523 <para>
15524 <indexterm role="concept">
15525 <primary><function>crypt16()</function></primary>
15526 </indexterm>
15527 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15528 use up to 16 characters of the password in some operating systems. Again, in
15529 modern operating systems, more characters may be used.
15530 </para>
15531 </listitem>
15532 </itemizedlist>
15533 <para>
15534 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15535 <function>crypt()</function>. For operating systems that have their own version, setting
15536 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15537 operating system version instead of its own. This option is set by default in
15538 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15539 support <function>crypt16()</function>.
15540 </para>
15541 <para>
15542 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
15543 it was not using the same algorithm as some operating systems&#x2019; versions. It
15544 turns out that as well as <function>crypt16()</function> there is a function called
15545 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15546 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
15547 </para>
15548 <para>
15549 However, since there is now a move away from the traditional <function>crypt()</function>
15550 functions towards using SHA1 and other algorithms, tidying up this area of
15551 Exim is seen as very low priority.
15552 </para>
15553 <para>
15554 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15555 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15556 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15557 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15558 function by specifying it explicitly in curly brackets.
15559 </para>
15560 </listitem></varlistentry>
15561 <varlistentry>
15562 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
15563 <listitem>
15564 <para>
15565 <indexterm role="concept">
15566 <primary>expansion</primary>
15567 <secondary>checking for empty variable</secondary>
15568 </indexterm>
15569 <indexterm role="concept">
15570 <primary><option>def</option> expansion condition</primary>
15571 </indexterm>
15572 The <option>def</option> condition must be followed by the name of one of the expansion
15573 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15574 variable does not contain the empty string. For example:
15575 </para>
15576 <literallayout class="monospaced">
15577 ${if def:sender_ident {from $sender_ident}}
15578 </literallayout>
15579 <para>
15580 Note that the variable name is given without a leading <option>$</option> character. If the
15581 variable does not exist, the expansion fails.
15582 </para>
15583 </listitem></varlistentry>
15584 <varlistentry>
15585 <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>
15586 <listitem>
15587 <para>
15588 <indexterm role="concept">
15589 <primary>expansion</primary>
15590 <secondary>checking header line existence</secondary>
15591 </indexterm>
15592 This condition is true if a message is being processed and the named header
15593 exists in the message. For example,
15594 </para>
15595 <literallayout class="monospaced">
15596 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15597 </literallayout>
15598 <para>
15599 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15600 the header name must be terminated by a colon if white space does not follow.
15601 </para>
15602 </listitem></varlistentry>
15603 <varlistentry>
15604 <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>
15605 <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>
15606 <listitem>
15607 <para>
15608 <indexterm role="concept">
15609 <primary>string</primary>
15610 <secondary>comparison</secondary>
15611 </indexterm>
15612 <indexterm role="concept">
15613 <primary>expansion</primary>
15614 <secondary>string comparison</secondary>
15615 </indexterm>
15616 <indexterm role="concept">
15617 <primary><option>eq</option> expansion condition</primary>
15618 </indexterm>
15619 <indexterm role="concept">
15620 <primary><option>eqi</option> expansion condition</primary>
15621 </indexterm>
15622 The two substrings are first expanded. The condition is true if the two
15623 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15624 letters, whereas for <option>eqi</option> the comparison is case-independent.
15625 </para>
15626 </listitem></varlistentry>
15627 <varlistentry>
15628 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15629 <listitem>
15630 <para>
15631 <indexterm role="concept">
15632 <primary>expansion</primary>
15633 <secondary>file existence test</secondary>
15634 </indexterm>
15635 <indexterm role="concept">
15636 <primary>file</primary>
15637 <secondary>existence test</secondary>
15638 </indexterm>
15639 <indexterm role="concept">
15640 <primary><option>exists</option>, expansion condition</primary>
15641 </indexterm>
15642 The substring is first expanded and then interpreted as an absolute path. The
15643 condition is true if the named file (or directory) exists. The existence test
15644 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15645 users&#x2019; filter files may be locked out by the system administrator.
15646 </para>
15647 </listitem></varlistentry>
15648 <varlistentry>
15649 <term><emphasis role="bold">first_delivery</emphasis></term>
15650 <listitem>
15651 <para>
15652 <indexterm role="concept">
15653 <primary>delivery</primary>
15654 <secondary>first</secondary>
15655 </indexterm>
15656 <indexterm role="concept">
15657 <primary>first delivery</primary>
15658 </indexterm>
15659 <indexterm role="concept">
15660 <primary>expansion</primary>
15661 <secondary>first delivery test</secondary>
15662 </indexterm>
15663 <indexterm role="concept">
15664 <primary><option>first_delivery</option> expansion condition</primary>
15665 </indexterm>
15666 This condition, which has no data, is true during a message&#x2019;s first delivery
15667 attempt. It is false during any subsequent delivery attempts.
15668 </para>
15669 </listitem></varlistentry>
15670 <varlistentry>
15671 <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>
15672 <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>
15673 <listitem>
15674 <para>
15675 <indexterm role="concept">
15676 <primary>list</primary>
15677 <secondary>iterative conditions</secondary>
15678 </indexterm>
15679 <indexterm role="concept">
15680 <primary>expansion</primary>
15681 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15682 </indexterm>
15683 <indexterm role="concept">
15684 <primary>expansion</primary>
15685 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15686 </indexterm>
15687 <indexterm role="variable">
15688 <primary><varname>$item</varname></primary>
15689 </indexterm>
15690 These conditions iterate over a list. The first argument is expanded to form
15691 the list. By default, the list separator is a colon, but it can be changed by
15692 the normal method. The second argument is interpreted as a condition that is to
15693 be applied to each item in the list in turn. During the interpretation of the
15694 condition, the current list item is placed in a variable called <varname>$item</varname>.
15695 </para>
15696 <itemizedlist>
15697 <listitem>
15698 <para>
15699 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15700 the result of the whole condition is true. If the condition is false for all
15701 items in the list, the overall condition is false.
15702 </para>
15703 </listitem>
15704 <listitem>
15705 <para>
15706 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15707 and the result of the whole condition is false. If the condition is true for
15708 all items in the list, the overall condition is true.
15709 </para>
15710 </listitem>
15711 </itemizedlist>
15712 <para>
15713 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15714 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15715 that the condition must be false for at least one item. In this example, the
15716 list separator is changed to a comma:
15717 </para>
15718 <literallayout class="monospaced">
15719 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
15720 </literallayout>
15721 <para>
15722 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15723 being processed, to enable these expansion items to be nested.
15724 </para>
15725 <para>
15726 <phrase revisionflag="changed">To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.</phrase>
15727 </para>
15728 </listitem></varlistentry>
15729 <varlistentry>
15730 <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>
15731 <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>
15732 <listitem>
15733 <para>
15734 <indexterm role="concept">
15735 <primary>string</primary>
15736 <secondary>comparison</secondary>
15737 </indexterm>
15738 <indexterm role="concept">
15739 <primary>expansion</primary>
15740 <secondary>string comparison</secondary>
15741 </indexterm>
15742 <indexterm role="concept">
15743 <primary><option>ge</option> expansion condition</primary>
15744 </indexterm>
15745 <indexterm role="concept">
15746 <primary><option>gei</option> expansion condition</primary>
15747 </indexterm>
15748 The two substrings are first expanded. The condition is true if the first
15749 string is lexically greater than or equal to the second string. For <option>ge</option> the
15750 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15751 case-independent.
15752 </para>
15753 </listitem></varlistentry>
15754 <varlistentry>
15755 <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>
15756 <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>
15757 <listitem>
15758 <para>
15759 <indexterm role="concept">
15760 <primary>string</primary>
15761 <secondary>comparison</secondary>
15762 </indexterm>
15763 <indexterm role="concept">
15764 <primary>expansion</primary>
15765 <secondary>string comparison</secondary>
15766 </indexterm>
15767 <indexterm role="concept">
15768 <primary><option>gt</option> expansion condition</primary>
15769 </indexterm>
15770 <indexterm role="concept">
15771 <primary><option>gti</option> expansion condition</primary>
15772 </indexterm>
15773 The two substrings are first expanded. The condition is true if the first
15774 string is lexically greater than the second string. For <option>gt</option> the comparison
15775 includes the case of letters, whereas for <option>gti</option> the comparison is
15776 case-independent.
15777 </para>
15778 </listitem></varlistentry>
15779 <varlistentry>
15780 <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>
15781 <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>
15782 <listitem>
15783 <para>
15784 <indexterm role="concept">
15785 <primary>string</primary>
15786 <secondary>comparison</secondary>
15787 </indexterm>
15788 <indexterm role="concept">
15789 <primary>list</primary>
15790 <secondary>iterative conditions</secondary>
15791 </indexterm>
15792 Both strings are expanded; the second string is treated as a list of simple
15793 strings; if the first string is a member of the second, then the condition
15794 is true.
15795 </para>
15796 <para>
15797 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
15798 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
15799 </para>
15800 <literallayout class="monospaced">
15801 ${if inlist{needle}{foo:needle:bar}}
15802   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
15803 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
15804   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
15805 </literallayout>
15806 </listitem></varlistentry>
15807 <varlistentry>
15808 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15809 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15810 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15811 <listitem>
15812 <para>
15813 <indexterm role="concept">
15814 <primary>IP address</primary>
15815 <secondary>testing string format</secondary>
15816 </indexterm>
15817 <indexterm role="concept">
15818 <primary>string</primary>
15819 <secondary>testing for IP address</secondary>
15820 </indexterm>
15821 <indexterm role="concept">
15822 <primary><option>isip</option> expansion condition</primary>
15823 </indexterm>
15824 <indexterm role="concept">
15825 <primary><option>isip4</option> expansion condition</primary>
15826 </indexterm>
15827 <indexterm role="concept">
15828 <primary><option>isip6</option> expansion condition</primary>
15829 </indexterm>
15830 The substring is first expanded, and then tested to see if it has the form of
15831 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15832 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15833 </para>
15834 <para>
15835 For an IPv4 address, the test is for four dot-separated components, each of
15836 which consists of from one to three digits. For an IPv6 address, up to eight
15837 colon-separated components are permitted, each containing from one to four
15838 hexadecimal digits. There may be fewer than eight components if an empty
15839 component (adjacent colons) is present. Only one empty component is permitted.
15840 </para>
15841 <para>
15842 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15843 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15844 check. The main use of these tests is to distinguish between IP addresses and
15845 host names, or between IPv4 and IPv6 addresses. For example, you could use
15846 </para>
15847 <literallayout class="monospaced">
15848 ${if isip4{$sender_host_address}...
15849 </literallayout>
15850 <para>
15851 to test which IP version an incoming SMTP connection is using.
15852 </para>
15853 </listitem></varlistentry>
15854 <varlistentry>
15855 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15856 <listitem>
15857 <para>
15858 <indexterm role="concept">
15859 <primary>LDAP</primary>
15860 <secondary>use for authentication</secondary>
15861 </indexterm>
15862 <indexterm role="concept">
15863 <primary>expansion</primary>
15864 <secondary>LDAP authentication test</secondary>
15865 </indexterm>
15866 <indexterm role="concept">
15867 <primary><option>ldapauth</option> expansion condition</primary>
15868 </indexterm>
15869 This condition supports user authentication using LDAP. See section
15870 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15871 queries. For this use, the query must contain a user name and password. The
15872 query itself is not used, and can be empty. The condition is true if the
15873 password is not empty, and the user name and password are accepted by the LDAP
15874 server. An empty password is rejected without calling LDAP because LDAP binds
15875 with an empty password are considered anonymous regardless of the username, and
15876 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15877 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15878 this can be used.
15879 </para>
15880 </listitem></varlistentry>
15881 <varlistentry>
15882 <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>
15883 <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>
15884 <listitem>
15885 <para>
15886 <indexterm role="concept">
15887 <primary>string</primary>
15888 <secondary>comparison</secondary>
15889 </indexterm>
15890 <indexterm role="concept">
15891 <primary>expansion</primary>
15892 <secondary>string comparison</secondary>
15893 </indexterm>
15894 <indexterm role="concept">
15895 <primary><option>le</option> expansion condition</primary>
15896 </indexterm>
15897 <indexterm role="concept">
15898 <primary><option>lei</option> expansion condition</primary>
15899 </indexterm>
15900 The two substrings are first expanded. The condition is true if the first
15901 string is lexically less than or equal to the second string. For <option>le</option> the
15902 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15903 case-independent.
15904 </para>
15905 </listitem></varlistentry>
15906 <varlistentry>
15907 <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>
15908 <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>
15909 <listitem>
15910 <para>
15911 <indexterm role="concept">
15912 <primary>string</primary>
15913 <secondary>comparison</secondary>
15914 </indexterm>
15915 <indexterm role="concept">
15916 <primary>expansion</primary>
15917 <secondary>string comparison</secondary>
15918 </indexterm>
15919 <indexterm role="concept">
15920 <primary><option>lt</option> expansion condition</primary>
15921 </indexterm>
15922 <indexterm role="concept">
15923 <primary><option>lti</option> expansion condition</primary>
15924 </indexterm>
15925 The two substrings are first expanded. The condition is true if the first
15926 string is lexically less than the second string. For <option>lt</option> the comparison
15927 includes the case of letters, whereas for <option>lti</option> the comparison is
15928 case-independent.
15929 </para>
15930 </listitem></varlistentry>
15931 <varlistentry>
15932 <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>
15933 <listitem>
15934 <para>
15935 <indexterm role="concept">
15936 <primary>expansion</primary>
15937 <secondary>regular expression comparison</secondary>
15938 </indexterm>
15939 <indexterm role="concept">
15940 <primary>regular expressions</primary>
15941 <secondary>match in expanded string</secondary>
15942 </indexterm>
15943 <indexterm role="concept">
15944 <primary><option>match</option> expansion condition</primary>
15945 </indexterm>
15946 The two substrings are first expanded. The second is then treated as a regular
15947 expression and applied to the first. Because of the pre-expansion, if the
15948 regular expression contains dollar, or backslash characters, they must be
15949 escaped. Care must also be taken if the regular expression contains braces
15950 (curly brackets). A closing brace must be escaped so that it is not taken as a
15951 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
15952 <literal>\N</literal> feature to disable expansion of the regular expression.
15953 For example,
15954 </para>
15955 <literallayout class="monospaced">
15956 ${if match {$local_part}{\N^\d{3}\N} ...
15957 </literallayout>
15958 <para>
15959 If the whole expansion string is in double quotes, further escaping of
15960 backslashes is also required.
15961 </para>
15962 <para>
15963 The condition is true if the regular expression match succeeds.
15964 The regular expression is not required to begin with a circumflex
15965 metacharacter, but if there is no circumflex, the expression is not anchored,
15966 and it may match anywhere in the subject, not just at the start. If you want
15967 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15968 metacharacter at an appropriate point.
15969 </para>
15970 <para>
15971 <indexterm role="concept">
15972 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15973 <secondary>in <option>if</option> expansion</secondary>
15974 </indexterm>
15975 At the start of an <option>if</option> expansion the values of the numeric variable
15976 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15977 succeeds causes them to be reset to the substrings of that condition and they
15978 will have these values during the expansion of the success string. At the end
15979 of the <option>if</option> expansion, the previous values are restored. After testing a
15980 combination of conditions using <option>or</option>, the subsequent values of the numeric
15981 variables are those of the condition that succeeded.
15982 </para>
15983 </listitem></varlistentry>
15984 <varlistentry>
15985 <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>
15986 <listitem>
15987 <para>
15988 <indexterm role="concept">
15989 <primary><option>match_address</option> expansion condition</primary>
15990 </indexterm>
15991 See <emphasis role="bold">match_local_part</emphasis>.
15992 </para>
15993 </listitem></varlistentry>
15994 <varlistentry>
15995 <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>
15996 <listitem>
15997 <para>
15998 <indexterm role="concept">
15999 <primary><option>match_domain</option> expansion condition</primary>
16000 </indexterm>
16001 See <emphasis role="bold">match_local_part</emphasis>.
16002 </para>
16003 </listitem></varlistentry>
16004 <varlistentry>
16005 <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>
16006 <listitem>
16007 <para>
16008 <indexterm role="concept">
16009 <primary><option>match_ip</option> expansion condition</primary>
16010 </indexterm>
16011 This condition matches an IP address to a list of IP address patterns. It must
16012 be followed by two argument strings. The first (after expansion) must be an IP
16013 address or an empty string. The second (not expanded) is a restricted host
16014 list that can match only an IP address, not a host name. For example:
16015 </para>
16016 <literallayout class="monospaced">
16017 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16018 </literallayout>
16019 <para>
16020 The specific types of host list item that are permitted in the list are:
16021 </para>
16022 <itemizedlist>
16023 <listitem>
16024 <para>
16025 An IP address, optionally with a CIDR mask.
16026 </para>
16027 </listitem>
16028 <listitem>
16029 <para>
16030 A single asterisk, which matches any IP address.
16031 </para>
16032 </listitem>
16033 <listitem>
16034 <para>
16035 An empty item, which matches only if the IP address is empty. This could be
16036 useful for testing for a locally submitted message or one from specific hosts
16037 in a single test such as
16038 </para>
16039 <literallayout class="monospaced">
16040   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
16041 </literallayout>
16042 <para>
16043 where the first item in the list is the empty string.
16044 </para>
16045 </listitem>
16046 <listitem>
16047 <para>
16048 The item @[] matches any of the local host&#x2019;s interface addresses.
16049 </para>
16050 </listitem>
16051 <listitem>
16052 <para>
16053 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
16054 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
16055 address into a host name. The most common type of linear search for
16056 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
16057 masks. For example:
16058 </para>
16059 <literallayout class="monospaced">
16060   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
16061 </literallayout>
16062 <para>
16063 It is of course possible to use other kinds of lookup, and in such a case, you
16064 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
16065 address mask, for example:
16066 </para>
16067 <literallayout class="monospaced">
16068   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
16069 </literallayout>
16070 <para>
16071 However, unless you are combining a <option>match_ip</option> condition with others, it is
16072 just as easy to use the fact that a lookup is itself a condition, and write:
16073 </para>
16074 <literallayout class="monospaced">
16075   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
16076 </literallayout>
16077 </listitem>
16078 </itemizedlist>
16079 <para>
16080 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16081 Exim was built with the EXPAND_LISTMATCH_RHS option.
16082 </para>
16083 <para>
16084 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
16085 </para>
16086 </listitem></varlistentry>
16087 <varlistentry>
16088 <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>
16089 <listitem>
16090 <para>
16091 <indexterm role="concept">
16092 <primary>domain list</primary>
16093 <secondary>in expansion condition</secondary>
16094 </indexterm>
16095 <indexterm role="concept">
16096 <primary>address list</primary>
16097 <secondary>in expansion condition</secondary>
16098 </indexterm>
16099 <indexterm role="concept">
16100 <primary>local part</primary>
16101 <secondary>list, in expansion condition</secondary>
16102 </indexterm>
16103 <indexterm role="concept">
16104 <primary><option>match_local_part</option> expansion condition</primary>
16105 </indexterm>
16106 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
16107 possible to test domain, address, and local part lists within expansions. Each
16108 condition requires two arguments: an item and a list to match. A trivial
16109 example is:
16110 </para>
16111 <literallayout class="monospaced">
16112 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
16113 </literallayout>
16114 <para>
16115 In each case, the second argument may contain any of the allowable items for a
16116 list of the appropriate type. Also, because the second argument (after
16117 expansion) is a standard form of list, it is possible to refer to a named list.
16118 Thus, you can use conditions like this:
16119 </para>
16120 <literallayout class="monospaced">
16121 ${if match_domain{$domain}{+local_domains}{...
16122 </literallayout>
16123 <para>
16124 <indexterm role="concept">
16125 <primary><literal>+caseful</literal></primary>
16126 </indexterm>
16127 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
16128 item can be used, as in all address lists, to cause subsequent items to
16129 have their local parts matched casefully. Domains are always matched
16130 caselessly.
16131 </para>
16132 <para>
16133 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
16134 Exim was built with the EXPAND_LISTMATCH_RHS option.
16135 </para>
16136 <para>
16137 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
16138 hosts have two identities: a name and an IP address, and it is not clear
16139 how to specify cleanly how such a test would work. However, IP addresses can be
16140 matched using <option>match_ip</option>.
16141 </para>
16142 </listitem></varlistentry>
16143 <varlistentry>
16144 <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>
16145 <listitem>
16146 <para>
16147 <indexterm role="concept">
16148 <primary>PAM authentication</primary>
16149 </indexterm>
16150 <indexterm role="concept">
16151 <primary>AUTH</primary>
16152 <secondary>with PAM</secondary>
16153 </indexterm>
16154 <indexterm role="concept">
16155 <primary>Solaris</primary>
16156 <secondary>PAM support</secondary>
16157 </indexterm>
16158 <indexterm role="concept">
16159 <primary>expansion</primary>
16160 <secondary>PAM authentication test</secondary>
16161 </indexterm>
16162 <indexterm role="concept">
16163 <primary><option>pam</option> expansion condition</primary>
16164 </indexterm>
16165 <emphasis>Pluggable Authentication Modules</emphasis>
16166 (<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
16167 available in the latest releases of Solaris and in some GNU/Linux
16168 distributions. The Exim support, which is intended for use in conjunction with
16169 the SMTP AUTH command, is available only if Exim is compiled with
16170 </para>
16171 <literallayout class="monospaced">
16172 SUPPORT_PAM=yes
16173 </literallayout>
16174 <para>
16175 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
16176 in some releases of GNU/Linux <option>-ldl</option> is also needed.
16177 </para>
16178 <para>
16179 The argument string is first expanded, and the result must be a
16180 colon-separated list of strings. Leading and trailing white space is ignored.
16181 The PAM module is initialized with the service name <quote>exim</quote> and the user name
16182 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
16183 The remaining items in the data string are passed over in response to requests
16184 from the authentication function. In the simple case there will only be one
16185 request, for a password, so the data consists of just two strings.
16186 </para>
16187 <para>
16188 There can be problems if any of the strings are permitted to contain colon
16189 characters. In the usual way, these have to be doubled to avoid being taken as
16190 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
16191 item can be used to double any existing colons. For example, the configuration
16192 of a LOGIN authenticator might contain this setting:
16193 </para>
16194 <literallayout class="monospaced">
16195 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
16196 </literallayout>
16197 <para>
16198 For a PLAIN authenticator you could use:
16199 </para>
16200 <literallayout class="monospaced">
16201 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
16202 </literallayout>
16203 <para>
16204 In some operating systems, PAM authentication can be done only from a process
16205 running as root. Since Exim is running as the Exim user when receiving
16206 messages, this means that PAM cannot be used directly in those systems.
16207 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
16208 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>.
16209 The patched module allows one special uid/gid combination, in addition to root,
16210 to authenticate. If you build the patched module to allow the Exim user and
16211 group, PAM can then be used from an Exim authenticator.
16212 </para>
16213 </listitem></varlistentry>
16214 <varlistentry>
16215 <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>
16216 <listitem>
16217 <para>
16218 <indexterm role="concept">
16219 <primary><emphasis>pwcheck</emphasis> daemon</primary>
16220 </indexterm>
16221 <indexterm role="concept">
16222 <primary>Cyrus</primary>
16223 </indexterm>
16224 <indexterm role="concept">
16225 <primary>expansion</primary>
16226 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
16227 </indexterm>
16228 <indexterm role="concept">
16229 <primary><option>pwcheck</option> expansion condition</primary>
16230 </indexterm>
16231 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
16232 This is one way of making it possible for passwords to be checked by a process
16233 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
16234 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
16235 </para>
16236 <para>
16237 The pwcheck support is not included in Exim by default. You need to specify
16238 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16239 building Exim. For example:
16240 </para>
16241 <literallayout class="monospaced">
16242 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
16243 </literallayout>
16244 <para>
16245 You do not need to install the full Cyrus software suite in order to use
16246 the pwcheck daemon. You can compile and install just the daemon alone
16247 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
16248 access to the <filename>/var/pwcheck</filename> directory.
16249 </para>
16250 <para>
16251 The <option>pwcheck</option> condition takes one argument, which must be the user name and
16252 password, separated by a colon. For example, in a LOGIN authenticator
16253 configuration, you might have this:
16254 </para>
16255 <literallayout class="monospaced">
16256 server_condition = ${if pwcheck{$auth1:$auth2}}
16257 </literallayout>
16258 <para>
16259 Again, for a PLAIN authenticator configuration, this would be:
16260 </para>
16261 <literallayout class="monospaced">
16262 server_condition = ${if pwcheck{$auth2:$auth3}}
16263 </literallayout>
16264 </listitem></varlistentry>
16265 <varlistentry>
16266 <term><emphasis role="bold">queue_running</emphasis></term>
16267 <listitem>
16268 <para>
16269 <indexterm role="concept">
16270 <primary>queue runner</primary>
16271 <secondary>detecting when delivering from</secondary>
16272 </indexterm>
16273 <indexterm role="concept">
16274 <primary>expansion</primary>
16275 <secondary>queue runner test</secondary>
16276 </indexterm>
16277 <indexterm role="concept">
16278 <primary><option>queue_running</option> expansion condition</primary>
16279 </indexterm>
16280 This condition, which has no data, is true during delivery attempts that are
16281 initiated by queue runner processes, and false otherwise.
16282 </para>
16283 </listitem></varlistentry>
16284 <varlistentry>
16285 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16286 <listitem>
16287 <para>
16288 <indexterm role="concept">
16289 <primary>Radius</primary>
16290 </indexterm>
16291 <indexterm role="concept">
16292 <primary>expansion</primary>
16293 <secondary>Radius authentication</secondary>
16294 </indexterm>
16295 <indexterm role="concept">
16296 <primary><option>radius</option> expansion condition</primary>
16297 </indexterm>
16298 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
16299 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
16300 the Radius client configuration file in order to build Exim with Radius
16301 support.
16302 </para>
16303 <para>
16304 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
16305 library, using the original API. If you are using release 0.4.0 or later of
16306 this library, you need to set
16307 </para>
16308 <literallayout class="monospaced">
16309 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
16310 </literallayout>
16311 <para>
16312 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
16313 <option>libradius</option> library that comes with FreeBSD. To do this, set
16314 </para>
16315 <literallayout class="monospaced">
16316 RADIUS_LIB_TYPE=RADLIB
16317 </literallayout>
16318 <para>
16319 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
16320 You may also have to supply a suitable setting in EXTRALIBS so that the
16321 Radius library can be found when Exim is linked.
16322 </para>
16323 <para>
16324 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
16325 Radius client library, which calls the Radius server. The condition is true if
16326 the authentication is successful. For example:
16327 </para>
16328 <literallayout class="monospaced">
16329 server_condition = ${if radius{&lt;arguments&gt;}}
16330 </literallayout>
16331 </listitem></varlistentry>
16332 <varlistentry>
16333 <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>
16334 <listitem>
16335 <para>
16336 <indexterm role="concept">
16337 <primary><emphasis>saslauthd</emphasis> daemon</primary>
16338 </indexterm>
16339 <indexterm role="concept">
16340 <primary>Cyrus</primary>
16341 </indexterm>
16342 <indexterm role="concept">
16343 <primary>expansion</primary>
16344 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
16345 </indexterm>
16346 <indexterm role="concept">
16347 <primary><option>saslauthd</option> expansion condition</primary>
16348 </indexterm>
16349 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
16350 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
16351 Using this daemon is one way of making it possible for passwords to be checked
16352 by a process that is not running as root.
16353 </para>
16354 <para>
16355 The saslauthd support is not included in Exim by default. You need to specify
16356 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
16357 building Exim. For example:
16358 </para>
16359 <literallayout class="monospaced">
16360 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
16361 </literallayout>
16362 <para>
16363 You do not need to install the full Cyrus software suite in order to use
16364 the saslauthd daemon. You can compile and install just the daemon alone
16365 from the Cyrus SASL library.
16366 </para>
16367 <para>
16368 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
16369 two are mandatory. For example:
16370 </para>
16371 <literallayout class="monospaced">
16372 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
16373 </literallayout>
16374 <para>
16375 The service and the realm are optional (which is why the arguments are enclosed
16376 in their own set of braces). For details of the meaning of the service and
16377 realm, and how to run the daemon, consult the Cyrus documentation.
16378 </para>
16379 </listitem></varlistentry>
16380 </variablelist>
16381 </section>
16382 <section id="SECID84">
16383 <title>Combining expansion conditions</title>
16384 <para>
16385 <indexterm role="concept">
16386 <primary>expansion</primary>
16387 <secondary>combining conditions</secondary>
16388 </indexterm>
16389 Several conditions can be tested at once by combining them using the <option>and</option>
16390 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
16391 conditions on their own, and precede their lists of sub-conditions. Each
16392 sub-condition must be enclosed in braces within the overall braces that contain
16393 the list. No repetition of <option>if</option> is used.
16394 </para>
16395 <variablelist>
16396 <varlistentry>
16397 <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>
16398 <listitem>
16399 <para>
16400 <indexterm role="concept">
16401 <primary><quote>or</quote> expansion condition</primary>
16402 </indexterm>
16403 <indexterm role="concept">
16404 <primary>expansion</primary>
16405 <secondary><quote>or</quote> of conditions</secondary>
16406 </indexterm>
16407 The sub-conditions are evaluated from left to right. The condition is true if
16408 any one of the sub-conditions is true.
16409 For example,
16410 </para>
16411 <literallayout class="monospaced">
16412 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
16413 </literallayout>
16414 <para>
16415 When a true sub-condition is found, the following ones are parsed but not
16416 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
16417 numeric variables afterwards are taken from the first one that succeeds.
16418 </para>
16419 </listitem></varlistentry>
16420 <varlistentry>
16421 <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>
16422 <listitem>
16423 <para>
16424 <indexterm role="concept">
16425 <primary><quote>and</quote> expansion condition</primary>
16426 </indexterm>
16427 <indexterm role="concept">
16428 <primary>expansion</primary>
16429 <secondary><quote>and</quote> of conditions</secondary>
16430 </indexterm>
16431 The sub-conditions are evaluated from left to right. The condition is true if
16432 all of the sub-conditions are true. If there are several <quote>match</quote>
16433 sub-conditions, the values of the numeric variables afterwards are taken from
16434 the last one. When a false sub-condition is found, the following ones are
16435 parsed but not evaluated.
16436 </para>
16437 </listitem></varlistentry>
16438 </variablelist>
16439 <para>
16440 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
16441 </para>
16442 </section>
16443 <section id="SECTexpvar">
16444 <title>Expansion variables</title>
16445 <para>
16446 <indexterm role="concept">
16447 <primary>expansion</primary>
16448 <secondary>variables, list of</secondary>
16449 </indexterm>
16450 This section contains an alphabetical list of all the expansion variables. Some
16451 of them are available only when Exim is compiled with specific options such as
16452 support for TLS or the content scanning extension.
16453 </para>
16454 <variablelist>
16455 <varlistentry>
16456 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
16457 <listitem>
16458 <para>
16459 <indexterm role="concept">
16460 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16461 </indexterm>
16462 When a <option>match</option> expansion condition succeeds, these variables contain the
16463 captured substrings identified by the regular expression during subsequent
16464 processing of the success string of the containing <option>if</option> expansion item.
16465 However, they do not retain their values afterwards; in fact, their previous
16466 values are restored at the end of processing an <option>if</option> item. The numerical
16467 variables may also be set externally by some other matching process which
16468 precedes the expansion of the string. For example, the commands available in
16469 Exim filter files include an <option>if</option> command with its own regular expression
16470 matching condition.
16471 </para>
16472 </listitem></varlistentry>
16473 <varlistentry>
16474 <term><varname>$acl_c...</varname></term>
16475 <listitem>
16476 <para>
16477 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
16478 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
16479 long, but the sixth character must be either a digit or an underscore. For
16480 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
16481 variables persist throughout the lifetime of an SMTP connection. They can be
16482 used to pass information between ACLs and between different invocations of the
16483 same ACL. When a message is received, the values of these variables are saved
16484 with the message, and can be accessed by filters, routers, and transports
16485 during subsequent delivery.
16486 </para>
16487 </listitem></varlistentry>
16488 <varlistentry>
16489 <term><varname>$acl_m...</varname></term>
16490 <listitem>
16491 <para>
16492 These variables are like the <varname>$acl_c...</varname> variables, except that their values
16493 are reset after a message has been received. Thus, if several messages are
16494 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
16495 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
16496 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
16497 message is received, the values of these variables are saved with the message,
16498 and can be accessed by filters, routers, and transports during subsequent
16499 delivery.
16500 </para>
16501 </listitem></varlistentry>
16502 <varlistentry>
16503 <term><varname>$acl_verify_message</varname></term>
16504 <listitem>
16505 <para>
16506 <indexterm role="variable">
16507 <primary><varname>$acl_verify_message</varname></primary>
16508 </indexterm>
16509 After an address verification has failed, this variable contains the failure
16510 message. It retains its value for use in subsequent modifiers. The message can
16511 be preserved by coding like this:
16512 </para>
16513 <literallayout class="monospaced">
16514 warn !verify = sender
16515      set acl_m0 = $acl_verify_message
16516 </literallayout>
16517 <para>
16518 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
16519 <option>log_message</option> modifiers, to include information about the verification
16520 failure.
16521 </para>
16522 </listitem></varlistentry>
16523 <varlistentry>
16524 <term><varname>$address_data</varname></term>
16525 <listitem>
16526 <para>
16527 <indexterm role="variable">
16528 <primary><varname>$address_data</varname></primary>
16529 </indexterm>
16530 This variable is set by means of the <option>address_data</option> option in routers. The
16531 value then remains with the address while it is processed by subsequent routers
16532 and eventually a transport. If the transport is handling multiple addresses,
16533 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
16534 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
16535 user filter files.
16536 </para>
16537 <para>
16538 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
16539 a recipient address, the final value is still in the variable for subsequent
16540 conditions and modifiers of the ACL statement. If routing the address caused it
16541 to be redirected to just one address, the child address is also routed as part
16542 of the verification, and in this case the final value of <varname>$address_data</varname> is
16543 from the child&#x2019;s routing.
16544 </para>
16545 <para>
16546 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16547 sender address, the final value is also preserved, but this time in
16548 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16549 address.
16550 </para>
16551 <para>
16552 In both cases (recipient and sender verification), the value does not persist
16553 after the end of the current ACL statement. If you want to preserve
16554 these values for longer, you can save them in ACL variables.
16555 </para>
16556 </listitem></varlistentry>
16557 <varlistentry>
16558 <term><varname>$address_file</varname></term>
16559 <listitem>
16560 <para>
16561 <indexterm role="variable">
16562 <primary><varname>$address_file</varname></primary>
16563 </indexterm>
16564 When, as a result of aliasing, forwarding, or filtering, a message is directed
16565 to a specific file, this variable holds the name of the file when the transport
16566 is running. At other times, the variable is empty. For example, using the
16567 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16568 </para>
16569 <literallayout class="monospaced">
16570 /home/r2d2/savemail
16571 </literallayout>
16572 <para>
16573 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16574 contains the text string <literal>/home/r2d2/savemail</literal>.
16575 <indexterm role="concept">
16576 <primary>Sieve filter</primary>
16577 <secondary>value of <varname>$address_file</varname></secondary>
16578 </indexterm>
16579 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16580 then up to the transport configuration to generate an appropriate absolute path
16581 to the relevant file.
16582 </para>
16583 </listitem></varlistentry>
16584 <varlistentry>
16585 <term><varname>$address_pipe</varname></term>
16586 <listitem>
16587 <para>
16588 <indexterm role="variable">
16589 <primary><varname>$address_pipe</varname></primary>
16590 </indexterm>
16591 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16592 this variable holds the pipe command when the transport is running.
16593 </para>
16594 </listitem></varlistentry>
16595 <varlistentry>
16596 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
16597 <listitem>
16598 <para>
16599 <indexterm role="variable">
16600 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16601 </indexterm>
16602 These variables are used in SMTP authenticators (see chapters
16603 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16604 </para>
16605 </listitem></varlistentry>
16606 <varlistentry>
16607 <term><varname>$authenticated_id</varname></term>
16608 <listitem>
16609 <para>
16610 <indexterm role="concept">
16611 <primary>authentication</primary>
16612 <secondary>id</secondary>
16613 </indexterm>
16614 <indexterm role="variable">
16615 <primary><varname>$authenticated_id</varname></primary>
16616 </indexterm>
16617 When a server successfully authenticates a client it may be configured to
16618 preserve some of the authentication information in the variable
16619 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16620 user/password authenticator configuration might preserve the user name for use
16621 in the routers. Note that this is not the same information that is saved in
16622 <varname>$sender_host_authenticated</varname>.
16623 When a message is submitted locally (that is, not over a TCP connection)
16624 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16625 process. However, a trusted user can override this by means of the <option>-oMai</option>
16626 command line option.
16627 </para>
16628 </listitem></varlistentry>
16629 <varlistentry revisionflag="changed">
16630 <term><varname>$authenticated_fail_id</varname></term>
16631 <listitem>
16632 <para revisionflag="changed">
16633 <indexterm role="concept">
16634 <primary>authentication</primary>
16635 <secondary>fail</secondary>
16636 </indexterm>
16637 <indexterm role="variable">
16638 <primary><varname>$authenticated_fail_id</varname></primary>
16639 </indexterm>
16640 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
16641 will contain the failed authentication id. If more than one authentication
16642 id is attempted, it will contain only the last one. The variable is
16643 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
16644 A message to a local recipient could still be accepted without requiring
16645 authentication, which means this variable could also be visible in all of
16646 the ACL&#x2019;s as well.
16647 </para>
16648 </listitem></varlistentry>
16649 <varlistentry>
16650 <term><varname>$authenticated_sender</varname></term>
16651 <listitem>
16652 <para>
16653 <indexterm role="concept">
16654 <primary>sender</primary>
16655 <secondary>authenticated</secondary>
16656 </indexterm>
16657 <indexterm role="concept">
16658 <primary>authentication</primary>
16659 <secondary>sender</secondary>
16660 </indexterm>
16661 <indexterm role="concept">
16662 <primary>AUTH</primary>
16663 <secondary>on MAIL command</secondary>
16664 </indexterm>
16665 <indexterm role="variable">
16666 <primary><varname>$authenticated_sender</varname></primary>
16667 </indexterm>
16668 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16669 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16670 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16671 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
16672 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16673 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16674 </para>
16675 <para>
16676 <indexterm role="variable">
16677 <primary><varname>$qualify_domain</varname></primary>
16678 </indexterm>
16679 When a message is submitted locally (that is, not over a TCP connection), the
16680 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16681 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16682 can override this by means of the <option>-oMas</option> command line option.
16683 </para>
16684 </listitem></varlistentry>
16685 <varlistentry>
16686 <term><varname>$authentication_failed</varname></term>
16687 <listitem>
16688 <para>
16689 <indexterm role="concept">
16690 <primary>authentication</primary>
16691 <secondary>failure</secondary>
16692 </indexterm>
16693 <indexterm role="variable">
16694 <primary><varname>$authentication_failed</varname></primary>
16695 </indexterm>
16696 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16697 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16698 possible to distinguish between <quote>did not try to authenticate</quote>
16699 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16700 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16701 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16702 negative response to an AUTH command, including (for example) an attempt to use
16703 an undefined mechanism.
16704 </para>
16705 </listitem></varlistentry>
16706 <varlistentry>
16707 <term><varname>$av_failed</varname></term>
16708 <listitem>
16709 <para>
16710 <indexterm role="concept">
16711 <primary>content scanning</primary>
16712 <secondary>AV scanner failure</secondary>
16713 </indexterm>
16714 This variable is available when Exim is compiled with the content-scanning
16715 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
16716 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
16717 the ACL malware condition.
16718 </para>
16719 </listitem></varlistentry>
16720 <varlistentry>
16721 <term><varname>$body_linecount</varname></term>
16722 <listitem>
16723 <para>
16724 <indexterm role="concept">
16725 <primary>message body</primary>
16726 <secondary>line count</secondary>
16727 </indexterm>
16728 <indexterm role="concept">
16729 <primary>body of message</primary>
16730 <secondary>line count</secondary>
16731 </indexterm>
16732 <indexterm role="variable">
16733 <primary><varname>$body_linecount</varname></primary>
16734 </indexterm>
16735 When a message is being received or delivered, this variable contains the
16736 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
16737 </para>
16738 </listitem></varlistentry>
16739 <varlistentry>
16740 <term><varname>$body_zerocount</varname></term>
16741 <listitem>
16742 <para>
16743 <indexterm role="concept">
16744 <primary>message body</primary>
16745 <secondary>binary zero count</secondary>
16746 </indexterm>
16747 <indexterm role="concept">
16748 <primary>body of message</primary>
16749 <secondary>binary zero count</secondary>
16750 </indexterm>
16751 <indexterm role="concept">
16752 <primary>binary zero</primary>
16753 <secondary>in message body</secondary>
16754 </indexterm>
16755 <indexterm role="variable">
16756 <primary><varname>$body_zerocount</varname></primary>
16757 </indexterm>
16758 When a message is being received or delivered, this variable contains the
16759 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
16760 </para>
16761 </listitem></varlistentry>
16762 <varlistentry>
16763 <term><varname>$bounce_recipient</varname></term>
16764 <listitem>
16765 <para>
16766 <indexterm role="variable">
16767 <primary><varname>$bounce_recipient</varname></primary>
16768 </indexterm>
16769 This is set to the recipient address of a bounce message while Exim is creating
16770 it. It is useful if a customized bounce message text file is in use (see
16771 chapter <xref linkend="CHAPemsgcust"/>).
16772 </para>
16773 </listitem></varlistentry>
16774 <varlistentry>
16775 <term><varname>$bounce_return_size_limit</varname></term>
16776 <listitem>
16777 <para>
16778 <indexterm role="variable">
16779 <primary><varname>$bounce_return_size_limit</varname></primary>
16780 </indexterm>
16781 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16782 up to a multiple of 1000. It is useful when a customized error message text
16783 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16784 </para>
16785 </listitem></varlistentry>
16786 <varlistentry>
16787 <term><varname>$caller_gid</varname></term>
16788 <listitem>
16789 <para>
16790 <indexterm role="concept">
16791 <primary>gid (group id)</primary>
16792 <secondary>caller</secondary>
16793 </indexterm>
16794 <indexterm role="variable">
16795 <primary><varname>$caller_gid</varname></primary>
16796 </indexterm>
16797 The real group id under which the process that called Exim was running. This is
16798 not the same as the group id of the originator of a message (see
16799 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16800 incarnation normally contains the Exim gid.
16801 </para>
16802 </listitem></varlistentry>
16803 <varlistentry>
16804 <term><varname>$caller_uid</varname></term>
16805 <listitem>
16806 <para>
16807 <indexterm role="concept">
16808 <primary>uid (user id)</primary>
16809 <secondary>caller</secondary>
16810 </indexterm>
16811 <indexterm role="variable">
16812 <primary><varname>$caller_uid</varname></primary>
16813 </indexterm>
16814 The real user id under which the process that called Exim was running. This is
16815 not the same as the user id of the originator of a message (see
16816 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16817 incarnation normally contains the Exim uid.
16818 </para>
16819 </listitem></varlistentry>
16820 <varlistentry>
16821 <term><varname>$compile_date</varname></term>
16822 <listitem>
16823 <para>
16824 <indexterm role="variable">
16825 <primary><varname>$compile_date</varname></primary>
16826 </indexterm>
16827 The date on which the Exim binary was compiled.
16828 </para>
16829 </listitem></varlistentry>
16830 <varlistentry>
16831 <term><varname>$compile_number</varname></term>
16832 <listitem>
16833 <para>
16834 <indexterm role="variable">
16835 <primary><varname>$compile_number</varname></primary>
16836 </indexterm>
16837 The building process for Exim keeps a count of the number
16838 of times it has been compiled. This serves to distinguish different
16839 compilations of the same version of the program.
16840 </para>
16841 </listitem></varlistentry>
16842 <varlistentry>
16843 <term><varname>$demime_errorlevel</varname></term>
16844 <listitem>
16845 <para>
16846 <indexterm role="variable">
16847 <primary><varname>$demime_errorlevel</varname></primary>
16848 </indexterm>
16849 This variable is available when Exim is compiled with
16850 the content-scanning extension and the obsolete <option>demime</option> condition. For
16851 details, see section <xref linkend="SECTdemimecond"/>.
16852 </para>
16853 </listitem></varlistentry>
16854 <varlistentry>
16855 <term><varname>$demime_reason</varname></term>
16856 <listitem>
16857 <para>
16858 <indexterm role="variable">
16859 <primary><varname>$demime_reason</varname></primary>
16860 </indexterm>
16861 This variable is available when Exim is compiled with the
16862 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16863 see section <xref linkend="SECTdemimecond"/>.
16864 </para>
16865 </listitem></varlistentry>
16866 <varlistentry>
16867 <term><varname>$dnslist_domain</varname></term>
16868 <term><varname>$dnslist_matched</varname></term>
16869 <term><varname>$dnslist_text</varname></term>
16870 <term><varname>$dnslist_value</varname></term>
16871 <listitem>
16872 <para>
16873 <indexterm role="variable">
16874 <primary><varname>$dnslist_domain</varname></primary>
16875 </indexterm>
16876 <indexterm role="variable">
16877 <primary><varname>$dnslist_matched</varname></primary>
16878 </indexterm>
16879 <indexterm role="variable">
16880 <primary><varname>$dnslist_text</varname></primary>
16881 </indexterm>
16882 <indexterm role="variable">
16883 <primary><varname>$dnslist_value</varname></primary>
16884 </indexterm>
16885 <indexterm role="concept">
16886 <primary>black list (DNS)</primary>
16887 </indexterm>
16888 When a DNS (black) list lookup succeeds, these variables are set to contain
16889 the following data from the lookup: the list&#x2019;s domain name, the key that was
16890 looked up, the contents of any associated TXT record, and the value from the
16891 main A record. See section <xref linkend="SECID204"/> for more details.
16892 </para>
16893 </listitem></varlistentry>
16894 <varlistentry>
16895 <term><varname>$domain</varname></term>
16896 <listitem>
16897 <para>
16898 <indexterm role="variable">
16899 <primary><varname>$domain</varname></primary>
16900 </indexterm>
16901 When an address is being routed, or delivered on its own, this variable
16902 contains the domain. Uppercase letters in the domain are converted into lower
16903 case for <varname>$domain</varname>.
16904 </para>
16905 <para>
16906 Global address rewriting happens when a message is received, so the value of
16907 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16908 is set during user filtering, but not during system filtering, because a
16909 message may have many recipients and the system filter is called just once.
16910 </para>
16911 <para>
16912 When more than one address is being delivered at once (for example, several
16913 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16914 have the same domain. Transports can be restricted to handling only one domain
16915 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
16916 the default for local transports. For further details of the environment in
16917 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16918 </para>
16919 <para>
16920 <indexterm role="option">
16921 <primary><option>delay_warning_condition</option></primary>
16922 </indexterm>
16923 At the end of a delivery, if all deferred addresses have the same domain, it is
16924 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16925 </para>
16926 <para>
16927 The <varname>$domain</varname> variable is also used in some other circumstances:
16928 </para>
16929 <itemizedlist>
16930 <listitem>
16931 <para>
16932 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16933 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16934 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16935 normally set during the running of the MAIL ACL. However, if the sender address
16936 is verified with a callout during the MAIL ACL, the sender domain is placed in
16937 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16938 the <command>smtp</command> transport.
16939 </para>
16940 </listitem>
16941 <listitem>
16942 <para>
16943 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16944 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16945 it can be used in the expansion of the replacement address, for example, to
16946 rewrite domains by file lookup.
16947 </para>
16948 </listitem>
16949 <listitem>
16950 <para>
16951 With one important exception, whenever a domain list is being scanned,
16952 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16953 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16954 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16955 that, in a RCPT ACL, the sender domain list can be dependent on the
16956 recipient domain (which is what is in <varname>$domain</varname> at this time).
16957 </para>
16958 </listitem>
16959 <listitem>
16960 <para>
16961 <indexterm role="concept">
16962 <primary>ETRN</primary>
16963 <secondary>value of <varname>$domain</varname></secondary>
16964 </indexterm>
16965 <indexterm role="option">
16966 <primary><option>smtp_etrn_command</option></primary>
16967 </indexterm>
16968 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16969 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16970 </para>
16971 </listitem>
16972 </itemizedlist>
16973 </listitem></varlistentry>
16974 <varlistentry>
16975 <term><varname>$domain_data</varname></term>
16976 <listitem>
16977 <para>
16978 <indexterm role="variable">
16979 <primary><varname>$domain_data</varname></primary>
16980 </indexterm>
16981 When the <option>domains</option> option on a router matches a domain by
16982 means of a lookup, the data read by the lookup is available during the running
16983 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16984 address to a transport, the value is available in that transport. If the
16985 transport is handling multiple addresses, the value from the first address is
16986 used.
16987 </para>
16988 <para>
16989 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16990 domain by means of a lookup. The data read by the lookup is available during
16991 the rest of the ACL statement. In all other situations, this variable expands
16992 to nothing.
16993 </para>
16994 </listitem></varlistentry>
16995 <varlistentry>
16996 <term><varname>$exim_gid</varname></term>
16997 <listitem>
16998 <para>
16999 <indexterm role="variable">
17000 <primary><varname>$exim_gid</varname></primary>
17001 </indexterm>
17002 This variable contains the numerical value of the Exim group id.
17003 </para>
17004 </listitem></varlistentry>
17005 <varlistentry>
17006 <term><varname>$exim_path</varname></term>
17007 <listitem>
17008 <para>
17009 <indexterm role="variable">
17010 <primary><varname>$exim_path</varname></primary>
17011 </indexterm>
17012 This variable contains the path to the Exim binary.
17013 </para>
17014 </listitem></varlistentry>
17015 <varlistentry>
17016 <term><varname>$exim_uid</varname></term>
17017 <listitem>
17018 <para>
17019 <indexterm role="variable">
17020 <primary><varname>$exim_uid</varname></primary>
17021 </indexterm>
17022 This variable contains the numerical value of the Exim user id.
17023 </para>
17024 </listitem></varlistentry>
17025 <varlistentry>
17026 <term><varname>$found_extension</varname></term>
17027 <listitem>
17028 <para>
17029 <indexterm role="variable">
17030 <primary><varname>$found_extension</varname></primary>
17031 </indexterm>
17032 This variable is available when Exim is compiled with the
17033 content-scanning extension and the obsolete <option>demime</option> condition. For details,
17034 see section <xref linkend="SECTdemimecond"/>.
17035 </para>
17036 </listitem></varlistentry>
17037 <varlistentry>
17038 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
17039 <listitem>
17040 <para>
17041 This is not strictly an expansion variable. It is expansion syntax for
17042 inserting the message header line with the given name. Note that the name must
17043 be terminated by colon or white space, because it may contain a wide variety of
17044 characters. Note also that braces must <emphasis>not</emphasis> be used.
17045 </para>
17046 </listitem></varlistentry>
17047 <varlistentry revisionflag="changed">
17048 <term><varname>$headers_added</varname></term>
17049 <listitem>
17050 <para revisionflag="changed">
17051 <indexterm role="variable">
17052 <primary><varname>$headers_added</varname></primary>
17053 </indexterm>
17054 Within an ACL this variable contains the headers added so far by
17055 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
17056 The headers are a newline-separated list.
17057 </para>
17058 </listitem></varlistentry>
17059 <varlistentry>
17060 <term><varname>$home</varname></term>
17061 <listitem>
17062 <para>
17063 <indexterm role="variable">
17064 <primary><varname>$home</varname></primary>
17065 </indexterm>
17066 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
17067 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
17068 means it is set during the running of users&#x2019; filter files. A router may also
17069 explicitly set a home directory for use by a transport; this can be overridden
17070 by a setting on the transport itself.
17071 </para>
17072 <para>
17073 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
17074 of the environment variable HOME.
17075 </para>
17076 </listitem></varlistentry>
17077 <varlistentry>
17078 <term><varname>$host</varname></term>
17079 <listitem>
17080 <para>
17081 <indexterm role="variable">
17082 <primary><varname>$host</varname></primary>
17083 </indexterm>
17084 If a router assigns an address to a transport (any transport), and passes a
17085 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
17086 to run is the name of the first host on the list. Note that this applies both
17087 to local and remote transports.
17088 </para>
17089 <para>
17090 <indexterm role="concept">
17091 <primary>transport</primary>
17092 <secondary>filter</secondary>
17093 </indexterm>
17094 <indexterm role="concept">
17095 <primary>filter</primary>
17096 <secondary>transport filter</secondary>
17097 </indexterm>
17098 For the <command>smtp</command> transport, if there is more than one host, the value of
17099 <varname>$host</varname> changes as the transport works its way through the list. In
17100 particular, when the <command>smtp</command> transport is expanding its options for encryption
17101 using TLS, or for specifying a transport filter (see chapter
17102 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
17103 is connected.
17104 </para>
17105 <para>
17106 When used in the client part of an authenticator configuration (see chapter
17107 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
17108 client is connected.
17109 </para>
17110 </listitem></varlistentry>
17111 <varlistentry>
17112 <term><varname>$host_address</varname></term>
17113 <listitem>
17114 <para>
17115 <indexterm role="variable">
17116 <primary><varname>$host_address</varname></primary>
17117 </indexterm>
17118 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
17119 for a remote connection. It is also set to the IP address that is being checked
17120 when the <option>ignore_target_hosts</option> option is being processed.
17121 </para>
17122 </listitem></varlistentry>
17123 <varlistentry>
17124 <term><varname>$host_data</varname></term>
17125 <listitem>
17126 <para>
17127 <indexterm role="variable">
17128 <primary><varname>$host_data</varname></primary>
17129 </indexterm>
17130 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
17131 result of the lookup is made available in the <varname>$host_data</varname> variable. This
17132 allows you, for example, to do things like this:
17133 </para>
17134 <literallayout class="monospaced">
17135 deny  hosts = net-lsearch;/some/file
17136 message = $host_data
17137 </literallayout>
17138 </listitem></varlistentry>
17139 <varlistentry>
17140 <term><varname>$host_lookup_deferred</varname></term>
17141 <listitem>
17142 <para>
17143 <indexterm role="concept">
17144 <primary>host name</primary>
17145 <secondary>lookup, failure of</secondary>
17146 </indexterm>
17147 <indexterm role="variable">
17148 <primary><varname>$host_lookup_deferred</varname></primary>
17149 </indexterm>
17150 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
17151 message comes from a remote host and there is an attempt to look up the host&#x2019;s
17152 name from its IP address, and the attempt is not successful, one of these
17153 variables is set to <quote>1</quote>.
17154 </para>
17155 <itemizedlist>
17156 <listitem>
17157 <para>
17158 If the lookup receives a definite negative response (for example, a DNS lookup
17159 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17160 </para>
17161 </listitem>
17162 <listitem>
17163 <para>
17164 If there is any kind of problem during the lookup, such that Exim cannot
17165 tell whether or not the host name is defined (for example, a timeout for a DNS
17166 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
17167 </para>
17168 </listitem>
17169 </itemizedlist>
17170 <para>
17171 Looking up a host&#x2019;s name from its IP address consists of more than just a
17172 single reverse lookup. Exim checks that a forward lookup of at least one of the
17173 names it receives from a reverse lookup yields the original IP address. If this
17174 is not the case, Exim does not accept the looked up name(s), and
17175 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
17176 IP address (for example, the existence of a PTR record in the DNS) is not
17177 sufficient on its own for the success of a host name lookup. If the reverse
17178 lookup succeeds, but there is a lookup problem such as a timeout when checking
17179 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
17180 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
17181 </para>
17182 </listitem></varlistentry>
17183 <varlistentry>
17184 <term><varname>$host_lookup_failed</varname></term>
17185 <listitem>
17186 <para>
17187 <indexterm role="variable">
17188 <primary><varname>$host_lookup_failed</varname></primary>
17189 </indexterm>
17190 See <varname>$host_lookup_deferred</varname>.
17191 </para>
17192 </listitem></varlistentry>
17193 <varlistentry>
17194 <term><varname>$inode</varname></term>
17195 <listitem>
17196 <para>
17197 <indexterm role="variable">
17198 <primary><varname>$inode</varname></primary>
17199 </indexterm>
17200 The only time this variable is set is while expanding the <option>directory_file</option>
17201 option in the <command>appendfile</command> transport. The variable contains the inode number
17202 of the temporary file which is about to be renamed. It can be used to construct
17203 a unique name for the file.
17204 </para>
17205 </listitem></varlistentry>
17206 <varlistentry>
17207 <term><varname>$interface_address</varname></term>
17208 <listitem>
17209 <para>
17210 <indexterm role="variable">
17211 <primary><varname>$interface_address</varname></primary>
17212 </indexterm>
17213 This is an obsolete name for <varname>$received_ip_address</varname>.
17214 </para>
17215 </listitem></varlistentry>
17216 <varlistentry>
17217 <term><varname>$interface_port</varname></term>
17218 <listitem>
17219 <para>
17220 <indexterm role="variable">
17221 <primary><varname>$interface_port</varname></primary>
17222 </indexterm>
17223 This is an obsolete name for <varname>$received_port</varname>.
17224 </para>
17225 </listitem></varlistentry>
17226 <varlistentry>
17227 <term><varname>$item</varname></term>
17228 <listitem>
17229 <para>
17230 <indexterm role="variable">
17231 <primary><varname>$item</varname></primary>
17232 </indexterm>
17233 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
17234 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
17235 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
17236 empty.
17237 </para>
17238 </listitem></varlistentry>
17239 <varlistentry>
17240 <term><varname>$ldap_dn</varname></term>
17241 <listitem>
17242 <para>
17243 <indexterm role="variable">
17244 <primary><varname>$ldap_dn</varname></primary>
17245 </indexterm>
17246 This variable, which is available only when Exim is compiled with LDAP support,
17247 contains the DN from the last entry in the most recently successful LDAP
17248 lookup.
17249 </para>
17250 </listitem></varlistentry>
17251 <varlistentry>
17252 <term><varname>$load_average</varname></term>
17253 <listitem>
17254 <para>
17255 <indexterm role="variable">
17256 <primary><varname>$load_average</varname></primary>
17257 </indexterm>
17258 This variable contains the system load average, multiplied by 1000 so that it
17259 is an integer. For example, if the load average is 0.21, the value of the
17260 variable is 210. The value is recomputed every time the variable is referenced.
17261 </para>
17262 </listitem></varlistentry>
17263 <varlistentry>
17264 <term><varname>$local_part</varname></term>
17265 <listitem>
17266 <para>
17267 <indexterm role="variable">
17268 <primary><varname>$local_part</varname></primary>
17269 </indexterm>
17270 When an address is being routed, or delivered on its own, this
17271 variable contains the local part. When a number of addresses are being
17272 delivered together (for example, multiple RCPT commands in an SMTP
17273 session), <varname>$local_part</varname> is not set.
17274 </para>
17275 <para>
17276 Global address rewriting happens when a message is received, so the value of
17277 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
17278 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
17279 because a message may have many recipients and the system filter is called just
17280 once.
17281 </para>
17282 <para>
17283 <indexterm role="variable">
17284 <primary><varname>$local_part_prefix</varname></primary>
17285 </indexterm>
17286 <indexterm role="variable">
17287 <primary><varname>$local_part_suffix</varname></primary>
17288 </indexterm>
17289 If a local part prefix or suffix has been recognized, it is not included in the
17290 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
17291 any prefix or suffix are in <varname>$local_part_prefix</varname> and
17292 <varname>$local_part_suffix</varname>, respectively.
17293 </para>
17294 <para>
17295 When a message is being delivered to a file, pipe, or autoreply transport as a
17296 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
17297 the parent address, not to the file name or command (see <varname>$address_file</varname> and
17298 <varname>$address_pipe</varname>).
17299 </para>
17300 <para>
17301 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
17302 local part of the recipient address.
17303 </para>
17304 <para>
17305 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17306 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
17307 it can be used in the expansion of the replacement address, for example.
17308 </para>
17309 <para>
17310 In all cases, all quoting is removed from the local part. For example, for both
17311 the addresses
17312 </para>
17313 <literallayout class="monospaced">
17314 "abc:xyz"@test.example
17315 abc\:xyz@test.example
17316 </literallayout>
17317 <para>
17318 the value of <varname>$local_part</varname> is
17319 </para>
17320 <literallayout class="monospaced">
17321 abc:xyz
17322 </literallayout>
17323 <para>
17324 If you use <varname>$local_part</varname> to create another address, you should always wrap it
17325 inside a quoting operator. For example, in a <command>redirect</command> router you could
17326 have:
17327 </para>
17328 <literallayout class="monospaced">
17329 data = ${quote_local_part:$local_part}@new.domain.example
17330 </literallayout>
17331 <para>
17332 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
17333 to process local parts in a case-dependent manner in a router, you can set the
17334 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
17335 </para>
17336 </listitem></varlistentry>
17337 <varlistentry>
17338 <term><varname>$local_part_data</varname></term>
17339 <listitem>
17340 <para>
17341 <indexterm role="variable">
17342 <primary><varname>$local_part_data</varname></primary>
17343 </indexterm>
17344 When the <option>local_parts</option> option on a router matches a local part by means of a
17345 lookup, the data read by the lookup is available during the running of the
17346 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
17347 to a transport, the value is available in that transport. If the transport is
17348 handling multiple addresses, the value from the first address is used.
17349 </para>
17350 <para>
17351 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
17352 matches a local part by means of a lookup. The data read by the lookup is
17353 available during the rest of the ACL statement. In all other situations, this
17354 variable expands to nothing.
17355 </para>
17356 </listitem></varlistentry>
17357 <varlistentry>
17358 <term><varname>$local_part_prefix</varname></term>
17359 <listitem>
17360 <para>
17361 <indexterm role="variable">
17362 <primary><varname>$local_part_prefix</varname></primary>
17363 </indexterm>
17364 When an address is being routed or delivered, and a
17365 specific prefix for the local part was recognized, it is available in this
17366 variable, having been removed from <varname>$local_part</varname>.
17367 </para>
17368 </listitem></varlistentry>
17369 <varlistentry>
17370 <term><varname>$local_part_suffix</varname></term>
17371 <listitem>
17372 <para>
17373 <indexterm role="variable">
17374 <primary><varname>$local_part_suffix</varname></primary>
17375 </indexterm>
17376 When an address is being routed or delivered, and a
17377 specific suffix for the local part was recognized, it is available in this
17378 variable, having been removed from <varname>$local_part</varname>.
17379 </para>
17380 </listitem></varlistentry>
17381 <varlistentry>
17382 <term><varname>$local_scan_data</varname></term>
17383 <listitem>
17384 <para>
17385 <indexterm role="variable">
17386 <primary><varname>$local_scan_data</varname></primary>
17387 </indexterm>
17388 This variable contains the text returned by the <function>local_scan()</function> function when
17389 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
17390 </para>
17391 </listitem></varlistentry>
17392 <varlistentry>
17393 <term><varname>$local_user_gid</varname></term>
17394 <listitem>
17395 <para>
17396 <indexterm role="variable">
17397 <primary><varname>$local_user_gid</varname></primary>
17398 </indexterm>
17399 See <varname>$local_user_uid</varname>.
17400 </para>
17401 </listitem></varlistentry>
17402 <varlistentry>
17403 <term><varname>$local_user_uid</varname></term>
17404 <listitem>
17405 <para>
17406 <indexterm role="variable">
17407 <primary><varname>$local_user_uid</varname></primary>
17408 </indexterm>
17409 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
17410 <option>check_local_user</option> router precondition succeeds. This means that their values
17411 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
17412 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
17413 router-specific expansions. At all other times, the values in these variables
17414 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
17415 </para>
17416 </listitem></varlistentry>
17417 <varlistentry>
17418 <term><varname>$localhost_number</varname></term>
17419 <listitem>
17420 <para>
17421 <indexterm role="variable">
17422 <primary><varname>$localhost_number</varname></primary>
17423 </indexterm>
17424 This contains the expanded value of the
17425 <option>localhost_number</option> option. The expansion happens after the main options have
17426 been read.
17427 </para>
17428 </listitem></varlistentry>
17429 <varlistentry>
17430 <term><varname>$log_inodes</varname></term>
17431 <listitem>
17432 <para>
17433 <indexterm role="variable">
17434 <primary><varname>$log_inodes</varname></primary>
17435 </indexterm>
17436 The number of free inodes in the disk partition where Exim&#x2019;s
17437 log files are being written. The value is recalculated whenever the variable is
17438 referenced. If the relevant file system does not have the concept of inodes,
17439 the value of is -1. See also the <option>check_log_inodes</option> option.
17440 </para>
17441 </listitem></varlistentry>
17442 <varlistentry>
17443 <term><varname>$log_space</varname></term>
17444 <listitem>
17445 <para>
17446 <indexterm role="variable">
17447 <primary><varname>$log_space</varname></primary>
17448 </indexterm>
17449 The amount of free space (as a number of kilobytes) in the disk
17450 partition where Exim&#x2019;s log files are being written. The value is recalculated
17451 whenever the variable is referenced. If the operating system does not have the
17452 ability to find the amount of free space (only true for experimental systems),
17453 the space value is -1. See also the <option>check_log_space</option> option.
17454 </para>
17455 </listitem></varlistentry>
17456 <varlistentry>
17457 <term><varname>$mailstore_basename</varname></term>
17458 <listitem>
17459 <para>
17460 <indexterm role="variable">
17461 <primary><varname>$mailstore_basename</varname></primary>
17462 </indexterm>
17463 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
17464 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
17465 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
17466 contains the basename of the files that are being written, that is, the name
17467 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
17468 variable is empty.
17469 </para>
17470 </listitem></varlistentry>
17471 <varlistentry>
17472 <term><varname>$malware_name</varname></term>
17473 <listitem>
17474 <para>
17475 <indexterm role="variable">
17476 <primary><varname>$malware_name</varname></primary>
17477 </indexterm>
17478 This variable is available when Exim is compiled with the
17479 content-scanning extension. It is set to the name of the virus that was found
17480 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
17481 </para>
17482 </listitem></varlistentry>
17483 <varlistentry>
17484 <term><varname>$max_received_linelength</varname></term>
17485 <listitem>
17486 <para>
17487 <indexterm role="variable">
17488 <primary><varname>$max_received_linelength</varname></primary>
17489 </indexterm>
17490 <indexterm role="concept">
17491 <primary>maximum</primary>
17492 <secondary>line length</secondary>
17493 </indexterm>
17494 <indexterm role="concept">
17495 <primary>line length</primary>
17496 <secondary>maximum</secondary>
17497 </indexterm>
17498 This variable contains the number of bytes in the longest line that was
17499 received as part of the message, not counting the line termination
17500 character(s).
17501 </para>
17502 </listitem></varlistentry>
17503 <varlistentry>
17504 <term><varname>$message_age</varname></term>
17505 <listitem>
17506 <para>
17507 <indexterm role="concept">
17508 <primary>message</primary>
17509 <secondary>age of</secondary>
17510 </indexterm>
17511 <indexterm role="variable">
17512 <primary><varname>$message_age</varname></primary>
17513 </indexterm>
17514 This variable is set at the start of a delivery attempt to contain the number
17515 of seconds since the message was received. It does not change during a single
17516 delivery attempt.
17517 </para>
17518 </listitem></varlistentry>
17519 <varlistentry>
17520 <term><varname>$message_body</varname></term>
17521 <listitem>
17522 <para>
17523 <indexterm role="concept">
17524 <primary>body of message</primary>
17525 <secondary>expansion variable</secondary>
17526 </indexterm>
17527 <indexterm role="concept">
17528 <primary>message body</primary>
17529 <secondary>in expansion</secondary>
17530 </indexterm>
17531 <indexterm role="concept">
17532 <primary>binary zero</primary>
17533 <secondary>in message body</secondary>
17534 </indexterm>
17535 <indexterm role="variable">
17536 <primary><varname>$message_body</varname></primary>
17537 </indexterm>
17538 <indexterm role="option">
17539 <primary><option>message_body_visible</option></primary>
17540 </indexterm>
17541 This variable contains the initial portion of a message&#x2019;s body while it is
17542 being delivered, and is intended mainly for use in filter files. The maximum
17543 number of characters of the body that are put into the variable is set by the
17544 <option>message_body_visible</option> configuration option; the default is 500.
17545 </para>
17546 <para>
17547 <indexterm role="option">
17548 <primary><option>message_body_newlines</option></primary>
17549 </indexterm>
17550 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
17551 easier to search for phrases that might be split over a line break. However,
17552 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
17553 zeros are always converted into spaces.
17554 </para>
17555 </listitem></varlistentry>
17556 <varlistentry>
17557 <term><varname>$message_body_end</varname></term>
17558 <listitem>
17559 <para>
17560 <indexterm role="concept">
17561 <primary>body of message</primary>
17562 <secondary>expansion variable</secondary>
17563 </indexterm>
17564 <indexterm role="concept">
17565 <primary>message body</primary>
17566 <secondary>in expansion</secondary>
17567 </indexterm>
17568 <indexterm role="variable">
17569 <primary><varname>$message_body_end</varname></primary>
17570 </indexterm>
17571 This variable contains the final portion of a message&#x2019;s
17572 body while it is being delivered. The format and maximum size are as for
17573 <varname>$message_body</varname>.
17574 </para>
17575 </listitem></varlistentry>
17576 <varlistentry>
17577 <term><varname>$message_body_size</varname></term>
17578 <listitem>
17579 <para>
17580 <indexterm role="concept">
17581 <primary>body of message</primary>
17582 <secondary>size</secondary>
17583 </indexterm>
17584 <indexterm role="concept">
17585 <primary>message body</primary>
17586 <secondary>size</secondary>
17587 </indexterm>
17588 <indexterm role="variable">
17589 <primary><varname>$message_body_size</varname></primary>
17590 </indexterm>
17591 When a message is being delivered, this variable contains the size of the body
17592 in bytes. The count starts from the character after the blank line that
17593 separates the body from the header. Newlines are included in the count. See
17594 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17595 </para>
17596 </listitem></varlistentry>
17597 <varlistentry>
17598 <term><varname>$message_exim_id</varname></term>
17599 <listitem>
17600 <para>
17601 <indexterm role="variable">
17602 <primary><varname>$message_exim_id</varname></primary>
17603 </indexterm>
17604 When a message is being received or delivered, this variable contains the
17605 unique message id that is generated and used by Exim to identify the message.
17606 An id is not created for a message until after its header has been successfully
17607 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17608 line; it is the local id that Exim assigns to the message, for example:
17609 <literal>1BXTIK-0001yO-VA</literal>.
17610 </para>
17611 </listitem></varlistentry>
17612 <varlistentry>
17613 <term><varname>$message_headers</varname></term>
17614 <listitem>
17615 <para>
17616 <indexterm role="variable">
17617 <primary><varname>$message_headers</varname></primary>
17618 </indexterm>
17619 This variable contains a concatenation of all the header lines when a message
17620 is being processed, except for lines added by routers or transports. The header
17621 lines are separated by newline characters. Their contents are decoded in the
17622 same way as a header line that is inserted by <option>bheader</option>.
17623 </para>
17624 </listitem></varlistentry>
17625 <varlistentry>
17626 <term><varname>$message_headers_raw</varname></term>
17627 <listitem>
17628 <para>
17629 <indexterm role="variable">
17630 <primary><varname>$message_headers_raw</varname></primary>
17631 </indexterm>
17632 This variable is like <varname>$message_headers</varname> except that no processing of the
17633 contents of header lines is done.
17634 </para>
17635 </listitem></varlistentry>
17636 <varlistentry>
17637 <term><varname>$message_id</varname></term>
17638 <listitem>
17639 <para>
17640 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17641 </para>
17642 </listitem></varlistentry>
17643 <varlistentry>
17644 <term><varname>$message_linecount</varname></term>
17645 <listitem>
17646 <para>
17647 <indexterm role="variable">
17648 <primary><varname>$message_linecount</varname></primary>
17649 </indexterm>
17650 This variable contains the total number of lines in the header and body of the
17651 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17652 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17653 number of lines received. Before delivery happens (that is, before filters,
17654 routers, and transports run) the count is increased to include the
17655 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17656 lines that are added by ACLs. The blank line that separates the message header
17657 from the body is not counted.
17658 </para>
17659 <para>
17660 As with the special case of <varname>$message_size</varname>, during the expansion of the
17661 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
17662 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
17663 file that has been written (minus one for the blank line between the
17664 header and the body).
17665 </para>
17666 <para>
17667 Here is an example of the use of this variable in a DATA ACL:
17668 </para>
17669 <literallayout class="monospaced">
17670 deny message   = Too many lines in message header
17671      condition = \
17672       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
17673 </literallayout>
17674 <para>
17675 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17676 message has not yet been received.
17677 </para>
17678 </listitem></varlistentry>
17679 <varlistentry>
17680 <term><varname>$message_size</varname></term>
17681 <listitem>
17682 <para>
17683 <indexterm role="concept">
17684 <primary>size</primary>
17685 <secondary>of message</secondary>
17686 </indexterm>
17687 <indexterm role="concept">
17688 <primary>message</primary>
17689 <secondary>size</secondary>
17690 </indexterm>
17691 <indexterm role="variable">
17692 <primary><varname>$message_size</varname></primary>
17693 </indexterm>
17694 When a message is being processed, this variable contains its size in bytes. In
17695 most cases, the size includes those headers that were received with the
17696 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17697 deliveries as they are written. However, there is one special case: during the
17698 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17699 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17700 precise size of the file that has been written. See also
17701 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17702 </para>
17703 <para>
17704 <indexterm role="concept">
17705 <primary>RCPT</primary>
17706 <secondary>value of <varname>$message_size</varname></secondary>
17707 </indexterm>
17708 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17709 contains the size supplied on the MAIL command, or -1 if no size was given. The
17710 value may not, of course, be truthful.
17711 </para>
17712 </listitem></varlistentry>
17713 <varlistentry>
17714 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17715 <listitem>
17716 <para>
17717 A number of variables whose names start with <varname>$mime</varname> are
17718 available when Exim is compiled with the content-scanning extension. For
17719 details, see section <xref linkend="SECTscanmimepart"/>.
17720 </para>
17721 </listitem></varlistentry>
17722 <varlistentry>
17723 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
17724 <listitem>
17725 <para>
17726 These variables are counters that can be incremented by means
17727 of the <option>add</option> command in filter files.
17728 </para>
17729 </listitem></varlistentry>
17730 <varlistentry>
17731 <term><varname>$original_domain</varname></term>
17732 <listitem>
17733 <para>
17734 <indexterm role="variable">
17735 <primary><varname>$domain</varname></primary>
17736 </indexterm>
17737 <indexterm role="variable">
17738 <primary><varname>$original_domain</varname></primary>
17739 </indexterm>
17740 When a top-level address is being processed for delivery, this contains the
17741 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17742 generated by an alias, forward, or filter file) is being processed, this
17743 variable contains the domain of the original address (lower cased). This
17744 differs from <varname>$parent_domain</varname> only when there is more than one level of
17745 aliasing or forwarding. When more than one address is being delivered in a
17746 single transport run, <varname>$original_domain</varname> is not set.
17747 </para>
17748 <para>
17749 If a new address is created by means of a <option>deliver</option> command in a system
17750 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17751 part <emphasis>system-filter</emphasis> and the default qualify domain.
17752 </para>
17753 </listitem></varlistentry>
17754 <varlistentry>
17755 <term><varname>$original_local_part</varname></term>
17756 <listitem>
17757 <para>
17758 <indexterm role="variable">
17759 <primary><varname>$local_part</varname></primary>
17760 </indexterm>
17761 <indexterm role="variable">
17762 <primary><varname>$original_local_part</varname></primary>
17763 </indexterm>
17764 When a top-level address is being processed for delivery, this contains the
17765 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17766 local part, because <varname>$original_local_part</varname> always contains the full local
17767 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17768 filter file) is being processed, this variable contains the full local part of
17769 the original address.
17770 </para>
17771 <para>
17772 If the router that did the redirection processed the local part
17773 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17774 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17775 one level of aliasing or forwarding. When more than one address is being
17776 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17777 </para>
17778 <para>
17779 If a new address is created by means of a <option>deliver</option> command in a system
17780 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17781 part <emphasis>system-filter</emphasis> and the default qualify domain.
17782 </para>
17783 </listitem></varlistentry>
17784 <varlistentry>
17785 <term><varname>$originator_gid</varname></term>
17786 <listitem>
17787 <para>
17788 <indexterm role="concept">
17789 <primary>gid (group id)</primary>
17790 <secondary>of originating user</secondary>
17791 </indexterm>
17792 <indexterm role="concept">
17793 <primary>sender</primary>
17794 <secondary>gid</secondary>
17795 </indexterm>
17796 <indexterm role="variable">
17797 <primary><varname>$caller_gid</varname></primary>
17798 </indexterm>
17799 <indexterm role="variable">
17800 <primary><varname>$originator_gid</varname></primary>
17801 </indexterm>
17802 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17803 message was received. For messages received via the command line, this is the
17804 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17805 normally the gid of the Exim user.
17806 </para>
17807 </listitem></varlistentry>
17808 <varlistentry>
17809 <term><varname>$originator_uid</varname></term>
17810 <listitem>
17811 <para>
17812 <indexterm role="concept">
17813 <primary>uid (user id)</primary>
17814 <secondary>of originating user</secondary>
17815 </indexterm>
17816 <indexterm role="concept">
17817 <primary>sender</primary>
17818 <secondary>uid</secondary>
17819 </indexterm>
17820 <indexterm role="variable">
17821 <primary><varname>$caller_uid</varname></primary>
17822 </indexterm>
17823 <indexterm role="variable">
17824 <primary><varname>$originaltor_uid</varname></primary>
17825 </indexterm>
17826 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17827 messages received via the command line, this is the uid of the sending user.
17828 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17829 user.
17830 </para>
17831 </listitem></varlistentry>
17832 <varlistentry>
17833 <term><varname>$parent_domain</varname></term>
17834 <listitem>
17835 <para>
17836 <indexterm role="variable">
17837 <primary><varname>$parent_domain</varname></primary>
17838 </indexterm>
17839 This variable is similar to <varname>$original_domain</varname> (see
17840 above), except that it refers to the immediately preceding parent address.
17841 </para>
17842 </listitem></varlistentry>
17843 <varlistentry>
17844 <term><varname>$parent_local_part</varname></term>
17845 <listitem>
17846 <para>
17847 <indexterm role="variable">
17848 <primary><varname>$parent_local_part</varname></primary>
17849 </indexterm>
17850 This variable is similar to <varname>$original_local_part</varname>
17851 (see above), except that it refers to the immediately preceding parent address.
17852 </para>
17853 </listitem></varlistentry>
17854 <varlistentry>
17855 <term><varname>$pid</varname></term>
17856 <listitem>
17857 <para>
17858 <indexterm role="concept">
17859 <primary>pid (process id)</primary>
17860 <secondary>of current process</secondary>
17861 </indexterm>
17862 <indexterm role="variable">
17863 <primary><varname>$pid</varname></primary>
17864 </indexterm>
17865 This variable contains the current process id.
17866 </para>
17867 </listitem></varlistentry>
17868 <varlistentry>
17869 <term><varname>$pipe_addresses</varname></term>
17870 <listitem>
17871 <para>
17872 <indexterm role="concept">
17873 <primary>filter</primary>
17874 <secondary>transport filter</secondary>
17875 </indexterm>
17876 <indexterm role="concept">
17877 <primary>transport</primary>
17878 <secondary>filter</secondary>
17879 </indexterm>
17880 <indexterm role="variable">
17881 <primary><varname>$pipe_addresses</varname></primary>
17882 </indexterm>
17883 This is not an expansion variable, but is mentioned here because the string
17884 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17885 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17886 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17887 It cannot be used in general expansion strings, and provokes an <quote>unknown
17888 variable</quote> error if encountered.
17889 </para>
17890 </listitem></varlistentry>
17891 <varlistentry>
17892 <term><varname>$primary_hostname</varname></term>
17893 <listitem>
17894 <para>
17895 <indexterm role="variable">
17896 <primary><varname>$primary_hostname</varname></primary>
17897 </indexterm>
17898 This variable contains the value set by <option>primary_hostname</option> in the
17899 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17900 a single-component name, Exim calls <function>gethostbyname()</function> (or
17901 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17902 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17903 </para>
17904 </listitem></varlistentry>
17905 <varlistentry>
17906 <term><varname>$prvscheck_address</varname></term>
17907 <listitem>
17908 <para>
17909 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17910 which is described in sections <xref linkend="SECTexpansionitems"/> and
17911 <xref linkend="SECTverifyPRVS"/>.
17912 </para>
17913 </listitem></varlistentry>
17914 <varlistentry>
17915 <term><varname>$prvscheck_keynum</varname></term>
17916 <listitem>
17917 <para>
17918 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17919 which is described in sections <xref linkend="SECTexpansionitems"/> and
17920 <xref linkend="SECTverifyPRVS"/>.
17921 </para>
17922 </listitem></varlistentry>
17923 <varlistentry>
17924 <term><varname>$prvscheck_result</varname></term>
17925 <listitem>
17926 <para>
17927 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17928 which is described in sections <xref linkend="SECTexpansionitems"/> and
17929 <xref linkend="SECTverifyPRVS"/>.
17930 </para>
17931 </listitem></varlistentry>
17932 <varlistentry>
17933 <term><varname>$qualify_domain</varname></term>
17934 <listitem>
17935 <para>
17936 <indexterm role="variable">
17937 <primary><varname>$qualify_domain</varname></primary>
17938 </indexterm>
17939 The value set for the <option>qualify_domain</option> option in the configuration file.
17940 </para>
17941 </listitem></varlistentry>
17942 <varlistentry>
17943 <term><varname>$qualify_recipient</varname></term>
17944 <listitem>
17945 <para>
17946 <indexterm role="variable">
17947 <primary><varname>$qualify_recipient</varname></primary>
17948 </indexterm>
17949 The value set for the <option>qualify_recipient</option> option in the configuration file,
17950 or if not set, the value of <varname>$qualify_domain</varname>.
17951 </para>
17952 </listitem></varlistentry>
17953 <varlistentry>
17954 <term><varname>$rcpt_count</varname></term>
17955 <listitem>
17956 <para>
17957 <indexterm role="variable">
17958 <primary><varname>$rcpt_count</varname></primary>
17959 </indexterm>
17960 When a message is being received by SMTP, this variable contains the number of
17961 RCPT commands received for the current message. If this variable is used in a
17962 RCPT ACL, its value includes the current command.
17963 </para>
17964 </listitem></varlistentry>
17965 <varlistentry>
17966 <term><varname>$rcpt_defer_count</varname></term>
17967 <listitem>
17968 <para>
17969 <indexterm role="variable">
17970 <primary><varname>$rcpt_defer_count</varname></primary>
17971 </indexterm>
17972 <indexterm role="concept">
17973 <primary>4<emphasis>xx</emphasis> responses</primary>
17974 <secondary>count of</secondary>
17975 </indexterm>
17976 When a message is being received by SMTP, this variable contains the number of
17977 RCPT commands in the current message that have previously been rejected with a
17978 temporary (4<emphasis>xx</emphasis>) response.
17979 </para>
17980 </listitem></varlistentry>
17981 <varlistentry>
17982 <term><varname>$rcpt_fail_count</varname></term>
17983 <listitem>
17984 <para>
17985 <indexterm role="variable">
17986 <primary><varname>$rcpt_fail_count</varname></primary>
17987 </indexterm>
17988 When a message is being received by SMTP, this variable contains the number of
17989 RCPT commands in the current message that have previously been rejected with a
17990 permanent (5<emphasis>xx</emphasis>) response.
17991 </para>
17992 </listitem></varlistentry>
17993 <varlistentry>
17994 <term><varname>$received_count</varname></term>
17995 <listitem>
17996 <para>
17997 <indexterm role="variable">
17998 <primary><varname>$received_count</varname></primary>
17999 </indexterm>
18000 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
18001 including the one added by Exim (so its value is always greater than zero). It
18002 is available in the DATA ACL, the non-SMTP ACL, and while routing and
18003 delivering.
18004 </para>
18005 </listitem></varlistentry>
18006 <varlistentry>
18007 <term><varname>$received_for</varname></term>
18008 <listitem>
18009 <para>
18010 <indexterm role="variable">
18011 <primary><varname>$received_for</varname></primary>
18012 </indexterm>
18013 If there is only a single recipient address in an incoming message, this
18014 variable contains that address when the <emphasis>Received:</emphasis> header line is being
18015 built. The value is copied after recipient rewriting has happened, but before
18016 the <function>local_scan()</function> function is run.
18017 </para>
18018 </listitem></varlistentry>
18019 <varlistentry>
18020 <term><varname>$received_ip_address</varname></term>
18021 <listitem>
18022 <para>
18023 <indexterm role="variable">
18024 <primary><varname>$received_ip_address</varname></primary>
18025 </indexterm>
18026 As soon as an Exim server starts processing an incoming TCP/IP connection, this
18027 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
18028 is set to the local port number. (The remote IP address and port are in
18029 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
18030 the port value is -1 unless it has been set using the <option>-oMi</option> command line
18031 option.
18032 </para>
18033 <para>
18034 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
18035 could be used, for example, to make the file name for a TLS certificate depend
18036 on which interface and/or port is being used for the incoming connection. The
18037 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
18038 messages that are received, thus making these variables available at delivery
18039 time.
18040 </para>
18041 <para>
18042 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
18043 the values are unknown (unless they are explicitly set by options of the
18044 <command>smtp</command> transport).
18045 </para>
18046 </listitem></varlistentry>
18047 <varlistentry>
18048 <term><varname>$received_port</varname></term>
18049 <listitem>
18050 <para>
18051 <indexterm role="variable">
18052 <primary><varname>$received_port</varname></primary>
18053 </indexterm>
18054 See <varname>$received_ip_address</varname>.
18055 </para>
18056 </listitem></varlistentry>
18057 <varlistentry>
18058 <term><varname>$received_protocol</varname></term>
18059 <listitem>
18060 <para>
18061 <indexterm role="variable">
18062 <primary><varname>$received_protocol</varname></primary>
18063 </indexterm>
18064 When a message is being processed, this variable contains the name of the
18065 protocol by which it was received. Most of the names used by Exim are defined
18066 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
18067 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
18068 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
18069 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
18070 connection and the client was successfully authenticated.
18071 </para>
18072 <para>
18073 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
18074 automatically set up on connection without the use of STARTTLS (see
18075 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
18076 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
18077 where the client initially uses EHLO, sets up an encrypted connection using
18078 STARTTLS, and then uses HELO afterwards.
18079 </para>
18080 <para>
18081 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
18082 messages that are injected locally by trusted callers. This is commonly used to
18083 identify messages that are being re-injected after some kind of scanning.
18084 </para>
18085 </listitem></varlistentry>
18086 <varlistentry>
18087 <term><varname>$received_time</varname></term>
18088 <listitem>
18089 <para>
18090 <indexterm role="variable">
18091 <primary><varname>$received_time</varname></primary>
18092 </indexterm>
18093 This variable contains the date and time when the current message was received,
18094 as a number of seconds since the start of the Unix epoch.
18095 </para>
18096 </listitem></varlistentry>
18097 <varlistentry>
18098 <term><varname>$recipient_data</varname></term>
18099 <listitem>
18100 <para>
18101 <indexterm role="variable">
18102 <primary><varname>$recipient_data</varname></primary>
18103 </indexterm>
18104 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
18105 condition. It contains the data from the lookup, and the value remains set
18106 until the next <option>recipients</option> test. Thus, you can do things like this:
18107 </para>
18108 <literallayout>
18109 <literal>require recipients  = cdb*@;/some/file</literal>
18110 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
18111 </literallayout>
18112 <para>
18113 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18114 method in the address list, using the semicolon syntax as in the example above.
18115 The variable is not set for a lookup that is used as part of the string
18116 expansion that all such lists undergo before being interpreted.
18117 </para>
18118 </listitem></varlistentry>
18119 <varlistentry>
18120 <term><varname>$recipient_verify_failure</varname></term>
18121 <listitem>
18122 <para>
18123 <indexterm role="variable">
18124 <primary><varname>$recipient_verify_failure</varname></primary>
18125 </indexterm>
18126 In an ACL, when a recipient verification fails, this variable contains
18127 information about the failure. It is set to one of the following words:
18128 </para>
18129 <itemizedlist>
18130 <listitem>
18131 <para>
18132 <quote>qualify</quote>: The address was unqualified (no domain), and the message
18133 was neither local nor came from an exempted host.
18134 </para>
18135 </listitem>
18136 <listitem>
18137 <para>
18138 <quote>route</quote>: Routing failed.
18139 </para>
18140 </listitem>
18141 <listitem>
18142 <para>
18143 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
18144 or before the MAIL command (that is, on initial connection, HELO, or
18145 MAIL).
18146 </para>
18147 </listitem>
18148 <listitem>
18149 <para>
18150 <quote>recipient</quote>: The RCPT command in a callout was rejected.
18151 </para>
18152 </listitem>
18153 <listitem>
18154 <para>
18155 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
18156 </para>
18157 </listitem>
18158 </itemizedlist>
18159 <para>
18160 The main use of this variable is expected to be to distinguish between
18161 rejections of MAIL and rejections of RCPT.
18162 </para>
18163 </listitem></varlistentry>
18164 <varlistentry>
18165 <term><varname>$recipients</varname></term>
18166 <listitem>
18167 <para>
18168 <indexterm role="variable">
18169 <primary><varname>$recipients</varname></primary>
18170 </indexterm>
18171 This variable contains a list of envelope recipients for a message. A comma and
18172 a space separate the addresses in the replacement text. However, the variable
18173 is not generally available, to prevent exposure of Bcc recipients in
18174 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
18175 cases:
18176 </para>
18177 <orderedlist numeration="arabic">
18178 <listitem>
18179 <para>
18180 In a system filter file.
18181 </para>
18182 </listitem>
18183 <listitem>
18184 <para>
18185 In the ACLs associated with the DATA command and with non-SMTP messages, that
18186 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
18187 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
18188 <option>acl_not_smtp_mime</option>.
18189 </para>
18190 </listitem>
18191 <listitem>
18192 <para>
18193 From within a <function>local_scan()</function> function.
18194 </para>
18195 </listitem>
18196 </orderedlist>
18197 </listitem></varlistentry>
18198 <varlistentry>
18199 <term><varname>$recipients_count</varname></term>
18200 <listitem>
18201 <para>
18202 <indexterm role="variable">
18203 <primary><varname>$recipients_count</varname></primary>
18204 </indexterm>
18205 When a message is being processed, this variable contains the number of
18206 envelope recipients that came with the message. Duplicates are not excluded
18207 from the count. While a message is being received over SMTP, the number
18208 increases for each accepted recipient. It can be referenced in an ACL.
18209 </para>
18210 </listitem></varlistentry>
18211 <varlistentry>
18212 <term><varname>$regex_match_string</varname></term>
18213 <listitem>
18214 <para>
18215 <indexterm role="variable">
18216 <primary><varname>$regex_match_string</varname></primary>
18217 </indexterm>
18218 This variable is set to contain the matching regular expression after a
18219 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
18220 </para>
18221 </listitem></varlistentry>
18222 <varlistentry>
18223 <term><varname>$reply_address</varname></term>
18224 <listitem>
18225 <para>
18226 <indexterm role="variable">
18227 <primary><varname>$reply_address</varname></primary>
18228 </indexterm>
18229 When a message is being processed, this variable contains the contents of the
18230 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
18231 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
18232 white space, the value is not processed in any way. In particular, no RFC 2047
18233 decoding or character code translation takes place.
18234 </para>
18235 </listitem></varlistentry>
18236 <varlistentry>
18237 <term><varname>$return_path</varname></term>
18238 <listitem>
18239 <para>
18240 <indexterm role="variable">
18241 <primary><varname>$return_path</varname></primary>
18242 </indexterm>
18243 When a message is being delivered, this variable contains the return path &ndash;
18244 the sender field that will be sent as part of the envelope. It is not enclosed
18245 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
18246 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
18247 mailing list has been expanded by a router which specifies a different address
18248 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
18249 address, whereas <varname>$sender_address</varname> always contains the original sender address
18250 that was received with the message. In other words, <varname>$sender_address</varname> contains
18251 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
18252 envelope sender.
18253 </para>
18254 </listitem></varlistentry>
18255 <varlistentry>
18256 <term><varname>$return_size_limit</varname></term>
18257 <listitem>
18258 <para>
18259 <indexterm role="variable">
18260 <primary><varname>$return_size_limit</varname></primary>
18261 </indexterm>
18262 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
18263 </para>
18264 </listitem></varlistentry>
18265 <varlistentry revisionflag="changed">
18266 <term><varname>$router_name</varname></term>
18267 <listitem>
18268 <para revisionflag="changed">
18269 <indexterm role="concept">
18270 <primary>router</primary>
18271 <secondary>name</secondary>
18272 </indexterm>
18273 <indexterm role="concept">
18274 <primary>name</primary>
18275 <secondary>of router</secondary>
18276 </indexterm>
18277 <indexterm role="variable">
18278 <primary><varname>$router_name</varname></primary>
18279 </indexterm>
18280 During the running of a router this variable contains its name.
18281 </para>
18282 </listitem></varlistentry>
18283 <varlistentry>
18284 <term><varname>$runrc</varname></term>
18285 <listitem>
18286 <para>
18287 <indexterm role="concept">
18288 <primary>return code</primary>
18289 <secondary>from <option>run</option> expansion</secondary>
18290 </indexterm>
18291 <indexterm role="variable">
18292 <primary><varname>$runrc</varname></primary>
18293 </indexterm>
18294 This variable contains the return code from a command that is run by the
18295 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
18296 assume the order in which option values are expanded, except for those
18297 preconditions whose order of testing is documented. Therefore, you cannot
18298 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
18299 another.
18300 </para>
18301 </listitem></varlistentry>
18302 <varlistentry>
18303 <term><varname>$self_hostname</varname></term>
18304 <listitem>
18305 <para>
18306 <indexterm role="option">
18307 <primary><option>self</option></primary>
18308 <secondary>value of host name</secondary>
18309 </indexterm>
18310 <indexterm role="variable">
18311 <primary><varname>$self_hostname</varname></primary>
18312 </indexterm>
18313 When an address is routed to a supposedly remote host that turns out to be the
18314 local host, what happens is controlled by the <option>self</option> generic router option.
18315 One of its values causes the address to be passed to another router. When this
18316 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
18317 original router encountered. In other circumstances its contents are null.
18318 </para>
18319 </listitem></varlistentry>
18320 <varlistentry>
18321 <term><varname>$sender_address</varname></term>
18322 <listitem>
18323 <para>
18324 <indexterm role="variable">
18325 <primary><varname>$sender_address</varname></primary>
18326 </indexterm>
18327 When a message is being processed, this variable contains the sender&#x2019;s address
18328 that was received in the message&#x2019;s envelope. The case of letters in the address
18329 is retained, in both the local part and the domain. For bounce messages, the
18330 value of this variable is the empty string. See also <varname>$return_path</varname>.
18331 </para>
18332 </listitem></varlistentry>
18333 <varlistentry>
18334 <term><varname>$sender_address_data</varname></term>
18335 <listitem>
18336 <para>
18337 <indexterm role="variable">
18338 <primary><varname>$address_data</varname></primary>
18339 </indexterm>
18340 <indexterm role="variable">
18341 <primary><varname>$sender_address_data</varname></primary>
18342 </indexterm>
18343 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18344 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
18345 distinguish it from data from a recipient address. The value does not persist
18346 after the end of the current ACL statement. If you want to preserve it for
18347 longer, you can save it in an ACL variable.
18348 </para>
18349 </listitem></varlistentry>
18350 <varlistentry>
18351 <term><varname>$sender_address_domain</varname></term>
18352 <listitem>
18353 <para>
18354 <indexterm role="variable">
18355 <primary><varname>$sender_address_domain</varname></primary>
18356 </indexterm>
18357 The domain portion of <varname>$sender_address</varname>.
18358 </para>
18359 </listitem></varlistentry>
18360 <varlistentry>
18361 <term><varname>$sender_address_local_part</varname></term>
18362 <listitem>
18363 <para>
18364 <indexterm role="variable">
18365 <primary><varname>$sender_address_local_part</varname></primary>
18366 </indexterm>
18367 The local part portion of <varname>$sender_address</varname>.
18368 </para>
18369 </listitem></varlistentry>
18370 <varlistentry>
18371 <term><varname>$sender_data</varname></term>
18372 <listitem>
18373 <para>
18374 <indexterm role="variable">
18375 <primary><varname>$sender_data</varname></primary>
18376 </indexterm>
18377 This variable is set after a lookup success in an ACL <option>senders</option> condition or
18378 in a router <option>senders</option> option. It contains the data from the lookup, and the
18379 value remains set until the next <option>senders</option> test. Thus, you can do things like
18380 this:
18381 </para>
18382 <literallayout>
18383 <literal>require senders      = cdb*@;/some/file</literal>
18384 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
18385 </literallayout>
18386 <para>
18387 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
18388 method in the address list, using the semicolon syntax as in the example above.
18389 The variable is not set for a lookup that is used as part of the string
18390 expansion that all such lists undergo before being interpreted.
18391 </para>
18392 </listitem></varlistentry>
18393 <varlistentry>
18394 <term><varname>$sender_fullhost</varname></term>
18395 <listitem>
18396 <para>
18397 <indexterm role="variable">
18398 <primary><varname>$sender_fullhost</varname></primary>
18399 </indexterm>
18400 When a message is received from a remote host, this variable contains the host
18401 name and IP address in a single string. It ends with the IP address in square
18402 brackets, followed by a colon and a port number if the logging of ports is
18403 enabled. The format of the rest of the string depends on whether the host
18404 issued a HELO or EHLO SMTP command, and whether the host name was verified by
18405 looking up its IP address. (Looking up the IP address can be forced by the
18406 <option>host_lookup</option> option, independent of verification.) A plain host name at the
18407 start of the string is a verified host name; if this is not present,
18408 verification either failed or was not requested. A host name in parentheses is
18409 the argument of a HELO or EHLO command. This is omitted if it is identical to
18410 the verified host name or to the host&#x2019;s IP address in square brackets.
18411 </para>
18412 </listitem></varlistentry>
18413 <varlistentry>
18414 <term><varname>$sender_helo_name</varname></term>
18415 <listitem>
18416 <para>
18417 <indexterm role="variable">
18418 <primary><varname>$sender_helo_name</varname></primary>
18419 </indexterm>
18420 When a message is received from a remote host that has issued a HELO or EHLO
18421 command, the argument of that command is placed in this variable. It is also
18422 set if HELO or EHLO is used when a message is received using SMTP locally via
18423 the <option>-bs</option> or <option>-bS</option> options.
18424 </para>
18425 </listitem></varlistentry>
18426 <varlistentry>
18427 <term><varname>$sender_host_address</varname></term>
18428 <listitem>
18429 <para>
18430 <indexterm role="variable">
18431 <primary><varname>$sender_host_address</varname></primary>
18432 </indexterm>
18433 When a message is received from a remote host, this variable contains that
18434 host&#x2019;s IP address. For locally submitted messages, it is empty.
18435 </para>
18436 </listitem></varlistentry>
18437 <varlistentry>
18438 <term><varname>$sender_host_authenticated</varname></term>
18439 <listitem>
18440 <para>
18441 <indexterm role="variable">
18442 <primary><varname>$sender_host_authenticated</varname></primary>
18443 </indexterm>
18444 This variable contains the name (not the public name) of the authenticator
18445 driver that successfully authenticated the client from which the message was
18446 received. It is empty if there was no successful authentication. See also
18447 <varname>$authenticated_id</varname>.
18448 </para>
18449 </listitem></varlistentry>
18450 <varlistentry revisionflag="changed">
18451 <term><varname>$sender_host_dnssec</varname></term>
18452 <listitem>
18453 <para revisionflag="changed">
18454 <indexterm role="variable">
18455 <primary><varname>$sender_host_dnssec</varname></primary>
18456 </indexterm>
18457 If <varname>$sender_host_name</varname> has been populated (by reference, <option>hosts_lookup</option> or
18458 otherwise) then this boolean will have been set true if, and only if, the
18459 resolver library states that the reverse DNS was authenticated data.  At all
18460 other times, this variable is false.
18461 </para>
18462 <para revisionflag="changed">
18463 It is likely that you will need to coerce DNSSEC support on in the resolver
18464 library, by setting:
18465 </para>
18466 <literallayout class="monospaced" revisionflag="changed">
18467 dns_use_dnssec = 1
18468 </literallayout>
18469 <para revisionflag="changed">
18470 Exim does not perform DNSSEC validation itself, instead leaving that to a
18471 validating resolver (eg, unbound, or bind with suitable configuration).
18472 </para>
18473 <para revisionflag="changed">
18474 Exim does not (currently) check to see if the forward DNS was also secured
18475 with DNSSEC, only the reverse DNS.
18476 </para>
18477 <para revisionflag="changed">
18478 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
18479 mechanism in the list, then this variable will be false.
18480 </para>
18481 </listitem></varlistentry>
18482 <varlistentry>
18483 <term><varname>$sender_host_name</varname></term>
18484 <listitem>
18485 <para>
18486 <indexterm role="variable">
18487 <primary><varname>$sender_host_name</varname></primary>
18488 </indexterm>
18489 When a message is received from a remote host, this variable contains the
18490 host&#x2019;s name as obtained by looking up its IP address. For messages received by
18491 other means, this variable is empty.
18492 </para>
18493 <para>
18494 <indexterm role="variable">
18495 <primary><varname>$host_lookup_failed</varname></primary>
18496 </indexterm>
18497 If the host name has not previously been looked up, a reference to
18498 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
18499 A looked up name is accepted only if it leads back to the original IP address
18500 via a forward lookup. If either the reverse or the forward lookup fails to find
18501 any data, or if the forward lookup does not yield the original IP address,
18502 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18503 </para>
18504 <para>
18505 <indexterm role="variable">
18506 <primary><varname>$host_lookup_deferred</varname></primary>
18507 </indexterm>
18508 However, if either of the lookups cannot be completed (for example, there is a
18509 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
18510 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
18511 </para>
18512 <para>
18513 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
18514 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
18515 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
18516 is set to <quote>1</quote>.
18517 </para>
18518 <para>
18519 Exim does not automatically look up every calling host&#x2019;s name. If you want
18520 maximum efficiency, you should arrange your configuration so that it avoids
18521 these lookups altogether. The lookup happens only if one or more of the
18522 following are true:
18523 </para>
18524 <itemizedlist>
18525 <listitem>
18526 <para>
18527 A string containing <varname>$sender_host_name</varname> is expanded.
18528 </para>
18529 </listitem>
18530 <listitem>
18531 <para>
18532 The calling host matches the list in <option>host_lookup</option>. In the default
18533 configuration, this option is set to *, so it must be changed if lookups are
18534 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
18535 </para>
18536 </listitem>
18537 <listitem>
18538 <para>
18539 Exim needs the host name in order to test an item in a host list. The items
18540 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
18541 <xref linkend="SECThoslispatnamsk"/>.
18542 </para>
18543 </listitem>
18544 <listitem>
18545 <para>
18546 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
18547 In this case, the host name is required to compare with the name quoted in any
18548 EHLO or HELO commands that the client issues.
18549 </para>
18550 </listitem>
18551 <listitem>
18552 <para>
18553 The remote host issues a EHLO or HELO command that quotes one of the
18554 domains in <option>helo_lookup_domains</option>. The default value of this option is
18555 </para>
18556 <literallayout class="monospaced">
18557   helo_lookup_domains = @ : @[]
18558 </literallayout>
18559 <para>
18560 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
18561 IP address in an EHLO or HELO command.
18562 </para>
18563 </listitem>
18564 </itemizedlist>
18565 </listitem></varlistentry>
18566 <varlistentry>
18567 <term><varname>$sender_host_port</varname></term>
18568 <listitem>
18569 <para>
18570 <indexterm role="variable">
18571 <primary><varname>$sender_host_port</varname></primary>
18572 </indexterm>
18573 When a message is received from a remote host, this variable contains the port
18574 number that was used on the remote host.
18575 </para>
18576 </listitem></varlistentry>
18577 <varlistentry>
18578 <term><varname>$sender_ident</varname></term>
18579 <listitem>
18580 <para>
18581 <indexterm role="variable">
18582 <primary><varname>$sender_ident</varname></primary>
18583 </indexterm>
18584 When a message is received from a remote host, this variable contains the
18585 identification received in response to an RFC 1413 request. When a message has
18586 been received locally, this variable contains the login name of the user that
18587 called Exim.
18588 </para>
18589 </listitem></varlistentry>
18590 <varlistentry>
18591 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
18592 <listitem>
18593 <para>
18594 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
18595 <option>ratelimit</option> ACL condition. Details are given in section
18596 <xref linkend="SECTratelimiting"/>.
18597 </para>
18598 </listitem></varlistentry>
18599 <varlistentry>
18600 <term><varname>$sender_rcvhost</varname></term>
18601 <listitem>
18602 <para>
18603 <indexterm role="concept">
18604 <primary>DNS</primary>
18605 <secondary>reverse lookup</secondary>
18606 </indexterm>
18607 <indexterm role="concept">
18608 <primary>reverse DNS lookup</primary>
18609 </indexterm>
18610 <indexterm role="variable">
18611 <primary><varname>$sender_rcvhost</varname></primary>
18612 </indexterm>
18613 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
18614 either the verified host name (as obtained from a reverse DNS lookup) or, if
18615 there is no verified host name, the IP address in square brackets. After that
18616 there may be text in parentheses. When the first item is a verified host name,
18617 the first thing in the parentheses is the IP address in square brackets,
18618 followed by a colon and a port number if port logging is enabled. When the
18619 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
18620 the parentheses.
18621 </para>
18622 <para>
18623 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
18624 was used and its argument was not identical to the real host name or IP
18625 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
18626 all three items are present in the parentheses, a newline and tab are inserted
18627 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
18628 </para>
18629 </listitem></varlistentry>
18630 <varlistentry>
18631 <term><varname>$sender_verify_failure</varname></term>
18632 <listitem>
18633 <para>
18634 <indexterm role="variable">
18635 <primary><varname>$sender_verify_failure</varname></primary>
18636 </indexterm>
18637 In an ACL, when a sender verification fails, this variable contains information
18638 about the failure. The details are the same as for
18639 <varname>$recipient_verify_failure</varname>.
18640 </para>
18641 </listitem></varlistentry>
18642 <varlistentry>
18643 <term><varname>$sending_ip_address</varname></term>
18644 <listitem>
18645 <para>
18646 <indexterm role="variable">
18647 <primary><varname>$sending_ip_address</varname></primary>
18648 </indexterm>
18649 This variable is set whenever an outgoing SMTP connection to another host has
18650 been set up. It contains the IP address of the local interface that is being
18651 used. This is useful if a host that has more than one IP address wants to take
18652 on different personalities depending on which one is being used. For incoming
18653 connections, see <varname>$received_ip_address</varname>.
18654 </para>
18655 </listitem></varlistentry>
18656 <varlistentry>
18657 <term><varname>$sending_port</varname></term>
18658 <listitem>
18659 <para>
18660 <indexterm role="variable">
18661 <primary><varname>$sending_port</varname></primary>
18662 </indexterm>
18663 This variable is set whenever an outgoing SMTP connection to another host has
18664 been set up. It contains the local port that is being used. For incoming
18665 connections, see <varname>$received_port</varname>.
18666 </para>
18667 </listitem></varlistentry>
18668 <varlistentry>
18669 <term><varname>$smtp_active_hostname</varname></term>
18670 <listitem>
18671 <para>
18672 <indexterm role="variable">
18673 <primary><varname>$smtp_active_hostname</varname></primary>
18674 </indexterm>
18675 During an incoming SMTP session, this variable contains the value of the active
18676 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18677 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18678 value can be consulted during routing and delivery.
18679 </para>
18680 </listitem></varlistentry>
18681 <varlistentry>
18682 <term><varname>$smtp_command</varname></term>
18683 <listitem>
18684 <para>
18685 <indexterm role="variable">
18686 <primary><varname>$smtp_command</varname></primary>
18687 </indexterm>
18688 During the processing of an incoming SMTP command, this variable contains the
18689 entire command. This makes it possible to distinguish between HELO and EHLO in
18690 the HELO ACL, and also to distinguish between commands such as these:
18691 </para>
18692 <literallayout class="monospaced">
18693 MAIL FROM:&lt;&gt;
18694 MAIL FROM: &lt;&gt;
18695 </literallayout>
18696 <para>
18697 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18698 command, the address in <varname>$smtp_command</varname> is the original address before any
18699 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18700 the address after SMTP-time rewriting.
18701 </para>
18702 </listitem></varlistentry>
18703 <varlistentry>
18704 <term><varname>$smtp_command_argument</varname></term>
18705 <listitem>
18706 <para>
18707 <indexterm role="concept">
18708 <primary>SMTP</primary>
18709 <secondary>command, argument for</secondary>
18710 </indexterm>
18711 <indexterm role="variable">
18712 <primary><varname>$smtp_command_argument</varname></primary>
18713 </indexterm>
18714 While an ACL is running to check an SMTP command, this variable contains the
18715 argument, that is, the text that follows the command name, with leading white
18716 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18717 somewhat redundant, but is retained for backwards compatibility.
18718 </para>
18719 </listitem></varlistentry>
18720 <varlistentry>
18721 <term><varname>$smtp_count_at_connection_start</varname></term>
18722 <listitem>
18723 <para>
18724 <indexterm role="variable">
18725 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18726 </indexterm>
18727 This variable is set greater than zero only in processes spawned by the Exim
18728 daemon for handling incoming SMTP connections. The name is deliberately long,
18729 in order to emphasize what the contents are. When the daemon accepts a new
18730 connection, it increments this variable. A copy of the variable is passed to
18731 the child process that handles the connection, but its value is fixed, and
18732 never changes. It is only an approximation of how many incoming connections
18733 there actually are, because many other connections may come and go while a
18734 single connection is being processed. When a child process terminates, the
18735 daemon decrements its copy of the variable.
18736 </para>
18737 </listitem></varlistentry>
18738 <varlistentry>
18739 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
18740 <listitem>
18741 <para>
18742 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
18743 that were current at the end of the system filter file. This allows a system
18744 filter file to set values that can be tested in users&#x2019; filter files. For
18745 example, a system filter could set a value indicating how likely it is that a
18746 message is junk mail.
18747 </para>
18748 </listitem></varlistentry>
18749 <varlistentry>
18750 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18751 <listitem>
18752 <para>
18753 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18754 is compiled with the content-scanning extension. For details, see section
18755 <xref linkend="SECTscanspamass"/>.
18756 </para>
18757 </listitem></varlistentry>
18758 <varlistentry>
18759 <term><varname>$spool_directory</varname></term>
18760 <listitem>
18761 <para>
18762 <indexterm role="variable">
18763 <primary><varname>$spool_directory</varname></primary>
18764 </indexterm>
18765 The name of Exim&#x2019;s spool directory.
18766 </para>
18767 </listitem></varlistentry>
18768 <varlistentry>
18769 <term><varname>$spool_inodes</varname></term>
18770 <listitem>
18771 <para>
18772 <indexterm role="variable">
18773 <primary><varname>$spool_inodes</varname></primary>
18774 </indexterm>
18775 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
18776 being written. The value is recalculated whenever the variable is referenced.
18777 If the relevant file system does not have the concept of inodes, the value of
18778 is -1. See also the <option>check_spool_inodes</option> option.
18779 </para>
18780 </listitem></varlistentry>
18781 <varlistentry>
18782 <term><varname>$spool_space</varname></term>
18783 <listitem>
18784 <para>
18785 <indexterm role="variable">
18786 <primary><varname>$spool_space</varname></primary>
18787 </indexterm>
18788 The amount of free space (as a number of kilobytes) in the disk partition where
18789 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
18790 variable is referenced. If the operating system does not have the ability to
18791 find the amount of free space (only true for experimental systems), the space
18792 value is -1. For example, to check in an ACL that there is at least 50
18793 megabytes free on the spool, you could write:
18794 </para>
18795 <literallayout class="monospaced">
18796 condition = ${if &gt; {$spool_space}{50000}}
18797 </literallayout>
18798 <para>
18799 See also the <option>check_spool_space</option> option.
18800 </para>
18801 </listitem></varlistentry>
18802 <varlistentry>
18803 <term><varname>$thisaddress</varname></term>
18804 <listitem>
18805 <para>
18806 <indexterm role="variable">
18807 <primary><varname>$thisaddress</varname></primary>
18808 </indexterm>
18809 This variable is set only during the processing of the <option>foranyaddress</option>
18810 command in a filter file. Its use is explained in the description of that
18811 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
18812 interfaces to mail filtering</emphasis>.
18813 </para>
18814 </listitem></varlistentry>
18815 <varlistentry revisionflag="changed">
18816 <term><varname>$tls_in_bits</varname></term>
18817 <listitem>
18818 <para revisionflag="changed">
18819 <indexterm role="variable">
18820 <primary><varname>$tls_in_bits</varname></primary>
18821 </indexterm>
18822 Contains an approximation of the TLS cipher&#x2019;s bit-strength
18823 on the inbound connection; the meaning of
18824 this depends upon the TLS implementation used.
18825 If TLS has not been negotiated, the value will be 0.
18826 The value of this is automatically fed into the Cyrus SASL authenticator
18827 when acting as a server, to specify the "external SSF" (a SASL term).
18828 </para>
18829 <para revisionflag="changed">
18830 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
18831 except when used in the context of an outbound SMTP delivery, when it refers to
18832 the outbound.
18833 </para>
18834 </listitem></varlistentry>
18835 <varlistentry revisionflag="changed">
18836 <term><varname>$tls_out_bits</varname></term>
18837 <listitem>
18838 <para revisionflag="changed">
18839 <indexterm role="variable">
18840 <primary><varname>$tls_out_bits</varname></primary>
18841 </indexterm>
18842 Contains an approximation of the TLS cipher&#x2019;s bit-strength
18843 on an outbound SMTP connection; the meaning of
18844 this depends upon the TLS implementation used.
18845 If TLS has not been negotiated, the value will be 0.
18846 </para>
18847 </listitem></varlistentry>
18848 <varlistentry revisionflag="changed">
18849 <term><varname>$tls_in_certificate_verified</varname></term>
18850 <listitem>
18851 <para revisionflag="changed">
18852 <indexterm role="variable">
18853 <primary><varname>$tls_in_certificate_verified</varname></primary>
18854 </indexterm>
18855 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18856 message was received, and <quote>0</quote> otherwise.
18857 </para>
18858 <para revisionflag="changed">
18859 The deprecated <varname>$tls_certificate_verfied</varname> variable refers to the inbound side
18860 except when used in the context of an outbound SMTP delivery, when it refers to
18861 the outbound.
18862 </para>
18863 </listitem></varlistentry>
18864 <varlistentry revisionflag="changed">
18865 <term><varname>$tls_out_certificate_verified</varname></term>
18866 <listitem>
18867 <para revisionflag="changed">
18868 <indexterm role="variable">
18869 <primary><varname>$tls_out_certificate_verified</varname></primary>
18870 </indexterm>
18871 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
18872 outbound SMTP connection was made,
18873 and <quote>0</quote> otherwise.
18874 </para>
18875 </listitem></varlistentry>
18876 <varlistentry revisionflag="changed">
18877 <term><varname>$tls_in_cipher</varname></term>
18878 <listitem>
18879 <para revisionflag="changed">
18880 <indexterm role="variable">
18881 <primary><varname>$tls_in_cipher</varname></primary>
18882 </indexterm>
18883 <indexterm role="variable">
18884 <primary><varname>$tls_cipher</varname></primary>
18885 </indexterm>
18886 When a message is received from a remote host over an encrypted SMTP
18887 connection, this variable is set to the cipher suite that was negotiated, for
18888 example DES-CBC3-SHA. In other circumstances, in particular, for message
18889 received over unencrypted connections, the variable is empty. Testing
18890 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18891 non-encrypted connections during ACL processing.
18892 </para>
18893 <para revisionflag="changed">
18894 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
18895 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
18896 becomes the same as <varname>$tls_out_cipher</varname>.
18897 </para>
18898 </listitem></varlistentry>
18899 <varlistentry revisionflag="changed">
18900 <term><varname>$tls_out_cipher</varname></term>
18901 <listitem>
18902 <para revisionflag="changed">
18903 <indexterm role="variable">
18904 <primary><varname>$tls_out_cipher</varname></primary>
18905 </indexterm>
18906 This variable is
18907 cleared before any outgoing SMTP connection is made,
18908 and then set to the outgoing cipher suite if one is negotiated. See chapter
18909 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18910 details of the <command>smtp</command> transport.
18911 </para>
18912 </listitem></varlistentry>
18913 <varlistentry revisionflag="changed">
18914 <term><varname>$tls_in_peerdn</varname></term>
18915 <listitem>
18916 <para revisionflag="changed">
18917 <indexterm role="variable">
18918 <primary><varname>$tls_in_peerdn</varname></primary>
18919 </indexterm>
18920 <indexterm role="variable">
18921 <primary><varname>$tls_peerdn</varname></primary>
18922 </indexterm>
18923 When a message is received from a remote host over an encrypted SMTP
18924 connection, and Exim is configured to request a certificate from the client,
18925 the value of the Distinguished Name of the certificate is made available in the
18926 <varname>$tls_in_peerdn</varname> during subsequent processing.
18927 </para>
18928 <para revisionflag="changed">
18929 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
18930 except when used in the context of an outbound SMTP delivery, when it refers to
18931 the outbound.
18932 </para>
18933 </listitem></varlistentry>
18934 <varlistentry revisionflag="changed">
18935 <term><varname>$tls_out_peerdn</varname></term>
18936 <listitem>
18937 <para revisionflag="changed">
18938 <indexterm role="variable">
18939 <primary><varname>$tls_out_peerdn</varname></primary>
18940 </indexterm>
18941 When a message is being delivered to a remote host over an encrypted SMTP
18942 connection, and Exim is configured to request a certificate from the server,
18943 the value of the Distinguished Name of the certificate is made available in the
18944 <varname>$tls_out_peerdn</varname> during subsequent processing.
18945 </para>
18946 </listitem></varlistentry>
18947 <varlistentry revisionflag="changed">
18948 <term><varname>$tls_in_sni</varname></term>
18949 <listitem>
18950 <para revisionflag="changed">
18951 <indexterm role="variable">
18952 <primary><varname>$tls_in_sni</varname></primary>
18953 </indexterm>
18954 <indexterm role="variable">
18955 <primary><varname>$tls_sni</varname></primary>
18956 </indexterm>
18957 <indexterm role="concept">
18958 <primary>TLS</primary>
18959 <secondary>Server Name Indication</secondary>
18960 </indexterm>
18961 When a TLS session is being established, if the client sends the Server
18962 Name Indication extension, the value will be placed in this variable.
18963 If the variable appears in <option>tls_certificate</option> then this option and
18964 some others, described in <xref linkend="SECTtlssni"/>,
18965 will be re-expanded early in the TLS session, to permit
18966 a different certificate to be presented (and optionally a different key to be
18967 used) to the client, based upon the value of the SNI extension.
18968 </para>
18969 <para revisionflag="changed">
18970 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
18971 except when used in the context of an outbound SMTP delivery, when it refers to
18972 the outbound.
18973 </para>
18974 </listitem></varlistentry>
18975 <varlistentry revisionflag="changed">
18976 <term><varname>$tls_out_sni</varname></term>
18977 <listitem>
18978 <para revisionflag="changed">
18979 <indexterm role="variable">
18980 <primary><varname>$tls_out_sni</varname></primary>
18981 </indexterm>
18982 <indexterm role="concept">
18983 <primary>TLS</primary>
18984 <secondary>Server Name Indication</secondary>
18985 </indexterm>
18986 During outbound
18987 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
18988 the transport.
18989 </para>
18990 </listitem></varlistentry>
18991 <varlistentry>
18992 <term><varname>$tod_bsdinbox</varname></term>
18993 <listitem>
18994 <para>
18995 <indexterm role="variable">
18996 <primary><varname>$tod_bsdinbox</varname></primary>
18997 </indexterm>
18998 The time of day and the date, in the format required for BSD-style mailbox
18999 files, for example: Thu Oct 17 17:14:09 1995.
19000 </para>
19001 </listitem></varlistentry>
19002 <varlistentry>
19003 <term><varname>$tod_epoch</varname></term>
19004 <listitem>
19005 <para>
19006 <indexterm role="variable">
19007 <primary><varname>$tod_epoch</varname></primary>
19008 </indexterm>
19009 The time and date as a number of seconds since the start of the Unix epoch.
19010 </para>
19011 </listitem></varlistentry>
19012 <varlistentry>
19013 <term><varname>$tod_epoch_l</varname></term>
19014 <listitem>
19015 <para>
19016 <indexterm role="variable">
19017 <primary><varname>$tod_epoch_l</varname></primary>
19018 </indexterm>
19019 The time and date as a number of microseconds since the start of the Unix epoch.
19020 </para>
19021 </listitem></varlistentry>
19022 <varlistentry>
19023 <term><varname>$tod_full</varname></term>
19024 <listitem>
19025 <para>
19026 <indexterm role="variable">
19027 <primary><varname>$tod_full</varname></primary>
19028 </indexterm>
19029 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
19030 +0100. The timezone is always given as a numerical offset from UTC, with
19031 positive values used for timezones that are ahead (east) of UTC, and negative
19032 values for those that are behind (west).
19033 </para>
19034 </listitem></varlistentry>
19035 <varlistentry>
19036 <term><varname>$tod_log</varname></term>
19037 <listitem>
19038 <para>
19039 <indexterm role="variable">
19040 <primary><varname>$tod_log</varname></primary>
19041 </indexterm>
19042 The time and date in the format used for writing Exim&#x2019;s log files, for example:
19043 1995-10-12 15:32:29, but without a timezone.
19044 </para>
19045 </listitem></varlistentry>
19046 <varlistentry>
19047 <term><varname>$tod_logfile</varname></term>
19048 <listitem>
19049 <para>
19050 <indexterm role="variable">
19051 <primary><varname>$tod_logfile</varname></primary>
19052 </indexterm>
19053 This variable contains the date in the format yyyymmdd. This is the format that
19054 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
19055 flag.
19056 </para>
19057 </listitem></varlistentry>
19058 <varlistentry>
19059 <term><varname>$tod_zone</varname></term>
19060 <listitem>
19061 <para>
19062 <indexterm role="variable">
19063 <primary><varname>$tod_zone</varname></primary>
19064 </indexterm>
19065 This variable contains the numerical value of the local timezone, for example:
19066 -0500.
19067 </para>
19068 </listitem></varlistentry>
19069 <varlistentry>
19070 <term><varname>$tod_zulu</varname></term>
19071 <listitem>
19072 <para>
19073 <indexterm role="variable">
19074 <primary><varname>$tod_zulu</varname></primary>
19075 </indexterm>
19076 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
19077 by ISO 8601, for example: 20030221154023Z.
19078 </para>
19079 </listitem></varlistentry>
19080 <varlistentry revisionflag="changed">
19081 <term><varname>$transport_name</varname></term>
19082 <listitem>
19083 <para revisionflag="changed">
19084 <indexterm role="concept">
19085 <primary>transport</primary>
19086 <secondary>name</secondary>
19087 </indexterm>
19088 <indexterm role="concept">
19089 <primary>name</primary>
19090 <secondary>of transport</secondary>
19091 </indexterm>
19092 <indexterm role="variable">
19093 <primary><varname>$transport_name</varname></primary>
19094 </indexterm>
19095 During the running of a transport, this variable contains its name.
19096 </para>
19097 </listitem></varlistentry>
19098 <varlistentry>
19099 <term><varname>$value</varname></term>
19100 <listitem>
19101 <para>
19102 <indexterm role="variable">
19103 <primary><varname>$value</varname></primary>
19104 </indexterm>
19105 This variable contains the result of an expansion lookup, extraction operation,
19106 or external command, as described above. It is also used during a
19107 <emphasis role="bold">reduce</emphasis> expansion.
19108 </para>
19109 </listitem></varlistentry>
19110 <varlistentry>
19111 <term><varname>$version_number</varname></term>
19112 <listitem>
19113 <para>
19114 <indexterm role="variable">
19115 <primary><varname>$version_number</varname></primary>
19116 </indexterm>
19117 The version number of Exim.
19118 </para>
19119 </listitem></varlistentry>
19120 <varlistentry>
19121 <term><varname>$warn_message_delay</varname></term>
19122 <listitem>
19123 <para>
19124 <indexterm role="variable">
19125 <primary><varname>$warn_message_delay</varname></primary>
19126 </indexterm>
19127 This variable is set only during the creation of a message warning about a
19128 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19129 </para>
19130 </listitem></varlistentry>
19131 <varlistentry>
19132 <term><varname>$warn_message_recipients</varname></term>
19133 <listitem>
19134 <para>
19135 <indexterm role="variable">
19136 <primary><varname>$warn_message_recipients</varname></primary>
19137 </indexterm>
19138 This variable is set only during the creation of a message warning about a
19139 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
19140 </para>
19141 </listitem></varlistentry>
19142 </variablelist>
19143 <para>
19144 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
19145 </para>
19146 </section>
19147 </chapter>
19148
19149 <chapter id="CHAPperl">
19150 <title>Embedded Perl</title>
19151 <para>
19152 <indexterm role="concept" id="IIDperl" class="startofrange">
19153 <primary>Perl</primary>
19154 <secondary>calling from Exim</secondary>
19155 </indexterm>
19156 Exim can be built to include an embedded Perl interpreter. When this is done,
19157 Perl subroutines can be called as part of the string expansion process. To make
19158 use of the Perl support, you need version 5.004 or later of Perl installed on
19159 your system. To include the embedded interpreter in the Exim binary, include
19160 the line
19161 </para>
19162 <literallayout class="monospaced">
19163 EXIM_PERL = perl.o
19164 </literallayout>
19165 <para>
19166 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
19167 </para>
19168 <section id="SECID85">
19169 <title>Setting up so Perl can be used</title>
19170 <para>
19171 <indexterm role="option">
19172 <primary><option>perl_startup</option></primary>
19173 </indexterm>
19174 Access to Perl subroutines is via a global configuration option called
19175 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
19176 no <option>perl_startup</option> option in the Exim configuration file then no Perl
19177 interpreter is started and there is almost no overhead for Exim (since none of
19178 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
19179 option then the associated value is taken to be Perl code which is executed in
19180 a newly created Perl interpreter.
19181 </para>
19182 <para>
19183 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
19184 need backslashes before any characters to escape special meanings. The option
19185 should usually be something like
19186 </para>
19187 <literallayout class="monospaced">
19188 perl_startup = do '/etc/exim.pl'
19189 </literallayout>
19190 <para>
19191 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
19192 use from Exim. Exim can be configured either to start up a Perl interpreter as
19193 soon as it is entered, or to wait until the first time it is needed. Starting
19194 the interpreter at the beginning ensures that it is done while Exim still has
19195 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
19196 fact used in a particular run. Also, note that this does not mean that Exim is
19197 necessarily running as root when Perl is called at a later time. By default,
19198 the interpreter is started only when it is needed, but this can be changed in
19199 two ways:
19200 </para>
19201 <itemizedlist>
19202 <listitem>
19203 <para>
19204 <indexterm role="option">
19205 <primary><option>perl_at_start</option></primary>
19206 </indexterm>
19207 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
19208 a startup when Exim is entered.
19209 </para>
19210 </listitem>
19211 <listitem>
19212 <para>
19213 The command line option <option>-ps</option> also requests a startup when Exim is entered,
19214 overriding the setting of <option>perl_at_start</option>.
19215 </para>
19216 </listitem>
19217 </itemizedlist>
19218 <para>
19219 There is also a command line option <option>-pd</option> (for delay) which suppresses the
19220 initial startup, even if <option>perl_at_start</option> is set.
19221 </para>
19222 </section>
19223 <section id="SECID86">
19224 <title>Calling Perl subroutines</title>
19225 <para>
19226 When the configuration file includes a <option>perl_startup</option> option you can make use
19227 of the string expansion item to call the Perl subroutines that are defined
19228 by the <option>perl_startup</option> code. The operator is used in any of the following
19229 forms:
19230 </para>
19231 <literallayout class="monospaced">
19232 ${perl{foo}}
19233 ${perl{foo}{argument}}
19234 ${perl{foo}{argument1}{argument2} ... }
19235 </literallayout>
19236 <para>
19237 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
19238 arguments may be passed. Passing more than this results in an expansion failure
19239 with an error message of the form
19240 </para>
19241 <literallayout class="monospaced">
19242 Too many arguments passed to Perl subroutine "foo" (max is 8)
19243 </literallayout>
19244 <para>
19245 The return value of the Perl subroutine is evaluated in a scalar context before
19246 it is passed back to Exim to be inserted into the expanded string. If the
19247 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
19248 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
19249 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
19250 that was passed to <option>die</option>.
19251 </para>
19252 </section>
19253 <section id="SECID87">
19254 <title>Calling Exim functions from Perl</title>
19255 <para>
19256 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
19257 is available to call back into Exim&#x2019;s string expansion function. For example,
19258 the Perl code
19259 </para>
19260 <literallayout class="monospaced">
19261 my $lp = Exim::expand_string('$local_part');
19262 </literallayout>
19263 <para>
19264 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
19265 Note those are single quotes and not double quotes to protect against
19266 <varname>$local_part</varname> being interpolated as a Perl variable.
19267 </para>
19268 <para>
19269 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
19270 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
19271 expansion string, the Perl call from the original expansion string fails with
19272 an appropriate error message, in the same way as if <option>die</option> were used.
19273 </para>
19274 <para>
19275 <indexterm role="concept">
19276 <primary>debugging</primary>
19277 <secondary>from embedded Perl</secondary>
19278 </indexterm>
19279 <indexterm role="concept">
19280 <primary>log</primary>
19281 <secondary>writing from embedded Perl</secondary>
19282 </indexterm>
19283 Two other Exim functions are available for use from within Perl code.
19284 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
19285 debugging is enabled. If you want a newline at the end, you must supply it.
19286 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
19287 timestamp. In this case, you should not supply a terminating newline.
19288 </para>
19289 </section>
19290 <section id="SECID88">
19291 <title>Use of standard output and error by Perl</title>
19292 <para>
19293 <indexterm role="concept">
19294 <primary>Perl</primary>
19295 <secondary>standard output and error</secondary>
19296 </indexterm>
19297 You should not write to the standard error or output streams from within your
19298 Perl code, as it is not defined how these are set up. In versions of Exim
19299 before 4.50, it is possible for the standard output or error to refer to the
19300 SMTP connection during message reception via the daemon. Writing to this stream
19301 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
19302 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
19303 avoided, but the output is lost.
19304 </para>
19305 <para>
19306 <indexterm role="concept">
19307 <primary>Perl</primary>
19308 <secondary>use of <option>warn</option></secondary>
19309 </indexterm>
19310 The Perl <option>warn</option> statement writes to the standard error stream by default.
19311 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
19312 you have no control. When Exim starts up the Perl interpreter, it arranges for
19313 output from the <option>warn</option> statement to be written to the Exim main log. You can
19314 change this by including appropriate Perl magic somewhere in your Perl code.
19315 For example, to discard <option>warn</option> output completely, you need this:
19316 </para>
19317 <literallayout class="monospaced">
19318 $SIG{__WARN__} = sub { };
19319 </literallayout>
19320 <para>
19321 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
19322 example, the code for the subroutine is empty, so it does nothing, but you can
19323 include any Perl code that you like. The text of the <option>warn</option> message is passed
19324 as the first subroutine argument.
19325 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
19326 </para>
19327 </section>
19328 </chapter>
19329
19330 <chapter id="CHAPinterfaces">
19331 <title>Starting the daemon and the use of network interfaces</title>
19332 <titleabbrev>Starting the daemon</titleabbrev>
19333 <para>
19334 <indexterm role="concept">
19335 <primary>daemon</primary>
19336 <secondary>starting</secondary>
19337 </indexterm>
19338 <indexterm role="concept">
19339 <primary>interface</primary>
19340 <secondary>listening</secondary>
19341 </indexterm>
19342 <indexterm role="concept">
19343 <primary>network interface</primary>
19344 </indexterm>
19345 <indexterm role="concept">
19346 <primary>interface</primary>
19347 <secondary>network</secondary>
19348 </indexterm>
19349 <indexterm role="concept">
19350 <primary>IP address</primary>
19351 <secondary>for listening</secondary>
19352 </indexterm>
19353 <indexterm role="concept">
19354 <primary>daemon</primary>
19355 <secondary>listening IP addresses</secondary>
19356 </indexterm>
19357 <indexterm role="concept">
19358 <primary>TCP/IP</primary>
19359 <secondary>setting listening interfaces</secondary>
19360 </indexterm>
19361 <indexterm role="concept">
19362 <primary>TCP/IP</primary>
19363 <secondary>setting listening ports</secondary>
19364 </indexterm>
19365 A host that is connected to a TCP/IP network may have one or more physical
19366 hardware network interfaces. Each of these interfaces may be configured as one
19367 or more <quote>logical</quote> interfaces, which are the entities that a program actually
19368 works with. Each of these logical interfaces is associated with an IP address.
19369 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
19370 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
19371 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
19372 </para>
19373 <orderedlist numeration="arabic">
19374 <listitem>
19375 <para>
19376 When a listening daemon is started, Exim needs to know which interfaces
19377 and ports to listen on.
19378 </para>
19379 </listitem>
19380 <listitem>
19381 <para>
19382 When Exim is routing an address, it needs to know which IP addresses
19383 are associated with local interfaces. This is required for the correct
19384 processing of MX lists by removing the local host and others with the
19385 same or higher priority values. Also, Exim needs to detect cases
19386 when an address is routed to an IP address that in fact belongs to the
19387 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
19388 option of the smtp transport is set (as appropriate), this is treated
19389 as an error situation.
19390 </para>
19391 </listitem>
19392 <listitem>
19393 <para>
19394 When Exim connects to a remote host, it may need to know which interface to use
19395 for the outgoing connection.
19396 </para>
19397 </listitem>
19398 </orderedlist>
19399 <para>
19400 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
19401 of cases. If your host has only one interface, and you want all its IP
19402 addresses to be treated in the same way, and you are using only the
19403 standard SMTP port, you should not need to take any special action. The
19404 rest of this chapter does not apply to you.
19405 </para>
19406 <para>
19407 In a more complicated situation you may want to listen only on certain
19408 interfaces, or on different ports, and for this reason there are a number of
19409 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
19410 chapter describes how they operate.
19411 </para>
19412 <para>
19413 When a message is received over TCP/IP, the interface and port that were
19414 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19415 </para>
19416 <section id="SECID89">
19417 <title>Starting a listening daemon</title>
19418 <para>
19419 When a listening daemon is started (by means of the <option>-bd</option> command line
19420 option), the interfaces and ports on which it listens are controlled by the
19421 following options:
19422 </para>
19423 <itemizedlist>
19424 <listitem>
19425 <para>
19426 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
19427 compatibility, this option can also be specified in the singular.)
19428 </para>
19429 </listitem>
19430 <listitem>
19431 <para>
19432 <option>local_interfaces</option> contains list of interface IP addresses on which to
19433 listen. Each item may optionally also specify a port.
19434 </para>
19435 </listitem>
19436 </itemizedlist>
19437 <para>
19438 The default list separator in both cases is a colon, but this can be changed as
19439 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
19440 it is usually best to change the separator to avoid having to double all the
19441 colons. For example:
19442 </para>
19443 <literallayout class="monospaced">
19444 local_interfaces = &lt;; 127.0.0.1 ; \
19445                       192.168.23.65 ; \
19446                       ::1 ; \
19447                       3ffe:ffff:836f::fe86:a061
19448 </literallayout>
19449 <para>
19450 There are two different formats for specifying a port along with an IP address
19451 in <option>local_interfaces</option>:
19452 </para>
19453 <orderedlist numeration="arabic">
19454 <listitem>
19455 <para>
19456 The port is added onto the address with a dot separator. For example, to listen
19457 on port 1234 on two different IP addresses:
19458 </para>
19459 <literallayout class="monospaced">
19460 local_interfaces = &lt;; 192.168.23.65.1234 ; \
19461                       3ffe:ffff:836f::fe86:a061.1234
19462 </literallayout>
19463 </listitem>
19464 <listitem>
19465 <para>
19466 The IP address is enclosed in square brackets, and the port is added
19467 with a colon separator, for example:
19468 </para>
19469 <literallayout class="monospaced">
19470 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
19471                       [3ffe:ffff:836f::fe86:a061]:1234
19472 </literallayout>
19473 </listitem>
19474 </orderedlist>
19475 <para>
19476 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
19477 default setting contains just one port:
19478 </para>
19479 <literallayout class="monospaced">
19480 daemon_smtp_ports = smtp
19481 </literallayout>
19482 <para>
19483 If more than one port is listed, each interface that does not have its own port
19484 specified listens on all of them. Ports that are listed in
19485 <option>daemon_smtp_ports</option> can be identified either by name (defined in
19486 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
19487 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
19488 </para>
19489 </section>
19490 <section id="SECID90">
19491 <title>Special IP listening addresses</title>
19492 <para>
19493 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
19494 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
19495 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
19496 instead of setting up separate listening sockets for each interface. The
19497 default value of <option>local_interfaces</option> is
19498 </para>
19499 <literallayout class="monospaced">
19500 local_interfaces = 0.0.0.0
19501 </literallayout>
19502 <para>
19503 when Exim is built without IPv6 support; otherwise it is:
19504 </para>
19505 <literallayout class="monospaced">
19506 local_interfaces = &lt;; ::0 ; 0.0.0.0
19507 </literallayout>
19508 <para>
19509 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
19510 </para>
19511 </section>
19512 <section id="SECID91">
19513 <title>Overriding local_interfaces and daemon_smtp_ports</title>
19514 <para>
19515 The <option>-oX</option> command line option can be used to override the values of
19516 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
19517 instance. Another way of doing this would be to use macros and the <option>-D</option>
19518 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
19519 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
19520 exim.
19521 </para>
19522 <para>
19523 The value of <option>-oX</option> is a list of items. The default colon separator can be
19524 changed in the usual way if required. If there are any items that do not
19525 contain dots or colons (that is, are not IP addresses), the value of
19526 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
19527 items that do contain dots or colons, the value of <option>local_interfaces</option> is
19528 replaced by those items. Thus, for example,
19529 </para>
19530 <literallayout class="monospaced">
19531 -oX 1225
19532 </literallayout>
19533 <para>
19534 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
19535 whereas
19536 </para>
19537 <literallayout class="monospaced">
19538 -oX 192.168.34.5.1125
19539 </literallayout>
19540 <para>
19541 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
19542 (However, since <option>local_interfaces</option> now contains no items without ports, the
19543 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
19544 </para>
19545 </section>
19546 <section id="SECTsupobssmt">
19547 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
19548 <para>
19549 <indexterm role="concept">
19550 <primary>ssmtp protocol</primary>
19551 </indexterm>
19552 <indexterm role="concept">
19553 <primary>smtps protocol</primary>
19554 </indexterm>
19555 <indexterm role="concept">
19556 <primary>SMTP</primary>
19557 <secondary>ssmtp protocol</secondary>
19558 </indexterm>
19559 <indexterm role="concept">
19560 <primary>SMTP</primary>
19561 <secondary>smtps protocol</secondary>
19562 </indexterm>
19563 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
19564 before the STARTTLS command was standardized for SMTP. Some legacy clients
19565 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
19566 list of port numbers, connections to those ports must use SSMTP. The most
19567 common use of this option is expected to be
19568 </para>
19569 <literallayout class="monospaced">
19570 tls_on_connect_ports = 465
19571 </literallayout>
19572 <para>
19573 because 465 is the usual port number used by the legacy clients. There is also
19574 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
19575 this way when a daemon is started.
19576 </para>
19577 <para>
19578 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
19579 daemon to listen on those ports. You must still specify them in
19580 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
19581 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
19582 connections via the daemon.)
19583 </para>
19584 </section>
19585 <section id="SECID92">
19586 <title>IPv6 address scopes</title>
19587 <para>
19588 <indexterm role="concept">
19589 <primary>IPv6</primary>
19590 <secondary>address scopes</secondary>
19591 </indexterm>
19592 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
19593 can, in principle, have the same link-local IPv6 address on different
19594 interfaces. Thus, additional information is needed, over and above the IP
19595 address, to distinguish individual interfaces. A convention of using a
19596 percent sign followed by something (often the interface name) has been
19597 adopted in some cases, leading to addresses like this:
19598 </para>
19599 <literallayout class="monospaced">
19600 fe80::202:b3ff:fe03:45c1%eth0
19601 </literallayout>
19602 <para>
19603 To accommodate this usage, a percent sign followed by an arbitrary string is
19604 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
19605 to convert a textual IPv6 address for actual use. This function recognizes the
19606 percent convention in operating systems that support it, and it processes the
19607 address appropriately. Unfortunately, some older libraries have problems with
19608 <function>getaddrinfo()</function>. If
19609 </para>
19610 <literallayout class="monospaced">
19611 IPV6_USE_INET_PTON=yes
19612 </literallayout>
19613 <para>
19614 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
19615 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
19616 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
19617 function.) Of course, this means that the additional functionality of
19618 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
19619 </para>
19620 </section>
19621 <section id="SECID93">
19622 <title>Disabling IPv6</title>
19623 <para>
19624 <indexterm role="concept">
19625 <primary>IPv6</primary>
19626 <secondary>disabling</secondary>
19627 </indexterm>
19628 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
19629 run on a host whose kernel does not support IPv6. The binary will fall back to
19630 using IPv4, but it may waste resources looking up AAAA records, and trying to
19631 connect to IPv6 addresses, causing delays to mail delivery. If you set the
19632 <indexterm role="option">
19633 <primary><option>disable_ipv6</option></primary>
19634 </indexterm>
19635 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
19636 activities take place. AAAA records are never looked up, and any IPv6 addresses
19637 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
19638 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
19639 to handle IPv6 literal addresses.
19640 </para>
19641 <para>
19642 On the other hand, when IPv6 is in use, there may be times when you want to
19643 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
19644 option to globally suppress the lookup of AAAA records for specified domains,
19645 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
19646 IPv6 addresses in an individual router.
19647 </para>
19648 </section>
19649 <section id="SECID94">
19650 <title>Examples of starting a listening daemon</title>
19651 <para>
19652 The default case in an IPv6 environment is
19653 </para>
19654 <literallayout class="monospaced">
19655 daemon_smtp_ports = smtp
19656 local_interfaces = &lt;; ::0 ; 0.0.0.0
19657 </literallayout>
19658 <para>
19659 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
19660 Either one or two sockets may be used, depending on the characteristics of
19661 the TCP/IP stack. (This is complicated and messy; for more information,
19662 read the comments in the <filename>daemon.c</filename> source file.)
19663 </para>
19664 <para>
19665 To specify listening on ports 25 and 26 on all interfaces:
19666 </para>
19667 <literallayout class="monospaced">
19668 daemon_smtp_ports = 25 : 26
19669 </literallayout>
19670 <para>
19671 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
19672 </para>
19673 <literallayout class="monospaced">
19674 local_interfaces = &lt;; ::0.25     ; ::0.26 \
19675                       0.0.0.0.25 ; 0.0.0.0.26
19676 </literallayout>
19677 <para>
19678 To listen on the default port on all IPv4 interfaces, and on port 26 on the
19679 IPv4 loopback address only:
19680 </para>
19681 <literallayout class="monospaced">
19682 local_interfaces = 0.0.0.0 : 127.0.0.1.26
19683 </literallayout>
19684 <para>
19685 To specify listening on the default port on specific interfaces only:
19686 </para>
19687 <literallayout class="monospaced">
19688 local_interfaces = 10.0.0.67 : 192.168.34.67
19689 </literallayout>
19690 <para>
19691 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
19692 </para>
19693 </section>
19694 <section id="SECTreclocipadd">
19695 <title>Recognizing the local host</title>
19696 <para>
19697 The <option>local_interfaces</option> option is also used when Exim needs to determine
19698 whether or not an IP address refers to the local host. That is, the IP
19699 addresses of all the interfaces on which a daemon is listening are always
19700 treated as local.
19701 </para>
19702 <para>
19703 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
19704 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
19705 available interfaces from the operating system, and extracts the relevant
19706 (that is, IPv4 or IPv6) addresses to use for checking.
19707 </para>
19708 <para>
19709 Some systems set up large numbers of virtual interfaces in order to provide
19710 many virtual web servers. In this situation, you may want to listen for
19711 email on only a few of the available interfaces, but nevertheless treat all
19712 interfaces as local when routing. You can do this by setting
19713 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
19714 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
19715 used for listening. Consider this example:
19716 </para>
19717 <literallayout class="monospaced">
19718 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
19719                       192.168.53.235 ; \
19720                       3ffe:2101:12:1:a00:20ff:fe86:a061
19721
19722 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
19723 </literallayout>
19724 <para>
19725 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
19726 address, but all available interface addresses are treated as local when
19727 Exim is routing.
19728 </para>
19729 <para>
19730 In some environments the local host name may be in an MX list, but with an IP
19731 address that is not assigned to any local interface. In other cases it may be
19732 desirable to treat other host names as if they referred to the local host. Both
19733 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
19734 This contains host names rather than IP addresses. When a host is referenced
19735 during routing, either via an MX record or directly, it is treated as the local
19736 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
19737 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
19738 </para>
19739 </section>
19740 <section id="SECID95">
19741 <title>Delivering to a remote host</title>
19742 <para>
19743 Delivery to a remote host is handled by the smtp transport. By default, it
19744 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
19745 there is more than one) when connecting to a remote host. However, the
19746 <option>interface</option> option can be set to specify which interface is used. See the
19747 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
19748 details.
19749 </para>
19750 </section>
19751 </chapter>
19752
19753 <chapter id="CHAPmainconfig">
19754 <title>Main configuration</title>
19755 <para>
19756 <indexterm role="concept" id="IIDconfima" class="startofrange">
19757 <primary>configuration file</primary>
19758 <secondary>main section</secondary>
19759 </indexterm>
19760 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
19761 <primary>main configuration</primary>
19762 </indexterm>
19763 The first part of the run time configuration file contains three types of item:
19764 </para>
19765 <itemizedlist>
19766 <listitem>
19767 <para>
19768 Macro definitions: These lines start with an upper case letter. See section
19769 <xref linkend="SECTmacrodefs"/> for details of macro processing.
19770 </para>
19771 </listitem>
19772 <listitem>
19773 <para>
19774 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
19775 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
19776 section <xref linkend="SECTnamedlists"/>.
19777 </para>
19778 </listitem>
19779 <listitem>
19780 <para>
19781 Main configuration settings: Each setting occupies one line of the file
19782 (with possible continuations). If any setting is preceded by the word
19783 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
19784 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
19785 settings.
19786 </para>
19787 </listitem>
19788 </itemizedlist>
19789 <para>
19790 This chapter specifies all the main configuration options, along with their
19791 types and default values. For ease of finding a particular option, they appear
19792 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
19793 are now so many options, they are first listed briefly in functional groups, as
19794 an aid to finding the name of the option you are looking for. Some options are
19795 listed in more than one group.
19796 </para>
19797 <section id="SECID96">
19798 <title>Miscellaneous</title>
19799 <informaltable frame="none">
19800 <tgroup cols="2" colsep="0" rowsep="0">
19801 <colspec colwidth="196pt" align="left"/>
19802 <colspec colwidth="254pt" align="left"/>
19803 <tbody>
19804 <row>
19805 <entry><option>bi_command</option></entry>
19806 <entry>to run for <option>-bi</option> command line option</entry>
19807 </row>
19808 <row>
19809 <entry><option>disable_ipv6</option></entry>
19810 <entry>do no IPv6 processing</entry>
19811 </row>
19812 <row>
19813 <entry><option>keep_malformed</option></entry>
19814 <entry>for broken files &ndash; should not happen</entry>
19815 </row>
19816 <row>
19817 <entry><option>localhost_number</option></entry>
19818 <entry>for unique message ids in clusters</entry>
19819 </row>
19820 <row>
19821 <entry><option>message_body_newlines</option></entry>
19822 <entry>retain newlines in <varname>$message_body</varname></entry>
19823 </row>
19824 <row>
19825 <entry><option>message_body_visible</option></entry>
19826 <entry>how much to show in <varname>$message_body</varname></entry>
19827 </row>
19828 <row>
19829 <entry><option>mua_wrapper</option></entry>
19830 <entry>run in <quote>MUA wrapper</quote> mode</entry>
19831 </row>
19832 <row>
19833 <entry><option>print_topbitchars</option></entry>
19834 <entry>top-bit characters are printing</entry>
19835 </row>
19836 <row>
19837 <entry><option>timezone</option></entry>
19838 <entry>force time zone</entry>
19839 </row>
19840 </tbody>
19841 </tgroup>
19842 </informaltable>
19843 </section>
19844 <section id="SECID97">
19845 <title>Exim parameters</title>
19846 <informaltable frame="none">
19847 <tgroup cols="2" colsep="0" rowsep="0">
19848 <colspec colwidth="196pt" align="left"/>
19849 <colspec colwidth="254pt" align="left"/>
19850 <tbody>
19851 <row>
19852 <entry><option>exim_group</option></entry>
19853 <entry>override compiled-in value</entry>
19854 </row>
19855 <row>
19856 <entry><option>exim_path</option></entry>
19857 <entry>override compiled-in value</entry>
19858 </row>
19859 <row>
19860 <entry><option>exim_user</option></entry>
19861 <entry>override compiled-in value</entry>
19862 </row>
19863 <row>
19864 <entry><option>primary_hostname</option></entry>
19865 <entry>default from <function>uname()</function></entry>
19866 </row>
19867 <row>
19868 <entry><option>split_spool_directory</option></entry>
19869 <entry>use multiple directories</entry>
19870 </row>
19871 <row>
19872 <entry><option>spool_directory</option></entry>
19873 <entry>override compiled-in value</entry>
19874 </row>
19875 </tbody>
19876 </tgroup>
19877 </informaltable>
19878 </section>
19879 <section id="SECID98">
19880 <title>Privilege controls</title>
19881 <informaltable frame="none">
19882 <tgroup cols="2" colsep="0" rowsep="0">
19883 <colspec colwidth="196pt" align="left"/>
19884 <colspec colwidth="254pt" align="left"/>
19885 <tbody>
19886 <row>
19887 <entry><option>admin_groups</option></entry>
19888 <entry>groups that are Exim admin users</entry>
19889 </row>
19890 <row>
19891 <entry><option>deliver_drop_privilege</option></entry>
19892 <entry>drop root for delivery processes</entry>
19893 </row>
19894 <row>
19895 <entry><option>local_from_check</option></entry>
19896 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19897 </row>
19898 <row>
19899 <entry><option>local_from_prefix</option></entry>
19900 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19901 </row>
19902 <row>
19903 <entry><option>local_from_suffix</option></entry>
19904 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19905 </row>
19906 <row>
19907 <entry><option>local_sender_retain</option></entry>
19908 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19909 </row>
19910 <row>
19911 <entry><option>never_users</option></entry>
19912 <entry>do not run deliveries as these</entry>
19913 </row>
19914 <row>
19915 <entry><option>prod_requires_admin</option></entry>
19916 <entry>forced delivery requires admin user</entry>
19917 </row>
19918 <row>
19919 <entry><option>queue_list_requires_admin</option></entry>
19920 <entry>queue listing requires admin user</entry>
19921 </row>
19922 <row>
19923 <entry><option>trusted_groups</option></entry>
19924 <entry>groups that are trusted</entry>
19925 </row>
19926 <row>
19927 <entry><option>trusted_users</option></entry>
19928 <entry>users that are trusted</entry>
19929 </row>
19930 </tbody>
19931 </tgroup>
19932 </informaltable>
19933 </section>
19934 <section id="SECID99">
19935 <title>Logging</title>
19936 <informaltable frame="none">
19937 <tgroup cols="2" colsep="0" rowsep="0">
19938 <colspec colwidth="196pt" align="left"/>
19939 <colspec colwidth="254pt" align="left"/>
19940 <tbody>
19941 <row>
19942 <entry><option>hosts_connection_nolog</option></entry>
19943 <entry>exemption from connect logging</entry>
19944 </row>
19945 <row>
19946 <entry><option>log_file_path</option></entry>
19947 <entry>override compiled-in value</entry>
19948 </row>
19949 <row>
19950 <entry><option>log_selector</option></entry>
19951 <entry>set/unset optional logging</entry>
19952 </row>
19953 <row>
19954 <entry><option>log_timezone</option></entry>
19955 <entry>add timezone to log lines</entry>
19956 </row>
19957 <row>
19958 <entry><option>message_logs</option></entry>
19959 <entry>create per-message logs</entry>
19960 </row>
19961 <row>
19962 <entry><option>preserve_message_logs</option></entry>
19963 <entry>after message completion</entry>
19964 </row>
19965 <row>
19966 <entry><option>process_log_path</option></entry>
19967 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19968 </row>
19969 <row>
19970 <entry><option>syslog_duplication</option></entry>
19971 <entry>controls duplicate log lines on syslog</entry>
19972 </row>
19973 <row>
19974 <entry><option>syslog_facility</option></entry>
19975 <entry>set syslog <quote>facility</quote> field</entry>
19976 </row>
19977 <row>
19978 <entry><option>syslog_processname</option></entry>
19979 <entry>set syslog <quote>ident</quote> field</entry>
19980 </row>
19981 <row>
19982 <entry><option>syslog_timestamp</option></entry>
19983 <entry>timestamp syslog lines</entry>
19984 </row>
19985 <row>
19986 <entry><option>write_rejectlog</option></entry>
19987 <entry>control use of message log</entry>
19988 </row>
19989 </tbody>
19990 </tgroup>
19991 </informaltable>
19992 </section>
19993 <section id="SECID100">
19994 <title>Frozen messages</title>
19995 <informaltable frame="none">
19996 <tgroup cols="2" colsep="0" rowsep="0">
19997 <colspec colwidth="196pt" align="left"/>
19998 <colspec colwidth="254pt" align="left"/>
19999 <tbody>
20000 <row>
20001 <entry><option>auto_thaw</option></entry>
20002 <entry>sets time for retrying frozen messages</entry>
20003 </row>
20004 <row>
20005 <entry><option>freeze_tell</option></entry>
20006 <entry>send message when freezing</entry>
20007 </row>
20008 <row>
20009 <entry><option>move_frozen_messages</option></entry>
20010 <entry>to another directory</entry>
20011 </row>
20012 <row>
20013 <entry><option>timeout_frozen_after</option></entry>
20014 <entry>keep frozen messages only so long</entry>
20015 </row>
20016 </tbody>
20017 </tgroup>
20018 </informaltable>
20019 </section>
20020 <section id="SECID101">
20021 <title>Data lookups</title>
20022 <informaltable frame="none">
20023 <tgroup cols="2" colsep="0" rowsep="0">
20024 <colspec colwidth="196pt" align="left"/>
20025 <colspec colwidth="254pt" align="left"/>
20026 <tbody>
20027 <row>
20028 <entry><option>ibase_servers</option></entry>
20029 <entry>InterBase servers</entry>
20030 </row>
20031 <row>
20032 <entry><option>ldap_ca_cert_dir</option></entry>
20033 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
20034 </row>
20035 <row>
20036 <entry><option>ldap_ca_cert_file</option></entry>
20037 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
20038 </row>
20039 <row>
20040 <entry><option>ldap_cert_file</option></entry>
20041 <entry>client cert file for LDAP</entry>
20042 </row>
20043 <row>
20044 <entry><option>ldap_cert_key</option></entry>
20045 <entry>client key file for LDAP</entry>
20046 </row>
20047 <row>
20048 <entry><option>ldap_cipher_suite</option></entry>
20049 <entry>TLS negotiation preference control</entry>
20050 </row>
20051 <row>
20052 <entry><option>ldap_default_servers</option></entry>
20053 <entry>used if no server in query</entry>
20054 </row>
20055 <row>
20056 <entry><option>ldap_require_cert</option></entry>
20057 <entry>action to take without LDAP server cert</entry>
20058 </row>
20059 <row>
20060 <entry><option>ldap_start_tls</option></entry>
20061 <entry>require TLS within LDAP</entry>
20062 </row>
20063 <row>
20064 <entry><option>ldap_version</option></entry>
20065 <entry>set protocol version</entry>
20066 </row>
20067 <row>
20068 <entry><option>lookup_open_max</option></entry>
20069 <entry>lookup files held open</entry>
20070 </row>
20071 <row>
20072 <entry><option>mysql_servers</option></entry>
20073 <entry>default MySQL servers</entry>
20074 </row>
20075 <row>
20076 <entry><option>oracle_servers</option></entry>
20077 <entry>Oracle servers</entry>
20078 </row>
20079 <row>
20080 <entry><option>pgsql_servers</option></entry>
20081 <entry>default PostgreSQL servers</entry>
20082 </row>
20083 <row>
20084 <entry><option>sqlite_lock_timeout</option></entry>
20085 <entry>as it says</entry>
20086 </row>
20087 </tbody>
20088 </tgroup>
20089 </informaltable>
20090 </section>
20091 <section id="SECID102">
20092 <title>Message ids</title>
20093 <informaltable frame="none">
20094 <tgroup cols="2" colsep="0" rowsep="0">
20095 <colspec colwidth="196pt" align="left"/>
20096 <colspec colwidth="254pt" align="left"/>
20097 <tbody>
20098 <row>
20099 <entry><option>message_id_header_domain</option></entry>
20100 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
20101 </row>
20102 <row>
20103 <entry><option>message_id_header_text</option></entry>
20104 <entry>ditto</entry>
20105 </row>
20106 </tbody>
20107 </tgroup>
20108 </informaltable>
20109 </section>
20110 <section id="SECID103">
20111 <title>Embedded Perl Startup</title>
20112 <informaltable frame="none">
20113 <tgroup cols="2" colsep="0" rowsep="0">
20114 <colspec colwidth="196pt" align="left"/>
20115 <colspec colwidth="254pt" align="left"/>
20116 <tbody>
20117 <row>
20118 <entry><option>perl_at_start</option></entry>
20119 <entry>always start the interpreter</entry>
20120 </row>
20121 <row>
20122 <entry><option>perl_startup</option></entry>
20123 <entry>code to obey when starting Perl</entry>
20124 </row>
20125 </tbody>
20126 </tgroup>
20127 </informaltable>
20128 </section>
20129 <section id="SECID104">
20130 <title>Daemon</title>
20131 <informaltable frame="none">
20132 <tgroup cols="2" colsep="0" rowsep="0">
20133 <colspec colwidth="196pt" align="left"/>
20134 <colspec colwidth="254pt" align="left"/>
20135 <tbody>
20136 <row>
20137 <entry><option>daemon_smtp_ports</option></entry>
20138 <entry>default ports</entry>
20139 </row>
20140 <row>
20141 <entry><option>daemon_startup_retries</option></entry>
20142 <entry>number of times to retry</entry>
20143 </row>
20144 <row>
20145 <entry><option>daemon_startup_sleep</option></entry>
20146 <entry>time to sleep between tries</entry>
20147 </row>
20148 <row>
20149 <entry><option>extra_local_interfaces</option></entry>
20150 <entry>not necessarily listened on</entry>
20151 </row>
20152 <row>
20153 <entry><option>local_interfaces</option></entry>
20154 <entry>on which to listen, with optional ports</entry>
20155 </row>
20156 <row>
20157 <entry><option>pid_file_path</option></entry>
20158 <entry>override compiled-in value</entry>
20159 </row>
20160 <row>
20161 <entry><option>queue_run_max</option></entry>
20162 <entry>maximum simultaneous queue runners</entry>
20163 </row>
20164 </tbody>
20165 </tgroup>
20166 </informaltable>
20167 </section>
20168 <section id="SECID105">
20169 <title>Resource control</title>
20170 <informaltable frame="none">
20171 <tgroup cols="2" colsep="0" rowsep="0">
20172 <colspec colwidth="196pt" align="left"/>
20173 <colspec colwidth="254pt" align="left"/>
20174 <tbody>
20175 <row>
20176 <entry><option>check_log_inodes</option></entry>
20177 <entry>before accepting a message</entry>
20178 </row>
20179 <row>
20180 <entry><option>check_log_space</option></entry>
20181 <entry>before accepting a message</entry>
20182 </row>
20183 <row>
20184 <entry><option>check_spool_inodes</option></entry>
20185 <entry>before accepting a message</entry>
20186 </row>
20187 <row>
20188 <entry><option>check_spool_space</option></entry>
20189 <entry>before accepting a message</entry>
20190 </row>
20191 <row>
20192 <entry><option>deliver_queue_load_max</option></entry>
20193 <entry>no queue deliveries if load high</entry>
20194 </row>
20195 <row>
20196 <entry><option>queue_only_load</option></entry>
20197 <entry>queue incoming if load high</entry>
20198 </row>
20199 <row>
20200 <entry><option>queue_only_load_latch</option></entry>
20201 <entry>don&#x2019;t re-evaluate load for each message</entry>
20202 </row>
20203 <row>
20204 <entry><option>queue_run_max</option></entry>
20205 <entry>maximum simultaneous queue runners</entry>
20206 </row>
20207 <row>
20208 <entry><option>remote_max_parallel</option></entry>
20209 <entry>parallel SMTP delivery per message</entry>
20210 </row>
20211 <row>
20212 <entry><option>smtp_accept_max</option></entry>
20213 <entry>simultaneous incoming connections</entry>
20214 </row>
20215 <row>
20216 <entry><option>smtp_accept_max_nonmail</option></entry>
20217 <entry>non-mail commands</entry>
20218 </row>
20219 <row>
20220 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20221 <entry>hosts to which the limit applies</entry>
20222 </row>
20223 <row>
20224 <entry><option>smtp_accept_max_per_connection</option></entry>
20225 <entry>messages per connection</entry>
20226 </row>
20227 <row>
20228 <entry><option>smtp_accept_max_per_host</option></entry>
20229 <entry>connections from one host</entry>
20230 </row>
20231 <row>
20232 <entry><option>smtp_accept_queue</option></entry>
20233 <entry>queue mail if more connections</entry>
20234 </row>
20235 <row>
20236 <entry><option>smtp_accept_queue_per_connection</option></entry>
20237 <entry>queue if more messages per connection</entry>
20238 </row>
20239 <row>
20240 <entry><option>smtp_accept_reserve</option></entry>
20241 <entry>only reserve hosts if more connections</entry>
20242 </row>
20243 <row>
20244 <entry><option>smtp_check_spool_space</option></entry>
20245 <entry>from SIZE on MAIL command</entry>
20246 </row>
20247 <row>
20248 <entry><option>smtp_connect_backlog</option></entry>
20249 <entry>passed to TCP/IP stack</entry>
20250 </row>
20251 <row>
20252 <entry><option>smtp_load_reserve</option></entry>
20253 <entry>SMTP from reserved hosts if load high</entry>
20254 </row>
20255 <row>
20256 <entry><option>smtp_reserve_hosts</option></entry>
20257 <entry>these are the reserve hosts</entry>
20258 </row>
20259 </tbody>
20260 </tgroup>
20261 </informaltable>
20262 </section>
20263 <section id="SECID106">
20264 <title>Policy controls</title>
20265 <informaltable frame="none">
20266 <tgroup cols="2" colsep="0" rowsep="0">
20267 <colspec colwidth="196pt" align="left"/>
20268 <colspec colwidth="254pt" align="left"/>
20269 <tbody>
20270 <row>
20271 <entry><option>acl_not_smtp</option></entry>
20272 <entry>ACL for non-SMTP messages</entry>
20273 </row>
20274 <row>
20275 <entry><option>acl_not_smtp_mime</option></entry>
20276 <entry>ACL for non-SMTP MIME parts</entry>
20277 </row>
20278 <row>
20279 <entry><option>acl_not_smtp_start</option></entry>
20280 <entry>ACL for start of non-SMTP message</entry>
20281 </row>
20282 <row>
20283 <entry><option>acl_smtp_auth</option></entry>
20284 <entry>ACL for AUTH</entry>
20285 </row>
20286 <row>
20287 <entry><option>acl_smtp_connect</option></entry>
20288 <entry>ACL for connection</entry>
20289 </row>
20290 <row>
20291 <entry><option>acl_smtp_data</option></entry>
20292 <entry>ACL for DATA</entry>
20293 </row>
20294 <row>
20295 <entry><option>acl_smtp_dkim</option></entry>
20296 <entry>ACL for DKIM verification</entry>
20297 </row>
20298 <row>
20299 <entry><option>acl_smtp_etrn</option></entry>
20300 <entry>ACL for ETRN</entry>
20301 </row>
20302 <row>
20303 <entry><option>acl_smtp_expn</option></entry>
20304 <entry>ACL for EXPN</entry>
20305 </row>
20306 <row>
20307 <entry><option>acl_smtp_helo</option></entry>
20308 <entry>ACL for EHLO or HELO</entry>
20309 </row>
20310 <row>
20311 <entry><option>acl_smtp_mail</option></entry>
20312 <entry>ACL for MAIL</entry>
20313 </row>
20314 <row>
20315 <entry><option>acl_smtp_mailauth</option></entry>
20316 <entry>ACL for AUTH on MAIL command</entry>
20317 </row>
20318 <row>
20319 <entry><option>acl_smtp_mime</option></entry>
20320 <entry>ACL for MIME parts</entry>
20321 </row>
20322 <row>
20323 <entry><option>acl_smtp_predata</option></entry>
20324 <entry>ACL for start of data</entry>
20325 </row>
20326 <row>
20327 <entry><option>acl_smtp_quit</option></entry>
20328 <entry>ACL for QUIT</entry>
20329 </row>
20330 <row>
20331 <entry><option>acl_smtp_rcpt</option></entry>
20332 <entry>ACL for RCPT</entry>
20333 </row>
20334 <row>
20335 <entry><option>acl_smtp_starttls</option></entry>
20336 <entry>ACL for STARTTLS</entry>
20337 </row>
20338 <row>
20339 <entry><option>acl_smtp_vrfy</option></entry>
20340 <entry>ACL for VRFY</entry>
20341 </row>
20342 <row>
20343 <entry><option>av_scanner</option></entry>
20344 <entry>specify virus scanner</entry>
20345 </row>
20346 <row>
20347 <entry><option>check_rfc2047_length</option></entry>
20348 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20349 </row>
20350 <row>
20351 <entry><option>dns_csa_search_limit</option></entry>
20352 <entry>control CSA parent search depth</entry>
20353 </row>
20354 <row>
20355 <entry><option>dns_csa_use_reverse</option></entry>
20356 <entry>en/disable CSA IP reverse search</entry>
20357 </row>
20358 <row>
20359 <entry><option>header_maxsize</option></entry>
20360 <entry>total size of message header</entry>
20361 </row>
20362 <row>
20363 <entry><option>header_line_maxsize</option></entry>
20364 <entry>individual header line limit</entry>
20365 </row>
20366 <row>
20367 <entry><option>helo_accept_junk_hosts</option></entry>
20368 <entry>allow syntactic junk from these hosts</entry>
20369 </row>
20370 <row>
20371 <entry><option>helo_allow_chars</option></entry>
20372 <entry>allow illegal chars in HELO names</entry>
20373 </row>
20374 <row>
20375 <entry><option>helo_lookup_domains</option></entry>
20376 <entry>lookup hostname for these HELO names</entry>
20377 </row>
20378 <row>
20379 <entry><option>helo_try_verify_hosts</option></entry>
20380 <entry>HELO soft-checked for these hosts</entry>
20381 </row>
20382 <row>
20383 <entry><option>helo_verify_hosts</option></entry>
20384 <entry>HELO hard-checked for these hosts</entry>
20385 </row>
20386 <row>
20387 <entry><option>host_lookup</option></entry>
20388 <entry>host name looked up for these hosts</entry>
20389 </row>
20390 <row>
20391 <entry><option>host_lookup_order</option></entry>
20392 <entry>order of DNS and local name lookups</entry>
20393 </row>
20394 <row>
20395 <entry><option>host_reject_connection</option></entry>
20396 <entry>reject connection from these hosts</entry>
20397 </row>
20398 <row>
20399 <entry><option>hosts_treat_as_local</option></entry>
20400 <entry>useful in some cluster configurations</entry>
20401 </row>
20402 <row>
20403 <entry><option>local_scan_timeout</option></entry>
20404 <entry>timeout for <function>local_scan()</function></entry>
20405 </row>
20406 <row>
20407 <entry><option>message_size_limit</option></entry>
20408 <entry>for all messages</entry>
20409 </row>
20410 <row>
20411 <entry><option>percent_hack_domains</option></entry>
20412 <entry>recognize %-hack for these domains</entry>
20413 </row>
20414 <row>
20415 <entry><option>spamd_address</option></entry>
20416 <entry>set interface to SpamAssassin</entry>
20417 </row>
20418 <row>
20419 <entry><option>strict_acl_vars</option></entry>
20420 <entry>object to unset ACL variables</entry>
20421 </row>
20422 </tbody>
20423 </tgroup>
20424 </informaltable>
20425 </section>
20426 <section id="SECID107">
20427 <title>Callout cache</title>
20428 <informaltable frame="none">
20429 <tgroup cols="2" colsep="0" rowsep="0">
20430 <colspec colwidth="196pt" align="left"/>
20431 <colspec colwidth="254pt" align="left"/>
20432 <tbody>
20433 <row>
20434 <entry><option>callout_domain_negative_expire</option></entry>
20435 <entry>timeout for negative domain cache item</entry>
20436 </row>
20437 <row>
20438 <entry><option>callout_domain_positive_expire</option></entry>
20439 <entry>timeout for positive domain cache item</entry>
20440 </row>
20441 <row>
20442 <entry><option>callout_negative_expire</option></entry>
20443 <entry>timeout for negative address cache item</entry>
20444 </row>
20445 <row>
20446 <entry><option>callout_positive_expire</option></entry>
20447 <entry>timeout for positive address cache item</entry>
20448 </row>
20449 <row>
20450 <entry><option>callout_random_local_part</option></entry>
20451 <entry>string to use for <quote>random</quote> testing</entry>
20452 </row>
20453 </tbody>
20454 </tgroup>
20455 </informaltable>
20456 </section>
20457 <section id="SECID108">
20458 <title>TLS</title>
20459 <informaltable frame="none">
20460 <tgroup cols="2" colsep="0" rowsep="0">
20461 <colspec colwidth="196pt" align="left"/>
20462 <colspec colwidth="254pt" align="left"/>
20463 <tbody>
20464 <row>
20465 <entry><option>gnutls_compat_mode</option></entry>
20466 <entry>use GnuTLS compatibility mode</entry>
20467 </row>
20468 <row>
20469 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
20470 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
20471 </row>
20472 <row>
20473 <entry><option>openssl_options</option></entry>
20474 <entry>adjust OpenSSL compatibility options</entry>
20475 </row>
20476 <row>
20477 <entry><option>tls_advertise_hosts</option></entry>
20478 <entry>advertise TLS to these hosts</entry>
20479 </row>
20480 <row>
20481 <entry><option>tls_certificate</option></entry>
20482 <entry>location of server certificate</entry>
20483 </row>
20484 <row>
20485 <entry><option>tls_crl</option></entry>
20486 <entry>certificate revocation list</entry>
20487 </row>
20488 <row>
20489 <entry><option>tls_dh_max_bits</option></entry>
20490 <entry>clamp D-H bit count suggestion</entry>
20491 </row>
20492 <row>
20493 <entry><option>tls_dhparam</option></entry>
20494 <entry>DH parameters for server</entry>
20495 </row>
20496 <row>
20497 <entry><option>tls_on_connect_ports</option></entry>
20498 <entry>specify SSMTP (SMTPS) ports</entry>
20499 </row>
20500 <row>
20501 <entry><option>tls_privatekey</option></entry>
20502 <entry>location of server private key</entry>
20503 </row>
20504 <row>
20505 <entry><option>tls_remember_esmtp</option></entry>
20506 <entry>don&#x2019;t reset after starting TLS</entry>
20507 </row>
20508 <row>
20509 <entry><option>tls_require_ciphers</option></entry>
20510 <entry>specify acceptable ciphers</entry>
20511 </row>
20512 <row>
20513 <entry><option>tls_try_verify_hosts</option></entry>
20514 <entry>try to verify client certificate</entry>
20515 </row>
20516 <row>
20517 <entry><option>tls_verify_certificates</option></entry>
20518 <entry>expected client certificates</entry>
20519 </row>
20520 <row>
20521 <entry><option>tls_verify_hosts</option></entry>
20522 <entry>insist on client certificate verify</entry>
20523 </row>
20524 </tbody>
20525 </tgroup>
20526 </informaltable>
20527 </section>
20528 <section id="SECID109">
20529 <title>Local user handling</title>
20530 <informaltable frame="none">
20531 <tgroup cols="2" colsep="0" rowsep="0">
20532 <colspec colwidth="196pt" align="left"/>
20533 <colspec colwidth="254pt" align="left"/>
20534 <tbody>
20535 <row>
20536 <entry><option>finduser_retries</option></entry>
20537 <entry>useful in NIS environments</entry>
20538 </row>
20539 <row>
20540 <entry><option>gecos_name</option></entry>
20541 <entry>used when creating <emphasis>Sender:</emphasis></entry>
20542 </row>
20543 <row>
20544 <entry><option>gecos_pattern</option></entry>
20545 <entry>ditto</entry>
20546 </row>
20547 <row>
20548 <entry><option>max_username_length</option></entry>
20549 <entry>for systems that truncate</entry>
20550 </row>
20551 <row>
20552 <entry><option>unknown_login</option></entry>
20553 <entry>used when no login name found</entry>
20554 </row>
20555 <row>
20556 <entry><option>unknown_username</option></entry>
20557 <entry>ditto</entry>
20558 </row>
20559 <row>
20560 <entry><option>uucp_from_pattern</option></entry>
20561 <entry>for recognizing <quote>From </quote> lines</entry>
20562 </row>
20563 <row>
20564 <entry><option>uucp_from_sender</option></entry>
20565 <entry>ditto</entry>
20566 </row>
20567 </tbody>
20568 </tgroup>
20569 </informaltable>
20570 </section>
20571 <section id="SECID110">
20572 <title>All incoming messages (SMTP and non-SMTP)</title>
20573 <informaltable frame="none">
20574 <tgroup cols="2" colsep="0" rowsep="0">
20575 <colspec colwidth="196pt" align="left"/>
20576 <colspec colwidth="254pt" align="left"/>
20577 <tbody>
20578 <row>
20579 <entry><option>header_maxsize</option></entry>
20580 <entry>total size of message header</entry>
20581 </row>
20582 <row>
20583 <entry><option>header_line_maxsize</option></entry>
20584 <entry>individual header line limit</entry>
20585 </row>
20586 <row>
20587 <entry><option>message_size_limit</option></entry>
20588 <entry>applies to all messages</entry>
20589 </row>
20590 <row>
20591 <entry><option>percent_hack_domains</option></entry>
20592 <entry>recognize %-hack for these domains</entry>
20593 </row>
20594 <row>
20595 <entry><option>received_header_text</option></entry>
20596 <entry>expanded to make <emphasis>Received:</emphasis></entry>
20597 </row>
20598 <row>
20599 <entry><option>received_headers_max</option></entry>
20600 <entry>for mail loop detection</entry>
20601 </row>
20602 <row>
20603 <entry><option>recipients_max</option></entry>
20604 <entry>limit per message</entry>
20605 </row>
20606 <row>
20607 <entry><option>recipients_max_reject</option></entry>
20608 <entry>permanently reject excess recipients</entry>
20609 </row>
20610 </tbody>
20611 </tgroup>
20612 </informaltable>
20613 </section>
20614 <section id="SECID111">
20615 <title>Non-SMTP incoming messages</title>
20616 <informaltable frame="none">
20617 <tgroup cols="2" colsep="0" rowsep="0">
20618 <colspec colwidth="196pt" align="left"/>
20619 <colspec colwidth="254pt" align="left"/>
20620 <tbody>
20621 <row>
20622 <entry><option>receive_timeout</option></entry>
20623 <entry>for non-SMTP messages</entry>
20624 </row>
20625 </tbody>
20626 </tgroup>
20627 </informaltable>
20628 </section>
20629 <section id="SECID112">
20630 <title>Incoming SMTP messages</title>
20631 <para>
20632 See also the <emphasis>Policy controls</emphasis> section above.
20633 </para>
20634 <informaltable frame="none">
20635 <tgroup cols="2" colsep="0" rowsep="0">
20636 <colspec colwidth="196pt" align="left"/>
20637 <colspec colwidth="254pt" align="left"/>
20638 <tbody>
20639 <row>
20640 <entry><option>host_lookup</option></entry>
20641 <entry>host name looked up for these hosts</entry>
20642 </row>
20643 <row>
20644 <entry><option>host_lookup_order</option></entry>
20645 <entry>order of DNS and local name lookups</entry>
20646 </row>
20647 <row>
20648 <entry><option>recipient_unqualified_hosts</option></entry>
20649 <entry>may send unqualified recipients</entry>
20650 </row>
20651 <row>
20652 <entry><option>rfc1413_hosts</option></entry>
20653 <entry>make ident calls to these hosts</entry>
20654 </row>
20655 <row>
20656 <entry><option>rfc1413_query_timeout</option></entry>
20657 <entry>zero disables ident calls</entry>
20658 </row>
20659 <row>
20660 <entry><option>sender_unqualified_hosts</option></entry>
20661 <entry>may send unqualified senders</entry>
20662 </row>
20663 <row>
20664 <entry><option>smtp_accept_keepalive</option></entry>
20665 <entry>some TCP/IP magic</entry>
20666 </row>
20667 <row>
20668 <entry><option>smtp_accept_max</option></entry>
20669 <entry>simultaneous incoming connections</entry>
20670 </row>
20671 <row>
20672 <entry><option>smtp_accept_max_nonmail</option></entry>
20673 <entry>non-mail commands</entry>
20674 </row>
20675 <row>
20676 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
20677 <entry>hosts to which the limit applies</entry>
20678 </row>
20679 <row>
20680 <entry><option>smtp_accept_max_per_connection</option></entry>
20681 <entry>messages per connection</entry>
20682 </row>
20683 <row>
20684 <entry><option>smtp_accept_max_per_host</option></entry>
20685 <entry>connections from one host</entry>
20686 </row>
20687 <row>
20688 <entry><option>smtp_accept_queue</option></entry>
20689 <entry>queue mail if more connections</entry>
20690 </row>
20691 <row>
20692 <entry><option>smtp_accept_queue_per_connection</option></entry>
20693 <entry>queue if more messages per connection</entry>
20694 </row>
20695 <row>
20696 <entry><option>smtp_accept_reserve</option></entry>
20697 <entry>only reserve hosts if more connections</entry>
20698 </row>
20699 <row>
20700 <entry><option>smtp_active_hostname</option></entry>
20701 <entry>host name to use in messages</entry>
20702 </row>
20703 <row>
20704 <entry><option>smtp_banner</option></entry>
20705 <entry>text for welcome banner</entry>
20706 </row>
20707 <row>
20708 <entry><option>smtp_check_spool_space</option></entry>
20709 <entry>from SIZE on MAIL command</entry>
20710 </row>
20711 <row>
20712 <entry><option>smtp_connect_backlog</option></entry>
20713 <entry>passed to TCP/IP stack</entry>
20714 </row>
20715 <row>
20716 <entry><option>smtp_enforce_sync</option></entry>
20717 <entry>of SMTP command/responses</entry>
20718 </row>
20719 <row>
20720 <entry><option>smtp_etrn_command</option></entry>
20721 <entry>what to run for ETRN</entry>
20722 </row>
20723 <row>
20724 <entry><option>smtp_etrn_serialize</option></entry>
20725 <entry>only one at once</entry>
20726 </row>
20727 <row>
20728 <entry><option>smtp_load_reserve</option></entry>
20729 <entry>only reserve hosts if this load</entry>
20730 </row>
20731 <row>
20732 <entry><option>smtp_max_unknown_commands</option></entry>
20733 <entry>before dropping connection</entry>
20734 </row>
20735 <row>
20736 <entry><option>smtp_ratelimit_hosts</option></entry>
20737 <entry>apply ratelimiting to these hosts</entry>
20738 </row>
20739 <row>
20740 <entry><option>smtp_ratelimit_mail</option></entry>
20741 <entry>ratelimit for MAIL commands</entry>
20742 </row>
20743 <row>
20744 <entry><option>smtp_ratelimit_rcpt</option></entry>
20745 <entry>ratelimit for RCPT commands</entry>
20746 </row>
20747 <row>
20748 <entry><option>smtp_receive_timeout</option></entry>
20749 <entry>per command or data line</entry>
20750 </row>
20751 <row>
20752 <entry><option>smtp_reserve_hosts</option></entry>
20753 <entry>these are the reserve hosts</entry>
20754 </row>
20755 <row>
20756 <entry><option>smtp_return_error_details</option></entry>
20757 <entry>give detail on rejections</entry>
20758 </row>
20759 </tbody>
20760 </tgroup>
20761 </informaltable>
20762 </section>
20763 <section id="SECID113">
20764 <title>SMTP extensions</title>
20765 <informaltable frame="none">
20766 <tgroup cols="2" colsep="0" rowsep="0">
20767 <colspec colwidth="196pt" align="left"/>
20768 <colspec colwidth="254pt" align="left"/>
20769 <tbody>
20770 <row>
20771 <entry><option>accept_8bitmime</option></entry>
20772 <entry>advertise 8BITMIME</entry>
20773 </row>
20774 <row>
20775 <entry><option>auth_advertise_hosts</option></entry>
20776 <entry>advertise AUTH to these hosts</entry>
20777 </row>
20778 <row>
20779 <entry><option>ignore_fromline_hosts</option></entry>
20780 <entry>allow <quote>From </quote> from these hosts</entry>
20781 </row>
20782 <row>
20783 <entry><option>ignore_fromline_local</option></entry>
20784 <entry>allow <quote>From </quote> from local SMTP</entry>
20785 </row>
20786 <row>
20787 <entry><option>pipelining_advertise_hosts</option></entry>
20788 <entry>advertise pipelining to these hosts</entry>
20789 </row>
20790 <row>
20791 <entry><option>tls_advertise_hosts</option></entry>
20792 <entry>advertise TLS to these hosts</entry>
20793 </row>
20794 </tbody>
20795 </tgroup>
20796 </informaltable>
20797 </section>
20798 <section id="SECID114">
20799 <title>Processing messages</title>
20800 <informaltable frame="none">
20801 <tgroup cols="2" colsep="0" rowsep="0">
20802 <colspec colwidth="196pt" align="left"/>
20803 <colspec colwidth="254pt" align="left"/>
20804 <tbody>
20805 <row>
20806 <entry><option>allow_domain_literals</option></entry>
20807 <entry>recognize domain literal syntax</entry>
20808 </row>
20809 <row>
20810 <entry><option>allow_mx_to_ip</option></entry>
20811 <entry>allow MX to point to IP address</entry>
20812 </row>
20813 <row>
20814 <entry><option>allow_utf8_domains</option></entry>
20815 <entry>in addresses</entry>
20816 </row>
20817 <row>
20818 <entry><option>check_rfc2047_length</option></entry>
20819 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
20820 </row>
20821 <row>
20822 <entry><option>delivery_date_remove</option></entry>
20823 <entry>from incoming messages</entry>
20824 </row>
20825 <row>
20826 <entry><option>envelope_to_remove</option></entry>
20827 <entry>from incoming messages</entry>
20828 </row>
20829 <row>
20830 <entry><option>extract_addresses_remove_arguments</option></entry>
20831 <entry>affects <option>-t</option> processing</entry>
20832 </row>
20833 <row>
20834 <entry><option>headers_charset</option></entry>
20835 <entry>default for translations</entry>
20836 </row>
20837 <row>
20838 <entry><option>qualify_domain</option></entry>
20839 <entry>default for senders</entry>
20840 </row>
20841 <row>
20842 <entry><option>qualify_recipient</option></entry>
20843 <entry>default for recipients</entry>
20844 </row>
20845 <row>
20846 <entry><option>return_path_remove</option></entry>
20847 <entry>from incoming messages</entry>
20848 </row>
20849 <row>
20850 <entry><option>strip_excess_angle_brackets</option></entry>
20851 <entry>in addresses</entry>
20852 </row>
20853 <row>
20854 <entry><option>strip_trailing_dot</option></entry>
20855 <entry>at end of addresses</entry>
20856 </row>
20857 <row>
20858 <entry><option>untrusted_set_sender</option></entry>
20859 <entry>untrusted can set envelope sender</entry>
20860 </row>
20861 </tbody>
20862 </tgroup>
20863 </informaltable>
20864 </section>
20865 <section id="SECID115">
20866 <title>System filter</title>
20867 <informaltable frame="none">
20868 <tgroup cols="2" colsep="0" rowsep="0">
20869 <colspec colwidth="196pt" align="left"/>
20870 <colspec colwidth="254pt" align="left"/>
20871 <tbody>
20872 <row>
20873 <entry><option>system_filter</option></entry>
20874 <entry>locate system filter</entry>
20875 </row>
20876 <row>
20877 <entry><option>system_filter_directory_transport</option></entry>
20878 <entry>transport for delivery to a directory</entry>
20879 </row>
20880 <row>
20881 <entry><option>system_filter_file_transport</option></entry>
20882 <entry>transport for delivery to a file</entry>
20883 </row>
20884 <row>
20885 <entry><option>system_filter_group</option></entry>
20886 <entry>group for filter running</entry>
20887 </row>
20888 <row>
20889 <entry><option>system_filter_pipe_transport</option></entry>
20890 <entry>transport for delivery to a pipe</entry>
20891 </row>
20892 <row>
20893 <entry><option>system_filter_reply_transport</option></entry>
20894 <entry>transport for autoreply delivery</entry>
20895 </row>
20896 <row>
20897 <entry><option>system_filter_user</option></entry>
20898 <entry>user for filter running</entry>
20899 </row>
20900 </tbody>
20901 </tgroup>
20902 </informaltable>
20903 </section>
20904 <section id="SECID116">
20905 <title>Routing and delivery</title>
20906 <informaltable frame="none">
20907 <tgroup cols="2" colsep="0" rowsep="0">
20908 <colspec colwidth="196pt" align="left"/>
20909 <colspec colwidth="254pt" align="left"/>
20910 <tbody>
20911 <row>
20912 <entry><option>disable_ipv6</option></entry>
20913 <entry>do no IPv6 processing</entry>
20914 </row>
20915 <row>
20916 <entry><option>dns_again_means_nonexist</option></entry>
20917 <entry>for broken domains</entry>
20918 </row>
20919 <row>
20920 <entry><option>dns_check_names_pattern</option></entry>
20921 <entry>pre-DNS syntax check</entry>
20922 </row>
20923 <row>
20924 <entry><option>dns_ipv4_lookup</option></entry>
20925 <entry>only v4 lookup for these domains</entry>
20926 </row>
20927 <row>
20928 <entry><option>dns_retrans</option></entry>
20929 <entry>parameter for resolver</entry>
20930 </row>
20931 <row>
20932 <entry><option>dns_retry</option></entry>
20933 <entry>parameter for resolver</entry>
20934 </row>
20935 <row>
20936 <entry><option>dns_use_dnssec</option></entry>
20937 <entry>parameter for resolver</entry>
20938 </row>
20939 <row>
20940 <entry><option>dns_use_edns0</option></entry>
20941 <entry>parameter for resolver</entry>
20942 </row>
20943 <row>
20944 <entry><option>hold_domains</option></entry>
20945 <entry>hold delivery for these domains</entry>
20946 </row>
20947 <row>
20948 <entry><option>local_interfaces</option></entry>
20949 <entry>for routing checks</entry>
20950 </row>
20951 <row>
20952 <entry><option>queue_domains</option></entry>
20953 <entry>no immediate delivery for these</entry>
20954 </row>
20955 <row>
20956 <entry><option>queue_only</option></entry>
20957 <entry>no immediate delivery at all</entry>
20958 </row>
20959 <row>
20960 <entry><option>queue_only_file</option></entry>
20961 <entry>no immediate delivery if file exists</entry>
20962 </row>
20963 <row>
20964 <entry><option>queue_only_load</option></entry>
20965 <entry>no immediate delivery if load is high</entry>
20966 </row>
20967 <row>
20968 <entry><option>queue_only_load_latch</option></entry>
20969 <entry>don&#x2019;t re-evaluate load for each message</entry>
20970 </row>
20971 <row>
20972 <entry><option>queue_only_override</option></entry>
20973 <entry>allow command line to override</entry>
20974 </row>
20975 <row>
20976 <entry><option>queue_run_in_order</option></entry>
20977 <entry>order of arrival</entry>
20978 </row>
20979 <row>
20980 <entry><option>queue_run_max</option></entry>
20981 <entry>of simultaneous queue runners</entry>
20982 </row>
20983 <row>
20984 <entry><option>queue_smtp_domains</option></entry>
20985 <entry>no immediate SMTP delivery for these</entry>
20986 </row>
20987 <row>
20988 <entry><option>remote_max_parallel</option></entry>
20989 <entry>parallel SMTP delivery per message</entry>
20990 </row>
20991 <row>
20992 <entry><option>remote_sort_domains</option></entry>
20993 <entry>order of remote deliveries</entry>
20994 </row>
20995 <row>
20996 <entry><option>retry_data_expire</option></entry>
20997 <entry>timeout for retry data</entry>
20998 </row>
20999 <row>
21000 <entry><option>retry_interval_max</option></entry>
21001 <entry>safety net for retry rules</entry>
21002 </row>
21003 </tbody>
21004 </tgroup>
21005 </informaltable>
21006 </section>
21007 <section id="SECID117">
21008 <title>Bounce and warning messages</title>
21009 <informaltable frame="none">
21010 <tgroup cols="2" colsep="0" rowsep="0">
21011 <colspec colwidth="196pt" align="left"/>
21012 <colspec colwidth="254pt" align="left"/>
21013 <tbody>
21014 <row>
21015 <entry><option>bounce_message_file</option></entry>
21016 <entry>content of bounce</entry>
21017 </row>
21018 <row>
21019 <entry><option>bounce_message_text</option></entry>
21020 <entry>content of bounce</entry>
21021 </row>
21022 <row>
21023 <entry><option>bounce_return_body</option></entry>
21024 <entry>include body if returning message</entry>
21025 </row>
21026 <row>
21027 <entry><option>bounce_return_message</option></entry>
21028 <entry>include original message in bounce</entry>
21029 </row>
21030 <row>
21031 <entry><option>bounce_return_size_limit</option></entry>
21032 <entry>limit on returned message</entry>
21033 </row>
21034 <row>
21035 <entry><option>bounce_sender_authentication</option></entry>
21036 <entry>send authenticated sender with bounce</entry>
21037 </row>
21038 <row>
21039 <entry><option>dsn_from</option></entry>
21040 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
21041 </row>
21042 <row>
21043 <entry><option>errors_copy</option></entry>
21044 <entry>copy bounce messages</entry>
21045 </row>
21046 <row>
21047 <entry><option>errors_reply_to</option></entry>
21048 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
21049 </row>
21050 <row>
21051 <entry><option>delay_warning</option></entry>
21052 <entry>time schedule</entry>
21053 </row>
21054 <row>
21055 <entry><option>delay_warning_condition</option></entry>
21056 <entry>condition for warning messages</entry>
21057 </row>
21058 <row>
21059 <entry><option>ignore_bounce_errors_after</option></entry>
21060 <entry>discard undeliverable bounces</entry>
21061 </row>
21062 <row>
21063 <entry><option>smtp_return_error_details</option></entry>
21064 <entry>give detail on rejections</entry>
21065 </row>
21066 <row>
21067 <entry><option>warn_message_file</option></entry>
21068 <entry>content of warning message</entry>
21069 </row>
21070 </tbody>
21071 </tgroup>
21072 </informaltable>
21073 </section>
21074 <section id="SECTalomo">
21075 <title>Alphabetical list of main options</title>
21076 <para>
21077 Those options that undergo string expansion before use are marked with
21078 &dagger;.
21079 </para>
21080 <para>
21081 <indexterm role="option">
21082 <primary><option>accept_8bitmime</option></primary>
21083 </indexterm>
21084 </para>
21085 <informaltable frame="all">
21086 <tgroup cols="4" colsep="0" rowsep="0">
21087 <colspec colwidth="8*" align="left"/>
21088 <colspec colwidth="6*" align="center"/>
21089 <colspec colwidth="6*" align="center"/>
21090 <colspec colwidth="6*" align="right"/>
21091 <tbody>
21092 <row>
21093 <entry><option>accept_8bitmime</option></entry>
21094 <entry>Use: <emphasis>main</emphasis></entry>
21095 <entry>Type: <emphasis>boolean</emphasis></entry>
21096 <entry>Default: <emphasis>true</emphasis></entry>
21097 </row>
21098 </tbody>
21099 </tgroup>
21100 </informaltable>
21101 <para>
21102 <indexterm role="concept">
21103 <primary>8BITMIME</primary>
21104 </indexterm>
21105 <indexterm role="concept">
21106 <primary>8-bit characters</primary>
21107 </indexterm>
21108 <indexterm role="concept">
21109 <primary>log</primary>
21110 <secondary>selectors</secondary>
21111 </indexterm>
21112 <indexterm role="concept">
21113 <primary>log</primary>
21114 <secondary>8BITMIME</secondary>
21115 </indexterm>
21116 This option causes Exim to send 8BITMIME in its response to an SMTP
21117 EHLO command, and to accept the BODY= parameter on MAIL commands.
21118 However, though Exim is 8-bit clean, it is not a protocol converter, and it
21119 takes no steps to do anything special with messages received by this route.
21120 </para>
21121 <para>
21122 Historically Exim kept this option off by default, but the maintainers
21123 feel that in today&#x2019;s Internet, this causes more problems than it solves.
21124 It now defaults to true.
21125 A more detailed analysis of the issues is provided by Dan Bernstein:
21126 </para>
21127 <literallayout>
21128 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
21129 </literallayout>
21130 <para revisionflag="changed">
21131 To log received 8BITMIME status use
21132 </para>
21133 <literallayout class="monospaced" revisionflag="changed">
21134 log_selector = +8bitmime
21135 </literallayout>
21136 <para>
21137 <indexterm role="option">
21138 <primary><option>acl_not_smtp</option></primary>
21139 </indexterm>
21140 </para>
21141 <informaltable frame="all">
21142 <tgroup cols="4" colsep="0" rowsep="0">
21143 <colspec colwidth="8*" align="left"/>
21144 <colspec colwidth="6*" align="center"/>
21145 <colspec colwidth="6*" align="center"/>
21146 <colspec colwidth="6*" align="right"/>
21147 <tbody>
21148 <row>
21149 <entry><option>acl_not_smtp</option></entry>
21150 <entry>Use: <emphasis>main</emphasis></entry>
21151 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21152 <entry>Default: <emphasis>unset</emphasis></entry>
21153 </row>
21154 </tbody>
21155 </tgroup>
21156 </informaltable>
21157 <para>
21158 <indexterm role="concept">
21159 <primary>access control lists (ACLs)</primary>
21160 <secondary>for non-SMTP messages</secondary>
21161 </indexterm>
21162 <indexterm role="concept">
21163 <primary>non-SMTP messages</primary>
21164 <secondary>ACLs for</secondary>
21165 </indexterm>
21166 This option defines the ACL that is run when a non-SMTP message has been
21167 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
21168 further details.
21169 </para>
21170 <para>
21171 <indexterm role="option">
21172 <primary><option>acl_not_smtp_mime</option></primary>
21173 </indexterm>
21174 </para>
21175 <informaltable frame="all">
21176 <tgroup cols="4" colsep="0" rowsep="0">
21177 <colspec colwidth="8*" align="left"/>
21178 <colspec colwidth="6*" align="center"/>
21179 <colspec colwidth="6*" align="center"/>
21180 <colspec colwidth="6*" align="right"/>
21181 <tbody>
21182 <row>
21183 <entry><option>acl_not_smtp_mime</option></entry>
21184 <entry>Use: <emphasis>main</emphasis></entry>
21185 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21186 <entry>Default: <emphasis>unset</emphasis></entry>
21187 </row>
21188 </tbody>
21189 </tgroup>
21190 </informaltable>
21191 <para>
21192 This option defines the ACL that is run for individual MIME parts of non-SMTP
21193 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
21194 SMTP messages.
21195 </para>
21196 <para>
21197 <indexterm role="option">
21198 <primary><option>acl_not_smtp_start</option></primary>
21199 </indexterm>
21200 </para>
21201 <informaltable frame="all">
21202 <tgroup cols="4" colsep="0" rowsep="0">
21203 <colspec colwidth="8*" align="left"/>
21204 <colspec colwidth="6*" align="center"/>
21205 <colspec colwidth="6*" align="center"/>
21206 <colspec colwidth="6*" align="right"/>
21207 <tbody>
21208 <row>
21209 <entry><option>acl_not_smtp_start</option></entry>
21210 <entry>Use: <emphasis>main</emphasis></entry>
21211 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21212 <entry>Default: <emphasis>unset</emphasis></entry>
21213 </row>
21214 </tbody>
21215 </tgroup>
21216 </informaltable>
21217 <para>
21218 <indexterm role="concept">
21219 <primary>access control lists (ACLs)</primary>
21220 <secondary>at start of non-SMTP message</secondary>
21221 </indexterm>
21222 <indexterm role="concept">
21223 <primary>non-SMTP messages</primary>
21224 <secondary>ACLs for</secondary>
21225 </indexterm>
21226 This option defines the ACL that is run before Exim starts reading a
21227 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
21228 </para>
21229 <para>
21230 <indexterm role="option">
21231 <primary><option>acl_smtp_auth</option></primary>
21232 </indexterm>
21233 </para>
21234 <informaltable frame="all">
21235 <tgroup cols="4" colsep="0" rowsep="0">
21236 <colspec colwidth="8*" align="left"/>
21237 <colspec colwidth="6*" align="center"/>
21238 <colspec colwidth="6*" align="center"/>
21239 <colspec colwidth="6*" align="right"/>
21240 <tbody>
21241 <row>
21242 <entry><option>acl_smtp_auth</option></entry>
21243 <entry>Use: <emphasis>main</emphasis></entry>
21244 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21245 <entry>Default: <emphasis>unset</emphasis></entry>
21246 </row>
21247 </tbody>
21248 </tgroup>
21249 </informaltable>
21250 <para>
21251 <indexterm role="concept">
21252 <primary>access control lists (ACLs)</primary>
21253 <secondary>setting up for SMTP commands</secondary>
21254 </indexterm>
21255 <indexterm role="concept">
21256 <primary>AUTH</primary>
21257 <secondary>ACL for</secondary>
21258 </indexterm>
21259 This option defines the ACL that is run when an SMTP AUTH command is
21260 received. See chapter <xref linkend="CHAPACL"/> for further details.
21261 </para>
21262 <para>
21263 <indexterm role="option">
21264 <primary><option>acl_smtp_connect</option></primary>
21265 </indexterm>
21266 </para>
21267 <informaltable frame="all">
21268 <tgroup cols="4" colsep="0" rowsep="0">
21269 <colspec colwidth="8*" align="left"/>
21270 <colspec colwidth="6*" align="center"/>
21271 <colspec colwidth="6*" align="center"/>
21272 <colspec colwidth="6*" align="right"/>
21273 <tbody>
21274 <row>
21275 <entry><option>acl_smtp_connect</option></entry>
21276 <entry>Use: <emphasis>main</emphasis></entry>
21277 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21278 <entry>Default: <emphasis>unset</emphasis></entry>
21279 </row>
21280 </tbody>
21281 </tgroup>
21282 </informaltable>
21283 <para>
21284 <indexterm role="concept">
21285 <primary>access control lists (ACLs)</primary>
21286 <secondary>on SMTP connection</secondary>
21287 </indexterm>
21288 This option defines the ACL that is run when an SMTP connection is received.
21289 See chapter <xref linkend="CHAPACL"/> for further details.
21290 </para>
21291 <para>
21292 <indexterm role="option">
21293 <primary><option>acl_smtp_data</option></primary>
21294 </indexterm>
21295 </para>
21296 <informaltable frame="all">
21297 <tgroup cols="4" colsep="0" rowsep="0">
21298 <colspec colwidth="8*" align="left"/>
21299 <colspec colwidth="6*" align="center"/>
21300 <colspec colwidth="6*" align="center"/>
21301 <colspec colwidth="6*" align="right"/>
21302 <tbody>
21303 <row>
21304 <entry><option>acl_smtp_data</option></entry>
21305 <entry>Use: <emphasis>main</emphasis></entry>
21306 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21307 <entry>Default: <emphasis>unset</emphasis></entry>
21308 </row>
21309 </tbody>
21310 </tgroup>
21311 </informaltable>
21312 <para>
21313 <indexterm role="concept">
21314 <primary>DATA</primary>
21315 <secondary>ACL for</secondary>
21316 </indexterm>
21317 This option defines the ACL that is run after an SMTP DATA command has been
21318 processed and the message itself has been received, but before the final
21319 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
21320 </para>
21321 <para>
21322 <indexterm role="option">
21323 <primary><option>acl_smtp_etrn</option></primary>
21324 </indexterm>
21325 </para>
21326 <informaltable frame="all">
21327 <tgroup cols="4" colsep="0" rowsep="0">
21328 <colspec colwidth="8*" align="left"/>
21329 <colspec colwidth="6*" align="center"/>
21330 <colspec colwidth="6*" align="center"/>
21331 <colspec colwidth="6*" align="right"/>
21332 <tbody>
21333 <row>
21334 <entry><option>acl_smtp_etrn</option></entry>
21335 <entry>Use: <emphasis>main</emphasis></entry>
21336 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21337 <entry>Default: <emphasis>unset</emphasis></entry>
21338 </row>
21339 </tbody>
21340 </tgroup>
21341 </informaltable>
21342 <para>
21343 <indexterm role="concept">
21344 <primary>ETRN</primary>
21345 <secondary>ACL for</secondary>
21346 </indexterm>
21347 This option defines the ACL that is run when an SMTP ETRN command is
21348 received. See chapter <xref linkend="CHAPACL"/> for further details.
21349 </para>
21350 <para>
21351 <indexterm role="option">
21352 <primary><option>acl_smtp_expn</option></primary>
21353 </indexterm>
21354 </para>
21355 <informaltable frame="all">
21356 <tgroup cols="4" colsep="0" rowsep="0">
21357 <colspec colwidth="8*" align="left"/>
21358 <colspec colwidth="6*" align="center"/>
21359 <colspec colwidth="6*" align="center"/>
21360 <colspec colwidth="6*" align="right"/>
21361 <tbody>
21362 <row>
21363 <entry><option>acl_smtp_expn</option></entry>
21364 <entry>Use: <emphasis>main</emphasis></entry>
21365 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21366 <entry>Default: <emphasis>unset</emphasis></entry>
21367 </row>
21368 </tbody>
21369 </tgroup>
21370 </informaltable>
21371 <para>
21372 <indexterm role="concept">
21373 <primary>EXPN</primary>
21374 <secondary>ACL for</secondary>
21375 </indexterm>
21376 This option defines the ACL that is run when an SMTP EXPN command is
21377 received. See chapter <xref linkend="CHAPACL"/> for further details.
21378 </para>
21379 <para>
21380 <indexterm role="option">
21381 <primary><option>acl_smtp_helo</option></primary>
21382 </indexterm>
21383 </para>
21384 <informaltable frame="all">
21385 <tgroup cols="4" colsep="0" rowsep="0">
21386 <colspec colwidth="8*" align="left"/>
21387 <colspec colwidth="6*" align="center"/>
21388 <colspec colwidth="6*" align="center"/>
21389 <colspec colwidth="6*" align="right"/>
21390 <tbody>
21391 <row>
21392 <entry><option>acl_smtp_helo</option></entry>
21393 <entry>Use: <emphasis>main</emphasis></entry>
21394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21395 <entry>Default: <emphasis>unset</emphasis></entry>
21396 </row>
21397 </tbody>
21398 </tgroup>
21399 </informaltable>
21400 <para>
21401 <indexterm role="concept">
21402 <primary>EHLO</primary>
21403 <secondary>ACL for</secondary>
21404 </indexterm>
21405 <indexterm role="concept">
21406 <primary>HELO</primary>
21407 <secondary>ACL for</secondary>
21408 </indexterm>
21409 This option defines the ACL that is run when an SMTP EHLO or HELO
21410 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
21411 </para>
21412 <para>
21413 <indexterm role="option">
21414 <primary><option>acl_smtp_mail</option></primary>
21415 </indexterm>
21416 </para>
21417 <informaltable frame="all">
21418 <tgroup cols="4" colsep="0" rowsep="0">
21419 <colspec colwidth="8*" align="left"/>
21420 <colspec colwidth="6*" align="center"/>
21421 <colspec colwidth="6*" align="center"/>
21422 <colspec colwidth="6*" align="right"/>
21423 <tbody>
21424 <row>
21425 <entry><option>acl_smtp_mail</option></entry>
21426 <entry>Use: <emphasis>main</emphasis></entry>
21427 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21428 <entry>Default: <emphasis>unset</emphasis></entry>
21429 </row>
21430 </tbody>
21431 </tgroup>
21432 </informaltable>
21433 <para>
21434 <indexterm role="concept">
21435 <primary>MAIL</primary>
21436 <secondary>ACL for</secondary>
21437 </indexterm>
21438 This option defines the ACL that is run when an SMTP MAIL command is
21439 received. See chapter <xref linkend="CHAPACL"/> for further details.
21440 </para>
21441 <para>
21442 <indexterm role="option">
21443 <primary><option>acl_smtp_mailauth</option></primary>
21444 </indexterm>
21445 </para>
21446 <informaltable frame="all">
21447 <tgroup cols="4" colsep="0" rowsep="0">
21448 <colspec colwidth="8*" align="left"/>
21449 <colspec colwidth="6*" align="center"/>
21450 <colspec colwidth="6*" align="center"/>
21451 <colspec colwidth="6*" align="right"/>
21452 <tbody>
21453 <row>
21454 <entry><option>acl_smtp_mailauth</option></entry>
21455 <entry>Use: <emphasis>main</emphasis></entry>
21456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21457 <entry>Default: <emphasis>unset</emphasis></entry>
21458 </row>
21459 </tbody>
21460 </tgroup>
21461 </informaltable>
21462 <para>
21463 <indexterm role="concept">
21464 <primary>AUTH</primary>
21465 <secondary>on MAIL command</secondary>
21466 </indexterm>
21467 This option defines the ACL that is run when there is an AUTH parameter on
21468 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
21469 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
21470 </para>
21471 <para>
21472 <indexterm role="option">
21473 <primary><option>acl_smtp_mime</option></primary>
21474 </indexterm>
21475 </para>
21476 <informaltable frame="all">
21477 <tgroup cols="4" colsep="0" rowsep="0">
21478 <colspec colwidth="8*" align="left"/>
21479 <colspec colwidth="6*" align="center"/>
21480 <colspec colwidth="6*" align="center"/>
21481 <colspec colwidth="6*" align="right"/>
21482 <tbody>
21483 <row>
21484 <entry><option>acl_smtp_mime</option></entry>
21485 <entry>Use: <emphasis>main</emphasis></entry>
21486 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21487 <entry>Default: <emphasis>unset</emphasis></entry>
21488 </row>
21489 </tbody>
21490 </tgroup>
21491 </informaltable>
21492 <para>
21493 <indexterm role="concept">
21494 <primary>MIME content scanning</primary>
21495 <secondary>ACL for</secondary>
21496 </indexterm>
21497 This option is available when Exim is built with the content-scanning
21498 extension. It defines the ACL that is run for each MIME part in a message. See
21499 section <xref linkend="SECTscanmimepart"/> for details.
21500 </para>
21501 <para>
21502 <indexterm role="option">
21503 <primary><option>acl_smtp_predata</option></primary>
21504 </indexterm>
21505 </para>
21506 <informaltable frame="all">
21507 <tgroup cols="4" colsep="0" rowsep="0">
21508 <colspec colwidth="8*" align="left"/>
21509 <colspec colwidth="6*" align="center"/>
21510 <colspec colwidth="6*" align="center"/>
21511 <colspec colwidth="6*" align="right"/>
21512 <tbody>
21513 <row>
21514 <entry><option>acl_smtp_predata</option></entry>
21515 <entry>Use: <emphasis>main</emphasis></entry>
21516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21517 <entry>Default: <emphasis>unset</emphasis></entry>
21518 </row>
21519 </tbody>
21520 </tgroup>
21521 </informaltable>
21522 <para>
21523 This option defines the ACL that is run when an SMTP DATA command is
21524 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
21525 further details.
21526 </para>
21527 <para>
21528 <indexterm role="option">
21529 <primary><option>acl_smtp_quit</option></primary>
21530 </indexterm>
21531 </para>
21532 <informaltable frame="all">
21533 <tgroup cols="4" colsep="0" rowsep="0">
21534 <colspec colwidth="8*" align="left"/>
21535 <colspec colwidth="6*" align="center"/>
21536 <colspec colwidth="6*" align="center"/>
21537 <colspec colwidth="6*" align="right"/>
21538 <tbody>
21539 <row>
21540 <entry><option>acl_smtp_quit</option></entry>
21541 <entry>Use: <emphasis>main</emphasis></entry>
21542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21543 <entry>Default: <emphasis>unset</emphasis></entry>
21544 </row>
21545 </tbody>
21546 </tgroup>
21547 </informaltable>
21548 <para>
21549 <indexterm role="concept">
21550 <primary>QUIT, ACL for</primary>
21551 </indexterm>
21552 This option defines the ACL that is run when an SMTP QUIT command is
21553 received. See chapter <xref linkend="CHAPACL"/> for further details.
21554 </para>
21555 <para>
21556 <indexterm role="option">
21557 <primary><option>acl_smtp_rcpt</option></primary>
21558 </indexterm>
21559 </para>
21560 <informaltable frame="all">
21561 <tgroup cols="4" colsep="0" rowsep="0">
21562 <colspec colwidth="8*" align="left"/>
21563 <colspec colwidth="6*" align="center"/>
21564 <colspec colwidth="6*" align="center"/>
21565 <colspec colwidth="6*" align="right"/>
21566 <tbody>
21567 <row>
21568 <entry><option>acl_smtp_rcpt</option></entry>
21569 <entry>Use: <emphasis>main</emphasis></entry>
21570 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21571 <entry>Default: <emphasis>unset</emphasis></entry>
21572 </row>
21573 </tbody>
21574 </tgroup>
21575 </informaltable>
21576 <para>
21577 <indexterm role="concept">
21578 <primary>RCPT</primary>
21579 <secondary>ACL for</secondary>
21580 </indexterm>
21581 This option defines the ACL that is run when an SMTP RCPT command is
21582 received. See chapter <xref linkend="CHAPACL"/> for further details.
21583 </para>
21584 <para>
21585 <indexterm role="option">
21586 <primary><option>acl_smtp_starttls</option></primary>
21587 </indexterm>
21588 </para>
21589 <informaltable frame="all">
21590 <tgroup cols="4" colsep="0" rowsep="0">
21591 <colspec colwidth="8*" align="left"/>
21592 <colspec colwidth="6*" align="center"/>
21593 <colspec colwidth="6*" align="center"/>
21594 <colspec colwidth="6*" align="right"/>
21595 <tbody>
21596 <row>
21597 <entry><option>acl_smtp_starttls</option></entry>
21598 <entry>Use: <emphasis>main</emphasis></entry>
21599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21600 <entry>Default: <emphasis>unset</emphasis></entry>
21601 </row>
21602 </tbody>
21603 </tgroup>
21604 </informaltable>
21605 <para>
21606 <indexterm role="concept">
21607 <primary>STARTTLS, ACL for</primary>
21608 </indexterm>
21609 This option defines the ACL that is run when an SMTP STARTTLS command is
21610 received. See chapter <xref linkend="CHAPACL"/> for further details.
21611 </para>
21612 <para>
21613 <indexterm role="option">
21614 <primary><option>acl_smtp_vrfy</option></primary>
21615 </indexterm>
21616 </para>
21617 <informaltable frame="all">
21618 <tgroup cols="4" colsep="0" rowsep="0">
21619 <colspec colwidth="8*" align="left"/>
21620 <colspec colwidth="6*" align="center"/>
21621 <colspec colwidth="6*" align="center"/>
21622 <colspec colwidth="6*" align="right"/>
21623 <tbody>
21624 <row>
21625 <entry><option>acl_smtp_vrfy</option></entry>
21626 <entry>Use: <emphasis>main</emphasis></entry>
21627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21628 <entry>Default: <emphasis>unset</emphasis></entry>
21629 </row>
21630 </tbody>
21631 </tgroup>
21632 </informaltable>
21633 <para>
21634 <indexterm role="concept">
21635 <primary>VRFY</primary>
21636 <secondary>ACL for</secondary>
21637 </indexterm>
21638 This option defines the ACL that is run when an SMTP VRFY command is
21639 received. See chapter <xref linkend="CHAPACL"/> for further details.
21640 </para>
21641 <para>
21642 <indexterm role="option">
21643 <primary><option>admin_groups</option></primary>
21644 </indexterm>
21645 </para>
21646 <informaltable frame="all">
21647 <tgroup cols="4" colsep="0" rowsep="0">
21648 <colspec colwidth="8*" align="left"/>
21649 <colspec colwidth="6*" align="center"/>
21650 <colspec colwidth="6*" align="center"/>
21651 <colspec colwidth="6*" align="right"/>
21652 <tbody>
21653 <row>
21654 <entry><option>admin_groups</option></entry>
21655 <entry>Use: <emphasis>main</emphasis></entry>
21656 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
21657 <entry>Default: <emphasis>unset</emphasis></entry>
21658 </row>
21659 </tbody>
21660 </tgroup>
21661 </informaltable>
21662 <para>
21663 <indexterm role="concept">
21664 <primary>admin user</primary>
21665 </indexterm>
21666 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
21667 current group or any of the supplementary groups of an Exim caller is in this
21668 colon-separated list, the caller has admin privileges. If all your system
21669 programmers are in a specific group, for example, you can give them all Exim
21670 admin privileges by putting that group in <option>admin_groups</option>. However, this does
21671 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
21672 To permit this, you have to add individuals to the Exim group.
21673 </para>
21674 <para>
21675 <indexterm role="option">
21676 <primary><option>allow_domain_literals</option></primary>
21677 </indexterm>
21678 </para>
21679 <informaltable frame="all">
21680 <tgroup cols="4" colsep="0" rowsep="0">
21681 <colspec colwidth="8*" align="left"/>
21682 <colspec colwidth="6*" align="center"/>
21683 <colspec colwidth="6*" align="center"/>
21684 <colspec colwidth="6*" align="right"/>
21685 <tbody>
21686 <row>
21687 <entry><option>allow_domain_literals</option></entry>
21688 <entry>Use: <emphasis>main</emphasis></entry>
21689 <entry>Type: <emphasis>boolean</emphasis></entry>
21690 <entry>Default: <emphasis>false</emphasis></entry>
21691 </row>
21692 </tbody>
21693 </tgroup>
21694 </informaltable>
21695 <para>
21696 <indexterm role="concept">
21697 <primary>domain literal</primary>
21698 </indexterm>
21699 If this option is set, the RFC 2822 domain literal format is permitted in
21700 email addresses. The option is not set by default, because the domain literal
21701 format is not normally required these days, and few people know about it. It
21702 has, however, been exploited by mail abusers.
21703 </para>
21704 <para>
21705 Unfortunately, it seems that some DNS black list maintainers are using this
21706 format to report black listing to postmasters. If you want to accept messages
21707 addressed to your hosts by IP address, you need to set
21708 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
21709 domains (defined in the named domain list <option>local_domains</option> in the default
21710 configuration). This <quote>magic string</quote> matches the domain literal form of all
21711 the local host&#x2019;s IP addresses.
21712 </para>
21713 <para>
21714 <indexterm role="option">
21715 <primary><option>allow_mx_to_ip</option></primary>
21716 </indexterm>
21717 </para>
21718 <informaltable frame="all">
21719 <tgroup cols="4" colsep="0" rowsep="0">
21720 <colspec colwidth="8*" align="left"/>
21721 <colspec colwidth="6*" align="center"/>
21722 <colspec colwidth="6*" align="center"/>
21723 <colspec colwidth="6*" align="right"/>
21724 <tbody>
21725 <row>
21726 <entry><option>allow_mx_to_ip</option></entry>
21727 <entry>Use: <emphasis>main</emphasis></entry>
21728 <entry>Type: <emphasis>boolean</emphasis></entry>
21729 <entry>Default: <emphasis>false</emphasis></entry>
21730 </row>
21731 </tbody>
21732 </tgroup>
21733 </informaltable>
21734 <para>
21735 <indexterm role="concept">
21736 <primary>MX record</primary>
21737 <secondary>pointing to IP address</secondary>
21738 </indexterm>
21739 It appears that more and more DNS zone administrators are breaking the rules
21740 and putting domain names that look like IP addresses on the right hand side of
21741 MX records. Exim follows the rules and rejects this, giving an error message
21742 that explains the mis-configuration. However, some other MTAs support this
21743 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
21744 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
21745 recommended, except when you have no other choice.
21746 </para>
21747 <para>
21748 <indexterm role="option">
21749 <primary><option>allow_utf8_domains</option></primary>
21750 </indexterm>
21751 </para>
21752 <informaltable frame="all">
21753 <tgroup cols="4" colsep="0" rowsep="0">
21754 <colspec colwidth="8*" align="left"/>
21755 <colspec colwidth="6*" align="center"/>
21756 <colspec colwidth="6*" align="center"/>
21757 <colspec colwidth="6*" align="right"/>
21758 <tbody>
21759 <row>
21760 <entry><option>allow_utf8_domains</option></entry>
21761 <entry>Use: <emphasis>main</emphasis></entry>
21762 <entry>Type: <emphasis>boolean</emphasis></entry>
21763 <entry>Default: <emphasis>false</emphasis></entry>
21764 </row>
21765 </tbody>
21766 </tgroup>
21767 </informaltable>
21768 <para>
21769 <indexterm role="concept">
21770 <primary>domain</primary>
21771 <secondary>UTF-8 characters in</secondary>
21772 </indexterm>
21773 <indexterm role="concept">
21774 <primary>UTF-8</primary>
21775 <secondary>in domain name</secondary>
21776 </indexterm>
21777 Lots of discussion is going on about internationalized domain names. One
21778 camp is strongly in favour of just using UTF-8 characters, and it seems
21779 that at least two other MTAs permit this. This option allows Exim users to
21780 experiment if they wish.
21781 </para>
21782 <para>
21783 If it is set true, Exim&#x2019;s domain parsing function allows valid
21784 UTF-8 multicharacters to appear in domain name components, in addition to
21785 letters, digits, and hyphens. However, just setting this option is not
21786 enough; if you want to look up these domain names in the DNS, you must also
21787 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
21788 suitable setting is:
21789 </para>
21790 <literallayout class="monospaced">
21791 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
21792   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
21793 </literallayout>
21794 <para>
21795 Alternatively, you can just disable this feature by setting
21796 </para>
21797 <literallayout class="monospaced">
21798 dns_check_names_pattern =
21799 </literallayout>
21800 <para>
21801 That is, set the option to an empty string so that no check is done.
21802 </para>
21803 <para>
21804 <indexterm role="option">
21805 <primary><option>auth_advertise_hosts</option></primary>
21806 </indexterm>
21807 </para>
21808 <informaltable frame="all">
21809 <tgroup cols="4" colsep="0" rowsep="0">
21810 <colspec colwidth="8*" align="left"/>
21811 <colspec colwidth="6*" align="center"/>
21812 <colspec colwidth="6*" align="center"/>
21813 <colspec colwidth="6*" align="right"/>
21814 <tbody>
21815 <row>
21816 <entry><option>auth_advertise_hosts</option></entry>
21817 <entry>Use: <emphasis>main</emphasis></entry>
21818 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
21819 <entry>Default: <emphasis>*</emphasis></entry>
21820 </row>
21821 </tbody>
21822 </tgroup>
21823 </informaltable>
21824 <para>
21825 <indexterm role="concept">
21826 <primary>authentication</primary>
21827 <secondary>advertising</secondary>
21828 </indexterm>
21829 <indexterm role="concept">
21830 <primary>AUTH</primary>
21831 <secondary>advertising</secondary>
21832 </indexterm>
21833 If any server authentication mechanisms are configured, Exim advertises them in
21834 response to an EHLO command only if the calling host matches this list.
21835 Otherwise, Exim does not advertise AUTH.
21836 Exim does not accept AUTH commands from clients to which it has not
21837 advertised the availability of AUTH. The advertising of individual
21838 authentication mechanisms can be controlled by the use of the
21839 <option>server_advertise_condition</option> generic authenticator option on the individual
21840 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
21841 </para>
21842 <para>
21843 Certain mail clients (for example, Netscape) require the user to provide a name
21844 and password for authentication if AUTH is advertised, even though it may
21845 not be needed (the host may accept messages from hosts on its local LAN without
21846 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
21847 to make these clients more friendly by excluding them from the set of hosts to
21848 which Exim advertises AUTH.
21849 </para>
21850 <para>
21851 <indexterm role="concept">
21852 <primary>AUTH</primary>
21853 <secondary>advertising when encrypted</secondary>
21854 </indexterm>
21855 If you want to advertise the availability of AUTH only when the connection
21856 is encrypted using TLS, you can make use of the fact that the value of this
21857 option is expanded, with a setting like this:
21858 </para>
21859 <literallayout class="monospaced">
21860 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
21861 </literallayout>
21862 <para>
21863 <indexterm role="variable">
21864 <primary><varname>$tls_in_cipher</varname></primary>
21865 </indexterm>
21866 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
21867 the expansion is empty, thus matching no hosts. Otherwise, the result of the
21868 expansion is *, which matches all hosts.
21869 </para>
21870 <para>
21871 <indexterm role="option">
21872 <primary><option>auto_thaw</option></primary>
21873 </indexterm>
21874 </para>
21875 <informaltable frame="all">
21876 <tgroup cols="4" colsep="0" rowsep="0">
21877 <colspec colwidth="8*" align="left"/>
21878 <colspec colwidth="6*" align="center"/>
21879 <colspec colwidth="6*" align="center"/>
21880 <colspec colwidth="6*" align="right"/>
21881 <tbody>
21882 <row>
21883 <entry><option>auto_thaw</option></entry>
21884 <entry>Use: <emphasis>main</emphasis></entry>
21885 <entry>Type: <emphasis>time</emphasis></entry>
21886 <entry>Default: <emphasis>0s</emphasis></entry>
21887 </row>
21888 </tbody>
21889 </tgroup>
21890 </informaltable>
21891 <para>
21892 <indexterm role="concept">
21893 <primary>thawing messages</primary>
21894 </indexterm>
21895 <indexterm role="concept">
21896 <primary>unfreezing messages</primary>
21897 </indexterm>
21898 If this option is set to a time greater than zero, a queue runner will try a
21899 new delivery attempt on any frozen message, other than a bounce message, if
21900 this much time has passed since it was frozen. This may result in the message
21901 being re-frozen if nothing has changed since the last attempt. It is a way of
21902 saying <quote>keep on trying, even though there are big problems</quote>.
21903 </para>
21904 <para>
21905 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
21906 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
21907 thought to be very useful any more, and its use should probably be avoided.
21908 </para>
21909 <para>
21910 <indexterm role="option">
21911 <primary><option>av_scanner</option></primary>
21912 </indexterm>
21913 </para>
21914 <informaltable frame="all">
21915 <tgroup cols="4" colsep="0" rowsep="0">
21916 <colspec colwidth="8*" align="left"/>
21917 <colspec colwidth="6*" align="center"/>
21918 <colspec colwidth="6*" align="center"/>
21919 <colspec colwidth="6*" align="right"/>
21920 <tbody>
21921 <row>
21922 <entry><option>av_scanner</option></entry>
21923 <entry>Use: <emphasis>main</emphasis></entry>
21924 <entry>Type: <emphasis>string</emphasis></entry>
21925 <entry>Default: <emphasis>see below</emphasis></entry>
21926 </row>
21927 </tbody>
21928 </tgroup>
21929 </informaltable>
21930 <para>
21931 This option is available if Exim is built with the content-scanning extension.
21932 It specifies which anti-virus scanner to use. The default value is:
21933 </para>
21934 <literallayout class="monospaced">
21935 sophie:/var/run/sophie
21936 </literallayout>
21937 <para>
21938 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21939 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21940 </para>
21941 <para>
21942 <indexterm role="option">
21943 <primary><option>bi_command</option></primary>
21944 </indexterm>
21945 </para>
21946 <informaltable frame="all">
21947 <tgroup cols="4" colsep="0" rowsep="0">
21948 <colspec colwidth="8*" align="left"/>
21949 <colspec colwidth="6*" align="center"/>
21950 <colspec colwidth="6*" align="center"/>
21951 <colspec colwidth="6*" align="right"/>
21952 <tbody>
21953 <row>
21954 <entry><option>bi_command</option></entry>
21955 <entry>Use: <emphasis>main</emphasis></entry>
21956 <entry>Type: <emphasis>string</emphasis></entry>
21957 <entry>Default: <emphasis>unset</emphasis></entry>
21958 </row>
21959 </tbody>
21960 </tgroup>
21961 </informaltable>
21962 <para>
21963 <indexterm role="option">
21964 <primary><option>-bi</option></primary>
21965 </indexterm>
21966 This option supplies the name of a command that is run when Exim is called with
21967 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21968 just the command name, it is not a complete command line. If an argument is
21969 required, it must come from the <option>-oA</option> command line option.
21970 </para>
21971 <para>
21972 <indexterm role="option">
21973 <primary><option>bounce_message_file</option></primary>
21974 </indexterm>
21975 </para>
21976 <informaltable frame="all">
21977 <tgroup cols="4" colsep="0" rowsep="0">
21978 <colspec colwidth="8*" align="left"/>
21979 <colspec colwidth="6*" align="center"/>
21980 <colspec colwidth="6*" align="center"/>
21981 <colspec colwidth="6*" align="right"/>
21982 <tbody>
21983 <row>
21984 <entry><option>bounce_message_file</option></entry>
21985 <entry>Use: <emphasis>main</emphasis></entry>
21986 <entry>Type: <emphasis>string</emphasis></entry>
21987 <entry>Default: <emphasis>unset</emphasis></entry>
21988 </row>
21989 </tbody>
21990 </tgroup>
21991 </informaltable>
21992 <para>
21993 <indexterm role="concept">
21994 <primary>bounce message</primary>
21995 <secondary>customizing</secondary>
21996 </indexterm>
21997 <indexterm role="concept">
21998 <primary>customizing</primary>
21999 <secondary>bounce message</secondary>
22000 </indexterm>
22001 This option defines a template file containing paragraphs of text to be used
22002 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
22003 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
22004 </para>
22005 <para>
22006 <indexterm role="option">
22007 <primary><option>bounce_message_text</option></primary>
22008 </indexterm>
22009 </para>
22010 <informaltable frame="all">
22011 <tgroup cols="4" colsep="0" rowsep="0">
22012 <colspec colwidth="8*" align="left"/>
22013 <colspec colwidth="6*" align="center"/>
22014 <colspec colwidth="6*" align="center"/>
22015 <colspec colwidth="6*" align="right"/>
22016 <tbody>
22017 <row>
22018 <entry><option>bounce_message_text</option></entry>
22019 <entry>Use: <emphasis>main</emphasis></entry>
22020 <entry>Type: <emphasis>string</emphasis></entry>
22021 <entry>Default: <emphasis>unset</emphasis></entry>
22022 </row>
22023 </tbody>
22024 </tgroup>
22025 </informaltable>
22026 <para>
22027 When this option is set, its contents are included in the default bounce
22028 message immediately after <quote>This message was created automatically by mail
22029 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
22030 </para>
22031 <para>
22032 <indexterm role="option">
22033 <primary><option>bounce_return_body</option></primary>
22034 </indexterm>
22035 </para>
22036 <informaltable frame="all">
22037 <tgroup cols="4" colsep="0" rowsep="0">
22038 <colspec colwidth="8*" align="left"/>
22039 <colspec colwidth="6*" align="center"/>
22040 <colspec colwidth="6*" align="center"/>
22041 <colspec colwidth="6*" align="right"/>
22042 <tbody>
22043 <row>
22044 <entry><option>bounce_return_body</option></entry>
22045 <entry>Use: <emphasis>main</emphasis></entry>
22046 <entry>Type: <emphasis>boolean</emphasis></entry>
22047 <entry>Default: <emphasis>true</emphasis></entry>
22048 </row>
22049 </tbody>
22050 </tgroup>
22051 </informaltable>
22052 <para>
22053 <indexterm role="concept">
22054 <primary>bounce message</primary>
22055 <secondary>including body</secondary>
22056 </indexterm>
22057 This option controls whether the body of an incoming message is included in a
22058 bounce message when <option>bounce_return_message</option> is true. The default setting
22059 causes the entire message, both header and body, to be returned (subject to the
22060 value of <option>bounce_return_size_limit</option>). If this option is false, only the
22061 message header is included. In the case of a non-SMTP message containing an
22062 error that is detected during reception, only those header lines preceding the
22063 point at which the error was detected are returned.
22064 <indexterm role="concept">
22065 <primary>bounce message</primary>
22066 <secondary>including original</secondary>
22067 </indexterm>
22068 </para>
22069 <para>
22070 <indexterm role="option">
22071 <primary><option>bounce_return_message</option></primary>
22072 </indexterm>
22073 </para>
22074 <informaltable frame="all">
22075 <tgroup cols="4" colsep="0" rowsep="0">
22076 <colspec colwidth="8*" align="left"/>
22077 <colspec colwidth="6*" align="center"/>
22078 <colspec colwidth="6*" align="center"/>
22079 <colspec colwidth="6*" align="right"/>
22080 <tbody>
22081 <row>
22082 <entry><option>bounce_return_message</option></entry>
22083 <entry>Use: <emphasis>main</emphasis></entry>
22084 <entry>Type: <emphasis>boolean</emphasis></entry>
22085 <entry>Default: <emphasis>true</emphasis></entry>
22086 </row>
22087 </tbody>
22088 </tgroup>
22089 </informaltable>
22090 <para>
22091 If this option is set false, none of the original message is included in
22092 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
22093 <option>bounce_return_body</option>.
22094 </para>
22095 <para>
22096 <indexterm role="option">
22097 <primary><option>bounce_return_size_limit</option></primary>
22098 </indexterm>
22099 </para>
22100 <informaltable frame="all">
22101 <tgroup cols="4" colsep="0" rowsep="0">
22102 <colspec colwidth="8*" align="left"/>
22103 <colspec colwidth="6*" align="center"/>
22104 <colspec colwidth="6*" align="center"/>
22105 <colspec colwidth="6*" align="right"/>
22106 <tbody>
22107 <row>
22108 <entry><option>bounce_return_size_limit</option></entry>
22109 <entry>Use: <emphasis>main</emphasis></entry>
22110 <entry>Type: <emphasis>integer</emphasis></entry>
22111 <entry>Default: <emphasis>100K</emphasis></entry>
22112 </row>
22113 </tbody>
22114 </tgroup>
22115 </informaltable>
22116 <para>
22117 <indexterm role="concept">
22118 <primary>size</primary>
22119 <secondary>of bounce, limit</secondary>
22120 </indexterm>
22121 <indexterm role="concept">
22122 <primary>bounce message</primary>
22123 <secondary>size limit</secondary>
22124 </indexterm>
22125 <indexterm role="concept">
22126 <primary>limit</primary>
22127 <secondary>bounce message size</secondary>
22128 </indexterm>
22129 This option sets a limit in bytes on the size of messages that are returned to
22130 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
22131 limit should be less than the value of the global <option>message_size_limit</option> and of
22132 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
22133 that Exim generates. If this option is set to zero there is no limit.
22134 </para>
22135 <para>
22136 When the body of any message that is to be included in a bounce message is
22137 greater than the limit, it is truncated, and a comment pointing this out is
22138 added at the top. The actual cutoff may be greater than the value given, owing
22139 to the use of buffering for transferring the message in chunks (typically 8K in
22140 size). The idea is to save bandwidth on those undeliverable 15-megabyte
22141 messages.
22142 </para>
22143 <para>
22144 <indexterm role="option">
22145 <primary><option>bounce_sender_authentication</option></primary>
22146 </indexterm>
22147 </para>
22148 <informaltable frame="all">
22149 <tgroup cols="4" colsep="0" rowsep="0">
22150 <colspec colwidth="8*" align="left"/>
22151 <colspec colwidth="6*" align="center"/>
22152 <colspec colwidth="6*" align="center"/>
22153 <colspec colwidth="6*" align="right"/>
22154 <tbody>
22155 <row>
22156 <entry><option>bounce_sender_authentication</option></entry>
22157 <entry>Use: <emphasis>main</emphasis></entry>
22158 <entry>Type: <emphasis>string</emphasis></entry>
22159 <entry>Default: <emphasis>unset</emphasis></entry>
22160 </row>
22161 </tbody>
22162 </tgroup>
22163 </informaltable>
22164 <para>
22165 <indexterm role="concept">
22166 <primary>bounce message</primary>
22167 <secondary>sender authentication</secondary>
22168 </indexterm>
22169 <indexterm role="concept">
22170 <primary>authentication</primary>
22171 <secondary>bounce message</secondary>
22172 </indexterm>
22173 <indexterm role="concept">
22174 <primary>AUTH</primary>
22175 <secondary>on bounce message</secondary>
22176 </indexterm>
22177 This option provides an authenticated sender address that is sent with any
22178 bounce messages generated by Exim that are sent over an authenticated SMTP
22179 connection. A typical setting might be:
22180 </para>
22181 <literallayout class="monospaced">
22182 bounce_sender_authentication = mailer-daemon@my.domain.example
22183 </literallayout>
22184 <para>
22185 which would cause bounce messages to be sent using the SMTP command:
22186 </para>
22187 <literallayout class="monospaced">
22188 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
22189 </literallayout>
22190 <para>
22191 The value of <option>bounce_sender_authentication</option> must always be a complete email
22192 address.
22193 </para>
22194 <para>
22195 <indexterm role="option">
22196 <primary><option>callout_domain_negative_expire</option></primary>
22197 </indexterm>
22198 </para>
22199 <informaltable frame="all">
22200 <tgroup cols="4" colsep="0" rowsep="0">
22201 <colspec colwidth="8*" align="left"/>
22202 <colspec colwidth="6*" align="center"/>
22203 <colspec colwidth="6*" align="center"/>
22204 <colspec colwidth="6*" align="right"/>
22205 <tbody>
22206 <row>
22207 <entry><option>callout_domain_negative_expire</option></entry>
22208 <entry>Use: <emphasis>main</emphasis></entry>
22209 <entry>Type: <emphasis>time</emphasis></entry>
22210 <entry>Default: <emphasis>3h</emphasis></entry>
22211 </row>
22212 </tbody>
22213 </tgroup>
22214 </informaltable>
22215 <para>
22216 <indexterm role="concept">
22217 <primary>caching</primary>
22218 <secondary>callout timeouts</secondary>
22219 </indexterm>
22220 <indexterm role="concept">
22221 <primary>callout</primary>
22222 <secondary>caching timeouts</secondary>
22223 </indexterm>
22224 This option specifies the expiry time for negative callout cache data for a
22225 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22226 section <xref linkend="SECTcallvercache"/> for details of the caching.
22227 </para>
22228 <para>
22229 <indexterm role="option">
22230 <primary><option>callout_domain_positive_expire</option></primary>
22231 </indexterm>
22232 </para>
22233 <informaltable frame="all">
22234 <tgroup cols="4" colsep="0" rowsep="0">
22235 <colspec colwidth="8*" align="left"/>
22236 <colspec colwidth="6*" align="center"/>
22237 <colspec colwidth="6*" align="center"/>
22238 <colspec colwidth="6*" align="right"/>
22239 <tbody>
22240 <row>
22241 <entry><option>callout_domain_positive_expire</option></entry>
22242 <entry>Use: <emphasis>main</emphasis></entry>
22243 <entry>Type: <emphasis>time</emphasis></entry>
22244 <entry>Default: <emphasis>7d</emphasis></entry>
22245 </row>
22246 </tbody>
22247 </tgroup>
22248 </informaltable>
22249 <para>
22250 This option specifies the expiry time for positive callout cache data for a
22251 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22252 section <xref linkend="SECTcallvercache"/> for details of the caching.
22253 </para>
22254 <para>
22255 <indexterm role="option">
22256 <primary><option>callout_negative_expire</option></primary>
22257 </indexterm>
22258 </para>
22259 <informaltable frame="all">
22260 <tgroup cols="4" colsep="0" rowsep="0">
22261 <colspec colwidth="8*" align="left"/>
22262 <colspec colwidth="6*" align="center"/>
22263 <colspec colwidth="6*" align="center"/>
22264 <colspec colwidth="6*" align="right"/>
22265 <tbody>
22266 <row>
22267 <entry><option>callout_negative_expire</option></entry>
22268 <entry>Use: <emphasis>main</emphasis></entry>
22269 <entry>Type: <emphasis>time</emphasis></entry>
22270 <entry>Default: <emphasis>2h</emphasis></entry>
22271 </row>
22272 </tbody>
22273 </tgroup>
22274 </informaltable>
22275 <para>
22276 This option specifies the expiry time for negative callout cache data for an
22277 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22278 section <xref linkend="SECTcallvercache"/> for details of the caching.
22279 </para>
22280 <para>
22281 <indexterm role="option">
22282 <primary><option>callout_positive_expire</option></primary>
22283 </indexterm>
22284 </para>
22285 <informaltable frame="all">
22286 <tgroup cols="4" colsep="0" rowsep="0">
22287 <colspec colwidth="8*" align="left"/>
22288 <colspec colwidth="6*" align="center"/>
22289 <colspec colwidth="6*" align="center"/>
22290 <colspec colwidth="6*" align="right"/>
22291 <tbody>
22292 <row>
22293 <entry><option>callout_positive_expire</option></entry>
22294 <entry>Use: <emphasis>main</emphasis></entry>
22295 <entry>Type: <emphasis>time</emphasis></entry>
22296 <entry>Default: <emphasis>24h</emphasis></entry>
22297 </row>
22298 </tbody>
22299 </tgroup>
22300 </informaltable>
22301 <para>
22302 This option specifies the expiry time for positive callout cache data for an
22303 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
22304 section <xref linkend="SECTcallvercache"/> for details of the caching.
22305 </para>
22306 <para>
22307 <indexterm role="option">
22308 <primary><option>callout_random_local_part</option></primary>
22309 </indexterm>
22310 </para>
22311 <informaltable frame="all">
22312 <tgroup cols="4" colsep="0" rowsep="0">
22313 <colspec colwidth="8*" align="left"/>
22314 <colspec colwidth="6*" align="center"/>
22315 <colspec colwidth="6*" align="center"/>
22316 <colspec colwidth="6*" align="right"/>
22317 <tbody>
22318 <row>
22319 <entry><option>callout_random_local_part</option></entry>
22320 <entry>Use: <emphasis>main</emphasis></entry>
22321 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22322 <entry>Default: <emphasis>see below</emphasis></entry>
22323 </row>
22324 </tbody>
22325 </tgroup>
22326 </informaltable>
22327 <para>
22328 This option defines the <quote>random</quote> local part that can be used as part of
22329 callout verification. The default value is
22330 </para>
22331 <literallayout class="monospaced">
22332 $primary_hostname-$tod_epoch-testing
22333 </literallayout>
22334 <para>
22335 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
22336 </para>
22337 <para>
22338 <indexterm role="option">
22339 <primary><option>check_log_inodes</option></primary>
22340 </indexterm>
22341 </para>
22342 <informaltable frame="all">
22343 <tgroup cols="4" colsep="0" rowsep="0">
22344 <colspec colwidth="8*" align="left"/>
22345 <colspec colwidth="6*" align="center"/>
22346 <colspec colwidth="6*" align="center"/>
22347 <colspec colwidth="6*" align="right"/>
22348 <tbody>
22349 <row>
22350 <entry><option>check_log_inodes</option></entry>
22351 <entry>Use: <emphasis>main</emphasis></entry>
22352 <entry>Type: <emphasis>integer</emphasis></entry>
22353 <entry>Default: <emphasis>0</emphasis></entry>
22354 </row>
22355 </tbody>
22356 </tgroup>
22357 </informaltable>
22358 <para>
22359 See <option>check_spool_space</option> below.
22360 </para>
22361 <para>
22362 <indexterm role="option">
22363 <primary><option>check_log_space</option></primary>
22364 </indexterm>
22365 </para>
22366 <informaltable frame="all">
22367 <tgroup cols="4" colsep="0" rowsep="0">
22368 <colspec colwidth="8*" align="left"/>
22369 <colspec colwidth="6*" align="center"/>
22370 <colspec colwidth="6*" align="center"/>
22371 <colspec colwidth="6*" align="right"/>
22372 <tbody>
22373 <row>
22374 <entry><option>check_log_space</option></entry>
22375 <entry>Use: <emphasis>main</emphasis></entry>
22376 <entry>Type: <emphasis>integer</emphasis></entry>
22377 <entry>Default: <emphasis>0</emphasis></entry>
22378 </row>
22379 </tbody>
22380 </tgroup>
22381 </informaltable>
22382 <para>
22383 See <option>check_spool_space</option> below.
22384 </para>
22385 <para>
22386 <indexterm role="option">
22387 <primary><option>check_rfc2047_length</option></primary>
22388 </indexterm>
22389 <indexterm role="concept">
22390 <primary>RFC 2047</primary>
22391 <secondary>disabling length check</secondary>
22392 </indexterm>
22393 <indexterm role="option">
22394 <primary><option>check_rfc2047_length</option></primary>
22395 </indexterm>
22396 </para>
22397 <informaltable frame="all">
22398 <tgroup cols="4" colsep="0" rowsep="0">
22399 <colspec colwidth="8*" align="left"/>
22400 <colspec colwidth="6*" align="center"/>
22401 <colspec colwidth="6*" align="center"/>
22402 <colspec colwidth="6*" align="right"/>
22403 <tbody>
22404 <row>
22405 <entry><option>check_rfc2047_length</option></entry>
22406 <entry>Use: <emphasis>main</emphasis></entry>
22407 <entry>Type: <emphasis>boolean</emphasis></entry>
22408 <entry>Default: <emphasis>true</emphasis></entry>
22409 </row>
22410 </tbody>
22411 </tgroup>
22412 </informaltable>
22413 <para>
22414 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
22415 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
22416 word; strings to be encoded that exceed this length are supposed to use
22417 multiple encoded words. By default, Exim does not recognize encoded words that
22418 exceed the maximum length. However, it seems that some software, in violation
22419 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
22420 set false, Exim recognizes encoded words of any length.
22421 </para>
22422 <para>
22423 <indexterm role="option">
22424 <primary><option>check_spool_inodes</option></primary>
22425 </indexterm>
22426 </para>
22427 <informaltable frame="all">
22428 <tgroup cols="4" colsep="0" rowsep="0">
22429 <colspec colwidth="8*" align="left"/>
22430 <colspec colwidth="6*" align="center"/>
22431 <colspec colwidth="6*" align="center"/>
22432 <colspec colwidth="6*" align="right"/>
22433 <tbody>
22434 <row>
22435 <entry><option>check_spool_inodes</option></entry>
22436 <entry>Use: <emphasis>main</emphasis></entry>
22437 <entry>Type: <emphasis>integer</emphasis></entry>
22438 <entry>Default: <emphasis>0</emphasis></entry>
22439 </row>
22440 </tbody>
22441 </tgroup>
22442 </informaltable>
22443 <para>
22444 See <option>check_spool_space</option> below.
22445 </para>
22446 <para>
22447 <indexterm role="option">
22448 <primary><option>check_spool_space</option></primary>
22449 </indexterm>
22450 </para>
22451 <informaltable frame="all">
22452 <tgroup cols="4" colsep="0" rowsep="0">
22453 <colspec colwidth="8*" align="left"/>
22454 <colspec colwidth="6*" align="center"/>
22455 <colspec colwidth="6*" align="center"/>
22456 <colspec colwidth="6*" align="right"/>
22457 <tbody>
22458 <row>
22459 <entry><option>check_spool_space</option></entry>
22460 <entry>Use: <emphasis>main</emphasis></entry>
22461 <entry>Type: <emphasis>integer</emphasis></entry>
22462 <entry>Default: <emphasis>0</emphasis></entry>
22463 </row>
22464 </tbody>
22465 </tgroup>
22466 </informaltable>
22467 <para>
22468 <indexterm role="concept">
22469 <primary>checking disk space</primary>
22470 </indexterm>
22471 <indexterm role="concept">
22472 <primary>disk space, checking</primary>
22473 </indexterm>
22474 <indexterm role="concept">
22475 <primary>spool directory</primary>
22476 <secondary>checking space</secondary>
22477 </indexterm>
22478 The four <option>check_...</option> options allow for checking of disk resources before a
22479 message is accepted.
22480 </para>
22481 <para>
22482 <indexterm role="variable">
22483 <primary><varname>$log_inodes</varname></primary>
22484 </indexterm>
22485 <indexterm role="variable">
22486 <primary><varname>$log_space</varname></primary>
22487 </indexterm>
22488 <indexterm role="variable">
22489 <primary><varname>$spool_inodes</varname></primary>
22490 </indexterm>
22491 <indexterm role="variable">
22492 <primary><varname>$spool_space</varname></primary>
22493 </indexterm>
22494 When any of these options are set, they apply to all incoming messages. If you
22495 want to apply different checks to different kinds of message, you can do so by
22496 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
22497 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
22498 </para>
22499 <para>
22500 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
22501 either value is greater than zero, for example:
22502 </para>
22503 <literallayout class="monospaced">
22504 check_spool_space = 10M
22505 check_spool_inodes = 100
22506 </literallayout>
22507 <para>
22508 The spool partition is the one that contains the directory defined by
22509 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
22510 transit.
22511 </para>
22512 <para>
22513 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
22514 files are written if either is greater than zero. These should be set only if
22515 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
22516 </para>
22517 <para>
22518 If there is less space or fewer inodes than requested, Exim refuses to accept
22519 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
22520 error response to the MAIL command. If ESMTP is in use and there was a
22521 SIZE parameter on the MAIL command, its value is added to the
22522 <option>check_spool_space</option> value, and the check is performed even if
22523 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
22524 </para>
22525 <para>
22526 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
22527 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
22528 </para>
22529 <para>
22530 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
22531 failure a message is written to stderr and Exim exits with a non-zero code, as
22532 it obviously cannot send an error message of any kind.
22533 </para>
22534 <para>
22535 <indexterm role="option">
22536 <primary><option>daemon_smtp_ports</option></primary>
22537 </indexterm>
22538 </para>
22539 <informaltable frame="all">
22540 <tgroup cols="4" colsep="0" rowsep="0">
22541 <colspec colwidth="8*" align="left"/>
22542 <colspec colwidth="6*" align="center"/>
22543 <colspec colwidth="6*" align="center"/>
22544 <colspec colwidth="6*" align="right"/>
22545 <tbody>
22546 <row>
22547 <entry><option>daemon_smtp_ports</option></entry>
22548 <entry>Use: <emphasis>main</emphasis></entry>
22549 <entry>Type: <emphasis>string</emphasis></entry>
22550 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
22551 </row>
22552 </tbody>
22553 </tgroup>
22554 </informaltable>
22555 <para>
22556 <indexterm role="concept">
22557 <primary>port</primary>
22558 <secondary>for daemon</secondary>
22559 </indexterm>
22560 <indexterm role="concept">
22561 <primary>TCP/IP</primary>
22562 <secondary>setting listening ports</secondary>
22563 </indexterm>
22564 This option specifies one or more default SMTP ports on which the Exim daemon
22565 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
22566 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
22567 </para>
22568 <para>
22569 <indexterm role="option">
22570 <primary><option>daemon_startup_retries</option></primary>
22571 </indexterm>
22572 </para>
22573 <informaltable frame="all">
22574 <tgroup cols="4" colsep="0" rowsep="0">
22575 <colspec colwidth="8*" align="left"/>
22576 <colspec colwidth="6*" align="center"/>
22577 <colspec colwidth="6*" align="center"/>
22578 <colspec colwidth="6*" align="right"/>
22579 <tbody>
22580 <row>
22581 <entry><option>daemon_startup_retries</option></entry>
22582 <entry>Use: <emphasis>main</emphasis></entry>
22583 <entry>Type: <emphasis>integer</emphasis></entry>
22584 <entry>Default: <emphasis>9</emphasis></entry>
22585 </row>
22586 </tbody>
22587 </tgroup>
22588 </informaltable>
22589 <para>
22590 <indexterm role="concept">
22591 <primary>daemon startup, retrying</primary>
22592 </indexterm>
22593 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
22594 the daemon at startup when it cannot immediately bind a listening socket
22595 (typically because the socket is already in use): <option>daemon_startup_retries</option>
22596 defines the number of retries after the first failure, and
22597 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
22598 </para>
22599 <para>
22600 <indexterm role="option">
22601 <primary><option>daemon_startup_sleep</option></primary>
22602 </indexterm>
22603 </para>
22604 <informaltable frame="all">
22605 <tgroup cols="4" colsep="0" rowsep="0">
22606 <colspec colwidth="8*" align="left"/>
22607 <colspec colwidth="6*" align="center"/>
22608 <colspec colwidth="6*" align="center"/>
22609 <colspec colwidth="6*" align="right"/>
22610 <tbody>
22611 <row>
22612 <entry><option>daemon_startup_sleep</option></entry>
22613 <entry>Use: <emphasis>main</emphasis></entry>
22614 <entry>Type: <emphasis>time</emphasis></entry>
22615 <entry>Default: <emphasis>30s</emphasis></entry>
22616 </row>
22617 </tbody>
22618 </tgroup>
22619 </informaltable>
22620 <para>
22621 See <option>daemon_startup_retries</option>.
22622 </para>
22623 <para>
22624 <indexterm role="option">
22625 <primary><option>delay_warning</option></primary>
22626 </indexterm>
22627 </para>
22628 <informaltable frame="all">
22629 <tgroup cols="4" colsep="0" rowsep="0">
22630 <colspec colwidth="8*" align="left"/>
22631 <colspec colwidth="6*" align="center"/>
22632 <colspec colwidth="6*" align="center"/>
22633 <colspec colwidth="6*" align="right"/>
22634 <tbody>
22635 <row>
22636 <entry><option>delay_warning</option></entry>
22637 <entry>Use: <emphasis>main</emphasis></entry>
22638 <entry>Type: <emphasis>time list</emphasis></entry>
22639 <entry>Default: <emphasis>24h</emphasis></entry>
22640 </row>
22641 </tbody>
22642 </tgroup>
22643 </informaltable>
22644 <para>
22645 <indexterm role="concept">
22646 <primary>warning of delay</primary>
22647 </indexterm>
22648 <indexterm role="concept">
22649 <primary>delay warning, specifying</primary>
22650 </indexterm>
22651 When a message is delayed, Exim sends a warning message to the sender at
22652 intervals specified by this option. The data is a colon-separated list of times
22653 after which to send warning messages. If the value of the option is an empty
22654 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
22655 message has been on the queue for longer than the last time, the last interval
22656 between the times is used to compute subsequent warning times. For example,
22657 with
22658 </para>
22659 <literallayout class="monospaced">
22660 delay_warning = 4h:8h:24h
22661 </literallayout>
22662 <para>
22663 the first message is sent after 4 hours, the second after 8 hours, and
22664 the third one after 24 hours. After that, messages are sent every 16 hours,
22665 because that is the interval between the last two times on the list. If you set
22666 just one time, it specifies the repeat interval. For example, with:
22667 </para>
22668 <literallayout class="monospaced">
22669 delay_warning = 6h
22670 </literallayout>
22671 <para>
22672 messages are repeated every six hours. To stop warnings after a given time, set
22673 a very large time at the end of the list. For example:
22674 </para>
22675 <literallayout class="monospaced">
22676 delay_warning = 2h:12h:99d
22677 </literallayout>
22678 <para>
22679 <indexterm role="option">
22680 <primary><option>delay_warning_condition</option></primary>
22681 </indexterm>
22682 </para>
22683 <informaltable frame="all">
22684 <tgroup cols="4" colsep="0" rowsep="0">
22685 <colspec colwidth="8*" align="left"/>
22686 <colspec colwidth="6*" align="center"/>
22687 <colspec colwidth="6*" align="center"/>
22688 <colspec colwidth="6*" align="right"/>
22689 <tbody>
22690 <row>
22691 <entry><option>delay_warning_condition</option></entry>
22692 <entry>Use: <emphasis>main</emphasis></entry>
22693 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22694 <entry>Default: <emphasis>see below</emphasis></entry>
22695 </row>
22696 </tbody>
22697 </tgroup>
22698 </informaltable>
22699 <para>
22700 <indexterm role="variable">
22701 <primary><varname>$domain</varname></primary>
22702 </indexterm>
22703 The string is expanded at the time a warning message might be sent. If all the
22704 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
22705 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
22706 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
22707 <quote>false</quote> (the comparison being done caselessly) then the warning message is
22708 not sent. The default is:
22709 </para>
22710 <literallayout class="monospaced">
22711 delay_warning_condition = ${if or {\
22712   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
22713   { match{$h_precedence:}{(?i)bulk|list|junk} }\
22714   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
22715   } {no}{yes}}
22716 </literallayout>
22717 <para>
22718 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
22719 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
22720 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
22721 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
22722 </para>
22723 <para>
22724 <indexterm role="option">
22725 <primary><option>deliver_drop_privilege</option></primary>
22726 </indexterm>
22727 </para>
22728 <informaltable frame="all">
22729 <tgroup cols="4" colsep="0" rowsep="0">
22730 <colspec colwidth="8*" align="left"/>
22731 <colspec colwidth="6*" align="center"/>
22732 <colspec colwidth="6*" align="center"/>
22733 <colspec colwidth="6*" align="right"/>
22734 <tbody>
22735 <row>
22736 <entry><option>deliver_drop_privilege</option></entry>
22737 <entry>Use: <emphasis>main</emphasis></entry>
22738 <entry>Type: <emphasis>boolean</emphasis></entry>
22739 <entry>Default: <emphasis>false</emphasis></entry>
22740 </row>
22741 </tbody>
22742 </tgroup>
22743 </informaltable>
22744 <para>
22745 <indexterm role="concept">
22746 <primary>unprivileged delivery</primary>
22747 </indexterm>
22748 <indexterm role="concept">
22749 <primary>delivery</primary>
22750 <secondary>unprivileged</secondary>
22751 </indexterm>
22752 If this option is set true, Exim drops its root privilege at the start of a
22753 delivery process, and runs as the Exim user throughout. This severely restricts
22754 the kinds of local delivery that are possible, but is viable in certain types
22755 of configuration. There is a discussion about the use of root privilege in
22756 chapter <xref linkend="CHAPsecurity"/>.
22757 </para>
22758 <para>
22759 <indexterm role="option">
22760 <primary><option>deliver_queue_load_max</option></primary>
22761 </indexterm>
22762 </para>
22763 <informaltable frame="all">
22764 <tgroup cols="4" colsep="0" rowsep="0">
22765 <colspec colwidth="8*" align="left"/>
22766 <colspec colwidth="6*" align="center"/>
22767 <colspec colwidth="6*" align="center"/>
22768 <colspec colwidth="6*" align="right"/>
22769 <tbody>
22770 <row>
22771 <entry><option>deliver_queue_load_max</option></entry>
22772 <entry>Use: <emphasis>main</emphasis></entry>
22773 <entry>Type: <emphasis>fixed-point</emphasis></entry>
22774 <entry>Default: <emphasis>unset</emphasis></entry>
22775 </row>
22776 </tbody>
22777 </tgroup>
22778 </informaltable>
22779 <para>
22780 <indexterm role="concept">
22781 <primary>load average</primary>
22782 </indexterm>
22783 <indexterm role="concept">
22784 <primary>queue runner</primary>
22785 <secondary>abandoning</secondary>
22786 </indexterm>
22787 When this option is set, a queue run is abandoned if the system load average
22788 becomes greater than the value of the option. The option has no effect on
22789 ancient operating systems on which Exim cannot determine the load average.
22790 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
22791 </para>
22792 <para>
22793 <indexterm role="option">
22794 <primary><option>delivery_date_remove</option></primary>
22795 </indexterm>
22796 </para>
22797 <informaltable frame="all">
22798 <tgroup cols="4" colsep="0" rowsep="0">
22799 <colspec colwidth="8*" align="left"/>
22800 <colspec colwidth="6*" align="center"/>
22801 <colspec colwidth="6*" align="center"/>
22802 <colspec colwidth="6*" align="right"/>
22803 <tbody>
22804 <row>
22805 <entry><option>delivery_date_remove</option></entry>
22806 <entry>Use: <emphasis>main</emphasis></entry>
22807 <entry>Type: <emphasis>boolean</emphasis></entry>
22808 <entry>Default: <emphasis>true</emphasis></entry>
22809 </row>
22810 </tbody>
22811 </tgroup>
22812 </informaltable>
22813 <para>
22814 <indexterm role="concept">
22815 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
22816 </indexterm>
22817 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
22818 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22819 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
22820 should not be present in incoming messages, and this option causes them to be
22821 removed at the time the message is received, to avoid any problems that might
22822 occur when a delivered message is subsequently sent on to some other recipient.
22823 </para>
22824 <para>
22825 <indexterm role="option">
22826 <primary><option>disable_fsync</option></primary>
22827 </indexterm>
22828 </para>
22829 <informaltable frame="all">
22830 <tgroup cols="4" colsep="0" rowsep="0">
22831 <colspec colwidth="8*" align="left"/>
22832 <colspec colwidth="6*" align="center"/>
22833 <colspec colwidth="6*" align="center"/>
22834 <colspec colwidth="6*" align="right"/>
22835 <tbody>
22836 <row>
22837 <entry><option>disable_fsync</option></entry>
22838 <entry>Use: <emphasis>main</emphasis></entry>
22839 <entry>Type: <emphasis>boolean</emphasis></entry>
22840 <entry>Default: <emphasis>false</emphasis></entry>
22841 </row>
22842 </tbody>
22843 </tgroup>
22844 </informaltable>
22845 <para>
22846 <indexterm role="concept">
22847 <primary><function>fsync()</function>, disabling</primary>
22848 </indexterm>
22849 This option is available only if Exim was built with the compile-time option
22850 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
22851 a runtime configuration generates an <quote>unknown option</quote> error. You should not
22852 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
22853 really, really, really understand what you are doing. <emphasis>No pre-compiled
22854 distributions of Exim should ever make this option available.</emphasis>
22855 </para>
22856 <para>
22857 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
22858 updated files&#x2019; data to be written to disc before continuing. Unexpected events
22859 such as crashes and power outages may cause data to be lost or scrambled.
22860 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
22861 </para>
22862 <para>
22863 <indexterm role="option">
22864 <primary><option>disable_ipv6</option></primary>
22865 </indexterm>
22866 </para>
22867 <informaltable frame="all">
22868 <tgroup cols="4" colsep="0" rowsep="0">
22869 <colspec colwidth="8*" align="left"/>
22870 <colspec colwidth="6*" align="center"/>
22871 <colspec colwidth="6*" align="center"/>
22872 <colspec colwidth="6*" align="right"/>
22873 <tbody>
22874 <row>
22875 <entry><option>disable_ipv6</option></entry>
22876 <entry>Use: <emphasis>main</emphasis></entry>
22877 <entry>Type: <emphasis>boolean</emphasis></entry>
22878 <entry>Default: <emphasis>false</emphasis></entry>
22879 </row>
22880 </tbody>
22881 </tgroup>
22882 </informaltable>
22883 <para>
22884 <indexterm role="concept">
22885 <primary>IPv6</primary>
22886 <secondary>disabling</secondary>
22887 </indexterm>
22888 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
22889 activities take place. AAAA records are never looked up, and any IPv6 addresses
22890 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
22891 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22892 to handle IPv6 literal addresses.
22893 </para>
22894 <para>
22895 <indexterm role="option">
22896 <primary><option>dns_again_means_nonexist</option></primary>
22897 </indexterm>
22898 </para>
22899 <informaltable frame="all">
22900 <tgroup cols="4" colsep="0" rowsep="0">
22901 <colspec colwidth="8*" align="left"/>
22902 <colspec colwidth="6*" align="center"/>
22903 <colspec colwidth="6*" align="center"/>
22904 <colspec colwidth="6*" align="right"/>
22905 <tbody>
22906 <row>
22907 <entry><option>dns_again_means_nonexist</option></entry>
22908 <entry>Use: <emphasis>main</emphasis></entry>
22909 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22910 <entry>Default: <emphasis>unset</emphasis></entry>
22911 </row>
22912 </tbody>
22913 </tgroup>
22914 </informaltable>
22915 <para>
22916 <indexterm role="concept">
22917 <primary>DNS</primary>
22918 <secondary><quote>try again</quote> response; overriding</secondary>
22919 </indexterm>
22920 DNS lookups give a <quote>try again</quote> response for the DNS errors
22921 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22922 keep trying to deliver a message, or to give repeated temporary errors to
22923 incoming mail. Sometimes the effect is caused by a badly set up name server and
22924 may persist for a long time. If a domain which exhibits this problem matches
22925 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22926 This option should be used with care. You can make it apply to reverse lookups
22927 by a setting such as this:
22928 </para>
22929 <literallayout class="monospaced">
22930 dns_again_means_nonexist = *.in-addr.arpa
22931 </literallayout>
22932 <para>
22933 This option applies to all DNS lookups that Exim does. It also applies when the
22934 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22935 since these are most likely to be caused by DNS lookup problems. The
22936 <command>dnslookup</command> router has some options of its own for controlling what happens
22937 when lookups for MX or SRV records give temporary errors. These more specific
22938 options are applied after this global option.
22939 </para>
22940 <para>
22941 <indexterm role="option">
22942 <primary><option>dns_check_names_pattern</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>dns_check_names_pattern</option></entry>
22954 <entry>Use: <emphasis>main</emphasis></entry>
22955 <entry>Type: <emphasis>string</emphasis></entry>
22956 <entry>Default: <emphasis>see below</emphasis></entry>
22957 </row>
22958 </tbody>
22959 </tgroup>
22960 </informaltable>
22961 <para>
22962 <indexterm role="concept">
22963 <primary>DNS</primary>
22964 <secondary>pre-check of name syntax</secondary>
22965 </indexterm>
22966 When this option is set to a non-empty string, it causes Exim to check domain
22967 names for characters that are not allowed in host names before handing them to
22968 the DNS resolver, because some resolvers give temporary errors for names that
22969 contain unusual characters. If a domain name contains any unwanted characters,
22970 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22971 done by matching the domain name against a regular expression, which is the
22972 value of this option. The default pattern is
22973 </para>
22974 <literallayout class="monospaced">
22975 dns_check_names_pattern = \
22976   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
22977 </literallayout>
22978 <para>
22979 which permits only letters, digits, slashes, and hyphens in components, but
22980 they must start and end with a letter or digit. Slashes are not, in fact,
22981 permitted in host names, but they are found in certain NS records (which can be
22982 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22983 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22984 empty string.
22985 </para>
22986 <para>
22987 <indexterm role="option">
22988 <primary><option>dns_csa_search_limit</option></primary>
22989 </indexterm>
22990 </para>
22991 <informaltable frame="all">
22992 <tgroup cols="4" colsep="0" rowsep="0">
22993 <colspec colwidth="8*" align="left"/>
22994 <colspec colwidth="6*" align="center"/>
22995 <colspec colwidth="6*" align="center"/>
22996 <colspec colwidth="6*" align="right"/>
22997 <tbody>
22998 <row>
22999 <entry><option>dns_csa_search_limit</option></entry>
23000 <entry>Use: <emphasis>main</emphasis></entry>
23001 <entry>Type: <emphasis>integer</emphasis></entry>
23002 <entry>Default: <emphasis>5</emphasis></entry>
23003 </row>
23004 </tbody>
23005 </tgroup>
23006 </informaltable>
23007 <para>
23008 This option controls the depth of parental searching for CSA SRV records in the
23009 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
23010 </para>
23011 <para>
23012 <indexterm role="option">
23013 <primary><option>dns_csa_use_reverse</option></primary>
23014 </indexterm>
23015 </para>
23016 <informaltable frame="all">
23017 <tgroup cols="4" colsep="0" rowsep="0">
23018 <colspec colwidth="8*" align="left"/>
23019 <colspec colwidth="6*" align="center"/>
23020 <colspec colwidth="6*" align="center"/>
23021 <colspec colwidth="6*" align="right"/>
23022 <tbody>
23023 <row>
23024 <entry><option>dns_csa_use_reverse</option></entry>
23025 <entry>Use: <emphasis>main</emphasis></entry>
23026 <entry>Type: <emphasis>boolean</emphasis></entry>
23027 <entry>Default: <emphasis>true</emphasis></entry>
23028 </row>
23029 </tbody>
23030 </tgroup>
23031 </informaltable>
23032 <para>
23033 This option controls whether or not an IP address, given as a CSA domain, is
23034 reversed and looked up in the reverse DNS, as described in more detail in
23035 section <xref linkend="SECTverifyCSA"/>.
23036 </para>
23037 <para>
23038 <indexterm role="option">
23039 <primary><option>dns_ipv4_lookup</option></primary>
23040 </indexterm>
23041 </para>
23042 <informaltable frame="all">
23043 <tgroup cols="4" colsep="0" rowsep="0">
23044 <colspec colwidth="8*" align="left"/>
23045 <colspec colwidth="6*" align="center"/>
23046 <colspec colwidth="6*" align="center"/>
23047 <colspec colwidth="6*" align="right"/>
23048 <tbody>
23049 <row>
23050 <entry><option>dns_ipv4_lookup</option></entry>
23051 <entry>Use: <emphasis>main</emphasis></entry>
23052 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23053 <entry>Default: <emphasis>unset</emphasis></entry>
23054 </row>
23055 </tbody>
23056 </tgroup>
23057 </informaltable>
23058 <para>
23059 <indexterm role="concept">
23060 <primary>IPv6</primary>
23061 <secondary>DNS lookup for AAAA records</secondary>
23062 </indexterm>
23063 <indexterm role="concept">
23064 <primary>DNS</primary>
23065 <secondary>IPv6 lookup for AAAA records</secondary>
23066 </indexterm>
23067 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
23068 looks for IPv6 address records (AAAA records) as well as IPv4 address records
23069 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
23070 domain matches this list.
23071 </para>
23072 <para>
23073 This is a fudge to help with name servers that give big delays or otherwise do
23074 not work for the AAAA record type. In due course, when the world&#x2019;s name
23075 servers have all been upgraded, there should be no need for this option.
23076 </para>
23077 <para>
23078 <indexterm role="option">
23079 <primary><option>dns_retrans</option></primary>
23080 </indexterm>
23081 </para>
23082 <informaltable frame="all">
23083 <tgroup cols="4" colsep="0" rowsep="0">
23084 <colspec colwidth="8*" align="left"/>
23085 <colspec colwidth="6*" align="center"/>
23086 <colspec colwidth="6*" align="center"/>
23087 <colspec colwidth="6*" align="right"/>
23088 <tbody>
23089 <row>
23090 <entry><option>dns_retrans</option></entry>
23091 <entry>Use: <emphasis>main</emphasis></entry>
23092 <entry>Type: <emphasis>time</emphasis></entry>
23093 <entry>Default: <emphasis>0s</emphasis></entry>
23094 </row>
23095 </tbody>
23096 </tgroup>
23097 </informaltable>
23098 <para>
23099 <indexterm role="concept">
23100 <primary>DNS</primary>
23101 <secondary>resolver options</secondary>
23102 </indexterm>
23103 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
23104 retransmission and retry parameters for DNS lookups. Values of zero (the
23105 defaults) leave the system default settings unchanged. The first value is the
23106 time between retries, and the second is the number of retries. It isn&#x2019;t
23107 totally clear exactly how these settings affect the total time a DNS lookup may
23108 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
23109 parameter values are available in the external resolver interface structure,
23110 but nowhere does it seem to describe how they are used or what you might want
23111 to set in them.
23112 </para>
23113 <para>
23114 <indexterm role="option">
23115 <primary><option>dns_retry</option></primary>
23116 </indexterm>
23117 </para>
23118 <informaltable frame="all">
23119 <tgroup cols="4" colsep="0" rowsep="0">
23120 <colspec colwidth="8*" align="left"/>
23121 <colspec colwidth="6*" align="center"/>
23122 <colspec colwidth="6*" align="center"/>
23123 <colspec colwidth="6*" align="right"/>
23124 <tbody>
23125 <row>
23126 <entry><option>dns_retry</option></entry>
23127 <entry>Use: <emphasis>main</emphasis></entry>
23128 <entry>Type: <emphasis>integer</emphasis></entry>
23129 <entry>Default: <emphasis>0</emphasis></entry>
23130 </row>
23131 </tbody>
23132 </tgroup>
23133 </informaltable>
23134 <para>
23135 See <option>dns_retrans</option> above.
23136 </para>
23137 <para revisionflag="changed">
23138 <indexterm role="option">
23139 <primary><option>dns_use_dnssec</option></primary>
23140 </indexterm>
23141 </para>
23142 <informaltable frame="all" revisionflag="changed">
23143 <tgroup cols="4" colsep="0" rowsep="0">
23144 <colspec colwidth="8*" align="left"/>
23145 <colspec colwidth="6*" align="center"/>
23146 <colspec colwidth="6*" align="center"/>
23147 <colspec colwidth="6*" align="right"/>
23148 <tbody>
23149 <row>
23150 <entry><option>dns_use_dnssec</option></entry>
23151 <entry>Use: <emphasis>main</emphasis></entry>
23152 <entry>Type: <emphasis>integer</emphasis></entry>
23153 <entry>Default: <emphasis>-1</emphasis></entry>
23154 </row>
23155 </tbody>
23156 </tgroup>
23157 </informaltable>
23158 <para revisionflag="changed">
23159 <indexterm role="concept">
23160 <primary>DNS</primary>
23161 <secondary>resolver options</secondary>
23162 </indexterm>
23163 <indexterm role="concept">
23164 <primary>DNS</primary>
23165 <secondary>DNSSEC</secondary>
23166 </indexterm>
23167 If this option is set to a non-negative number then Exim will initialise the
23168 DNS resolver library to either use or not use DNSSEC, overriding the system
23169 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
23170 </para>
23171 <para revisionflag="changed">
23172 If the resolver library does not support DNSSEC then this option has no effect.
23173 </para>
23174 <para>
23175 <indexterm role="option">
23176 <primary><option>dns_use_edns0</option></primary>
23177 </indexterm>
23178 </para>
23179 <informaltable frame="all">
23180 <tgroup cols="4" colsep="0" rowsep="0">
23181 <colspec colwidth="8*" align="left"/>
23182 <colspec colwidth="6*" align="center"/>
23183 <colspec colwidth="6*" align="center"/>
23184 <colspec colwidth="6*" align="right"/>
23185 <tbody>
23186 <row>
23187 <entry><option>dns_use_edns0</option></entry>
23188 <entry>Use: <emphasis>main</emphasis></entry>
23189 <entry>Type: <emphasis>integer</emphasis></entry>
23190 <entry>Default: <emphasis>-1</emphasis></entry>
23191 </row>
23192 </tbody>
23193 </tgroup>
23194 </informaltable>
23195 <para>
23196 <indexterm role="concept">
23197 <primary>DNS</primary>
23198 <secondary>resolver options</secondary>
23199 </indexterm>
23200 <indexterm role="concept">
23201 <primary>DNS</primary>
23202 <secondary>EDNS0</secondary>
23203 </indexterm>
23204 If this option is set to a non-negative number then Exim will initialise the
23205 DNS resolver library to either use or not use EDNS0 extensions, overriding
23206 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
23207 on.
23208 </para>
23209 <para>
23210 If the resolver library does not support EDNS0 then this option has no effect.
23211 </para>
23212 <para>
23213 <indexterm role="option">
23214 <primary><option>drop_cr</option></primary>
23215 </indexterm>
23216 </para>
23217 <informaltable frame="all">
23218 <tgroup cols="4" colsep="0" rowsep="0">
23219 <colspec colwidth="8*" align="left"/>
23220 <colspec colwidth="6*" align="center"/>
23221 <colspec colwidth="6*" align="center"/>
23222 <colspec colwidth="6*" align="right"/>
23223 <tbody>
23224 <row>
23225 <entry><option>drop_cr</option></entry>
23226 <entry>Use: <emphasis>main</emphasis></entry>
23227 <entry>Type: <emphasis>boolean</emphasis></entry>
23228 <entry>Default: <emphasis>false</emphasis></entry>
23229 </row>
23230 </tbody>
23231 </tgroup>
23232 </informaltable>
23233 <para>
23234 This is an obsolete option that is now a no-op. It used to affect the way Exim
23235 handled CR and LF characters in incoming messages. What happens now is
23236 described in section <xref linkend="SECTlineendings"/>.
23237 </para>
23238 <para>
23239 <indexterm role="option">
23240 <primary><option>dsn_from</option></primary>
23241 </indexterm>
23242 </para>
23243 <informaltable frame="all">
23244 <tgroup cols="4" colsep="0" rowsep="0">
23245 <colspec colwidth="8*" align="left"/>
23246 <colspec colwidth="6*" align="center"/>
23247 <colspec colwidth="6*" align="center"/>
23248 <colspec colwidth="6*" align="right"/>
23249 <tbody>
23250 <row>
23251 <entry><option>dsn_from</option></entry>
23252 <entry>Use: <emphasis>main</emphasis></entry>
23253 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23254 <entry>Default: <emphasis>see below</emphasis></entry>
23255 </row>
23256 </tbody>
23257 </tgroup>
23258 </informaltable>
23259 <para>
23260 <indexterm role="concept">
23261 <primary><emphasis>From:</emphasis> header line</primary>
23262 <secondary>in bounces</secondary>
23263 </indexterm>
23264 <indexterm role="concept">
23265 <primary>bounce messages</primary>
23266 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
23267 </indexterm>
23268 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
23269 bounces and other automatically generated messages (<quote>Delivery Status
23270 Notifications</quote> &ndash; hence the name of the option). The default setting is:
23271 </para>
23272 <literallayout class="monospaced">
23273 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
23274 </literallayout>
23275 <para>
23276 The value is expanded every time it is needed. If the expansion fails, a
23277 panic is logged, and the default value is used.
23278 </para>
23279 <para>
23280 <indexterm role="option">
23281 <primary><option>envelope_to_remove</option></primary>
23282 </indexterm>
23283 </para>
23284 <informaltable frame="all">
23285 <tgroup cols="4" colsep="0" rowsep="0">
23286 <colspec colwidth="8*" align="left"/>
23287 <colspec colwidth="6*" align="center"/>
23288 <colspec colwidth="6*" align="center"/>
23289 <colspec colwidth="6*" align="right"/>
23290 <tbody>
23291 <row>
23292 <entry><option>envelope_to_remove</option></entry>
23293 <entry>Use: <emphasis>main</emphasis></entry>
23294 <entry>Type: <emphasis>boolean</emphasis></entry>
23295 <entry>Default: <emphasis>true</emphasis></entry>
23296 </row>
23297 </tbody>
23298 </tgroup>
23299 </informaltable>
23300 <para>
23301 <indexterm role="concept">
23302 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
23303 </indexterm>
23304 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
23305 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
23306 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
23307 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
23308 be present in incoming messages, and this option causes them to be removed at
23309 the time the message is received, to avoid any problems that might occur when a
23310 delivered message is subsequently sent on to some other recipient.
23311 </para>
23312 <para>
23313 <indexterm role="option">
23314 <primary><option>errors_copy</option></primary>
23315 </indexterm>
23316 </para>
23317 <informaltable frame="all">
23318 <tgroup cols="4" colsep="0" rowsep="0">
23319 <colspec colwidth="8*" align="left"/>
23320 <colspec colwidth="6*" align="center"/>
23321 <colspec colwidth="6*" align="center"/>
23322 <colspec colwidth="6*" align="right"/>
23323 <tbody>
23324 <row>
23325 <entry><option>errors_copy</option></entry>
23326 <entry>Use: <emphasis>main</emphasis></entry>
23327 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23328 <entry>Default: <emphasis>unset</emphasis></entry>
23329 </row>
23330 </tbody>
23331 </tgroup>
23332 </informaltable>
23333 <para>
23334 <indexterm role="concept">
23335 <primary>bounce message</primary>
23336 <secondary>copy to other address</secondary>
23337 </indexterm>
23338 <indexterm role="concept">
23339 <primary>copy of bounce message</primary>
23340 </indexterm>
23341 Setting this option causes Exim to send bcc copies of bounce messages that it
23342 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
23343 coming from elsewhere. The value of the option is a colon-separated list of
23344 items. Each item consists of a pattern, terminated by white space, followed by
23345 a comma-separated list of email addresses. If a pattern contains spaces, it
23346 must be enclosed in double quotes.
23347 </para>
23348 <para>
23349 Each pattern is processed in the same way as a single item in an address list
23350 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
23351 the bounce message, the message is copied to the addresses on the list. The
23352 items are scanned in order, and once a matching one is found, no further items
23353 are examined. For example:
23354 </para>
23355 <literallayout class="monospaced">
23356 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
23357               rqps@mydomain   hostmaster@mydomain.example,\
23358                               postmaster@mydomain.example
23359 </literallayout>
23360 <para>
23361 <indexterm role="variable">
23362 <primary><varname>$domain</varname></primary>
23363 </indexterm>
23364 <indexterm role="variable">
23365 <primary><varname>$local_part</varname></primary>
23366 </indexterm>
23367 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
23368 and <varname>$domain</varname> are set from the original recipient of the error message, and if
23369 there was any wildcard matching in the pattern, the expansion
23370 <indexterm role="concept">
23371 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23372 <secondary>in <option>errors_copy</option></secondary>
23373 </indexterm>
23374 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
23375 </para>
23376 <para>
23377 <indexterm role="option">
23378 <primary><option>errors_reply_to</option></primary>
23379 </indexterm>
23380 </para>
23381 <informaltable frame="all">
23382 <tgroup cols="4" colsep="0" rowsep="0">
23383 <colspec colwidth="8*" align="left"/>
23384 <colspec colwidth="6*" align="center"/>
23385 <colspec colwidth="6*" align="center"/>
23386 <colspec colwidth="6*" align="right"/>
23387 <tbody>
23388 <row>
23389 <entry><option>errors_reply_to</option></entry>
23390 <entry>Use: <emphasis>main</emphasis></entry>
23391 <entry>Type: <emphasis>string</emphasis></entry>
23392 <entry>Default: <emphasis>unset</emphasis></entry>
23393 </row>
23394 </tbody>
23395 </tgroup>
23396 </informaltable>
23397 <para>
23398 <indexterm role="concept">
23399 <primary>bounce message</primary>
23400 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
23401 </indexterm>
23402 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
23403 </para>
23404 <literallayout>
23405 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
23406 </literallayout>
23407 <para>
23408 <indexterm role="option">
23409 <primary><option>quota_warn_message</option></primary>
23410 </indexterm>
23411 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
23412 A warning message that is generated by the <option>quota_warn_message</option> option in an
23413 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
23414 overrides the default.
23415 </para>
23416 <para>
23417 Experience shows that people reply to bounce messages. If the
23418 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
23419 and warning messages. For example:
23420 </para>
23421 <literallayout class="monospaced">
23422 errors_reply_to = postmaster@my.domain.example
23423 </literallayout>
23424 <para>
23425 The value of the option is not expanded. It must specify a valid RFC 2822
23426 address. However, if a warning message that is generated by the
23427 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
23428 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
23429 not used.
23430 </para>
23431 <para>
23432 <indexterm role="option">
23433 <primary><option>exim_group</option></primary>
23434 </indexterm>
23435 </para>
23436 <informaltable frame="all">
23437 <tgroup cols="4" colsep="0" rowsep="0">
23438 <colspec colwidth="8*" align="left"/>
23439 <colspec colwidth="6*" align="center"/>
23440 <colspec colwidth="6*" align="center"/>
23441 <colspec colwidth="6*" align="right"/>
23442 <tbody>
23443 <row>
23444 <entry><option>exim_group</option></entry>
23445 <entry>Use: <emphasis>main</emphasis></entry>
23446 <entry>Type: <emphasis>string</emphasis></entry>
23447 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23448 </row>
23449 </tbody>
23450 </tgroup>
23451 </informaltable>
23452 <para>
23453 <indexterm role="concept">
23454 <primary>gid (group id)</primary>
23455 <secondary>Exim&#x2019;s own</secondary>
23456 </indexterm>
23457 <indexterm role="concept">
23458 <primary>Exim group</primary>
23459 </indexterm>
23460 This option changes the gid under which Exim runs when it gives up root
23461 privilege. The default value is compiled into the binary. The value of this
23462 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
23463 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
23464 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
23465 security issues.
23466 </para>
23467 <para>
23468 <indexterm role="option">
23469 <primary><option>exim_path</option></primary>
23470 </indexterm>
23471 </para>
23472 <informaltable frame="all">
23473 <tgroup cols="4" colsep="0" rowsep="0">
23474 <colspec colwidth="8*" align="left"/>
23475 <colspec colwidth="6*" align="center"/>
23476 <colspec colwidth="6*" align="center"/>
23477 <colspec colwidth="6*" align="right"/>
23478 <tbody>
23479 <row>
23480 <entry><option>exim_path</option></entry>
23481 <entry>Use: <emphasis>main</emphasis></entry>
23482 <entry>Type: <emphasis>string</emphasis></entry>
23483 <entry>Default: <emphasis>see below</emphasis></entry>
23484 </row>
23485 </tbody>
23486 </tgroup>
23487 </informaltable>
23488 <para>
23489 <indexterm role="concept">
23490 <primary>Exim binary, path name</primary>
23491 </indexterm>
23492 This option specifies the path name of the Exim binary, which is used when Exim
23493 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
23494 the directory configured at compile time by the BIN_DIRECTORY setting. It
23495 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
23496 other place.
23497 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
23498 you will break those Exim utilities that scan the configuration file to find
23499 where the binary is. (They then use the <option>-bP</option> option to extract option
23500 settings such as the value of <option>spool_directory</option>.)
23501 </para>
23502 <para>
23503 <indexterm role="option">
23504 <primary><option>exim_user</option></primary>
23505 </indexterm>
23506 </para>
23507 <informaltable frame="all">
23508 <tgroup cols="4" colsep="0" rowsep="0">
23509 <colspec colwidth="8*" align="left"/>
23510 <colspec colwidth="6*" align="center"/>
23511 <colspec colwidth="6*" align="center"/>
23512 <colspec colwidth="6*" align="right"/>
23513 <tbody>
23514 <row>
23515 <entry><option>exim_user</option></entry>
23516 <entry>Use: <emphasis>main</emphasis></entry>
23517 <entry>Type: <emphasis>string</emphasis></entry>
23518 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
23519 </row>
23520 </tbody>
23521 </tgroup>
23522 </informaltable>
23523 <para>
23524 <indexterm role="concept">
23525 <primary>uid (user id)</primary>
23526 <secondary>Exim&#x2019;s own</secondary>
23527 </indexterm>
23528 <indexterm role="concept">
23529 <primary>Exim user</primary>
23530 </indexterm>
23531 This option changes the uid under which Exim runs when it gives up root
23532 privilege. The default value is compiled into the binary. Ownership of the run
23533 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
23534 options is checked against the values in the binary, not what is set here.
23535 </para>
23536 <para>
23537 Unless it consists entirely of digits, the string is looked up using
23538 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
23539 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
23540 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
23541 </para>
23542 <para>
23543 <indexterm role="option">
23544 <primary><option>extra_local_interfaces</option></primary>
23545 </indexterm>
23546 </para>
23547 <informaltable frame="all">
23548 <tgroup cols="4" colsep="0" rowsep="0">
23549 <colspec colwidth="8*" align="left"/>
23550 <colspec colwidth="6*" align="center"/>
23551 <colspec colwidth="6*" align="center"/>
23552 <colspec colwidth="6*" align="right"/>
23553 <tbody>
23554 <row>
23555 <entry><option>extra_local_interfaces</option></entry>
23556 <entry>Use: <emphasis>main</emphasis></entry>
23557 <entry>Type: <emphasis>string list</emphasis></entry>
23558 <entry>Default: <emphasis>unset</emphasis></entry>
23559 </row>
23560 </tbody>
23561 </tgroup>
23562 </informaltable>
23563 <para>
23564 This option defines network interfaces that are to be considered local when
23565 routing, but which are not used for listening by the daemon. See section
23566 <xref linkend="SECTreclocipadd"/> for details.
23567 </para>
23568 <para>
23569 <indexterm role="option">
23570 <primary><option>extract_addresses_remove_arguments</option></primary>
23571 </indexterm>
23572 </para>
23573 <informaltable frame="all">
23574 <tgroup cols="4" colsep="0" rowsep="0">
23575 <colspec colwidth="8*" align="left"/>
23576 <colspec colwidth="6*" align="center"/>
23577 <colspec colwidth="6*" align="center"/>
23578 <colspec colwidth="6*" align="right"/>
23579 <tbody>
23580 <row>
23581 <entry><option>extract_addresses_remove_ &nbsp;&nbsp;arguments</option></entry>
23582 <entry>Use: <emphasis>main</emphasis></entry>
23583 <entry>Type: <emphasis>boolean</emphasis></entry>
23584 <entry>Default: <emphasis>true</emphasis></entry>
23585 </row>
23586 </tbody>
23587 </tgroup>
23588 </informaltable>
23589 <para>
23590 <indexterm role="option">
23591 <primary><option>-t</option></primary>
23592 </indexterm>
23593 <indexterm role="concept">
23594 <primary>command line</primary>
23595 <secondary>addresses with <option>-t</option></secondary>
23596 </indexterm>
23597 <indexterm role="concept">
23598 <primary>Sendmail compatibility</primary>
23599 <secondary><option>-t</option> option</secondary>
23600 </indexterm>
23601 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
23602 are present on the command line when the <option>-t</option> option is used to build an
23603 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
23604 line addresses are removed from the recipients list. This is also how Smail
23605 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
23606 command line addresses are added to those obtained from the header lines. When
23607 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
23608 argument headers. If it is set false, Exim adds rather than removes argument
23609 addresses.
23610 </para>
23611 <para>
23612 <indexterm role="option">
23613 <primary><option>finduser_retries</option></primary>
23614 </indexterm>
23615 </para>
23616 <informaltable frame="all">
23617 <tgroup cols="4" colsep="0" rowsep="0">
23618 <colspec colwidth="8*" align="left"/>
23619 <colspec colwidth="6*" align="center"/>
23620 <colspec colwidth="6*" align="center"/>
23621 <colspec colwidth="6*" align="right"/>
23622 <tbody>
23623 <row>
23624 <entry><option>finduser_retries</option></entry>
23625 <entry>Use: <emphasis>main</emphasis></entry>
23626 <entry>Type: <emphasis>integer</emphasis></entry>
23627 <entry>Default: <emphasis>0</emphasis></entry>
23628 </row>
23629 </tbody>
23630 </tgroup>
23631 </informaltable>
23632 <para>
23633 <indexterm role="concept">
23634 <primary>NIS, retrying user lookups</primary>
23635 </indexterm>
23636 On systems running NIS or other schemes in which user and group information is
23637 distributed from a remote system, there can be times when <function>getpwnam()</function> and
23638 related functions fail, even when given valid data, because things time out.
23639 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
23640 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
23641 many extra times to find a user or a group, waiting for one second between
23642 retries.
23643 </para>
23644 <para>
23645 <indexterm role="concept">
23646 <primary><filename>/etc/passwd</filename></primary>
23647 <secondary>multiple reading of</secondary>
23648 </indexterm>
23649 You should not set this option greater than zero if your user information is in
23650 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
23651 search the file multiple times for non-existent users, and also cause delay.
23652 </para>
23653 <para>
23654 <indexterm role="option">
23655 <primary><option>freeze_tell</option></primary>
23656 </indexterm>
23657 </para>
23658 <informaltable frame="all">
23659 <tgroup cols="4" colsep="0" rowsep="0">
23660 <colspec colwidth="8*" align="left"/>
23661 <colspec colwidth="6*" align="center"/>
23662 <colspec colwidth="6*" align="center"/>
23663 <colspec colwidth="6*" align="right"/>
23664 <tbody>
23665 <row>
23666 <entry><option>freeze_tell</option></entry>
23667 <entry>Use: <emphasis>main</emphasis></entry>
23668 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
23669 <entry>Default: <emphasis>unset</emphasis></entry>
23670 </row>
23671 </tbody>
23672 </tgroup>
23673 </informaltable>
23674 <para>
23675 <indexterm role="concept">
23676 <primary>freezing messages</primary>
23677 <secondary>sending a message when freezing</secondary>
23678 </indexterm>
23679 On encountering certain errors, or when configured to do so in a system filter,
23680 ACL, or special router, Exim freezes a message. This means that no further
23681 delivery attempts take place until an administrator thaws the message, or the
23682 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
23683 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
23684 warning message whenever it freezes something, unless the message it is
23685 freezing is a locally-generated bounce message. (Without this exception there
23686 is the possibility of looping.) The warning message is sent to the addresses
23687 supplied as the comma-separated value of this option. If several of the
23688 message&#x2019;s addresses cause freezing, only a single message is sent. If the
23689 freezing was automatic, the reason(s) for freezing can be found in the message
23690 log. If you configure freezing in a filter or ACL, you must arrange for any
23691 logging that you require.
23692 </para>
23693 <para>
23694 <indexterm role="option">
23695 <primary><option>gecos_name</option></primary>
23696 </indexterm>
23697 </para>
23698 <informaltable frame="all">
23699 <tgroup cols="4" colsep="0" rowsep="0">
23700 <colspec colwidth="8*" align="left"/>
23701 <colspec colwidth="6*" align="center"/>
23702 <colspec colwidth="6*" align="center"/>
23703 <colspec colwidth="6*" align="right"/>
23704 <tbody>
23705 <row>
23706 <entry><option>gecos_name</option></entry>
23707 <entry>Use: <emphasis>main</emphasis></entry>
23708 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23709 <entry>Default: <emphasis>unset</emphasis></entry>
23710 </row>
23711 </tbody>
23712 </tgroup>
23713 </informaltable>
23714 <para>
23715 <indexterm role="concept">
23716 <primary>HP-UX</primary>
23717 </indexterm>
23718 <indexterm role="concept">
23719 <primary><quote>gecos</quote> field, parsing</primary>
23720 </indexterm>
23721 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
23722 password file to hold other information in addition to users&#x2019; real names. Exim
23723 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
23724 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
23725 of the field are used unchanged, except that, if an ampersand is encountered,
23726 it is replaced by the user&#x2019;s login name with the first character forced to
23727 upper case, since this is a convention that is observed on many systems.
23728 </para>
23729 <para>
23730 When these options are set, <option>gecos_pattern</option> is treated as a regular
23731 expression that is to be applied to the field (again with &amp; replaced by the
23732 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
23733 user&#x2019;s name.
23734 </para>
23735 <para>
23736 <indexterm role="concept">
23737 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
23738 <secondary>in <option>gecos_name</option></secondary>
23739 </indexterm>
23740 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
23741 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
23742 name terminates at the first comma, the following can be used:
23743 </para>
23744 <literallayout class="monospaced">
23745 gecos_pattern = ([^,]*)
23746 gecos_name = $1
23747 </literallayout>
23748 <para>
23749 <indexterm role="option">
23750 <primary><option>gecos_pattern</option></primary>
23751 </indexterm>
23752 </para>
23753 <informaltable frame="all">
23754 <tgroup cols="4" colsep="0" rowsep="0">
23755 <colspec colwidth="8*" align="left"/>
23756 <colspec colwidth="6*" align="center"/>
23757 <colspec colwidth="6*" align="center"/>
23758 <colspec colwidth="6*" align="right"/>
23759 <tbody>
23760 <row>
23761 <entry><option>gecos_pattern</option></entry>
23762 <entry>Use: <emphasis>main</emphasis></entry>
23763 <entry>Type: <emphasis>string</emphasis></entry>
23764 <entry>Default: <emphasis>unset</emphasis></entry>
23765 </row>
23766 </tbody>
23767 </tgroup>
23768 </informaltable>
23769 <para>
23770 See <option>gecos_name</option> above.
23771 </para>
23772 <para>
23773 <indexterm role="option">
23774 <primary><option>gnutls_compat_mode</option></primary>
23775 </indexterm>
23776 </para>
23777 <informaltable frame="all">
23778 <tgroup cols="4" colsep="0" rowsep="0">
23779 <colspec colwidth="8*" align="left"/>
23780 <colspec colwidth="6*" align="center"/>
23781 <colspec colwidth="6*" align="center"/>
23782 <colspec colwidth="6*" align="right"/>
23783 <tbody>
23784 <row>
23785 <entry><option>gnutls_compat_mode</option></entry>
23786 <entry>Use: <emphasis>main</emphasis></entry>
23787 <entry>Type: <emphasis>boolean</emphasis></entry>
23788 <entry>Default: <emphasis>unset</emphasis></entry>
23789 </row>
23790 </tbody>
23791 </tgroup>
23792 </informaltable>
23793 <para>
23794 This option controls whether GnuTLS is used in compatibility mode in an Exim
23795 server. This reduces security slightly, but improves interworking with older
23796 implementations of TLS.
23797 </para>
23798 <para revisionflag="changed">
23799 option gnutls_allow_auto_pkcs11 main boolean unset
23800 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
23801 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
23802 </para>
23803 <para revisionflag="changed">
23804 See
23805 <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>
23806 for documentation.
23807 </para>
23808 <para>
23809 <indexterm role="option">
23810 <primary><option>headers_charset</option></primary>
23811 </indexterm>
23812 </para>
23813 <informaltable frame="all">
23814 <tgroup cols="4" colsep="0" rowsep="0">
23815 <colspec colwidth="8*" align="left"/>
23816 <colspec colwidth="6*" align="center"/>
23817 <colspec colwidth="6*" align="center"/>
23818 <colspec colwidth="6*" align="right"/>
23819 <tbody>
23820 <row>
23821 <entry><option>headers_charset</option></entry>
23822 <entry>Use: <emphasis>main</emphasis></entry>
23823 <entry>Type: <emphasis>string</emphasis></entry>
23824 <entry>Default: <emphasis>see below</emphasis></entry>
23825 </row>
23826 </tbody>
23827 </tgroup>
23828 </informaltable>
23829 <para>
23830 This option sets a default character set for translating from encoded MIME
23831 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
23832 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
23833 ultimate default is ISO-8859-1. For more details see the description of header
23834 insertions in section <xref linkend="SECTexpansionitems"/>.
23835 </para>
23836 <para>
23837 <indexterm role="option">
23838 <primary><option>header_maxsize</option></primary>
23839 </indexterm>
23840 </para>
23841 <informaltable frame="all">
23842 <tgroup cols="4" colsep="0" rowsep="0">
23843 <colspec colwidth="8*" align="left"/>
23844 <colspec colwidth="6*" align="center"/>
23845 <colspec colwidth="6*" align="center"/>
23846 <colspec colwidth="6*" align="right"/>
23847 <tbody>
23848 <row>
23849 <entry><option>header_maxsize</option></entry>
23850 <entry>Use: <emphasis>main</emphasis></entry>
23851 <entry>Type: <emphasis>integer</emphasis></entry>
23852 <entry>Default: <emphasis>see below</emphasis></entry>
23853 </row>
23854 </tbody>
23855 </tgroup>
23856 </informaltable>
23857 <para>
23858 <indexterm role="concept">
23859 <primary>header section</primary>
23860 <secondary>maximum size of</secondary>
23861 </indexterm>
23862 <indexterm role="concept">
23863 <primary>limit</primary>
23864 <secondary>size of message header section</secondary>
23865 </indexterm>
23866 This option controls the overall maximum size of a message&#x2019;s header
23867 section. The default is the value of HEADER_MAXSIZE in
23868 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
23869 sections are rejected.
23870 </para>
23871 <para>
23872 <indexterm role="option">
23873 <primary><option>header_line_maxsize</option></primary>
23874 </indexterm>
23875 </para>
23876 <informaltable frame="all">
23877 <tgroup cols="4" colsep="0" rowsep="0">
23878 <colspec colwidth="8*" align="left"/>
23879 <colspec colwidth="6*" align="center"/>
23880 <colspec colwidth="6*" align="center"/>
23881 <colspec colwidth="6*" align="right"/>
23882 <tbody>
23883 <row>
23884 <entry><option>header_line_maxsize</option></entry>
23885 <entry>Use: <emphasis>main</emphasis></entry>
23886 <entry>Type: <emphasis>integer</emphasis></entry>
23887 <entry>Default: <emphasis>0</emphasis></entry>
23888 </row>
23889 </tbody>
23890 </tgroup>
23891 </informaltable>
23892 <para>
23893 <indexterm role="concept">
23894 <primary>header lines</primary>
23895 <secondary>maximum size of</secondary>
23896 </indexterm>
23897 <indexterm role="concept">
23898 <primary>limit</primary>
23899 <secondary>size of one header line</secondary>
23900 </indexterm>
23901 This option limits the length of any individual header line in a message, after
23902 all the continuations have been joined together. Messages with individual
23903 header lines that are longer than the limit are rejected. The default value of
23904 zero means <quote>no limit</quote>.
23905 </para>
23906 <para>
23907 <indexterm role="option">
23908 <primary><option>helo_accept_junk_hosts</option></primary>
23909 </indexterm>
23910 </para>
23911 <informaltable frame="all">
23912 <tgroup cols="4" colsep="0" rowsep="0">
23913 <colspec colwidth="8*" align="left"/>
23914 <colspec colwidth="6*" align="center"/>
23915 <colspec colwidth="6*" align="center"/>
23916 <colspec colwidth="6*" align="right"/>
23917 <tbody>
23918 <row>
23919 <entry><option>helo_accept_junk_hosts</option></entry>
23920 <entry>Use: <emphasis>main</emphasis></entry>
23921 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23922 <entry>Default: <emphasis>unset</emphasis></entry>
23923 </row>
23924 </tbody>
23925 </tgroup>
23926 </informaltable>
23927 <para>
23928 <indexterm role="concept">
23929 <primary>HELO</primary>
23930 <secondary>accepting junk data</secondary>
23931 </indexterm>
23932 <indexterm role="concept">
23933 <primary>EHLO</primary>
23934 <secondary>accepting junk data</secondary>
23935 </indexterm>
23936 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23937 mail, and gives an error response for invalid data. Unfortunately, there are
23938 some SMTP clients that send syntactic junk. They can be accommodated by setting
23939 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23940 if you want to do semantic checking.
23941 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23942 set.
23943 </para>
23944 <para>
23945 <indexterm role="option">
23946 <primary><option>helo_allow_chars</option></primary>
23947 </indexterm>
23948 </para>
23949 <informaltable frame="all">
23950 <tgroup cols="4" colsep="0" rowsep="0">
23951 <colspec colwidth="8*" align="left"/>
23952 <colspec colwidth="6*" align="center"/>
23953 <colspec colwidth="6*" align="center"/>
23954 <colspec colwidth="6*" align="right"/>
23955 <tbody>
23956 <row>
23957 <entry><option>helo_allow_chars</option></entry>
23958 <entry>Use: <emphasis>main</emphasis></entry>
23959 <entry>Type: <emphasis>string</emphasis></entry>
23960 <entry>Default: <emphasis>unset</emphasis></entry>
23961 </row>
23962 </tbody>
23963 </tgroup>
23964 </informaltable>
23965 <para>
23966 <indexterm role="concept">
23967 <primary>HELO</primary>
23968 <secondary>underscores in</secondary>
23969 </indexterm>
23970 <indexterm role="concept">
23971 <primary>EHLO</primary>
23972 <secondary>underscores in</secondary>
23973 </indexterm>
23974 <indexterm role="concept">
23975 <primary>underscore in EHLO/HELO</primary>
23976 </indexterm>
23977 This option can be set to a string of rogue characters that are permitted in
23978 all EHLO and HELO names in addition to the standard letters, digits,
23979 hyphens, and dots. If you really must allow underscores, you can set
23980 </para>
23981 <literallayout class="monospaced">
23982 helo_allow_chars = _
23983 </literallayout>
23984 <para>
23985 Note that the value is one string, not a list.
23986 </para>
23987 <para>
23988 <indexterm role="option">
23989 <primary><option>helo_lookup_domains</option></primary>
23990 </indexterm>
23991 </para>
23992 <informaltable frame="all">
23993 <tgroup cols="4" colsep="0" rowsep="0">
23994 <colspec colwidth="8*" align="left"/>
23995 <colspec colwidth="6*" align="center"/>
23996 <colspec colwidth="6*" align="center"/>
23997 <colspec colwidth="6*" align="right"/>
23998 <tbody>
23999 <row>
24000 <entry><option>helo_lookup_domains</option></entry>
24001 <entry>Use: <emphasis>main</emphasis></entry>
24002 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24003 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
24004 </row>
24005 </tbody>
24006 </tgroup>
24007 </informaltable>
24008 <para>
24009 <indexterm role="concept">
24010 <primary>HELO</primary>
24011 <secondary>forcing reverse lookup</secondary>
24012 </indexterm>
24013 <indexterm role="concept">
24014 <primary>EHLO</primary>
24015 <secondary>forcing reverse lookup</secondary>
24016 </indexterm>
24017 If the domain given by a client in a HELO or EHLO command matches this
24018 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
24019 default forces a lookup if the client host gives the server&#x2019;s name or any of
24020 its IP addresses (in brackets), something that broken clients have been seen to
24021 do.
24022 </para>
24023 <para>
24024 <indexterm role="option">
24025 <primary><option>helo_try_verify_hosts</option></primary>
24026 </indexterm>
24027 </para>
24028 <informaltable frame="all">
24029 <tgroup cols="4" colsep="0" rowsep="0">
24030 <colspec colwidth="8*" align="left"/>
24031 <colspec colwidth="6*" align="center"/>
24032 <colspec colwidth="6*" align="center"/>
24033 <colspec colwidth="6*" align="right"/>
24034 <tbody>
24035 <row>
24036 <entry><option>helo_try_verify_hosts</option></entry>
24037 <entry>Use: <emphasis>main</emphasis></entry>
24038 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24039 <entry>Default: <emphasis>unset</emphasis></entry>
24040 </row>
24041 </tbody>
24042 </tgroup>
24043 </informaltable>
24044 <para>
24045 <indexterm role="concept">
24046 <primary>HELO verifying</primary>
24047 <secondary>optional</secondary>
24048 </indexterm>
24049 <indexterm role="concept">
24050 <primary>EHLO</primary>
24051 <secondary>verifying, optional</secondary>
24052 </indexterm>
24053 By default, Exim just checks the syntax of HELO and EHLO commands (see
24054 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
24055 to do more extensive checking of the data supplied by these commands. The ACL
24056 condition <literal>verify = helo</literal> is provided to make this possible.
24057 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
24058 to force the check to occur. From release 4.53 onwards, this is no longer
24059 necessary. If the check has not been done before <literal>verify = helo</literal> is
24060 encountered, it is done at that time. Consequently, this option is obsolete.
24061 Its specification is retained here for backwards compatibility.
24062 </para>
24063 <para>
24064 When an EHLO or HELO command is received, if the calling host matches
24065 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
24066 EHLO command either:
24067 </para>
24068 <itemizedlist>
24069 <listitem>
24070 <para>
24071 is an IP literal matching the calling address of the host, or
24072 </para>
24073 </listitem>
24074 <listitem>
24075 <para>
24076 <indexterm role="concept">
24077 <primary>DNS</primary>
24078 <secondary>reverse lookup</secondary>
24079 </indexterm>
24080 <indexterm role="concept">
24081 <primary>reverse DNS lookup</primary>
24082 </indexterm>
24083 matches the host name that Exim obtains by doing a reverse lookup of the
24084 calling host address, or
24085 </para>
24086 </listitem>
24087 <listitem>
24088 <para>
24089 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
24090 available) yields the calling host address.
24091 </para>
24092 </listitem>
24093 </itemizedlist>
24094 <para>
24095 However, the EHLO or HELO command is not rejected if any of the checks
24096 fail. Processing continues, but the result of the check is remembered, and can
24097 be detected later in an ACL by the <literal>verify = helo</literal> condition.
24098 </para>
24099 <para>
24100 <indexterm role="option">
24101 <primary><option>helo_verify_hosts</option></primary>
24102 </indexterm>
24103 </para>
24104 <informaltable frame="all">
24105 <tgroup cols="4" colsep="0" rowsep="0">
24106 <colspec colwidth="8*" align="left"/>
24107 <colspec colwidth="6*" align="center"/>
24108 <colspec colwidth="6*" align="center"/>
24109 <colspec colwidth="6*" align="right"/>
24110 <tbody>
24111 <row>
24112 <entry><option>helo_verify_hosts</option></entry>
24113 <entry>Use: <emphasis>main</emphasis></entry>
24114 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24115 <entry>Default: <emphasis>unset</emphasis></entry>
24116 </row>
24117 </tbody>
24118 </tgroup>
24119 </informaltable>
24120 <para>
24121 <indexterm role="concept">
24122 <primary>HELO verifying</primary>
24123 <secondary>mandatory</secondary>
24124 </indexterm>
24125 <indexterm role="concept">
24126 <primary>EHLO</primary>
24127 <secondary>verifying, mandatory</secondary>
24128 </indexterm>
24129 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
24130 backwards compatibility. For hosts that match this option, Exim checks the host
24131 name given in the HELO or EHLO in the same way as for
24132 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
24133 rejected with a 550 error, and entries are written to the main and reject logs.
24134 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
24135 error.
24136 </para>
24137 <para>
24138 <indexterm role="option">
24139 <primary><option>hold_domains</option></primary>
24140 </indexterm>
24141 </para>
24142 <informaltable frame="all">
24143 <tgroup cols="4" colsep="0" rowsep="0">
24144 <colspec colwidth="8*" align="left"/>
24145 <colspec colwidth="6*" align="center"/>
24146 <colspec colwidth="6*" align="center"/>
24147 <colspec colwidth="6*" align="right"/>
24148 <tbody>
24149 <row>
24150 <entry><option>hold_domains</option></entry>
24151 <entry>Use: <emphasis>main</emphasis></entry>
24152 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24153 <entry>Default: <emphasis>unset</emphasis></entry>
24154 </row>
24155 </tbody>
24156 </tgroup>
24157 </informaltable>
24158 <para>
24159 <indexterm role="concept">
24160 <primary>domain</primary>
24161 <secondary>delaying delivery</secondary>
24162 </indexterm>
24163 <indexterm role="concept">
24164 <primary>delivery</primary>
24165 <secondary>delaying certain domains</secondary>
24166 </indexterm>
24167 This option allows mail for particular domains to be held on the queue
24168 manually. The option is overridden if a message delivery is forced with the
24169 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
24170 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
24171 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
24172 it is deferred every time the message is looked at.
24173 </para>
24174 <para>
24175 This option is intended as a temporary operational measure for delaying the
24176 delivery of mail while some problem is being sorted out, or some new
24177 configuration tested. If you just want to delay the processing of some
24178 domains until a queue run occurs, you should use <option>queue_domains</option> or
24179 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
24180 </para>
24181 <para>
24182 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
24183 messages from the queue if they have been there longer than the longest retry
24184 time in any retry rule. If you want to hold messages for longer than the normal
24185 retry times, insert a dummy retry rule with a long retry time.
24186 </para>
24187 <para>
24188 <indexterm role="option">
24189 <primary><option>host_lookup</option></primary>
24190 </indexterm>
24191 </para>
24192 <informaltable frame="all">
24193 <tgroup cols="4" colsep="0" rowsep="0">
24194 <colspec colwidth="8*" align="left"/>
24195 <colspec colwidth="6*" align="center"/>
24196 <colspec colwidth="6*" align="center"/>
24197 <colspec colwidth="6*" align="right"/>
24198 <tbody>
24199 <row>
24200 <entry><option>host_lookup</option></entry>
24201 <entry>Use: <emphasis>main</emphasis></entry>
24202 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24203 <entry>Default: <emphasis>unset</emphasis></entry>
24204 </row>
24205 </tbody>
24206 </tgroup>
24207 </informaltable>
24208 <para>
24209 <indexterm role="concept">
24210 <primary>host name</primary>
24211 <secondary>lookup, forcing</secondary>
24212 </indexterm>
24213 Exim does not look up the name of a calling host from its IP address unless it
24214 is required to compare against some host list, or the host matches
24215 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
24216 option (which normally contains IP addresses rather than host names). The
24217 default configuration file contains
24218 </para>
24219 <literallayout class="monospaced">
24220 host_lookup = *
24221 </literallayout>
24222 <para>
24223 which causes a lookup to happen for all hosts. If the expense of these lookups
24224 is felt to be too great, the setting can be changed or removed.
24225 </para>
24226 <para>
24227 After a successful reverse lookup, Exim does a forward lookup on the name it
24228 has obtained, to verify that it yields the IP address that it started with. If
24229 this check fails, Exim behaves as if the name lookup failed.
24230 </para>
24231 <para>
24232 <indexterm role="variable">
24233 <primary><varname>$host_lookup_failed</varname></primary>
24234 </indexterm>
24235 <indexterm role="variable">
24236 <primary><varname>$sender_host_name</varname></primary>
24237 </indexterm>
24238 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
24239 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
24240 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
24241 <literal>verify = reverse_host_lookup</literal> in ACLs.
24242 </para>
24243 <para>
24244 <indexterm role="option">
24245 <primary><option>host_lookup_order</option></primary>
24246 </indexterm>
24247 </para>
24248 <informaltable frame="all">
24249 <tgroup cols="4" colsep="0" rowsep="0">
24250 <colspec colwidth="8*" align="left"/>
24251 <colspec colwidth="6*" align="center"/>
24252 <colspec colwidth="6*" align="center"/>
24253 <colspec colwidth="6*" align="right"/>
24254 <tbody>
24255 <row>
24256 <entry><option>host_lookup_order</option></entry>
24257 <entry>Use: <emphasis>main</emphasis></entry>
24258 <entry>Type: <emphasis>string list</emphasis></entry>
24259 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
24260 </row>
24261 </tbody>
24262 </tgroup>
24263 </informaltable>
24264 <para>
24265 This option specifies the order of different lookup methods when Exim is trying
24266 to find a host name from an IP address. The default is to do a DNS lookup
24267 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
24268 if that fails. You can change the order of these lookups, or omit one entirely,
24269 if you want.
24270 </para>
24271 <para>
24272 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
24273 multiple PTR records in the DNS and the IP address is not listed in
24274 <filename>/etc/hosts</filename>. Different operating systems give different results in this
24275 case. That is why the default tries a DNS lookup first.
24276 </para>
24277 <para>
24278 <indexterm role="option">
24279 <primary><option>host_reject_connection</option></primary>
24280 </indexterm>
24281 </para>
24282 <informaltable frame="all">
24283 <tgroup cols="4" colsep="0" rowsep="0">
24284 <colspec colwidth="8*" align="left"/>
24285 <colspec colwidth="6*" align="center"/>
24286 <colspec colwidth="6*" align="center"/>
24287 <colspec colwidth="6*" align="right"/>
24288 <tbody>
24289 <row>
24290 <entry><option>host_reject_connection</option></entry>
24291 <entry>Use: <emphasis>main</emphasis></entry>
24292 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24293 <entry>Default: <emphasis>unset</emphasis></entry>
24294 </row>
24295 </tbody>
24296 </tgroup>
24297 </informaltable>
24298 <para>
24299 <indexterm role="concept">
24300 <primary>host</primary>
24301 <secondary>rejecting connections from</secondary>
24302 </indexterm>
24303 If this option is set, incoming SMTP calls from the hosts listed are rejected
24304 as soon as the connection is made.
24305 This option is obsolete, and retained only for backward compatibility, because
24306 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
24307 connections immediately.
24308 </para>
24309 <para>
24310 The ability to give an immediate rejection (either by this option or using an
24311 ACL) is provided for use in unusual cases. Many hosts will just try again,
24312 sometimes without much delay. Normally, it is better to use an ACL to reject
24313 incoming messages at a later stage, such as after RCPT commands. See
24314 chapter <xref linkend="CHAPACL"/>.
24315 </para>
24316 <para>
24317 <indexterm role="option">
24318 <primary><option>hosts_connection_nolog</option></primary>
24319 </indexterm>
24320 </para>
24321 <informaltable frame="all">
24322 <tgroup cols="4" colsep="0" rowsep="0">
24323 <colspec colwidth="8*" align="left"/>
24324 <colspec colwidth="6*" align="center"/>
24325 <colspec colwidth="6*" align="center"/>
24326 <colspec colwidth="6*" align="right"/>
24327 <tbody>
24328 <row>
24329 <entry><option>hosts_connection_nolog</option></entry>
24330 <entry>Use: <emphasis>main</emphasis></entry>
24331 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24332 <entry>Default: <emphasis>unset</emphasis></entry>
24333 </row>
24334 </tbody>
24335 </tgroup>
24336 </informaltable>
24337 <para>
24338 <indexterm role="concept">
24339 <primary>host</primary>
24340 <secondary>not logging connections from</secondary>
24341 </indexterm>
24342 This option defines a list of hosts for which connection logging does not
24343 happen, even though the <option>smtp_connection</option> log selector is set. For example,
24344 you might want not to log SMTP connections from local processes, or from
24345 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
24346 the daemon; you should therefore strive to restrict its value to a short inline
24347 list of IP addresses and networks. To disable logging SMTP connections from
24348 local processes, you must create a host list with an empty item. For example:
24349 </para>
24350 <literallayout class="monospaced">
24351 hosts_connection_nolog = :
24352 </literallayout>
24353 <para>
24354 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
24355 </para>
24356 <para>
24357 <indexterm role="option">
24358 <primary><option>hosts_treat_as_local</option></primary>
24359 </indexterm>
24360 </para>
24361 <informaltable frame="all">
24362 <tgroup cols="4" colsep="0" rowsep="0">
24363 <colspec colwidth="8*" align="left"/>
24364 <colspec colwidth="6*" align="center"/>
24365 <colspec colwidth="6*" align="center"/>
24366 <colspec colwidth="6*" align="right"/>
24367 <tbody>
24368 <row>
24369 <entry><option>hosts_treat_as_local</option></entry>
24370 <entry>Use: <emphasis>main</emphasis></entry>
24371 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24372 <entry>Default: <emphasis>unset</emphasis></entry>
24373 </row>
24374 </tbody>
24375 </tgroup>
24376 </informaltable>
24377 <para>
24378 <indexterm role="concept">
24379 <primary>local host</primary>
24380 <secondary>domains treated as</secondary>
24381 </indexterm>
24382 <indexterm role="concept">
24383 <primary>host</primary>
24384 <secondary>treated as local</secondary>
24385 </indexterm>
24386 If this option is set, any host names that match the domain list are treated as
24387 if they were the local host when Exim is scanning host lists obtained from MX
24388 records
24389 or other sources. Note that the value of this option is a domain list, not a
24390 host list, because it is always used to check host names, not IP addresses.
24391 </para>
24392 <para>
24393 This option also applies when Exim is matching the special items
24394 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
24395 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
24396 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
24397 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
24398 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
24399 interfaces and recognizing the local host.
24400 </para>
24401 <para>
24402 <indexterm role="option">
24403 <primary><option>ibase_servers</option></primary>
24404 </indexterm>
24405 </para>
24406 <informaltable frame="all">
24407 <tgroup cols="4" colsep="0" rowsep="0">
24408 <colspec colwidth="8*" align="left"/>
24409 <colspec colwidth="6*" align="center"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="right"/>
24412 <tbody>
24413 <row>
24414 <entry><option>ibase_servers</option></entry>
24415 <entry>Use: <emphasis>main</emphasis></entry>
24416 <entry>Type: <emphasis>string list</emphasis></entry>
24417 <entry>Default: <emphasis>unset</emphasis></entry>
24418 </row>
24419 </tbody>
24420 </tgroup>
24421 </informaltable>
24422 <para>
24423 <indexterm role="concept">
24424 <primary>InterBase</primary>
24425 <secondary>server list</secondary>
24426 </indexterm>
24427 This option provides a list of InterBase servers and associated connection data,
24428 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
24429 The option is available only if Exim has been built with InterBase support.
24430 </para>
24431 <para>
24432 <indexterm role="option">
24433 <primary><option>ignore_bounce_errors_after</option></primary>
24434 </indexterm>
24435 </para>
24436 <informaltable frame="all">
24437 <tgroup cols="4" colsep="0" rowsep="0">
24438 <colspec colwidth="8*" align="left"/>
24439 <colspec colwidth="6*" align="center"/>
24440 <colspec colwidth="6*" align="center"/>
24441 <colspec colwidth="6*" align="right"/>
24442 <tbody>
24443 <row>
24444 <entry><option>ignore_bounce_errors_after</option></entry>
24445 <entry>Use: <emphasis>main</emphasis></entry>
24446 <entry>Type: <emphasis>time</emphasis></entry>
24447 <entry>Default: <emphasis>10w</emphasis></entry>
24448 </row>
24449 </tbody>
24450 </tgroup>
24451 </informaltable>
24452 <para>
24453 <indexterm role="concept">
24454 <primary>bounce message</primary>
24455 <secondary>discarding</secondary>
24456 </indexterm>
24457 <indexterm role="concept">
24458 <primary>discarding bounce message</primary>
24459 </indexterm>
24460 This option affects the processing of bounce messages that cannot be delivered,
24461 that is, those that suffer a permanent delivery failure. (Bounce messages that
24462 suffer temporary delivery failures are of course retried in the usual way.)
24463 </para>
24464 <para>
24465 After a permanent delivery failure, bounce messages are frozen,
24466 because there is no sender to whom they can be returned. When a frozen bounce
24467 message has been on the queue for more than the given time, it is unfrozen at
24468 the next queue run, and a further delivery is attempted. If delivery fails
24469 again, the bounce message is discarded. This makes it possible to keep failed
24470 bounce messages around for a shorter time than the normal maximum retry time
24471 for frozen messages. For example,
24472 </para>
24473 <literallayout class="monospaced">
24474 ignore_bounce_errors_after = 12h
24475 </literallayout>
24476 <para>
24477 retries failed bounce message deliveries after 12 hours, discarding any further
24478 failures. If the value of this option is set to a zero time period, bounce
24479 failures are discarded immediately. Setting a very long time (as in the default
24480 value) has the effect of disabling this option. For ways of automatically
24481 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
24482 <option>timeout_frozen_after</option>.
24483 </para>
24484 <para>
24485 <indexterm role="option">
24486 <primary><option>ignore_fromline_hosts</option></primary>
24487 </indexterm>
24488 </para>
24489 <informaltable frame="all">
24490 <tgroup cols="4" colsep="0" rowsep="0">
24491 <colspec colwidth="8*" align="left"/>
24492 <colspec colwidth="6*" align="center"/>
24493 <colspec colwidth="6*" align="center"/>
24494 <colspec colwidth="6*" align="right"/>
24495 <tbody>
24496 <row>
24497 <entry><option>ignore_fromline_hosts</option></entry>
24498 <entry>Use: <emphasis>main</emphasis></entry>
24499 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24500 <entry>Default: <emphasis>unset</emphasis></entry>
24501 </row>
24502 </tbody>
24503 </tgroup>
24504 </informaltable>
24505 <para>
24506 <indexterm role="concept">
24507 <primary><quote>From</quote> line</primary>
24508 </indexterm>
24509 <indexterm role="concept">
24510 <primary>UUCP</primary>
24511 <secondary><quote>From</quote> line</secondary>
24512 </indexterm>
24513 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
24514 the headers of a message. By default this is treated as the start of the
24515 message&#x2019;s body, which means that any following headers are not recognized as
24516 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
24517 match those hosts that insist on sending it. If the sender is actually a local
24518 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
24519 <option>ignore_fromline_local</option> must be set to achieve this effect.
24520 </para>
24521 <para>
24522 <indexterm role="option">
24523 <primary><option>ignore_fromline_local</option></primary>
24524 </indexterm>
24525 </para>
24526 <informaltable frame="all">
24527 <tgroup cols="4" colsep="0" rowsep="0">
24528 <colspec colwidth="8*" align="left"/>
24529 <colspec colwidth="6*" align="center"/>
24530 <colspec colwidth="6*" align="center"/>
24531 <colspec colwidth="6*" align="right"/>
24532 <tbody>
24533 <row>
24534 <entry><option>ignore_fromline_local</option></entry>
24535 <entry>Use: <emphasis>main</emphasis></entry>
24536 <entry>Type: <emphasis>boolean</emphasis></entry>
24537 <entry>Default: <emphasis>false</emphasis></entry>
24538 </row>
24539 </tbody>
24540 </tgroup>
24541 </informaltable>
24542 <para>
24543 See <option>ignore_fromline_hosts</option> above.
24544 </para>
24545 <para>
24546 <indexterm role="option">
24547 <primary><option>keep_malformed</option></primary>
24548 </indexterm>
24549 </para>
24550 <informaltable frame="all">
24551 <tgroup cols="4" colsep="0" rowsep="0">
24552 <colspec colwidth="8*" align="left"/>
24553 <colspec colwidth="6*" align="center"/>
24554 <colspec colwidth="6*" align="center"/>
24555 <colspec colwidth="6*" align="right"/>
24556 <tbody>
24557 <row>
24558 <entry><option>keep_malformed</option></entry>
24559 <entry>Use: <emphasis>main</emphasis></entry>
24560 <entry>Type: <emphasis>time</emphasis></entry>
24561 <entry>Default: <emphasis>4d</emphasis></entry>
24562 </row>
24563 </tbody>
24564 </tgroup>
24565 </informaltable>
24566 <para>
24567 This option specifies the length of time to keep messages whose spool files
24568 have been corrupted in some way. This should, of course, never happen. At the
24569 next attempt to deliver such a message, it gets removed. The incident is
24570 logged.
24571 </para>
24572 <para>
24573 <indexterm role="option">
24574 <primary><option>ldap_ca_cert_dir</option></primary>
24575 </indexterm>
24576 </para>
24577 <informaltable frame="all">
24578 <tgroup cols="4" colsep="0" rowsep="0">
24579 <colspec colwidth="8*" align="left"/>
24580 <colspec colwidth="6*" align="center"/>
24581 <colspec colwidth="6*" align="center"/>
24582 <colspec colwidth="6*" align="right"/>
24583 <tbody>
24584 <row>
24585 <entry><option>ldap_ca_cert_dir</option></entry>
24586 <entry>Use: <emphasis>main</emphasis></entry>
24587 <entry>Type: <emphasis>string</emphasis></entry>
24588 <entry>Default: <emphasis>unset</emphasis></entry>
24589 </row>
24590 </tbody>
24591 </tgroup>
24592 </informaltable>
24593 <para>
24594 <indexterm role="concept">
24595 <primary>LDAP</primary>
24596 <secondary>,</secondary>
24597 </indexterm>
24598 This option indicates which directory contains CA certificates for verifying
24599 a TLS certificate presented by an LDAP server.
24600 While Exim does not provide a default value, your SSL library may.
24601 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
24602 and constrained to be a directory.
24603 </para>
24604 <para>
24605 <indexterm role="option">
24606 <primary><option>ldap_ca_cert_file</option></primary>
24607 </indexterm>
24608 </para>
24609 <informaltable frame="all">
24610 <tgroup cols="4" colsep="0" rowsep="0">
24611 <colspec colwidth="8*" align="left"/>
24612 <colspec colwidth="6*" align="center"/>
24613 <colspec colwidth="6*" align="center"/>
24614 <colspec colwidth="6*" align="right"/>
24615 <tbody>
24616 <row>
24617 <entry><option>ldap_ca_cert_file</option></entry>
24618 <entry>Use: <emphasis>main</emphasis></entry>
24619 <entry>Type: <emphasis>string</emphasis></entry>
24620 <entry>Default: <emphasis>unset</emphasis></entry>
24621 </row>
24622 </tbody>
24623 </tgroup>
24624 </informaltable>
24625 <para>
24626 <indexterm role="concept">
24627 <primary>LDAP</primary>
24628 <secondary>,</secondary>
24629 </indexterm>
24630 This option indicates which file contains CA certificates for verifying
24631 a TLS certificate presented by an LDAP server.
24632 While Exim does not provide a default value, your SSL library may.
24633 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
24634 and constrained to be a file.
24635 </para>
24636 <para>
24637 <indexterm role="option">
24638 <primary><option>ldap_cert_file</option></primary>
24639 </indexterm>
24640 </para>
24641 <informaltable frame="all">
24642 <tgroup cols="4" colsep="0" rowsep="0">
24643 <colspec colwidth="8*" align="left"/>
24644 <colspec colwidth="6*" align="center"/>
24645 <colspec colwidth="6*" align="center"/>
24646 <colspec colwidth="6*" align="right"/>
24647 <tbody>
24648 <row>
24649 <entry><option>ldap_cert_file</option></entry>
24650 <entry>Use: <emphasis>main</emphasis></entry>
24651 <entry>Type: <emphasis>string</emphasis></entry>
24652 <entry>Default: <emphasis>unset</emphasis></entry>
24653 </row>
24654 </tbody>
24655 </tgroup>
24656 </informaltable>
24657 <para>
24658 <indexterm role="concept">
24659 <primary>LDAP</primary>
24660 <secondary>TLS client certificate file</secondary>
24661 </indexterm>
24662 This option indicates which file contains an TLS client certificate which
24663 Exim should present to the LDAP server during TLS negotiation.
24664 Should be used together with <option>ldap_cert_key</option>.
24665 </para>
24666 <para>
24667 <indexterm role="option">
24668 <primary><option>ldap_cert_key</option></primary>
24669 </indexterm>
24670 </para>
24671 <informaltable frame="all">
24672 <tgroup cols="4" colsep="0" rowsep="0">
24673 <colspec colwidth="8*" align="left"/>
24674 <colspec colwidth="6*" align="center"/>
24675 <colspec colwidth="6*" align="center"/>
24676 <colspec colwidth="6*" align="right"/>
24677 <tbody>
24678 <row>
24679 <entry><option>ldap_cert_key</option></entry>
24680 <entry>Use: <emphasis>main</emphasis></entry>
24681 <entry>Type: <emphasis>string</emphasis></entry>
24682 <entry>Default: <emphasis>unset</emphasis></entry>
24683 </row>
24684 </tbody>
24685 </tgroup>
24686 </informaltable>
24687 <para>
24688 <indexterm role="concept">
24689 <primary>LDAP</primary>
24690 <secondary>TLS client key file</secondary>
24691 </indexterm>
24692 This option indicates which file contains the secret/private key to use
24693 to prove identity to the LDAP server during TLS negotiation.
24694 Should be used together with <option>ldap_cert_file</option>, which contains the
24695 identity to be proven.
24696 </para>
24697 <para>
24698 <indexterm role="option">
24699 <primary><option>ldap_cipher_suite</option></primary>
24700 </indexterm>
24701 </para>
24702 <informaltable frame="all">
24703 <tgroup cols="4" colsep="0" rowsep="0">
24704 <colspec colwidth="8*" align="left"/>
24705 <colspec colwidth="6*" align="center"/>
24706 <colspec colwidth="6*" align="center"/>
24707 <colspec colwidth="6*" align="right"/>
24708 <tbody>
24709 <row>
24710 <entry><option>ldap_cipher_suite</option></entry>
24711 <entry>Use: <emphasis>main</emphasis></entry>
24712 <entry>Type: <emphasis>string</emphasis></entry>
24713 <entry>Default: <emphasis>unset</emphasis></entry>
24714 </row>
24715 </tbody>
24716 </tgroup>
24717 </informaltable>
24718 <para>
24719 <indexterm role="concept">
24720 <primary>LDAP</primary>
24721 <secondary>TLS cipher suite</secondary>
24722 </indexterm>
24723 This controls the TLS cipher-suite negotiation during TLS negotiation with
24724 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
24725 cipher-suite options with OpenSSL (as used by LDAP client libraries).
24726 </para>
24727 <para>
24728 <indexterm role="option">
24729 <primary><option>ldap_default_servers</option></primary>
24730 </indexterm>
24731 </para>
24732 <informaltable frame="all">
24733 <tgroup cols="4" colsep="0" rowsep="0">
24734 <colspec colwidth="8*" align="left"/>
24735 <colspec colwidth="6*" align="center"/>
24736 <colspec colwidth="6*" align="center"/>
24737 <colspec colwidth="6*" align="right"/>
24738 <tbody>
24739 <row>
24740 <entry><option>ldap_default_servers</option></entry>
24741 <entry>Use: <emphasis>main</emphasis></entry>
24742 <entry>Type: <emphasis>string list</emphasis></entry>
24743 <entry>Default: <emphasis>unset</emphasis></entry>
24744 </row>
24745 </tbody>
24746 </tgroup>
24747 </informaltable>
24748 <para>
24749 <indexterm role="concept">
24750 <primary>LDAP</primary>
24751 <secondary>default servers</secondary>
24752 </indexterm>
24753 This option provides a list of LDAP servers which are tried in turn when an
24754 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
24755 details of LDAP queries. This option is available only when Exim has been built
24756 with LDAP support.
24757 </para>
24758 <para>
24759 <indexterm role="option">
24760 <primary><option>ldap_require_cert</option></primary>
24761 </indexterm>
24762 </para>
24763 <informaltable frame="all">
24764 <tgroup cols="4" colsep="0" rowsep="0">
24765 <colspec colwidth="8*" align="left"/>
24766 <colspec colwidth="6*" align="center"/>
24767 <colspec colwidth="6*" align="center"/>
24768 <colspec colwidth="6*" align="right"/>
24769 <tbody>
24770 <row>
24771 <entry><option>ldap_require_cert</option></entry>
24772 <entry>Use: <emphasis>main</emphasis></entry>
24773 <entry>Type: <emphasis>string</emphasis></entry>
24774 <entry>Default: <emphasis>unset.</emphasis></entry>
24775 </row>
24776 </tbody>
24777 </tgroup>
24778 </informaltable>
24779 <para>
24780 <indexterm role="concept">
24781 <primary>LDAP</primary>
24782 <secondary>policy for LDAP server TLS cert presentation</secondary>
24783 </indexterm>
24784 This should be one of the values "hard", "demand", "allow", "try" or "never".
24785 A value other than one of these is interpreted as "never".
24786 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
24787 Although Exim does not set a default, the LDAP library probably defaults
24788 to hard/demand.
24789 </para>
24790 <para>
24791 <indexterm role="option">
24792 <primary><option>ldap_start_tls</option></primary>
24793 </indexterm>
24794 </para>
24795 <informaltable frame="all">
24796 <tgroup cols="4" colsep="0" rowsep="0">
24797 <colspec colwidth="8*" align="left"/>
24798 <colspec colwidth="6*" align="center"/>
24799 <colspec colwidth="6*" align="center"/>
24800 <colspec colwidth="6*" align="right"/>
24801 <tbody>
24802 <row>
24803 <entry><option>ldap_start_tls</option></entry>
24804 <entry>Use: <emphasis>main</emphasis></entry>
24805 <entry>Type: <emphasis>boolean</emphasis></entry>
24806 <entry>Default: <emphasis>false</emphasis></entry>
24807 </row>
24808 </tbody>
24809 </tgroup>
24810 </informaltable>
24811 <para>
24812 <indexterm role="concept">
24813 <primary>LDAP</primary>
24814 <secondary>whether or not to negotiate TLS</secondary>
24815 </indexterm>
24816 If set, Exim will attempt to negotiate TLS with the LDAP server when
24817 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
24818 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
24819 of SSL-on-connect.
24820 In the event of failure to negotiate TLS, the action taken is controlled
24821 by <option>ldap_require_cert</option>.
24822 </para>
24823 <para>
24824 <indexterm role="option">
24825 <primary><option>ldap_version</option></primary>
24826 </indexterm>
24827 </para>
24828 <informaltable frame="all">
24829 <tgroup cols="4" colsep="0" rowsep="0">
24830 <colspec colwidth="8*" align="left"/>
24831 <colspec colwidth="6*" align="center"/>
24832 <colspec colwidth="6*" align="center"/>
24833 <colspec colwidth="6*" align="right"/>
24834 <tbody>
24835 <row>
24836 <entry><option>ldap_version</option></entry>
24837 <entry>Use: <emphasis>main</emphasis></entry>
24838 <entry>Type: <emphasis>integer</emphasis></entry>
24839 <entry>Default: <emphasis>unset</emphasis></entry>
24840 </row>
24841 </tbody>
24842 </tgroup>
24843 </informaltable>
24844 <para>
24845 <indexterm role="concept">
24846 <primary>LDAP</primary>
24847 <secondary>protocol version, forcing</secondary>
24848 </indexterm>
24849 This option can be used to force Exim to set a specific protocol version for
24850 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
24851 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
24852 the LDAP headers; otherwise it is 2. This option is available only when Exim
24853 has been built with LDAP support.
24854 </para>
24855 <para>
24856 <indexterm role="option">
24857 <primary><option>local_from_check</option></primary>
24858 </indexterm>
24859 </para>
24860 <informaltable frame="all">
24861 <tgroup cols="4" colsep="0" rowsep="0">
24862 <colspec colwidth="8*" align="left"/>
24863 <colspec colwidth="6*" align="center"/>
24864 <colspec colwidth="6*" align="center"/>
24865 <colspec colwidth="6*" align="right"/>
24866 <tbody>
24867 <row>
24868 <entry><option>local_from_check</option></entry>
24869 <entry>Use: <emphasis>main</emphasis></entry>
24870 <entry>Type: <emphasis>boolean</emphasis></entry>
24871 <entry>Default: <emphasis>true</emphasis></entry>
24872 </row>
24873 </tbody>
24874 </tgroup>
24875 </informaltable>
24876 <para>
24877 <indexterm role="concept">
24878 <primary><emphasis>Sender:</emphasis> header line</primary>
24879 <secondary>disabling addition of</secondary>
24880 </indexterm>
24881 <indexterm role="concept">
24882 <primary><emphasis>From:</emphasis> header line</primary>
24883 <secondary>disabling checking of</secondary>
24884 </indexterm>
24885 When a message is submitted locally (that is, not over a TCP/IP connection) by
24886 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
24887 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
24888 the domain specified by <option>qualify_domain</option>.
24889 </para>
24890 <para>
24891 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
24892 locally submitted message is automatically qualified by Exim, unless the
24893 <option>-bnq</option> command line option is used.
24894 </para>
24895 <para>
24896 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
24897 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
24898 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
24899 and the default qualify domain.
24900 </para>
24901 <para>
24902 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
24903 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
24904 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
24905 <option>local_sender_retain</option> to be true.
24906 </para>
24907 <para>
24908 <indexterm role="concept">
24909 <primary>envelope sender</primary>
24910 </indexterm>
24911 These options affect only the header lines in the message. The envelope sender
24912 is still forced to be the login id at the qualify domain unless
24913 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
24914 </para>
24915 <para>
24916 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
24917 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
24918 has more details about <emphasis>Sender:</emphasis> processing.
24919 </para>
24920 <para>
24921 <indexterm role="option">
24922 <primary><option>local_from_prefix</option></primary>
24923 </indexterm>
24924 </para>
24925 <informaltable frame="all">
24926 <tgroup cols="4" colsep="0" rowsep="0">
24927 <colspec colwidth="8*" align="left"/>
24928 <colspec colwidth="6*" align="center"/>
24929 <colspec colwidth="6*" align="center"/>
24930 <colspec colwidth="6*" align="right"/>
24931 <tbody>
24932 <row>
24933 <entry><option>local_from_prefix</option></entry>
24934 <entry>Use: <emphasis>main</emphasis></entry>
24935 <entry>Type: <emphasis>string</emphasis></entry>
24936 <entry>Default: <emphasis>unset</emphasis></entry>
24937 </row>
24938 </tbody>
24939 </tgroup>
24940 </informaltable>
24941 <para>
24942 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
24943 matching the login id (see <option>local_from_check</option> above), it can be configured to
24944 ignore certain prefixes and suffixes in the local part of the address. This is
24945 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
24946 appropriate lists, in the same form as the <option>local_part_prefix</option> and
24947 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
24948 example, if
24949 </para>
24950 <literallayout class="monospaced">
24951 local_from_prefix = *-
24952 </literallayout>
24953 <para>
24954 is set, a <emphasis>From:</emphasis> line containing
24955 </para>
24956 <literallayout class="monospaced">
24957 From: anything-user@your.domain.example
24958 </literallayout>
24959 <para>
24960 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
24961 matches the actual sender address that is constructed from the login name and
24962 qualify domain.
24963 </para>
24964 <para>
24965 <indexterm role="option">
24966 <primary><option>local_from_suffix</option></primary>
24967 </indexterm>
24968 </para>
24969 <informaltable frame="all">
24970 <tgroup cols="4" colsep="0" rowsep="0">
24971 <colspec colwidth="8*" align="left"/>
24972 <colspec colwidth="6*" align="center"/>
24973 <colspec colwidth="6*" align="center"/>
24974 <colspec colwidth="6*" align="right"/>
24975 <tbody>
24976 <row>
24977 <entry><option>local_from_suffix</option></entry>
24978 <entry>Use: <emphasis>main</emphasis></entry>
24979 <entry>Type: <emphasis>string</emphasis></entry>
24980 <entry>Default: <emphasis>unset</emphasis></entry>
24981 </row>
24982 </tbody>
24983 </tgroup>
24984 </informaltable>
24985 <para>
24986 See <option>local_from_prefix</option> above.
24987 </para>
24988 <para>
24989 <indexterm role="option">
24990 <primary><option>local_interfaces</option></primary>
24991 </indexterm>
24992 </para>
24993 <informaltable frame="all">
24994 <tgroup cols="4" colsep="0" rowsep="0">
24995 <colspec colwidth="8*" align="left"/>
24996 <colspec colwidth="6*" align="center"/>
24997 <colspec colwidth="6*" align="center"/>
24998 <colspec colwidth="6*" align="right"/>
24999 <tbody>
25000 <row>
25001 <entry><option>local_interfaces</option></entry>
25002 <entry>Use: <emphasis>main</emphasis></entry>
25003 <entry>Type: <emphasis>string list</emphasis></entry>
25004 <entry>Default: <emphasis>see below</emphasis></entry>
25005 </row>
25006 </tbody>
25007 </tgroup>
25008 </informaltable>
25009 <para>
25010 This option controls which network interfaces are used by the daemon for
25011 listening; they are also used to identify the local host when routing. Chapter
25012 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
25013 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
25014 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
25015 <option>local_interfaces</option> is
25016 </para>
25017 <literallayout class="monospaced">
25018 local_interfaces = 0.0.0.0
25019 </literallayout>
25020 <para>
25021 when Exim is built without IPv6 support; otherwise it is
25022 </para>
25023 <literallayout class="monospaced">
25024 local_interfaces = &lt;; ::0 ; 0.0.0.0
25025 </literallayout>
25026 <para>
25027 <indexterm role="option">
25028 <primary><option>local_scan_timeout</option></primary>
25029 </indexterm>
25030 </para>
25031 <informaltable frame="all">
25032 <tgroup cols="4" colsep="0" rowsep="0">
25033 <colspec colwidth="8*" align="left"/>
25034 <colspec colwidth="6*" align="center"/>
25035 <colspec colwidth="6*" align="center"/>
25036 <colspec colwidth="6*" align="right"/>
25037 <tbody>
25038 <row>
25039 <entry><option>local_scan_timeout</option></entry>
25040 <entry>Use: <emphasis>main</emphasis></entry>
25041 <entry>Type: <emphasis>time</emphasis></entry>
25042 <entry>Default: <emphasis>5m</emphasis></entry>
25043 </row>
25044 </tbody>
25045 </tgroup>
25046 </informaltable>
25047 <para>
25048 <indexterm role="concept">
25049 <primary>timeout</primary>
25050 <secondary>for <function>local_scan()</function> function</secondary>
25051 </indexterm>
25052 <indexterm role="concept">
25053 <primary><function>local_scan()</function> function</primary>
25054 <secondary>timeout</secondary>
25055 </indexterm>
25056 This timeout applies to the <function>local_scan()</function> function (see chapter
25057 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
25058 the incoming message is rejected with a temporary error if it is an SMTP
25059 message. For a non-SMTP message, the message is dropped and Exim ends with a
25060 non-zero code. The incident is logged on the main and reject logs.
25061 </para>
25062 <para>
25063 <indexterm role="option">
25064 <primary><option>local_sender_retain</option></primary>
25065 </indexterm>
25066 </para>
25067 <informaltable frame="all">
25068 <tgroup cols="4" colsep="0" rowsep="0">
25069 <colspec colwidth="8*" align="left"/>
25070 <colspec colwidth="6*" align="center"/>
25071 <colspec colwidth="6*" align="center"/>
25072 <colspec colwidth="6*" align="right"/>
25073 <tbody>
25074 <row>
25075 <entry><option>local_sender_retain</option></entry>
25076 <entry>Use: <emphasis>main</emphasis></entry>
25077 <entry>Type: <emphasis>boolean</emphasis></entry>
25078 <entry>Default: <emphasis>false</emphasis></entry>
25079 </row>
25080 </tbody>
25081 </tgroup>
25082 </informaltable>
25083 <para>
25084 <indexterm role="concept">
25085 <primary><emphasis>Sender:</emphasis> header line</primary>
25086 <secondary>retaining from local submission</secondary>
25087 </indexterm>
25088 When a message is submitted locally (that is, not over a TCP/IP connection) by
25089 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
25090 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
25091 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
25092 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
25093 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
25094 </para>
25095 <para>
25096 <indexterm role="option">
25097 <primary><option>localhost_number</option></primary>
25098 </indexterm>
25099 </para>
25100 <informaltable frame="all">
25101 <tgroup cols="4" colsep="0" rowsep="0">
25102 <colspec colwidth="8*" align="left"/>
25103 <colspec colwidth="6*" align="center"/>
25104 <colspec colwidth="6*" align="center"/>
25105 <colspec colwidth="6*" align="right"/>
25106 <tbody>
25107 <row>
25108 <entry><option>localhost_number</option></entry>
25109 <entry>Use: <emphasis>main</emphasis></entry>
25110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25111 <entry>Default: <emphasis>unset</emphasis></entry>
25112 </row>
25113 </tbody>
25114 </tgroup>
25115 </informaltable>
25116 <para>
25117 <indexterm role="concept">
25118 <primary>host</primary>
25119 <secondary>locally unique number for</secondary>
25120 </indexterm>
25121 <indexterm role="concept">
25122 <primary>message ids</primary>
25123 <secondary>with multiple hosts</secondary>
25124 </indexterm>
25125 <indexterm role="variable">
25126 <primary><varname>$localhost_number</varname></primary>
25127 </indexterm>
25128 Exim&#x2019;s message ids are normally unique only within the local host. If
25129 uniqueness among a set of hosts is required, each host must set a different
25130 value for the <option>localhost_number</option> option. The string is expanded immediately
25131 after reading the configuration file (so that a number can be computed from the
25132 host name, for example) and the result of the expansion must be a number in the
25133 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
25134 systems). This is available in subsequent string expansions via the variable
25135 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
25136 characters of the message id, instead of just being a fractional part of the
25137 time, are computed from the time and the local host number as described in
25138 section <xref linkend="SECTmessiden"/>.
25139 </para>
25140 <para>
25141 <indexterm role="option">
25142 <primary><option>log_file_path</option></primary>
25143 </indexterm>
25144 </para>
25145 <informaltable frame="all">
25146 <tgroup cols="4" colsep="0" rowsep="0">
25147 <colspec colwidth="8*" align="left"/>
25148 <colspec colwidth="6*" align="center"/>
25149 <colspec colwidth="6*" align="center"/>
25150 <colspec colwidth="6*" align="right"/>
25151 <tbody>
25152 <row>
25153 <entry><option>log_file_path</option></entry>
25154 <entry>Use: <emphasis>main</emphasis></entry>
25155 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25156 <entry>Default: <emphasis>set at compile time</emphasis></entry>
25157 </row>
25158 </tbody>
25159 </tgroup>
25160 </informaltable>
25161 <para>
25162 <indexterm role="concept">
25163 <primary>log</primary>
25164 <secondary>file path for</secondary>
25165 </indexterm>
25166 This option sets the path which is used to determine the names of Exim&#x2019;s log
25167 files, or indicates that logging is to be to syslog, or both. It is expanded
25168 when Exim is entered, so it can, for example, contain a reference to the host
25169 name. If no specific path is set for the log files at compile or run time, they
25170 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
25171 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
25172 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
25173 used. If this string is fixed at your installation (contains no expansion
25174 variables) it is recommended that you do not set this option in the
25175 configuration file, but instead supply the path using LOG_FILE_PATH in
25176 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
25177 early on &ndash; in particular, failure to read the configuration file.
25178 </para>
25179 <para>
25180 <indexterm role="option">
25181 <primary><option>log_selector</option></primary>
25182 </indexterm>
25183 </para>
25184 <informaltable frame="all">
25185 <tgroup cols="4" colsep="0" rowsep="0">
25186 <colspec colwidth="8*" align="left"/>
25187 <colspec colwidth="6*" align="center"/>
25188 <colspec colwidth="6*" align="center"/>
25189 <colspec colwidth="6*" align="right"/>
25190 <tbody>
25191 <row>
25192 <entry><option>log_selector</option></entry>
25193 <entry>Use: <emphasis>main</emphasis></entry>
25194 <entry>Type: <emphasis>string</emphasis></entry>
25195 <entry>Default: <emphasis>unset</emphasis></entry>
25196 </row>
25197 </tbody>
25198 </tgroup>
25199 </informaltable>
25200 <para>
25201 <indexterm role="concept">
25202 <primary>log</primary>
25203 <secondary>selectors</secondary>
25204 </indexterm>
25205 This option can be used to reduce or increase the number of things that Exim
25206 writes to its log files. Its argument is made up of names preceded by plus or
25207 minus characters. For example:
25208 </para>
25209 <literallayout class="monospaced">
25210 log_selector = +arguments -retry_defer
25211 </literallayout>
25212 <para>
25213 A list of possible names and what they control is given in the chapter on
25214 logging, in section <xref linkend="SECTlogselector"/>.
25215 </para>
25216 <para>
25217 <indexterm role="option">
25218 <primary><option>log_timezone</option></primary>
25219 </indexterm>
25220 </para>
25221 <informaltable frame="all">
25222 <tgroup cols="4" colsep="0" rowsep="0">
25223 <colspec colwidth="8*" align="left"/>
25224 <colspec colwidth="6*" align="center"/>
25225 <colspec colwidth="6*" align="center"/>
25226 <colspec colwidth="6*" align="right"/>
25227 <tbody>
25228 <row>
25229 <entry><option>log_timezone</option></entry>
25230 <entry>Use: <emphasis>main</emphasis></entry>
25231 <entry>Type: <emphasis>boolean</emphasis></entry>
25232 <entry>Default: <emphasis>false</emphasis></entry>
25233 </row>
25234 </tbody>
25235 </tgroup>
25236 </informaltable>
25237 <para>
25238 <indexterm role="concept">
25239 <primary>log</primary>
25240 <secondary>timezone for entries</secondary>
25241 </indexterm>
25242 <indexterm role="variable">
25243 <primary><varname>$tod_log</varname></primary>
25244 </indexterm>
25245 <indexterm role="variable">
25246 <primary><varname>$tod_zone</varname></primary>
25247 </indexterm>
25248 By default, the timestamps on log lines are in local time without the
25249 timezone. This means that if your timezone changes twice a year, the timestamps
25250 in log lines are ambiguous for an hour when the clocks go back. One way of
25251 avoiding this problem is to set the timezone to UTC. An alternative is to set
25252 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
25253 timestamps in log lines. Turning on this option can add quite a lot to the size
25254 of log files because each line is extended by 6 characters. Note that the
25255 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
25256 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
25257 </para>
25258 <para>
25259 <indexterm role="option">
25260 <primary><option>lookup_open_max</option></primary>
25261 </indexterm>
25262 </para>
25263 <informaltable frame="all">
25264 <tgroup cols="4" colsep="0" rowsep="0">
25265 <colspec colwidth="8*" align="left"/>
25266 <colspec colwidth="6*" align="center"/>
25267 <colspec colwidth="6*" align="center"/>
25268 <colspec colwidth="6*" align="right"/>
25269 <tbody>
25270 <row>
25271 <entry><option>lookup_open_max</option></entry>
25272 <entry>Use: <emphasis>main</emphasis></entry>
25273 <entry>Type: <emphasis>integer</emphasis></entry>
25274 <entry>Default: <emphasis>25</emphasis></entry>
25275 </row>
25276 </tbody>
25277 </tgroup>
25278 </informaltable>
25279 <para>
25280 <indexterm role="concept">
25281 <primary>too many open files</primary>
25282 </indexterm>
25283 <indexterm role="concept">
25284 <primary>open files, too many</primary>
25285 </indexterm>
25286 <indexterm role="concept">
25287 <primary>file</primary>
25288 <secondary>too many open</secondary>
25289 </indexterm>
25290 <indexterm role="concept">
25291 <primary>lookup</primary>
25292 <secondary>maximum open files</secondary>
25293 </indexterm>
25294 <indexterm role="concept">
25295 <primary>limit</primary>
25296 <secondary>open files for lookups</secondary>
25297 </indexterm>
25298 This option limits the number of simultaneously open files for single-key
25299 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
25300 Exim normally keeps these files open during routing, because often the same
25301 file is required several times. If the limit is reached, Exim closes the least
25302 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
25303 actually opens two files for each logical DBM database, though it still counts
25304 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
25305 open files</quote> errors with NDBM, you need to reduce the value of
25306 <option>lookup_open_max</option>.
25307 </para>
25308 <para>
25309 <indexterm role="option">
25310 <primary><option>max_username_length</option></primary>
25311 </indexterm>
25312 </para>
25313 <informaltable frame="all">
25314 <tgroup cols="4" colsep="0" rowsep="0">
25315 <colspec colwidth="8*" align="left"/>
25316 <colspec colwidth="6*" align="center"/>
25317 <colspec colwidth="6*" align="center"/>
25318 <colspec colwidth="6*" align="right"/>
25319 <tbody>
25320 <row>
25321 <entry><option>max_username_length</option></entry>
25322 <entry>Use: <emphasis>main</emphasis></entry>
25323 <entry>Type: <emphasis>integer</emphasis></entry>
25324 <entry>Default: <emphasis>0</emphasis></entry>
25325 </row>
25326 </tbody>
25327 </tgroup>
25328 </informaltable>
25329 <para>
25330 <indexterm role="concept">
25331 <primary>length of login name</primary>
25332 </indexterm>
25333 <indexterm role="concept">
25334 <primary>user name</primary>
25335 <secondary>maximum length</secondary>
25336 </indexterm>
25337 <indexterm role="concept">
25338 <primary>limit</primary>
25339 <secondary>user name length</secondary>
25340 </indexterm>
25341 Some operating systems are broken in that they truncate long arguments to
25342 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
25343 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
25344 an argument that is longer behaves as if <function>getpwnam()</function> failed.
25345 </para>
25346 <para>
25347 <indexterm role="option">
25348 <primary><option>message_body_newlines</option></primary>
25349 </indexterm>
25350 </para>
25351 <informaltable frame="all">
25352 <tgroup cols="4" colsep="0" rowsep="0">
25353 <colspec colwidth="8*" align="left"/>
25354 <colspec colwidth="6*" align="center"/>
25355 <colspec colwidth="6*" align="center"/>
25356 <colspec colwidth="6*" align="right"/>
25357 <tbody>
25358 <row>
25359 <entry><option>message_body_newlines</option></entry>
25360 <entry>Use: <emphasis>main</emphasis></entry>
25361 <entry>Type: <emphasis>bool</emphasis></entry>
25362 <entry>Default: <emphasis>false</emphasis></entry>
25363 </row>
25364 </tbody>
25365 </tgroup>
25366 </informaltable>
25367 <para>
25368 <indexterm role="concept">
25369 <primary>message body</primary>
25370 <secondary>newlines in variables</secondary>
25371 </indexterm>
25372 <indexterm role="concept">
25373 <primary>newline</primary>
25374 <secondary>in message body variables</secondary>
25375 </indexterm>
25376 <indexterm role="variable">
25377 <primary><varname>$message_body</varname></primary>
25378 </indexterm>
25379 <indexterm role="variable">
25380 <primary><varname>$message_body_end</varname></primary>
25381 </indexterm>
25382 By default, newlines in the message body are replaced by spaces when setting
25383 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
25384 option is set true, this no longer happens.
25385 </para>
25386 <para>
25387 <indexterm role="option">
25388 <primary><option>message_body_visible</option></primary>
25389 </indexterm>
25390 </para>
25391 <informaltable frame="all">
25392 <tgroup cols="4" colsep="0" rowsep="0">
25393 <colspec colwidth="8*" align="left"/>
25394 <colspec colwidth="6*" align="center"/>
25395 <colspec colwidth="6*" align="center"/>
25396 <colspec colwidth="6*" align="right"/>
25397 <tbody>
25398 <row>
25399 <entry><option>message_body_visible</option></entry>
25400 <entry>Use: <emphasis>main</emphasis></entry>
25401 <entry>Type: <emphasis>integer</emphasis></entry>
25402 <entry>Default: <emphasis>500</emphasis></entry>
25403 </row>
25404 </tbody>
25405 </tgroup>
25406 </informaltable>
25407 <para>
25408 <indexterm role="concept">
25409 <primary>body of message</primary>
25410 <secondary>visible size</secondary>
25411 </indexterm>
25412 <indexterm role="concept">
25413 <primary>message body</primary>
25414 <secondary>visible size</secondary>
25415 </indexterm>
25416 <indexterm role="variable">
25417 <primary><varname>$message_body</varname></primary>
25418 </indexterm>
25419 <indexterm role="variable">
25420 <primary><varname>$message_body_end</varname></primary>
25421 </indexterm>
25422 This option specifies how much of a message&#x2019;s body is to be included in the
25423 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
25424 </para>
25425 <para>
25426 <indexterm role="option">
25427 <primary><option>message_id_header_domain</option></primary>
25428 </indexterm>
25429 </para>
25430 <informaltable frame="all">
25431 <tgroup cols="4" colsep="0" rowsep="0">
25432 <colspec colwidth="8*" align="left"/>
25433 <colspec colwidth="6*" align="center"/>
25434 <colspec colwidth="6*" align="center"/>
25435 <colspec colwidth="6*" align="right"/>
25436 <tbody>
25437 <row>
25438 <entry><option>message_id_header_domain</option></entry>
25439 <entry>Use: <emphasis>main</emphasis></entry>
25440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25441 <entry>Default: <emphasis>unset</emphasis></entry>
25442 </row>
25443 </tbody>
25444 </tgroup>
25445 </informaltable>
25446 <para>
25447 <indexterm role="concept">
25448 <primary><emphasis>Message-ID:</emphasis> header line</primary>
25449 </indexterm>
25450 If this option is set, the string is expanded and used as the right hand side
25451 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
25452 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
25453 means <quote>not received over TCP/IP.</quote>
25454 Otherwise, the primary host name is used.
25455 Only letters, digits, dot and hyphen are accepted; any other characters are
25456 replaced by hyphens. If the expansion is forced to fail, or if the result is an
25457 empty string, the option is ignored.
25458 </para>
25459 <para>
25460 <indexterm role="option">
25461 <primary><option>message_id_header_text</option></primary>
25462 </indexterm>
25463 </para>
25464 <informaltable frame="all">
25465 <tgroup cols="4" colsep="0" rowsep="0">
25466 <colspec colwidth="8*" align="left"/>
25467 <colspec colwidth="6*" align="center"/>
25468 <colspec colwidth="6*" align="center"/>
25469 <colspec colwidth="6*" align="right"/>
25470 <tbody>
25471 <row>
25472 <entry><option>message_id_header_text</option></entry>
25473 <entry>Use: <emphasis>main</emphasis></entry>
25474 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25475 <entry>Default: <emphasis>unset</emphasis></entry>
25476 </row>
25477 </tbody>
25478 </tgroup>
25479 </informaltable>
25480 <para>
25481 If this variable is set, the string is expanded and used to augment the text of
25482 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
25483 message does not have one. The text of this header is required by RFC 2822 to
25484 take the form of an address. By default, Exim uses its internal message id as
25485 the local part, and the primary host name as the domain. If this option is set,
25486 it is expanded, and provided the expansion is not forced to fail, and does not
25487 yield an empty string, the result is inserted into the header immediately
25488 before the @, separated from the internal message id by a dot. Any characters
25489 that are illegal in an address are automatically converted into hyphens. This
25490 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
25491 colons will become hyphens.
25492 </para>
25493 <para>
25494 <indexterm role="option">
25495 <primary><option>message_logs</option></primary>
25496 </indexterm>
25497 </para>
25498 <informaltable frame="all">
25499 <tgroup cols="4" colsep="0" rowsep="0">
25500 <colspec colwidth="8*" align="left"/>
25501 <colspec colwidth="6*" align="center"/>
25502 <colspec colwidth="6*" align="center"/>
25503 <colspec colwidth="6*" align="right"/>
25504 <tbody>
25505 <row>
25506 <entry><option>message_logs</option></entry>
25507 <entry>Use: <emphasis>main</emphasis></entry>
25508 <entry>Type: <emphasis>boolean</emphasis></entry>
25509 <entry>Default: <emphasis>true</emphasis></entry>
25510 </row>
25511 </tbody>
25512 </tgroup>
25513 </informaltable>
25514 <para>
25515 <indexterm role="concept">
25516 <primary>message logs</primary>
25517 <secondary>disabling</secondary>
25518 </indexterm>
25519 <indexterm role="concept">
25520 <primary>log</primary>
25521 <secondary>message log; disabling</secondary>
25522 </indexterm>
25523 If this option is turned off, per-message log files are not created in the
25524 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
25525 Exim, by reducing the number of files involved in handling a message from a
25526 minimum of four (header spool file, body spool file, delivery journal, and
25527 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
25528 which is not affected by this option.
25529 </para>
25530 <para>
25531 <indexterm role="option">
25532 <primary><option>message_size_limit</option></primary>
25533 </indexterm>
25534 </para>
25535 <informaltable frame="all">
25536 <tgroup cols="4" colsep="0" rowsep="0">
25537 <colspec colwidth="8*" align="left"/>
25538 <colspec colwidth="6*" align="center"/>
25539 <colspec colwidth="6*" align="center"/>
25540 <colspec colwidth="6*" align="right"/>
25541 <tbody>
25542 <row>
25543 <entry><option>message_size_limit</option></entry>
25544 <entry>Use: <emphasis>main</emphasis></entry>
25545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25546 <entry>Default: <emphasis>50M</emphasis></entry>
25547 </row>
25548 </tbody>
25549 </tgroup>
25550 </informaltable>
25551 <para>
25552 <indexterm role="concept">
25553 <primary>message</primary>
25554 <secondary>size limit</secondary>
25555 </indexterm>
25556 <indexterm role="concept">
25557 <primary>limit</primary>
25558 <secondary>message size</secondary>
25559 </indexterm>
25560 <indexterm role="concept">
25561 <primary>size</primary>
25562 <secondary>of message, limit</secondary>
25563 </indexterm>
25564 This option limits the maximum size of message that Exim will process. The
25565 value is expanded for each incoming connection so, for example, it can be made
25566 to depend on the IP address of the remote host for messages arriving via
25567 TCP/IP. After expansion, the value must be a sequence of decimal digits,
25568 optionally followed by K or M.
25569 </para>
25570 <para>
25571 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
25572 other properties of an individual message, because it has to be advertised in
25573 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
25574 error. A value of zero means no limit, but its use is not recommended. See also
25575 <option>bounce_return_size_limit</option>.
25576 </para>
25577 <para>
25578 Incoming SMTP messages are failed with a 552 error if the limit is
25579 exceeded; locally-generated messages either get a stderr message or a delivery
25580 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
25581 an oversized message is logged in both the main and the reject logs. See also
25582 the generic transport option <option>message_size_limit</option>, which limits the size of
25583 message that an individual transport can process.
25584 </para>
25585 <para>
25586 If you use a virus-scanner and set this option to to a value larger than the
25587 maximum size that your virus-scanner is configured to support, you may get
25588 failures triggered by large mails.  The right size to configure for the
25589 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
25590 probably safest to just set it to a little larger than this value.  Eg, with a
25591 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
25592 some problems may result.
25593 </para>
25594 <para>
25595 A value of 0 will disable size limit checking; Exim will still advertise the
25596 SIZE extension in an EHLO response, but without a limit, so as to permit
25597 SMTP clients to still indicate the message size along with the MAIL verb.
25598 </para>
25599 <para>
25600 <indexterm role="option">
25601 <primary><option>move_frozen_messages</option></primary>
25602 </indexterm>
25603 </para>
25604 <informaltable frame="all">
25605 <tgroup cols="4" colsep="0" rowsep="0">
25606 <colspec colwidth="8*" align="left"/>
25607 <colspec colwidth="6*" align="center"/>
25608 <colspec colwidth="6*" align="center"/>
25609 <colspec colwidth="6*" align="right"/>
25610 <tbody>
25611 <row>
25612 <entry><option>move_frozen_messages</option></entry>
25613 <entry>Use: <emphasis>main</emphasis></entry>
25614 <entry>Type: <emphasis>boolean</emphasis></entry>
25615 <entry>Default: <emphasis>false</emphasis></entry>
25616 </row>
25617 </tbody>
25618 </tgroup>
25619 </informaltable>
25620 <para>
25621 <indexterm role="concept">
25622 <primary>frozen messages</primary>
25623 <secondary>moving</secondary>
25624 </indexterm>
25625 This option, which is available only if Exim has been built with the setting
25626 </para>
25627 <literallayout class="monospaced">
25628 SUPPORT_MOVE_FROZEN_MESSAGES=yes
25629 </literallayout>
25630 <para>
25631 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
25632 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
25633 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
25634 standard utilities for handling such moved messages, and they do not show up in
25635 lists generated by <option>-bp</option> or by the Exim monitor.
25636 </para>
25637 <para>
25638 <indexterm role="option">
25639 <primary><option>mua_wrapper</option></primary>
25640 </indexterm>
25641 </para>
25642 <informaltable frame="all">
25643 <tgroup cols="4" colsep="0" rowsep="0">
25644 <colspec colwidth="8*" align="left"/>
25645 <colspec colwidth="6*" align="center"/>
25646 <colspec colwidth="6*" align="center"/>
25647 <colspec colwidth="6*" align="right"/>
25648 <tbody>
25649 <row>
25650 <entry><option>mua_wrapper</option></entry>
25651 <entry>Use: <emphasis>main</emphasis></entry>
25652 <entry>Type: <emphasis>boolean</emphasis></entry>
25653 <entry>Default: <emphasis>false</emphasis></entry>
25654 </row>
25655 </tbody>
25656 </tgroup>
25657 </informaltable>
25658 <para>
25659 Setting this option true causes Exim to run in a very restrictive mode in which
25660 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
25661 contains a full description of this facility.
25662 </para>
25663 <para>
25664 <indexterm role="option">
25665 <primary><option>mysql_servers</option></primary>
25666 </indexterm>
25667 </para>
25668 <informaltable frame="all">
25669 <tgroup cols="4" colsep="0" rowsep="0">
25670 <colspec colwidth="8*" align="left"/>
25671 <colspec colwidth="6*" align="center"/>
25672 <colspec colwidth="6*" align="center"/>
25673 <colspec colwidth="6*" align="right"/>
25674 <tbody>
25675 <row>
25676 <entry><option>mysql_servers</option></entry>
25677 <entry>Use: <emphasis>main</emphasis></entry>
25678 <entry>Type: <emphasis>string list</emphasis></entry>
25679 <entry>Default: <emphasis>unset</emphasis></entry>
25680 </row>
25681 </tbody>
25682 </tgroup>
25683 </informaltable>
25684 <para>
25685 <indexterm role="concept">
25686 <primary>MySQL</primary>
25687 <secondary>server list</secondary>
25688 </indexterm>
25689 This option provides a list of MySQL servers and associated connection data, to
25690 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
25691 option is available only if Exim has been built with MySQL support.
25692 </para>
25693 <para>
25694 <indexterm role="option">
25695 <primary><option>never_users</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>never_users</option></entry>
25707 <entry>Use: <emphasis>main</emphasis></entry>
25708 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25709 <entry>Default: <emphasis>unset</emphasis></entry>
25710 </row>
25711 </tbody>
25712 </tgroup>
25713 </informaltable>
25714 <para>
25715 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
25716 message deliveries are normally run in processes that are setuid to the
25717 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
25718 It is usually desirable to prevent any deliveries from running as root, as a
25719 safety precaution.
25720 </para>
25721 <para>
25722 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
25723 list of users that must not be used for local deliveries. This list is fixed in
25724 the binary and cannot be overridden by the configuration file. By default, it
25725 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
25726 can be used to add more users to the fixed list.
25727 </para>
25728 <para>
25729 If a message is to be delivered as one of the users on the fixed list or the
25730 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
25731 example is
25732 </para>
25733 <literallayout class="monospaced">
25734 never_users = root:daemon:bin
25735 </literallayout>
25736 <para>
25737 Including root is redundant if it is also on the fixed list, but it does no
25738 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
25739 transport driver.
25740 </para>
25741 <para>
25742 <indexterm role="option">
25743 <primary><option>openssl_options</option></primary>
25744 </indexterm>
25745 </para>
25746 <informaltable frame="all">
25747 <tgroup cols="4" colsep="0" rowsep="0">
25748 <colspec colwidth="8*" align="left"/>
25749 <colspec colwidth="6*" align="center"/>
25750 <colspec colwidth="6*" align="center"/>
25751 <colspec colwidth="6*" align="right"/>
25752 <tbody>
25753 <row>
25754 <entry><option>openssl_options</option></entry>
25755 <entry>Use: <emphasis>main</emphasis></entry>
25756 <entry>Type: <emphasis>string list</emphasis></entry>
25757 <entry>Default: <emphasis>+no_sslv2</emphasis></entry>
25758 </row>
25759 </tbody>
25760 </tgroup>
25761 </informaltable>
25762 <para>
25763 <indexterm role="concept">
25764 <primary>OpenSSL </primary>
25765 <secondary>compatibility</secondary>
25766 </indexterm>
25767 This option allows an administrator to adjust the SSL options applied
25768 by OpenSSL to connections.  It is given as a space-separated list of items,
25769 each one to be +added or -subtracted from the current value.
25770 </para>
25771 <para>
25772 This option is only available if Exim is built against OpenSSL.  The values
25773 available for this option vary according to the age of your OpenSSL install.
25774 The <quote>all</quote> value controls a subset of flags which are available, typically
25775 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
25776 list the values known on your system and Exim should support all the
25777 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
25778 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
25779 </para>
25780 <para>
25781 Note that adjusting the options can have severe impact upon the security of
25782 SSL as used by Exim.  It is possible to disable safety checks and shoot
25783 yourself in the foot in various unpleasant ways.  This option should not be
25784 adjusted lightly.  An unrecognised item will be detected at startup, by
25785 invoking Exim with the <option>-bV</option> flag.
25786 </para>
25787 <para>
25788 Historical note: prior to release 4.80, Exim defaulted this value to
25789 "+dont_insert_empty_fragments", which may still be needed for compatibility
25790 with some clients, but which lowers security by increasing exposure to
25791 some now infamous attacks.
25792 </para>
25793 <para>
25794 An example:
25795 </para>
25796 <literallayout class="monospaced">
25797 # Make both old MS and old Eudora happy:
25798 openssl_options = -all +microsoft_big_sslv3_buffer \
25799                        +dont_insert_empty_fragments
25800 </literallayout>
25801 <para>
25802 Possible options may include:
25803 </para>
25804 <itemizedlist>
25805 <listitem>
25806 <para>
25807 <literal>all</literal>
25808 </para>
25809 </listitem>
25810 <listitem>
25811 <para>
25812 <literal>allow_unsafe_legacy_renegotiation</literal>
25813 </para>
25814 </listitem>
25815 <listitem>
25816 <para>
25817 <literal>cipher_server_preference</literal>
25818 </para>
25819 </listitem>
25820 <listitem>
25821 <para>
25822 <literal>dont_insert_empty_fragments</literal>
25823 </para>
25824 </listitem>
25825 <listitem>
25826 <para>
25827 <literal>ephemeral_rsa</literal>
25828 </para>
25829 </listitem>
25830 <listitem>
25831 <para>
25832 <literal>legacy_server_connect</literal>
25833 </para>
25834 </listitem>
25835 <listitem>
25836 <para>
25837 <literal>microsoft_big_sslv3_buffer</literal>
25838 </para>
25839 </listitem>
25840 <listitem>
25841 <para>
25842 <literal>microsoft_sess_id_bug</literal>
25843 </para>
25844 </listitem>
25845 <listitem>
25846 <para>
25847 <literal>msie_sslv2_rsa_padding</literal>
25848 </para>
25849 </listitem>
25850 <listitem>
25851 <para>
25852 <literal>netscape_challenge_bug</literal>
25853 </para>
25854 </listitem>
25855 <listitem>
25856 <para>
25857 <literal>netscape_reuse_cipher_change_bug</literal>
25858 </para>
25859 </listitem>
25860 <listitem>
25861 <para>
25862 <literal>no_compression</literal>
25863 </para>
25864 </listitem>
25865 <listitem>
25866 <para>
25867 <literal>no_session_resumption_on_renegotiation</literal>
25868 </para>
25869 </listitem>
25870 <listitem>
25871 <para>
25872 <literal>no_sslv2</literal>
25873 </para>
25874 </listitem>
25875 <listitem>
25876 <para>
25877 <literal>no_sslv3</literal>
25878 </para>
25879 </listitem>
25880 <listitem>
25881 <para>
25882 <literal>no_ticket</literal>
25883 </para>
25884 </listitem>
25885 <listitem>
25886 <para>
25887 <literal>no_tlsv1</literal>
25888 </para>
25889 </listitem>
25890 <listitem>
25891 <para>
25892 <literal>no_tlsv1_1</literal>
25893 </para>
25894 </listitem>
25895 <listitem>
25896 <para>
25897 <literal>no_tlsv1_2</literal>
25898 </para>
25899 </listitem>
25900 <listitem>
25901 <para revisionflag="changed">
25902 <literal>safari_ecdhe_ecdsa_bug</literal>
25903 </para>
25904 </listitem>
25905 <listitem>
25906 <para>
25907 <literal>single_dh_use</literal>
25908 </para>
25909 </listitem>
25910 <listitem>
25911 <para>
25912 <literal>single_ecdh_use</literal>
25913 </para>
25914 </listitem>
25915 <listitem>
25916 <para>
25917 <literal>ssleay_080_client_dh_bug</literal>
25918 </para>
25919 </listitem>
25920 <listitem>
25921 <para>
25922 <literal>sslref2_reuse_cert_type_bug</literal>
25923 </para>
25924 </listitem>
25925 <listitem>
25926 <para>
25927 <literal>tls_block_padding_bug</literal>
25928 </para>
25929 </listitem>
25930 <listitem>
25931 <para>
25932 <literal>tls_d5_bug</literal>
25933 </para>
25934 </listitem>
25935 <listitem>
25936 <para>
25937 <literal>tls_rollback_bug</literal>
25938 </para>
25939 </listitem>
25940 </itemizedlist>
25941 <para revisionflag="changed">
25942 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
25943 all clients connecting using the MacOS SecureTransport TLS facility prior
25944 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
25945 to negotiate TLS then this option value might help, provided that your OpenSSL
25946 release is new enough to contain this work-around.  This may be a situation
25947 where you have to upgrade OpenSSL to get buggy clients working.
25948 </para>
25949 <para>
25950 <indexterm role="option">
25951 <primary><option>oracle_servers</option></primary>
25952 </indexterm>
25953 </para>
25954 <informaltable frame="all">
25955 <tgroup cols="4" colsep="0" rowsep="0">
25956 <colspec colwidth="8*" align="left"/>
25957 <colspec colwidth="6*" align="center"/>
25958 <colspec colwidth="6*" align="center"/>
25959 <colspec colwidth="6*" align="right"/>
25960 <tbody>
25961 <row>
25962 <entry><option>oracle_servers</option></entry>
25963 <entry>Use: <emphasis>main</emphasis></entry>
25964 <entry>Type: <emphasis>string list</emphasis></entry>
25965 <entry>Default: <emphasis>unset</emphasis></entry>
25966 </row>
25967 </tbody>
25968 </tgroup>
25969 </informaltable>
25970 <para>
25971 <indexterm role="concept">
25972 <primary>Oracle</primary>
25973 <secondary>server list</secondary>
25974 </indexterm>
25975 This option provides a list of Oracle servers and associated connection data,
25976 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
25977 The option is available only if Exim has been built with Oracle support.
25978 </para>
25979 <para>
25980 <indexterm role="option">
25981 <primary><option>percent_hack_domains</option></primary>
25982 </indexterm>
25983 </para>
25984 <informaltable frame="all">
25985 <tgroup cols="4" colsep="0" rowsep="0">
25986 <colspec colwidth="8*" align="left"/>
25987 <colspec colwidth="6*" align="center"/>
25988 <colspec colwidth="6*" align="center"/>
25989 <colspec colwidth="6*" align="right"/>
25990 <tbody>
25991 <row>
25992 <entry><option>percent_hack_domains</option></entry>
25993 <entry>Use: <emphasis>main</emphasis></entry>
25994 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25995 <entry>Default: <emphasis>unset</emphasis></entry>
25996 </row>
25997 </tbody>
25998 </tgroup>
25999 </informaltable>
26000 <para>
26001 <indexterm role="concept">
26002 <primary><quote>percent hack</quote></primary>
26003 </indexterm>
26004 <indexterm role="concept">
26005 <primary>source routing</primary>
26006 <secondary>in email address</secondary>
26007 </indexterm>
26008 <indexterm role="concept">
26009 <primary>address</primary>
26010 <secondary>source-routed</secondary>
26011 </indexterm>
26012 The <quote>percent hack</quote> is the convention whereby a local part containing a
26013 percent sign is re-interpreted as a new email address, with the percent
26014 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
26015 also applied to RFC 2822 addresses that begin with an @ character. If this
26016 option is set, Exim implements the percent facility for those domains listed,
26017 but no others. This happens before an incoming SMTP address is tested against
26018 an ACL.
26019 </para>
26020 <para>
26021 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
26022 trying to get round relaying restrictions. For this reason, it is best avoided
26023 if at all possible. Unfortunately, a number of less security-conscious MTAs
26024 implement it unconditionally. If you are running Exim on a gateway host, and
26025 routing mail through to internal MTAs without processing the local parts, it is
26026 a good idea to reject recipient addresses with percent characters in their
26027 local parts. Exim&#x2019;s default configuration does this.
26028 </para>
26029 <para>
26030 <indexterm role="option">
26031 <primary><option>perl_at_start</option></primary>
26032 </indexterm>
26033 </para>
26034 <informaltable frame="all">
26035 <tgroup cols="4" colsep="0" rowsep="0">
26036 <colspec colwidth="8*" align="left"/>
26037 <colspec colwidth="6*" align="center"/>
26038 <colspec colwidth="6*" align="center"/>
26039 <colspec colwidth="6*" align="right"/>
26040 <tbody>
26041 <row>
26042 <entry><option>perl_at_start</option></entry>
26043 <entry>Use: <emphasis>main</emphasis></entry>
26044 <entry>Type: <emphasis>boolean</emphasis></entry>
26045 <entry>Default: <emphasis>false</emphasis></entry>
26046 </row>
26047 </tbody>
26048 </tgroup>
26049 </informaltable>
26050 <para>
26051 This option is available only when Exim is built with an embedded Perl
26052 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26053 </para>
26054 <para>
26055 <indexterm role="option">
26056 <primary><option>perl_startup</option></primary>
26057 </indexterm>
26058 </para>
26059 <informaltable frame="all">
26060 <tgroup cols="4" colsep="0" rowsep="0">
26061 <colspec colwidth="8*" align="left"/>
26062 <colspec colwidth="6*" align="center"/>
26063 <colspec colwidth="6*" align="center"/>
26064 <colspec colwidth="6*" align="right"/>
26065 <tbody>
26066 <row>
26067 <entry><option>perl_startup</option></entry>
26068 <entry>Use: <emphasis>main</emphasis></entry>
26069 <entry>Type: <emphasis>string</emphasis></entry>
26070 <entry>Default: <emphasis>unset</emphasis></entry>
26071 </row>
26072 </tbody>
26073 </tgroup>
26074 </informaltable>
26075 <para>
26076 This option is available only when Exim is built with an embedded Perl
26077 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
26078 </para>
26079 <para>
26080 <indexterm role="option">
26081 <primary><option>pgsql_servers</option></primary>
26082 </indexterm>
26083 </para>
26084 <informaltable frame="all">
26085 <tgroup cols="4" colsep="0" rowsep="0">
26086 <colspec colwidth="8*" align="left"/>
26087 <colspec colwidth="6*" align="center"/>
26088 <colspec colwidth="6*" align="center"/>
26089 <colspec colwidth="6*" align="right"/>
26090 <tbody>
26091 <row>
26092 <entry><option>pgsql_servers</option></entry>
26093 <entry>Use: <emphasis>main</emphasis></entry>
26094 <entry>Type: <emphasis>string list</emphasis></entry>
26095 <entry>Default: <emphasis>unset</emphasis></entry>
26096 </row>
26097 </tbody>
26098 </tgroup>
26099 </informaltable>
26100 <para>
26101 <indexterm role="concept">
26102 <primary>PostgreSQL lookup type</primary>
26103 <secondary>server list</secondary>
26104 </indexterm>
26105 This option provides a list of PostgreSQL servers and associated connection
26106 data, to be used in conjunction with <command>pgsql</command> lookups (see section
26107 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
26108 PostgreSQL support.
26109 </para>
26110 <para>
26111 <indexterm role="option">
26112 <primary><option>pid_file_path</option></primary>
26113 </indexterm>
26114 </para>
26115 <informaltable frame="all">
26116 <tgroup cols="4" colsep="0" rowsep="0">
26117 <colspec colwidth="8*" align="left"/>
26118 <colspec colwidth="6*" align="center"/>
26119 <colspec colwidth="6*" align="center"/>
26120 <colspec colwidth="6*" align="right"/>
26121 <tbody>
26122 <row>
26123 <entry><option>pid_file_path</option></entry>
26124 <entry>Use: <emphasis>main</emphasis></entry>
26125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26126 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26127 </row>
26128 </tbody>
26129 </tgroup>
26130 </informaltable>
26131 <para>
26132 <indexterm role="concept">
26133 <primary>daemon</primary>
26134 <secondary>pid file path</secondary>
26135 </indexterm>
26136 <indexterm role="concept">
26137 <primary>pid file, path for</primary>
26138 </indexterm>
26139 This option sets the name of the file to which the Exim daemon writes its
26140 process id. The string is expanded, so it can contain, for example, references
26141 to the host name:
26142 </para>
26143 <literallayout class="monospaced">
26144 pid_file_path = /var/log/$primary_hostname/exim.pid
26145 </literallayout>
26146 <para>
26147 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
26148 spool directory.
26149 The value set by the option can be overridden by the <option>-oP</option> command line
26150 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
26151 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
26152 </para>
26153 <para>
26154 <indexterm role="option">
26155 <primary><option>pipelining_advertise_hosts</option></primary>
26156 </indexterm>
26157 </para>
26158 <informaltable frame="all">
26159 <tgroup cols="4" colsep="0" rowsep="0">
26160 <colspec colwidth="8*" align="left"/>
26161 <colspec colwidth="6*" align="center"/>
26162 <colspec colwidth="6*" align="center"/>
26163 <colspec colwidth="6*" align="right"/>
26164 <tbody>
26165 <row>
26166 <entry><option>pipelining_advertise_hosts</option></entry>
26167 <entry>Use: <emphasis>main</emphasis></entry>
26168 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26169 <entry>Default: <emphasis>*</emphasis></entry>
26170 </row>
26171 </tbody>
26172 </tgroup>
26173 </informaltable>
26174 <para>
26175 <indexterm role="concept">
26176 <primary>PIPELINING</primary>
26177 <secondary>suppressing advertising</secondary>
26178 </indexterm>
26179 This option can be used to suppress the advertisement of the SMTP
26180 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
26181 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
26182 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
26183 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
26184 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
26185 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
26186 </para>
26187 <para>
26188 <indexterm role="option">
26189 <primary><option>preserve_message_logs</option></primary>
26190 </indexterm>
26191 </para>
26192 <informaltable frame="all">
26193 <tgroup cols="4" colsep="0" rowsep="0">
26194 <colspec colwidth="8*" align="left"/>
26195 <colspec colwidth="6*" align="center"/>
26196 <colspec colwidth="6*" align="center"/>
26197 <colspec colwidth="6*" align="right"/>
26198 <tbody>
26199 <row>
26200 <entry><option>preserve_message_logs</option></entry>
26201 <entry>Use: <emphasis>main</emphasis></entry>
26202 <entry>Type: <emphasis>boolean</emphasis></entry>
26203 <entry>Default: <emphasis>false</emphasis></entry>
26204 </row>
26205 </tbody>
26206 </tgroup>
26207 </informaltable>
26208 <para>
26209 <indexterm role="concept">
26210 <primary>message logs</primary>
26211 <secondary>preserving</secondary>
26212 </indexterm>
26213 If this option is set, message log files are not deleted when messages are
26214 completed. Instead, they are moved to a sub-directory of the spool directory
26215 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
26216 purposes. This is a dangerous option to set on systems with any appreciable
26217 volume of mail. Use with care!
26218 </para>
26219 <para>
26220 <indexterm role="option">
26221 <primary><option>primary_hostname</option></primary>
26222 </indexterm>
26223 </para>
26224 <informaltable frame="all">
26225 <tgroup cols="4" colsep="0" rowsep="0">
26226 <colspec colwidth="8*" align="left"/>
26227 <colspec colwidth="6*" align="center"/>
26228 <colspec colwidth="6*" align="center"/>
26229 <colspec colwidth="6*" align="right"/>
26230 <tbody>
26231 <row>
26232 <entry><option>primary_hostname</option></entry>
26233 <entry>Use: <emphasis>main</emphasis></entry>
26234 <entry>Type: <emphasis>string</emphasis></entry>
26235 <entry>Default: <emphasis>see below</emphasis></entry>
26236 </row>
26237 </tbody>
26238 </tgroup>
26239 </informaltable>
26240 <para>
26241 <indexterm role="concept">
26242 <primary>name</primary>
26243 <secondary>of local host</secondary>
26244 </indexterm>
26245 <indexterm role="concept">
26246 <primary>host</primary>
26247 <secondary>name of local</secondary>
26248 </indexterm>
26249 <indexterm role="concept">
26250 <primary>local host</primary>
26251 <secondary>name of</secondary>
26252 </indexterm>
26253 <indexterm role="variable">
26254 <primary><varname>$primary_hostname</varname></primary>
26255 </indexterm>
26256 This specifies the name of the current host. It is used in the default EHLO or
26257 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
26258 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
26259 The value is also used by default in some SMTP response messages from an Exim
26260 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
26261 </para>
26262 <para>
26263 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
26264 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
26265 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
26266 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
26267 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
26268 explicitly by this option, or defaulted.
26269 </para>
26270 <para>
26271 <indexterm role="option">
26272 <primary><option>print_topbitchars</option></primary>
26273 </indexterm>
26274 </para>
26275 <informaltable frame="all">
26276 <tgroup cols="4" colsep="0" rowsep="0">
26277 <colspec colwidth="8*" align="left"/>
26278 <colspec colwidth="6*" align="center"/>
26279 <colspec colwidth="6*" align="center"/>
26280 <colspec colwidth="6*" align="right"/>
26281 <tbody>
26282 <row>
26283 <entry><option>print_topbitchars</option></entry>
26284 <entry>Use: <emphasis>main</emphasis></entry>
26285 <entry>Type: <emphasis>boolean</emphasis></entry>
26286 <entry>Default: <emphasis>false</emphasis></entry>
26287 </row>
26288 </tbody>
26289 </tgroup>
26290 </informaltable>
26291 <para>
26292 <indexterm role="concept">
26293 <primary>printing characters</primary>
26294 </indexterm>
26295 <indexterm role="concept">
26296 <primary>8-bit characters</primary>
26297 </indexterm>
26298 By default, Exim considers only those characters whose codes lie in the range
26299 32&ndash;126 to be printing characters. In a number of circumstances (for example,
26300 when writing log entries) non-printing characters are converted into escape
26301 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
26302 is set, code values of 128 and above are also considered to be printing
26303 characters.
26304 </para>
26305 <para>
26306 This option also affects the header syntax checks performed by the
26307 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
26308 the user&#x2019;s full name when constructing From: and Sender: addresses (as
26309 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
26310 Exim to generate eight bit message headers that do not conform to the
26311 standards.
26312 </para>
26313 <para>
26314 <indexterm role="option">
26315 <primary><option>process_log_path</option></primary>
26316 </indexterm>
26317 </para>
26318 <informaltable frame="all">
26319 <tgroup cols="4" colsep="0" rowsep="0">
26320 <colspec colwidth="8*" align="left"/>
26321 <colspec colwidth="6*" align="center"/>
26322 <colspec colwidth="6*" align="center"/>
26323 <colspec colwidth="6*" align="right"/>
26324 <tbody>
26325 <row>
26326 <entry><option>process_log_path</option></entry>
26327 <entry>Use: <emphasis>main</emphasis></entry>
26328 <entry>Type: <emphasis>string</emphasis></entry>
26329 <entry>Default: <emphasis>unset</emphasis></entry>
26330 </row>
26331 </tbody>
26332 </tgroup>
26333 </informaltable>
26334 <para>
26335 <indexterm role="concept">
26336 <primary>process log path</primary>
26337 </indexterm>
26338 <indexterm role="concept">
26339 <primary>log</primary>
26340 <secondary>process log</secondary>
26341 </indexterm>
26342 <indexterm role="concept">
26343 <primary><emphasis>exiwhat</emphasis></primary>
26344 </indexterm>
26345 This option sets the name of the file to which an Exim process writes its
26346 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
26347 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
26348 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
26349 can be useful in environments where two different Exims are running, using
26350 different spool directories.
26351 </para>
26352 <para>
26353 <indexterm role="option">
26354 <primary><option>prod_requires_admin</option></primary>
26355 </indexterm>
26356 </para>
26357 <informaltable frame="all">
26358 <tgroup cols="4" colsep="0" rowsep="0">
26359 <colspec colwidth="8*" align="left"/>
26360 <colspec colwidth="6*" align="center"/>
26361 <colspec colwidth="6*" align="center"/>
26362 <colspec colwidth="6*" align="right"/>
26363 <tbody>
26364 <row>
26365 <entry><option>prod_requires_admin</option></entry>
26366 <entry>Use: <emphasis>main</emphasis></entry>
26367 <entry>Type: <emphasis>boolean</emphasis></entry>
26368 <entry>Default: <emphasis>true</emphasis></entry>
26369 </row>
26370 </tbody>
26371 </tgroup>
26372 </informaltable>
26373 <para>
26374 <indexterm role="option">
26375 <primary><option>-M</option></primary>
26376 </indexterm>
26377 <indexterm role="option">
26378 <primary><option>-R</option></primary>
26379 </indexterm>
26380 <indexterm role="option">
26381 <primary><option>-q</option></primary>
26382 </indexterm>
26383 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
26384 admin user unless <option>prod_requires_admin</option> is set false. See also
26385 <option>queue_list_requires_admin</option>.
26386 </para>
26387 <para>
26388 <indexterm role="option">
26389 <primary><option>qualify_domain</option></primary>
26390 </indexterm>
26391 </para>
26392 <informaltable frame="all">
26393 <tgroup cols="4" colsep="0" rowsep="0">
26394 <colspec colwidth="8*" align="left"/>
26395 <colspec colwidth="6*" align="center"/>
26396 <colspec colwidth="6*" align="center"/>
26397 <colspec colwidth="6*" align="right"/>
26398 <tbody>
26399 <row>
26400 <entry><option>qualify_domain</option></entry>
26401 <entry>Use: <emphasis>main</emphasis></entry>
26402 <entry>Type: <emphasis>string</emphasis></entry>
26403 <entry>Default: <emphasis>see below</emphasis></entry>
26404 </row>
26405 </tbody>
26406 </tgroup>
26407 </informaltable>
26408 <para>
26409 <indexterm role="concept">
26410 <primary>domain</primary>
26411 <secondary>for qualifying addresses</secondary>
26412 </indexterm>
26413 <indexterm role="concept">
26414 <primary>address</primary>
26415 <secondary>qualification</secondary>
26416 </indexterm>
26417 This option specifies the domain name that is added to any envelope sender
26418 addresses that do not have a domain qualification. It also applies to
26419 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
26420 are accepted by default only for locally-generated messages. Qualification is
26421 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
26422 locally-generated messages, unless the <option>-bnq</option> command line option is used.
26423 </para>
26424 <para>
26425 Messages from external sources must always contain fully qualified addresses,
26426 unless the sending host matches <option>sender_unqualified_hosts</option> or
26427 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
26428 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
26429 necessary. Internally, Exim always works with fully qualified envelope
26430 addresses. If <option>qualify_domain</option> is not set, it defaults to the
26431 <option>primary_hostname</option> value.
26432 </para>
26433 <para>
26434 <indexterm role="option">
26435 <primary><option>qualify_recipient</option></primary>
26436 </indexterm>
26437 </para>
26438 <informaltable frame="all">
26439 <tgroup cols="4" colsep="0" rowsep="0">
26440 <colspec colwidth="8*" align="left"/>
26441 <colspec colwidth="6*" align="center"/>
26442 <colspec colwidth="6*" align="center"/>
26443 <colspec colwidth="6*" align="right"/>
26444 <tbody>
26445 <row>
26446 <entry><option>qualify_recipient</option></entry>
26447 <entry>Use: <emphasis>main</emphasis></entry>
26448 <entry>Type: <emphasis>string</emphasis></entry>
26449 <entry>Default: <emphasis>see below</emphasis></entry>
26450 </row>
26451 </tbody>
26452 </tgroup>
26453 </informaltable>
26454 <para>
26455 This option allows you to specify a different domain for qualifying recipient
26456 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
26457 </para>
26458 <para>
26459 <indexterm role="option">
26460 <primary><option>queue_domains</option></primary>
26461 </indexterm>
26462 </para>
26463 <informaltable frame="all">
26464 <tgroup cols="4" colsep="0" rowsep="0">
26465 <colspec colwidth="8*" align="left"/>
26466 <colspec colwidth="6*" align="center"/>
26467 <colspec colwidth="6*" align="center"/>
26468 <colspec colwidth="6*" align="right"/>
26469 <tbody>
26470 <row>
26471 <entry><option>queue_domains</option></entry>
26472 <entry>Use: <emphasis>main</emphasis></entry>
26473 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26474 <entry>Default: <emphasis>unset</emphasis></entry>
26475 </row>
26476 </tbody>
26477 </tgroup>
26478 </informaltable>
26479 <para>
26480 <indexterm role="concept">
26481 <primary>domain</primary>
26482 <secondary>specifying non-immediate delivery</secondary>
26483 </indexterm>
26484 <indexterm role="concept">
26485 <primary>queueing incoming messages</primary>
26486 </indexterm>
26487 <indexterm role="concept">
26488 <primary>message</primary>
26489 <secondary>queueing certain domains</secondary>
26490 </indexterm>
26491 This option lists domains for which immediate delivery is not required.
26492 A delivery process is started whenever a message is received, but only those
26493 domains that do not match are processed. All other deliveries wait until the
26494 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
26495 </para>
26496 <para>
26497 <indexterm role="option">
26498 <primary><option>queue_list_requires_admin</option></primary>
26499 </indexterm>
26500 </para>
26501 <informaltable frame="all">
26502 <tgroup cols="4" colsep="0" rowsep="0">
26503 <colspec colwidth="8*" align="left"/>
26504 <colspec colwidth="6*" align="center"/>
26505 <colspec colwidth="6*" align="center"/>
26506 <colspec colwidth="6*" align="right"/>
26507 <tbody>
26508 <row>
26509 <entry><option>queue_list_requires_admin</option></entry>
26510 <entry>Use: <emphasis>main</emphasis></entry>
26511 <entry>Type: <emphasis>boolean</emphasis></entry>
26512 <entry>Default: <emphasis>true</emphasis></entry>
26513 </row>
26514 </tbody>
26515 </tgroup>
26516 </informaltable>
26517 <para>
26518 <indexterm role="option">
26519 <primary><option>-bp</option></primary>
26520 </indexterm>
26521 The <option>-bp</option> command-line option, which lists the messages that are on the
26522 queue, requires the caller to be an admin user unless
26523 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
26524 </para>
26525 <para>
26526 <indexterm role="option">
26527 <primary><option>queue_only</option></primary>
26528 </indexterm>
26529 </para>
26530 <informaltable frame="all">
26531 <tgroup cols="4" colsep="0" rowsep="0">
26532 <colspec colwidth="8*" align="left"/>
26533 <colspec colwidth="6*" align="center"/>
26534 <colspec colwidth="6*" align="center"/>
26535 <colspec colwidth="6*" align="right"/>
26536 <tbody>
26537 <row>
26538 <entry><option>queue_only</option></entry>
26539 <entry>Use: <emphasis>main</emphasis></entry>
26540 <entry>Type: <emphasis>boolean</emphasis></entry>
26541 <entry>Default: <emphasis>false</emphasis></entry>
26542 </row>
26543 </tbody>
26544 </tgroup>
26545 </informaltable>
26546 <para>
26547 <indexterm role="concept">
26548 <primary>queueing incoming messages</primary>
26549 </indexterm>
26550 <indexterm role="concept">
26551 <primary>message</primary>
26552 <secondary>queueing unconditionally</secondary>
26553 </indexterm>
26554 If <option>queue_only</option> is set, a delivery process is not automatically started
26555 whenever a message is received. Instead, the message waits on the queue for the
26556 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
26557 delivered immediately when certain conditions (such as heavy load) occur.
26558 </para>
26559 <para>
26560 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
26561 and <option>-odi</option> command line options override <option>queue_only</option> unless
26562 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
26563 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
26564 </para>
26565 <para>
26566 <indexterm role="option">
26567 <primary><option>queue_only_file</option></primary>
26568 </indexterm>
26569 </para>
26570 <informaltable frame="all">
26571 <tgroup cols="4" colsep="0" rowsep="0">
26572 <colspec colwidth="8*" align="left"/>
26573 <colspec colwidth="6*" align="center"/>
26574 <colspec colwidth="6*" align="center"/>
26575 <colspec colwidth="6*" align="right"/>
26576 <tbody>
26577 <row>
26578 <entry><option>queue_only_file</option></entry>
26579 <entry>Use: <emphasis>main</emphasis></entry>
26580 <entry>Type: <emphasis>string</emphasis></entry>
26581 <entry>Default: <emphasis>unset</emphasis></entry>
26582 </row>
26583 </tbody>
26584 </tgroup>
26585 </informaltable>
26586 <para>
26587 <indexterm role="concept">
26588 <primary>queueing incoming messages</primary>
26589 </indexterm>
26590 <indexterm role="concept">
26591 <primary>message</primary>
26592 <secondary>queueing by file existence</secondary>
26593 </indexterm>
26594 This option can be set to a colon-separated list of absolute path names, each
26595 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
26596 it tests for the existence of each listed path using a call to <function>stat()</function>. For
26597 each path that exists, the corresponding queueing option is set.
26598 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
26599 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
26600 </para>
26601 <literallayout class="monospaced">
26602 queue_only_file = smtp/some/file
26603 </literallayout>
26604 <para>
26605 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
26606 <filename>/some/file</filename> exists.
26607 </para>
26608 <para>
26609 <indexterm role="option">
26610 <primary><option>queue_only_load</option></primary>
26611 </indexterm>
26612 </para>
26613 <informaltable frame="all">
26614 <tgroup cols="4" colsep="0" rowsep="0">
26615 <colspec colwidth="8*" align="left"/>
26616 <colspec colwidth="6*" align="center"/>
26617 <colspec colwidth="6*" align="center"/>
26618 <colspec colwidth="6*" align="right"/>
26619 <tbody>
26620 <row>
26621 <entry><option>queue_only_load</option></entry>
26622 <entry>Use: <emphasis>main</emphasis></entry>
26623 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26624 <entry>Default: <emphasis>unset</emphasis></entry>
26625 </row>
26626 </tbody>
26627 </tgroup>
26628 </informaltable>
26629 <para>
26630 <indexterm role="concept">
26631 <primary>load average</primary>
26632 </indexterm>
26633 <indexterm role="concept">
26634 <primary>queueing incoming messages</primary>
26635 </indexterm>
26636 <indexterm role="concept">
26637 <primary>message</primary>
26638 <secondary>queueing by load</secondary>
26639 </indexterm>
26640 If the system load average is higher than this value, incoming messages from
26641 all sources are queued, and no automatic deliveries are started. If this
26642 happens during local or remote SMTP input, all subsequent messages received on
26643 the same SMTP connection are queued by default, whatever happens to the load in
26644 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
26645 false.
26646 </para>
26647 <para>
26648 Deliveries will subsequently be performed by queue runner processes. This
26649 option has no effect on ancient operating systems on which Exim cannot
26650 determine the load average. See also <option>deliver_queue_load_max</option> and
26651 <option>smtp_load_reserve</option>.
26652 </para>
26653 <para>
26654 <indexterm role="option">
26655 <primary><option>queue_only_load_latch</option></primary>
26656 </indexterm>
26657 </para>
26658 <informaltable frame="all">
26659 <tgroup cols="4" colsep="0" rowsep="0">
26660 <colspec colwidth="8*" align="left"/>
26661 <colspec colwidth="6*" align="center"/>
26662 <colspec colwidth="6*" align="center"/>
26663 <colspec colwidth="6*" align="right"/>
26664 <tbody>
26665 <row>
26666 <entry><option>queue_only_load_latch</option></entry>
26667 <entry>Use: <emphasis>main</emphasis></entry>
26668 <entry>Type: <emphasis>boolean</emphasis></entry>
26669 <entry>Default: <emphasis>true</emphasis></entry>
26670 </row>
26671 </tbody>
26672 </tgroup>
26673 </informaltable>
26674 <para>
26675 <indexterm role="concept">
26676 <primary>load average</primary>
26677 <secondary>re-evaluating per message</secondary>
26678 </indexterm>
26679 When this option is true (the default), once one message has been queued
26680 because the load average is higher than the value set by <option>queue_only_load</option>,
26681 all subsequent messages received on the same SMTP connection are also queued.
26682 This is a deliberate choice; even though the load average may fall below the
26683 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
26684 connection when not delivering earlier ones. However, there are special
26685 circumstances such as very long-lived connections from scanning appliances
26686 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
26687 should be set false. This causes the value of the load average to be
26688 re-evaluated for each message.
26689 </para>
26690 <para>
26691 <indexterm role="option">
26692 <primary><option>queue_only_override</option></primary>
26693 </indexterm>
26694 </para>
26695 <informaltable frame="all">
26696 <tgroup cols="4" colsep="0" rowsep="0">
26697 <colspec colwidth="8*" align="left"/>
26698 <colspec colwidth="6*" align="center"/>
26699 <colspec colwidth="6*" align="center"/>
26700 <colspec colwidth="6*" align="right"/>
26701 <tbody>
26702 <row>
26703 <entry><option>queue_only_override</option></entry>
26704 <entry>Use: <emphasis>main</emphasis></entry>
26705 <entry>Type: <emphasis>boolean</emphasis></entry>
26706 <entry>Default: <emphasis>true</emphasis></entry>
26707 </row>
26708 </tbody>
26709 </tgroup>
26710 </informaltable>
26711 <para>
26712 <indexterm role="concept">
26713 <primary>queueing incoming messages</primary>
26714 </indexterm>
26715 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
26716 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
26717 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
26718 to override; they are accepted, but ignored.
26719 </para>
26720 <para>
26721 <indexterm role="option">
26722 <primary><option>queue_run_in_order</option></primary>
26723 </indexterm>
26724 </para>
26725 <informaltable frame="all">
26726 <tgroup cols="4" colsep="0" rowsep="0">
26727 <colspec colwidth="8*" align="left"/>
26728 <colspec colwidth="6*" align="center"/>
26729 <colspec colwidth="6*" align="center"/>
26730 <colspec colwidth="6*" align="right"/>
26731 <tbody>
26732 <row>
26733 <entry><option>queue_run_in_order</option></entry>
26734 <entry>Use: <emphasis>main</emphasis></entry>
26735 <entry>Type: <emphasis>boolean</emphasis></entry>
26736 <entry>Default: <emphasis>false</emphasis></entry>
26737 </row>
26738 </tbody>
26739 </tgroup>
26740 </informaltable>
26741 <para>
26742 <indexterm role="concept">
26743 <primary>queue runner</primary>
26744 <secondary>processing messages in order</secondary>
26745 </indexterm>
26746 If this option is set, queue runs happen in order of message arrival instead of
26747 in an arbitrary order. For this to happen, a complete list of the entire queue
26748 must be set up before the deliveries start. When the queue is all held in a
26749 single directory (the default), a single list is created for both the ordered
26750 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
26751 single list is not created when <option>queue_run_in_order</option> is false. In this case,
26752 the sub-directories are processed one at a time (in a random order), and this
26753 avoids setting up one huge list for the whole queue. Thus, setting
26754 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
26755 when the queue is large, because of the extra work in setting up the single,
26756 large list. In most situations, <option>queue_run_in_order</option> should not be set.
26757 </para>
26758 <para>
26759 <indexterm role="option">
26760 <primary><option>queue_run_max</option></primary>
26761 </indexterm>
26762 </para>
26763 <informaltable frame="all">
26764 <tgroup cols="4" colsep="0" rowsep="0">
26765 <colspec colwidth="8*" align="left"/>
26766 <colspec colwidth="6*" align="center"/>
26767 <colspec colwidth="6*" align="center"/>
26768 <colspec colwidth="6*" align="right"/>
26769 <tbody>
26770 <row>
26771 <entry><option>queue_run_max</option></entry>
26772 <entry>Use: <emphasis>main</emphasis></entry>
26773 <entry>Type: <emphasis>integer</emphasis></entry>
26774 <entry>Default: <emphasis>5</emphasis></entry>
26775 </row>
26776 </tbody>
26777 </tgroup>
26778 </informaltable>
26779 <para>
26780 <indexterm role="concept">
26781 <primary>queue runner</primary>
26782 <secondary>maximum number of</secondary>
26783 </indexterm>
26784 This controls the maximum number of queue runner processes that an Exim daemon
26785 can run simultaneously. This does not mean that it starts them all at once,
26786 but rather that if the maximum number are still running when the time comes to
26787 start another one, it refrains from starting another one. This can happen with
26788 very large queues and/or very sluggish deliveries. This option does not,
26789 however, interlock with other processes, so additional queue runners can be
26790 started by other means, or by killing and restarting the daemon.
26791 </para>
26792 <para>
26793 Setting this option to zero does not suppress queue runs; rather, it disables
26794 the limit, allowing any number of simultaneous queue runner processes to be
26795 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
26796 the daemon&#x2019;s command line.
26797 </para>
26798 <para>
26799 <indexterm role="option">
26800 <primary><option>queue_smtp_domains</option></primary>
26801 </indexterm>
26802 </para>
26803 <informaltable frame="all">
26804 <tgroup cols="4" colsep="0" rowsep="0">
26805 <colspec colwidth="8*" align="left"/>
26806 <colspec colwidth="6*" align="center"/>
26807 <colspec colwidth="6*" align="center"/>
26808 <colspec colwidth="6*" align="right"/>
26809 <tbody>
26810 <row>
26811 <entry><option>queue_smtp_domains</option></entry>
26812 <entry>Use: <emphasis>main</emphasis></entry>
26813 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26814 <entry>Default: <emphasis>unset</emphasis></entry>
26815 </row>
26816 </tbody>
26817 </tgroup>
26818 </informaltable>
26819 <para>
26820 <indexterm role="concept">
26821 <primary>queueing incoming messages</primary>
26822 </indexterm>
26823 <indexterm role="concept">
26824 <primary>message</primary>
26825 <secondary>queueing remote deliveries</secondary>
26826 </indexterm>
26827 When this option is set, a delivery process is started whenever a message is
26828 received, routing is performed, and local deliveries take place.
26829 However, if any SMTP deliveries are required for domains that match
26830 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
26831 message waits on the queue for the next queue run. Since routing of the message
26832 has taken place, Exim knows to which remote hosts it must be delivered, and so
26833 when the queue run happens, multiple messages for the same host are delivered
26834 over a single SMTP connection. The <option>-odqs</option> command line option causes all
26835 SMTP deliveries to be queued in this way, and is equivalent to setting
26836 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
26837 <option>queue_domains</option>.
26838 </para>
26839 <para>
26840 <indexterm role="option">
26841 <primary><option>receive_timeout</option></primary>
26842 </indexterm>
26843 </para>
26844 <informaltable frame="all">
26845 <tgroup cols="4" colsep="0" rowsep="0">
26846 <colspec colwidth="8*" align="left"/>
26847 <colspec colwidth="6*" align="center"/>
26848 <colspec colwidth="6*" align="center"/>
26849 <colspec colwidth="6*" align="right"/>
26850 <tbody>
26851 <row>
26852 <entry><option>receive_timeout</option></entry>
26853 <entry>Use: <emphasis>main</emphasis></entry>
26854 <entry>Type: <emphasis>time</emphasis></entry>
26855 <entry>Default: <emphasis>0s</emphasis></entry>
26856 </row>
26857 </tbody>
26858 </tgroup>
26859 </informaltable>
26860 <para>
26861 <indexterm role="concept">
26862 <primary>timeout</primary>
26863 <secondary>for non-SMTP input</secondary>
26864 </indexterm>
26865 This option sets the timeout for accepting a non-SMTP message, that is, the
26866 maximum time that Exim waits when reading a message on the standard input. If
26867 the value is zero, it will wait for ever. This setting is overridden by the
26868 <option>-or</option> command line option. The timeout for incoming SMTP messages is
26869 controlled by <option>smtp_receive_timeout</option>.
26870 </para>
26871 <para>
26872 <indexterm role="option">
26873 <primary><option>received_header_text</option></primary>
26874 </indexterm>
26875 </para>
26876 <informaltable frame="all">
26877 <tgroup cols="4" colsep="0" rowsep="0">
26878 <colspec colwidth="8*" align="left"/>
26879 <colspec colwidth="6*" align="center"/>
26880 <colspec colwidth="6*" align="center"/>
26881 <colspec colwidth="6*" align="right"/>
26882 <tbody>
26883 <row>
26884 <entry><option>received_header_text</option></entry>
26885 <entry>Use: <emphasis>main</emphasis></entry>
26886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26887 <entry>Default: <emphasis>see below</emphasis></entry>
26888 </row>
26889 </tbody>
26890 </tgroup>
26891 </informaltable>
26892 <para>
26893 <indexterm role="concept">
26894 <primary>customizing</primary>
26895 <secondary><emphasis>Received:</emphasis> header</secondary>
26896 </indexterm>
26897 <indexterm role="concept">
26898 <primary><emphasis>Received:</emphasis> header line</primary>
26899 <secondary>customizing</secondary>
26900 </indexterm>
26901 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
26902 added to each message, except for the timestamp, which is automatically added
26903 on at the end (preceded by a semicolon). The string is expanded each time it is
26904 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
26905 added to the message. Otherwise, the string should start with the text
26906 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
26907 header lines. The default setting is:
26908 </para>
26909 <literallayout class="monospaced">
26910 received_header_text = Received: \
26911   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
26912   {${if def:sender_ident \
26913   {from ${quote_local_part:$sender_ident} }}\
26914   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
26915   by $primary_hostname \
26916   ${if def:received_protocol {with $received_protocol}} \
26917   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
26918   (Exim $version_number)\n\t\
26919   ${if def:sender_address \
26920   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
26921   id $message_exim_id\
26922   ${if def:received_for {\n\tfor $received_for}}
26923 </literallayout>
26924 <para>
26925 The reference to the TLS cipher is omitted when Exim is built without TLS
26926 support. The use of conditional expansions ensures that this works for both
26927 locally generated messages and messages received from remote hosts, giving
26928 header lines such as the following:
26929 </para>
26930 <literallayout class="monospaced">
26931 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
26932 by marley.carol.example with esmtp (Exim 4.00)
26933 (envelope-from &lt;bob@carol.example&gt;)
26934 id 16IOWa-00019l-00
26935 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
26936 Received: by scrooge.carol.example with local (Exim 4.00)
26937 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
26938 </literallayout>
26939 <para>
26940 Until the body of the message has been received, the timestamp is the time when
26941 the message started to be received. Once the body has arrived, and all policy
26942 checks have taken place, the timestamp is updated to the time at which the
26943 message was accepted.
26944 </para>
26945 <para>
26946 <indexterm role="option">
26947 <primary><option>received_headers_max</option></primary>
26948 </indexterm>
26949 </para>
26950 <informaltable frame="all">
26951 <tgroup cols="4" colsep="0" rowsep="0">
26952 <colspec colwidth="8*" align="left"/>
26953 <colspec colwidth="6*" align="center"/>
26954 <colspec colwidth="6*" align="center"/>
26955 <colspec colwidth="6*" align="right"/>
26956 <tbody>
26957 <row>
26958 <entry><option>received_headers_max</option></entry>
26959 <entry>Use: <emphasis>main</emphasis></entry>
26960 <entry>Type: <emphasis>integer</emphasis></entry>
26961 <entry>Default: <emphasis>30</emphasis></entry>
26962 </row>
26963 </tbody>
26964 </tgroup>
26965 </informaltable>
26966 <para>
26967 <indexterm role="concept">
26968 <primary>loop</primary>
26969 <secondary>prevention</secondary>
26970 </indexterm>
26971 <indexterm role="concept">
26972 <primary>mail loop prevention</primary>
26973 </indexterm>
26974 <indexterm role="concept">
26975 <primary><emphasis>Received:</emphasis> header line</primary>
26976 <secondary>counting</secondary>
26977 </indexterm>
26978 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
26979 counted, and if it is greater than this parameter, a mail loop is assumed to
26980 have occurred, the delivery is abandoned, and an error message is generated.
26981 This applies to both local and remote deliveries.
26982 </para>
26983 <para>
26984 <indexterm role="option">
26985 <primary><option>recipient_unqualified_hosts</option></primary>
26986 </indexterm>
26987 </para>
26988 <informaltable frame="all">
26989 <tgroup cols="4" colsep="0" rowsep="0">
26990 <colspec colwidth="8*" align="left"/>
26991 <colspec colwidth="6*" align="center"/>
26992 <colspec colwidth="6*" align="center"/>
26993 <colspec colwidth="6*" align="right"/>
26994 <tbody>
26995 <row>
26996 <entry><option>recipient_unqualified_hosts</option></entry>
26997 <entry>Use: <emphasis>main</emphasis></entry>
26998 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26999 <entry>Default: <emphasis>unset</emphasis></entry>
27000 </row>
27001 </tbody>
27002 </tgroup>
27003 </informaltable>
27004 <para>
27005 <indexterm role="concept">
27006 <primary>unqualified addresses</primary>
27007 </indexterm>
27008 <indexterm role="concept">
27009 <primary>host</primary>
27010 <secondary>unqualified addresses from</secondary>
27011 </indexterm>
27012 This option lists those hosts from which Exim is prepared to accept unqualified
27013 recipient addresses in message envelopes. The addresses are made fully
27014 qualified by the addition of the <option>qualify_recipient</option> value. This option also
27015 affects message header lines. Exim does not reject unqualified recipient
27016 addresses in headers, but it qualifies them only if the message came from a
27017 host that matches <option>recipient_unqualified_hosts</option>,
27018 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
27019 option was not set.
27020 </para>
27021 <para>
27022 <indexterm role="option">
27023 <primary><option>recipients_max</option></primary>
27024 </indexterm>
27025 </para>
27026 <informaltable frame="all">
27027 <tgroup cols="4" colsep="0" rowsep="0">
27028 <colspec colwidth="8*" align="left"/>
27029 <colspec colwidth="6*" align="center"/>
27030 <colspec colwidth="6*" align="center"/>
27031 <colspec colwidth="6*" align="right"/>
27032 <tbody>
27033 <row>
27034 <entry><option>recipients_max</option></entry>
27035 <entry>Use: <emphasis>main</emphasis></entry>
27036 <entry>Type: <emphasis>integer</emphasis></entry>
27037 <entry>Default: <emphasis>0</emphasis></entry>
27038 </row>
27039 </tbody>
27040 </tgroup>
27041 </informaltable>
27042 <para>
27043 <indexterm role="concept">
27044 <primary>limit</primary>
27045 <secondary>number of recipients</secondary>
27046 </indexterm>
27047 <indexterm role="concept">
27048 <primary>recipient</primary>
27049 <secondary>maximum number</secondary>
27050 </indexterm>
27051 If this option is set greater than zero, it specifies the maximum number of
27052 original recipients for any message. Additional recipients that are generated
27053 by aliasing or forwarding do not count. SMTP messages get a 452 response for
27054 all recipients over the limit; earlier recipients are delivered as normal.
27055 Non-SMTP messages with too many recipients are failed, and no deliveries are
27056 done.
27057 </para>
27058 <para>
27059 <indexterm role="concept">
27060 <primary>RCPT</primary>
27061 <secondary>maximum number of incoming</secondary>
27062 </indexterm>
27063 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
27064 RCPT commands in a single message.
27065 </para>
27066 <para>
27067 <indexterm role="option">
27068 <primary><option>recipients_max_reject</option></primary>
27069 </indexterm>
27070 </para>
27071 <informaltable frame="all">
27072 <tgroup cols="4" colsep="0" rowsep="0">
27073 <colspec colwidth="8*" align="left"/>
27074 <colspec colwidth="6*" align="center"/>
27075 <colspec colwidth="6*" align="center"/>
27076 <colspec colwidth="6*" align="right"/>
27077 <tbody>
27078 <row>
27079 <entry><option>recipients_max_reject</option></entry>
27080 <entry>Use: <emphasis>main</emphasis></entry>
27081 <entry>Type: <emphasis>boolean</emphasis></entry>
27082 <entry>Default: <emphasis>false</emphasis></entry>
27083 </row>
27084 </tbody>
27085 </tgroup>
27086 </informaltable>
27087 <para>
27088 If this option is set true, Exim rejects SMTP messages containing too many
27089 recipients by giving 552 errors to the surplus RCPT commands, and a 554
27090 error to the eventual DATA command. Otherwise (the default) it gives a 452
27091 error to the surplus RCPT commands and accepts the message on behalf of the
27092 initial set of recipients. The remote server should then re-send the message
27093 for the remaining recipients at a later time.
27094 </para>
27095 <para>
27096 <indexterm role="option">
27097 <primary><option>remote_max_parallel</option></primary>
27098 </indexterm>
27099 </para>
27100 <informaltable frame="all">
27101 <tgroup cols="4" colsep="0" rowsep="0">
27102 <colspec colwidth="8*" align="left"/>
27103 <colspec colwidth="6*" align="center"/>
27104 <colspec colwidth="6*" align="center"/>
27105 <colspec colwidth="6*" align="right"/>
27106 <tbody>
27107 <row>
27108 <entry><option>remote_max_parallel</option></entry>
27109 <entry>Use: <emphasis>main</emphasis></entry>
27110 <entry>Type: <emphasis>integer</emphasis></entry>
27111 <entry>Default: <emphasis>2</emphasis></entry>
27112 </row>
27113 </tbody>
27114 </tgroup>
27115 </informaltable>
27116 <para>
27117 <indexterm role="concept">
27118 <primary>delivery</primary>
27119 <secondary>parallelism for remote</secondary>
27120 </indexterm>
27121 This option controls parallel delivery of one message to a number of remote
27122 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
27123 does all the remote deliveries for a message one by one. Otherwise, if a single
27124 message has to be delivered to more than one remote host, or if several copies
27125 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
27126 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
27127 deliveries are required, the maximum number of processes are started, and as
27128 each one finishes, another is begun. The order of starting processes is the
27129 same as if sequential delivery were being done, and can be controlled by the
27130 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
27131 with debugging turned on, the debugging output from each delivery process is
27132 tagged with its process id.
27133 </para>
27134 <para>
27135 This option controls only the maximum number of parallel deliveries for one
27136 message in one Exim delivery process. Because Exim has no central queue
27137 manager, there is no way of controlling the total number of simultaneous
27138 deliveries if the configuration allows a delivery attempt as soon as a message
27139 is received.
27140 </para>
27141 <para>
27142 <indexterm role="concept">
27143 <primary>number of deliveries</primary>
27144 </indexterm>
27145 <indexterm role="concept">
27146 <primary>delivery</primary>
27147 <secondary>maximum number of</secondary>
27148 </indexterm>
27149 If you want to control the total number of deliveries on the system, you
27150 need to set the <option>queue_only</option> option. This ensures that all incoming messages
27151 are added to the queue without starting a delivery process. Then set up an Exim
27152 daemon to start queue runner processes at appropriate intervals (probably
27153 fairly often, for example, every minute), and limit the total number of queue
27154 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
27155 delivers only one message at a time, the maximum number of deliveries that can
27156 then take place at once is <option>queue_run_max</option> multiplied by
27157 <option>remote_max_parallel</option>.
27158 </para>
27159 <para>
27160 If it is purely remote deliveries you want to control, use
27161 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
27162 doing the SMTP routing before queueing, so that several messages for the same
27163 host will eventually get delivered down the same connection.
27164 </para>
27165 <para>
27166 <indexterm role="option">
27167 <primary><option>remote_sort_domains</option></primary>
27168 </indexterm>
27169 </para>
27170 <informaltable frame="all">
27171 <tgroup cols="4" colsep="0" rowsep="0">
27172 <colspec colwidth="8*" align="left"/>
27173 <colspec colwidth="6*" align="center"/>
27174 <colspec colwidth="6*" align="center"/>
27175 <colspec colwidth="6*" align="right"/>
27176 <tbody>
27177 <row>
27178 <entry><option>remote_sort_domains</option></entry>
27179 <entry>Use: <emphasis>main</emphasis></entry>
27180 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27181 <entry>Default: <emphasis>unset</emphasis></entry>
27182 </row>
27183 </tbody>
27184 </tgroup>
27185 </informaltable>
27186 <para>
27187 <indexterm role="concept">
27188 <primary>sorting remote deliveries</primary>
27189 </indexterm>
27190 <indexterm role="concept">
27191 <primary>delivery</primary>
27192 <secondary>sorting remote</secondary>
27193 </indexterm>
27194 When there are a number of remote deliveries for a message, they are sorted by
27195 domain into the order given by this list. For example,
27196 </para>
27197 <literallayout class="monospaced">
27198 remote_sort_domains = *.cam.ac.uk:*.uk
27199 </literallayout>
27200 <para>
27201 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
27202 then to those in the <option>uk</option> domain, then to any others.
27203 </para>
27204 <para>
27205 <indexterm role="option">
27206 <primary><option>retry_data_expire</option></primary>
27207 </indexterm>
27208 </para>
27209 <informaltable frame="all">
27210 <tgroup cols="4" colsep="0" rowsep="0">
27211 <colspec colwidth="8*" align="left"/>
27212 <colspec colwidth="6*" align="center"/>
27213 <colspec colwidth="6*" align="center"/>
27214 <colspec colwidth="6*" align="right"/>
27215 <tbody>
27216 <row>
27217 <entry><option>retry_data_expire</option></entry>
27218 <entry>Use: <emphasis>main</emphasis></entry>
27219 <entry>Type: <emphasis>time</emphasis></entry>
27220 <entry>Default: <emphasis>7d</emphasis></entry>
27221 </row>
27222 </tbody>
27223 </tgroup>
27224 </informaltable>
27225 <para>
27226 <indexterm role="concept">
27227 <primary>hints database</primary>
27228 <secondary>data expiry</secondary>
27229 </indexterm>
27230 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
27231 database. Any older retry data is ignored. This means that, for example, once a
27232 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
27233 past failures.
27234 </para>
27235 <para>
27236 <indexterm role="option">
27237 <primary><option>retry_interval_max</option></primary>
27238 </indexterm>
27239 </para>
27240 <informaltable frame="all">
27241 <tgroup cols="4" colsep="0" rowsep="0">
27242 <colspec colwidth="8*" align="left"/>
27243 <colspec colwidth="6*" align="center"/>
27244 <colspec colwidth="6*" align="center"/>
27245 <colspec colwidth="6*" align="right"/>
27246 <tbody>
27247 <row>
27248 <entry><option>retry_interval_max</option></entry>
27249 <entry>Use: <emphasis>main</emphasis></entry>
27250 <entry>Type: <emphasis>time</emphasis></entry>
27251 <entry>Default: <emphasis>24h</emphasis></entry>
27252 </row>
27253 </tbody>
27254 </tgroup>
27255 </informaltable>
27256 <para>
27257 <indexterm role="concept">
27258 <primary>retry</primary>
27259 <secondary>limit on interval</secondary>
27260 </indexterm>
27261 <indexterm role="concept">
27262 <primary>limit</primary>
27263 <secondary>on retry interval</secondary>
27264 </indexterm>
27265 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
27266 intervals between delivery attempts for messages that cannot be delivered
27267 straight away. This option sets an overall limit to the length of time between
27268 retries. It cannot be set greater than 24 hours; any attempt to do so forces
27269 the default value.
27270 </para>
27271 <para>
27272 <indexterm role="option">
27273 <primary><option>return_path_remove</option></primary>
27274 </indexterm>
27275 </para>
27276 <informaltable frame="all">
27277 <tgroup cols="4" colsep="0" rowsep="0">
27278 <colspec colwidth="8*" align="left"/>
27279 <colspec colwidth="6*" align="center"/>
27280 <colspec colwidth="6*" align="center"/>
27281 <colspec colwidth="6*" align="right"/>
27282 <tbody>
27283 <row>
27284 <entry><option>return_path_remove</option></entry>
27285 <entry>Use: <emphasis>main</emphasis></entry>
27286 <entry>Type: <emphasis>boolean</emphasis></entry>
27287 <entry>Default: <emphasis>true</emphasis></entry>
27288 </row>
27289 </tbody>
27290 </tgroup>
27291 </informaltable>
27292 <para>
27293 <indexterm role="concept">
27294 <primary><emphasis>Return-path:</emphasis> header line</primary>
27295 <secondary>removing</secondary>
27296 </indexterm>
27297 RFC 2821, section 4.4, states that an SMTP server must insert a
27298 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
27299 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
27300 MAIL command. This description implies that this header should not be present
27301 in an incoming message. If <option>return_path_remove</option> is true, any existing
27302 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
27303 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
27304 the time of delivery. They are normally used only for final local deliveries.
27305 </para>
27306 <para>
27307 <indexterm role="option">
27308 <primary><option>return_size_limit</option></primary>
27309 </indexterm>
27310 </para>
27311 <informaltable frame="all">
27312 <tgroup cols="4" colsep="0" rowsep="0">
27313 <colspec colwidth="8*" align="left"/>
27314 <colspec colwidth="6*" align="center"/>
27315 <colspec colwidth="6*" align="center"/>
27316 <colspec colwidth="6*" align="right"/>
27317 <tbody>
27318 <row>
27319 <entry><option>return_size_limit</option></entry>
27320 <entry>Use: <emphasis>main</emphasis></entry>
27321 <entry>Type: <emphasis>integer</emphasis></entry>
27322 <entry>Default: <emphasis>100K</emphasis></entry>
27323 </row>
27324 </tbody>
27325 </tgroup>
27326 </informaltable>
27327 <para>
27328 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
27329 </para>
27330 <para>
27331 <indexterm role="option">
27332 <primary><option>rfc1413_hosts</option></primary>
27333 </indexterm>
27334 </para>
27335 <informaltable frame="all">
27336 <tgroup cols="4" colsep="0" rowsep="0">
27337 <colspec colwidth="8*" align="left"/>
27338 <colspec colwidth="6*" align="center"/>
27339 <colspec colwidth="6*" align="center"/>
27340 <colspec colwidth="6*" align="right"/>
27341 <tbody>
27342 <row>
27343 <entry><option>rfc1413_hosts</option></entry>
27344 <entry>Use: <emphasis>main</emphasis></entry>
27345 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27346 <entry>Default: <emphasis>*</emphasis></entry>
27347 </row>
27348 </tbody>
27349 </tgroup>
27350 </informaltable>
27351 <para>
27352 <indexterm role="concept">
27353 <primary>RFC 1413</primary>
27354 </indexterm>
27355 <indexterm role="concept">
27356 <primary>host</primary>
27357 <secondary>for RFC 1413 calls</secondary>
27358 </indexterm>
27359 RFC 1413 identification calls are made to any client host which matches an item
27360 in the list.
27361 </para>
27362 <para>
27363 <indexterm role="option">
27364 <primary><option>rfc1413_query_timeout</option></primary>
27365 </indexterm>
27366 </para>
27367 <informaltable frame="all">
27368 <tgroup cols="4" colsep="0" rowsep="0">
27369 <colspec colwidth="8*" align="left"/>
27370 <colspec colwidth="6*" align="center"/>
27371 <colspec colwidth="6*" align="center"/>
27372 <colspec colwidth="6*" align="right"/>
27373 <tbody>
27374 <row>
27375 <entry><option>rfc1413_query_timeout</option></entry>
27376 <entry>Use: <emphasis>main</emphasis></entry>
27377 <entry>Type: <emphasis>time</emphasis></entry>
27378 <entry>Default: <emphasis>5s</emphasis></entry>
27379 </row>
27380 </tbody>
27381 </tgroup>
27382 </informaltable>
27383 <para>
27384 <indexterm role="concept">
27385 <primary>RFC 1413</primary>
27386 <secondary>query timeout</secondary>
27387 </indexterm>
27388 <indexterm role="concept">
27389 <primary>timeout</primary>
27390 <secondary>for RFC 1413 call</secondary>
27391 </indexterm>
27392 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
27393 no RFC 1413 calls are ever made.
27394 </para>
27395 <para>
27396 <indexterm role="option">
27397 <primary><option>sender_unqualified_hosts</option></primary>
27398 </indexterm>
27399 </para>
27400 <informaltable frame="all">
27401 <tgroup cols="4" colsep="0" rowsep="0">
27402 <colspec colwidth="8*" align="left"/>
27403 <colspec colwidth="6*" align="center"/>
27404 <colspec colwidth="6*" align="center"/>
27405 <colspec colwidth="6*" align="right"/>
27406 <tbody>
27407 <row>
27408 <entry><option>sender_unqualified_hosts</option></entry>
27409 <entry>Use: <emphasis>main</emphasis></entry>
27410 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27411 <entry>Default: <emphasis>unset</emphasis></entry>
27412 </row>
27413 </tbody>
27414 </tgroup>
27415 </informaltable>
27416 <para>
27417 <indexterm role="concept">
27418 <primary>unqualified addresses</primary>
27419 </indexterm>
27420 <indexterm role="concept">
27421 <primary>host</primary>
27422 <secondary>unqualified addresses from</secondary>
27423 </indexterm>
27424 This option lists those hosts from which Exim is prepared to accept unqualified
27425 sender addresses. The addresses are made fully qualified by the addition of
27426 <option>qualify_domain</option>. This option also affects message header lines. Exim does
27427 not reject unqualified addresses in headers that contain sender addresses, but
27428 it qualifies them only if the message came from a host that matches
27429 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
27430 using TCP/IP), and the <option>-bnq</option> option was not set.
27431 </para>
27432 <para>
27433 <indexterm role="option">
27434 <primary><option>smtp_accept_keepalive</option></primary>
27435 </indexterm>
27436 </para>
27437 <informaltable frame="all">
27438 <tgroup cols="4" colsep="0" rowsep="0">
27439 <colspec colwidth="8*" align="left"/>
27440 <colspec colwidth="6*" align="center"/>
27441 <colspec colwidth="6*" align="center"/>
27442 <colspec colwidth="6*" align="right"/>
27443 <tbody>
27444 <row>
27445 <entry><option>smtp_accept_keepalive</option></entry>
27446 <entry>Use: <emphasis>main</emphasis></entry>
27447 <entry>Type: <emphasis>boolean</emphasis></entry>
27448 <entry>Default: <emphasis>true</emphasis></entry>
27449 </row>
27450 </tbody>
27451 </tgroup>
27452 </informaltable>
27453 <para>
27454 <indexterm role="concept">
27455 <primary>keepalive</primary>
27456 <secondary>on incoming connection</secondary>
27457 </indexterm>
27458 This option controls the setting of the SO_KEEPALIVE option on incoming
27459 TCP/IP socket connections. When set, it causes the kernel to probe idle
27460 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
27461 other end of the connection should send an acknowledgment if the connection is
27462 still okay or a reset if the connection has been aborted. The reason for doing
27463 this is that it has the beneficial effect of freeing up certain types of
27464 connection that can get stuck when the remote host is disconnected without
27465 tidying up the TCP/IP call properly. The keepalive mechanism takes several
27466 hours to detect unreachable hosts.
27467 </para>
27468 <para>
27469 <indexterm role="option">
27470 <primary><option>smtp_accept_max</option></primary>
27471 </indexterm>
27472 </para>
27473 <informaltable frame="all">
27474 <tgroup cols="4" colsep="0" rowsep="0">
27475 <colspec colwidth="8*" align="left"/>
27476 <colspec colwidth="6*" align="center"/>
27477 <colspec colwidth="6*" align="center"/>
27478 <colspec colwidth="6*" align="right"/>
27479 <tbody>
27480 <row>
27481 <entry><option>smtp_accept_max</option></entry>
27482 <entry>Use: <emphasis>main</emphasis></entry>
27483 <entry>Type: <emphasis>integer</emphasis></entry>
27484 <entry>Default: <emphasis>20</emphasis></entry>
27485 </row>
27486 </tbody>
27487 </tgroup>
27488 </informaltable>
27489 <para>
27490 <indexterm role="concept">
27491 <primary>limit</primary>
27492 <secondary>incoming SMTP connections</secondary>
27493 </indexterm>
27494 <indexterm role="concept">
27495 <primary>SMTP</primary>
27496 <secondary>incoming connection count</secondary>
27497 </indexterm>
27498 <indexterm role="concept">
27499 <primary>inetd</primary>
27500 </indexterm>
27501 This option specifies the maximum number of simultaneous incoming SMTP calls
27502 that Exim will accept. It applies only to the listening daemon; there is no
27503 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
27504 value is set to zero, no limit is applied. However, it is required to be
27505 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
27506 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
27507 </para>
27508 <para>
27509 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
27510 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
27511 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
27512 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
27513 </para>
27514 <para>
27515 <indexterm role="option">
27516 <primary><option>smtp_accept_max_nonmail</option></primary>
27517 </indexterm>
27518 </para>
27519 <informaltable frame="all">
27520 <tgroup cols="4" colsep="0" rowsep="0">
27521 <colspec colwidth="8*" align="left"/>
27522 <colspec colwidth="6*" align="center"/>
27523 <colspec colwidth="6*" align="center"/>
27524 <colspec colwidth="6*" align="right"/>
27525 <tbody>
27526 <row>
27527 <entry><option>smtp_accept_max_nonmail</option></entry>
27528 <entry>Use: <emphasis>main</emphasis></entry>
27529 <entry>Type: <emphasis>integer</emphasis></entry>
27530 <entry>Default: <emphasis>10</emphasis></entry>
27531 </row>
27532 </tbody>
27533 </tgroup>
27534 </informaltable>
27535 <para>
27536 <indexterm role="concept">
27537 <primary>limit</primary>
27538 <secondary>non-mail SMTP commands</secondary>
27539 </indexterm>
27540 <indexterm role="concept">
27541 <primary>SMTP</primary>
27542 <secondary>limiting non-mail commands</secondary>
27543 </indexterm>
27544 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
27545 the connection if there are too many. This option defines <quote>too many</quote>. The
27546 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
27547 client looping sending EHLO, for example. The check is applied only if the
27548 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
27549 </para>
27550 <para>
27551 When a new message is expected, one occurrence of RSET is not counted. This
27552 allows a client to send one RSET between messages (this is not necessary,
27553 but some clients do it). Exim also allows one uncounted occurrence of HELO
27554 or EHLO, and one occurrence of STARTTLS between messages. After
27555 starting up a TLS session, another EHLO is expected, and so it too is not
27556 counted. The first occurrence of AUTH in a connection, or immediately
27557 following STARTTLS is not counted. Otherwise, all commands other than
27558 MAIL, RCPT, DATA, and QUIT are counted.
27559 </para>
27560 <para>
27561 <indexterm role="option">
27562 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
27563 </indexterm>
27564 </para>
27565 <informaltable frame="all">
27566 <tgroup cols="4" colsep="0" rowsep="0">
27567 <colspec colwidth="8*" align="left"/>
27568 <colspec colwidth="6*" align="center"/>
27569 <colspec colwidth="6*" align="center"/>
27570 <colspec colwidth="6*" align="right"/>
27571 <tbody>
27572 <row>
27573 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
27574 <entry>Use: <emphasis>main</emphasis></entry>
27575 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27576 <entry>Default: <emphasis>*</emphasis></entry>
27577 </row>
27578 </tbody>
27579 </tgroup>
27580 </informaltable>
27581 <para>
27582 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
27583 check by setting this option. The default value makes it apply to all hosts. By
27584 changing the value, you can exclude any badly-behaved hosts that you have to
27585 live with.
27586 </para>
27587 <para>
27588 <indexterm role="option">
27589 <primary><option>smtp_accept_max_per_connection</option></primary>
27590 </indexterm>
27591 </para>
27592 <informaltable frame="all">
27593 <tgroup cols="4" colsep="0" rowsep="0">
27594 <colspec colwidth="8*" align="left"/>
27595 <colspec colwidth="6*" align="center"/>
27596 <colspec colwidth="6*" align="center"/>
27597 <colspec colwidth="6*" align="right"/>
27598 <tbody>
27599 <row>
27600 <entry><option>smtp_accept_max_per_connection</option></entry>
27601 <entry>Use: <emphasis>main</emphasis></entry>
27602 <entry>Type: <emphasis>integer</emphasis></entry>
27603 <entry>Default: <emphasis>1000</emphasis></entry>
27604 </row>
27605 </tbody>
27606 </tgroup>
27607 </informaltable>
27608 <para>
27609 <indexterm role="concept">
27610 <primary>SMTP</primary>
27611 <secondary>limiting incoming message count</secondary>
27612 </indexterm>
27613 <indexterm role="concept">
27614 <primary>limit</primary>
27615 <secondary>messages per SMTP connection</secondary>
27616 </indexterm>
27617 The value of this option limits the number of MAIL commands that Exim is
27618 prepared to accept over a single SMTP connection, whether or not each command
27619 results in the transfer of a message. After the limit is reached, a 421
27620 response is given to subsequent MAIL commands. This limit is a safety
27621 precaution against a client that goes mad (incidents of this type have been
27622 seen).
27623 </para>
27624 <para>
27625 <indexterm role="option">
27626 <primary><option>smtp_accept_max_per_host</option></primary>
27627 </indexterm>
27628 </para>
27629 <informaltable frame="all">
27630 <tgroup cols="4" colsep="0" rowsep="0">
27631 <colspec colwidth="8*" align="left"/>
27632 <colspec colwidth="6*" align="center"/>
27633 <colspec colwidth="6*" align="center"/>
27634 <colspec colwidth="6*" align="right"/>
27635 <tbody>
27636 <row>
27637 <entry><option>smtp_accept_max_per_host</option></entry>
27638 <entry>Use: <emphasis>main</emphasis></entry>
27639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27640 <entry>Default: <emphasis>unset</emphasis></entry>
27641 </row>
27642 </tbody>
27643 </tgroup>
27644 </informaltable>
27645 <para>
27646 <indexterm role="concept">
27647 <primary>limit</primary>
27648 <secondary>SMTP connections from one host</secondary>
27649 </indexterm>
27650 <indexterm role="concept">
27651 <primary>host</primary>
27652 <secondary>limiting SMTP connections from</secondary>
27653 </indexterm>
27654 This option restricts the number of simultaneous IP connections from a single
27655 host (strictly, from a single IP address) to the Exim daemon. The option is
27656 expanded, to enable different limits to be applied to different hosts by
27657 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
27658 connection attempts from the same host are rejected with error code 421. This
27659 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
27660 of zero imposes no limit. If this option is set greater than zero, it is
27661 required that <option>smtp_accept_max</option> be non-zero.
27662 </para>
27663 <para>
27664 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
27665 constructions that take an appreciable amount of time. The expansion and test
27666 happen in the main daemon loop, in order to reject additional connections
27667 without forking additional processes (otherwise a denial-of-service attack
27668 could cause a vast number or processes to be created). While the daemon is
27669 doing this processing, it cannot accept any other incoming connections.
27670 </para>
27671 <para>
27672 <indexterm role="option">
27673 <primary><option>smtp_accept_queue</option></primary>
27674 </indexterm>
27675 </para>
27676 <informaltable frame="all">
27677 <tgroup cols="4" colsep="0" rowsep="0">
27678 <colspec colwidth="8*" align="left"/>
27679 <colspec colwidth="6*" align="center"/>
27680 <colspec colwidth="6*" align="center"/>
27681 <colspec colwidth="6*" align="right"/>
27682 <tbody>
27683 <row>
27684 <entry><option>smtp_accept_queue</option></entry>
27685 <entry>Use: <emphasis>main</emphasis></entry>
27686 <entry>Type: <emphasis>integer</emphasis></entry>
27687 <entry>Default: <emphasis>0</emphasis></entry>
27688 </row>
27689 </tbody>
27690 </tgroup>
27691 </informaltable>
27692 <para>
27693 <indexterm role="concept">
27694 <primary>SMTP</primary>
27695 <secondary>incoming connection count</secondary>
27696 </indexterm>
27697 <indexterm role="concept">
27698 <primary>queueing incoming messages</primary>
27699 </indexterm>
27700 <indexterm role="concept">
27701 <primary>message</primary>
27702 <secondary>queueing by SMTP connection count</secondary>
27703 </indexterm>
27704 If the number of simultaneous incoming SMTP connections being handled via the
27705 listening daemon exceeds this value, messages received by SMTP are just placed
27706 on the queue; no delivery processes are started automatically. The count is
27707 fixed at the start of an SMTP connection. It cannot be updated in the
27708 subprocess that receives messages, and so the queueing or not queueing applies
27709 to all messages received in the same connection.
27710 </para>
27711 <para>
27712 A value of zero implies no limit, and clearly any non-zero value is useful only
27713 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
27714 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
27715 various <option>-od</option><emphasis>x</emphasis> command line options.
27716 </para>
27717 <para>
27718 <indexterm role="option">
27719 <primary><option>smtp_accept_queue_per_connection</option></primary>
27720 </indexterm>
27721 </para>
27722 <informaltable frame="all">
27723 <tgroup cols="4" colsep="0" rowsep="0">
27724 <colspec colwidth="8*" align="left"/>
27725 <colspec colwidth="6*" align="center"/>
27726 <colspec colwidth="6*" align="center"/>
27727 <colspec colwidth="6*" align="right"/>
27728 <tbody>
27729 <row>
27730 <entry><option>smtp_accept_queue_per_connection</option></entry>
27731 <entry>Use: <emphasis>main</emphasis></entry>
27732 <entry>Type: <emphasis>integer</emphasis></entry>
27733 <entry>Default: <emphasis>10</emphasis></entry>
27734 </row>
27735 </tbody>
27736 </tgroup>
27737 </informaltable>
27738 <para>
27739 <indexterm role="concept">
27740 <primary>queueing incoming messages</primary>
27741 </indexterm>
27742 <indexterm role="concept">
27743 <primary>message</primary>
27744 <secondary>queueing by message count</secondary>
27745 </indexterm>
27746 This option limits the number of delivery processes that Exim starts
27747 automatically when receiving messages via SMTP, whether via the daemon or by
27748 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
27749 and the number of messages received in a single SMTP session exceeds this
27750 number, subsequent messages are placed on the queue, but no delivery processes
27751 are started. This helps to limit the number of Exim processes when a server
27752 restarts after downtime and there is a lot of mail waiting for it on other
27753 systems. On large systems, the default should probably be increased, and on
27754 dial-in client systems it should probably be set to zero (that is, disabled).
27755 </para>
27756 <para>
27757 <indexterm role="option">
27758 <primary><option>smtp_accept_reserve</option></primary>
27759 </indexterm>
27760 </para>
27761 <informaltable frame="all">
27762 <tgroup cols="4" colsep="0" rowsep="0">
27763 <colspec colwidth="8*" align="left"/>
27764 <colspec colwidth="6*" align="center"/>
27765 <colspec colwidth="6*" align="center"/>
27766 <colspec colwidth="6*" align="right"/>
27767 <tbody>
27768 <row>
27769 <entry><option>smtp_accept_reserve</option></entry>
27770 <entry>Use: <emphasis>main</emphasis></entry>
27771 <entry>Type: <emphasis>integer</emphasis></entry>
27772 <entry>Default: <emphasis>0</emphasis></entry>
27773 </row>
27774 </tbody>
27775 </tgroup>
27776 </informaltable>
27777 <para>
27778 <indexterm role="concept">
27779 <primary>SMTP</primary>
27780 <secondary>incoming call count</secondary>
27781 </indexterm>
27782 <indexterm role="concept">
27783 <primary>host</primary>
27784 <secondary>reserved</secondary>
27785 </indexterm>
27786 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
27787 number of SMTP connections that are reserved for connections from the hosts
27788 that are specified in <option>smtp_reserve_hosts</option>. The value set in
27789 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
27790 restricted to this number of connections; the option specifies a minimum number
27791 of connection slots for them, not a maximum. It is a guarantee that this group
27792 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
27793 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
27794 individual host.
27795 </para>
27796 <para>
27797 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
27798 set to 5, once there are 45 active connections (from any hosts), new
27799 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
27800 provided the other criteria for acceptance are met.
27801 </para>
27802 <para>
27803 <indexterm role="option">
27804 <primary><option>smtp_active_hostname</option></primary>
27805 </indexterm>
27806 </para>
27807 <informaltable frame="all">
27808 <tgroup cols="4" colsep="0" rowsep="0">
27809 <colspec colwidth="8*" align="left"/>
27810 <colspec colwidth="6*" align="center"/>
27811 <colspec colwidth="6*" align="center"/>
27812 <colspec colwidth="6*" align="right"/>
27813 <tbody>
27814 <row>
27815 <entry><option>smtp_active_hostname</option></entry>
27816 <entry>Use: <emphasis>main</emphasis></entry>
27817 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27818 <entry>Default: <emphasis>unset</emphasis></entry>
27819 </row>
27820 </tbody>
27821 </tgroup>
27822 </informaltable>
27823 <para>
27824 <indexterm role="concept">
27825 <primary>host</primary>
27826 <secondary>name in SMTP responses</secondary>
27827 </indexterm>
27828 <indexterm role="concept">
27829 <primary>SMTP</primary>
27830 <secondary>host name in responses</secondary>
27831 </indexterm>
27832 <indexterm role="variable">
27833 <primary><varname>$primary_hostname</varname></primary>
27834 </indexterm>
27835 This option is provided for multi-homed servers that want to masquerade as
27836 several different hosts. At the start of an incoming SMTP connection, its value
27837 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
27838 responses. For example, it is used as domain name in the response to an
27839 incoming HELO or EHLO command.
27840 </para>
27841 <para>
27842 <indexterm role="variable">
27843 <primary><varname>$smtp_active_hostname</varname></primary>
27844 </indexterm>
27845 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
27846 is saved with any messages that are received. It is therefore available for use
27847 in routers and transports when the message is later delivered.
27848 </para>
27849 <para>
27850 If this option is unset, or if its expansion is forced to fail, or if the
27851 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
27852 used. Other expansion failures cause a message to be written to the main and
27853 panic logs, and the SMTP command receives a temporary error. Typically, the
27854 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
27855 For example:
27856 </para>
27857 <literallayout class="monospaced">
27858 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
27859   {cox.mydomain}{box.mydomain}}
27860 </literallayout>
27861 <para>
27862 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
27863 messages, it is also used as the default for HELO commands in callout
27864 verification if there is no remote transport from which to obtain a
27865 <option>helo_data</option> value.
27866 </para>
27867 <para>
27868 <indexterm role="option">
27869 <primary><option>smtp_banner</option></primary>
27870 </indexterm>
27871 </para>
27872 <informaltable frame="all">
27873 <tgroup cols="4" colsep="0" rowsep="0">
27874 <colspec colwidth="8*" align="left"/>
27875 <colspec colwidth="6*" align="center"/>
27876 <colspec colwidth="6*" align="center"/>
27877 <colspec colwidth="6*" align="right"/>
27878 <tbody>
27879 <row>
27880 <entry><option>smtp_banner</option></entry>
27881 <entry>Use: <emphasis>main</emphasis></entry>
27882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27883 <entry>Default: <emphasis>see below</emphasis></entry>
27884 </row>
27885 </tbody>
27886 </tgroup>
27887 </informaltable>
27888 <para>
27889 <indexterm role="concept">
27890 <primary>SMTP</primary>
27891 <secondary>welcome banner</secondary>
27892 </indexterm>
27893 <indexterm role="concept">
27894 <primary>banner for SMTP</primary>
27895 </indexterm>
27896 <indexterm role="concept">
27897 <primary>welcome banner for SMTP</primary>
27898 </indexterm>
27899 <indexterm role="concept">
27900 <primary>customizing</primary>
27901 <secondary>SMTP banner</secondary>
27902 </indexterm>
27903 This string, which is expanded every time it is used, is output as the initial
27904 positive response to an SMTP connection. The default setting is:
27905 </para>
27906 <literallayout class="monospaced">
27907 smtp_banner = $smtp_active_hostname ESMTP Exim \
27908   $version_number $tod_full
27909 </literallayout>
27910 <para>
27911 Failure to expand the string causes a panic error. If you want to create a
27912 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
27913 appropriate points, but not at the end. Note that the 220 code is not included
27914 in this string. Exim adds it automatically (several times in the case of a
27915 multiline response).
27916 </para>
27917 <para>
27918 <indexterm role="option">
27919 <primary><option>smtp_check_spool_space</option></primary>
27920 </indexterm>
27921 </para>
27922 <informaltable frame="all">
27923 <tgroup cols="4" colsep="0" rowsep="0">
27924 <colspec colwidth="8*" align="left"/>
27925 <colspec colwidth="6*" align="center"/>
27926 <colspec colwidth="6*" align="center"/>
27927 <colspec colwidth="6*" align="right"/>
27928 <tbody>
27929 <row>
27930 <entry><option>smtp_check_spool_space</option></entry>
27931 <entry>Use: <emphasis>main</emphasis></entry>
27932 <entry>Type: <emphasis>boolean</emphasis></entry>
27933 <entry>Default: <emphasis>true</emphasis></entry>
27934 </row>
27935 </tbody>
27936 </tgroup>
27937 </informaltable>
27938 <para>
27939 <indexterm role="concept">
27940 <primary>checking disk space</primary>
27941 </indexterm>
27942 <indexterm role="concept">
27943 <primary>disk space, checking</primary>
27944 </indexterm>
27945 <indexterm role="concept">
27946 <primary>spool directory</primary>
27947 <secondary>checking space</secondary>
27948 </indexterm>
27949 When this option is set, if an incoming SMTP session encounters the SIZE
27950 option on a MAIL command, it checks that there is enough space in the
27951 spool directory&#x2019;s partition to accept a message of that size, while still
27952 leaving free the amount specified by <option>check_spool_space</option> (even if that value
27953 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
27954 </para>
27955 <para>
27956 <indexterm role="option">
27957 <primary><option>smtp_connect_backlog</option></primary>
27958 </indexterm>
27959 </para>
27960 <informaltable frame="all">
27961 <tgroup cols="4" colsep="0" rowsep="0">
27962 <colspec colwidth="8*" align="left"/>
27963 <colspec colwidth="6*" align="center"/>
27964 <colspec colwidth="6*" align="center"/>
27965 <colspec colwidth="6*" align="right"/>
27966 <tbody>
27967 <row>
27968 <entry><option>smtp_connect_backlog</option></entry>
27969 <entry>Use: <emphasis>main</emphasis></entry>
27970 <entry>Type: <emphasis>integer</emphasis></entry>
27971 <entry>Default: <emphasis>20</emphasis></entry>
27972 </row>
27973 </tbody>
27974 </tgroup>
27975 </informaltable>
27976 <para>
27977 <indexterm role="concept">
27978 <primary>connection backlog</primary>
27979 </indexterm>
27980 <indexterm role="concept">
27981 <primary>SMTP</primary>
27982 <secondary>connection backlog</secondary>
27983 </indexterm>
27984 <indexterm role="concept">
27985 <primary>backlog of connections</primary>
27986 </indexterm>
27987 This option specifies a maximum number of waiting SMTP connections. Exim passes
27988 this value to the TCP/IP system when it sets up its listener. Once this number
27989 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
27990 attempts are refused at the TCP/IP level. At least, that is what the manuals
27991 say; in some circumstances such connection attempts have been observed to time
27992 out instead. For large systems it is probably a good idea to increase the
27993 value (to 50, say). It also gives some protection against denial-of-service
27994 attacks by SYN flooding.
27995 </para>
27996 <para>
27997 <indexterm role="option">
27998 <primary><option>smtp_enforce_sync</option></primary>
27999 </indexterm>
28000 </para>
28001 <informaltable frame="all">
28002 <tgroup cols="4" colsep="0" rowsep="0">
28003 <colspec colwidth="8*" align="left"/>
28004 <colspec colwidth="6*" align="center"/>
28005 <colspec colwidth="6*" align="center"/>
28006 <colspec colwidth="6*" align="right"/>
28007 <tbody>
28008 <row>
28009 <entry><option>smtp_enforce_sync</option></entry>
28010 <entry>Use: <emphasis>main</emphasis></entry>
28011 <entry>Type: <emphasis>boolean</emphasis></entry>
28012 <entry>Default: <emphasis>true</emphasis></entry>
28013 </row>
28014 </tbody>
28015 </tgroup>
28016 </informaltable>
28017 <para>
28018 <indexterm role="concept">
28019 <primary>SMTP</primary>
28020 <secondary>synchronization checking</secondary>
28021 </indexterm>
28022 <indexterm role="concept">
28023 <primary>synchronization checking in SMTP</primary>
28024 </indexterm>
28025 The SMTP protocol specification requires the client to wait for a response from
28026 the server at certain points in the dialogue. Without PIPELINING these
28027 synchronization points are after every command; with PIPELINING they are
28028 fewer, but they still exist.
28029 </para>
28030 <para>
28031 Some spamming sites send out a complete set of SMTP commands without waiting
28032 for any response. Exim protects against this by rejecting a message if the
28033 client has sent further input when it should not have. The error response <quote>554
28034 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
28035 for this error cannot be perfect because of transmission delays (unexpected
28036 input may be on its way but not yet received when Exim checks). However, it
28037 does detect many instances.
28038 </para>
28039 <para>
28040 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
28041 If you want to disable the check selectively (for example, only for certain
28042 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
28043 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
28044 </para>
28045 <para>
28046 <indexterm role="option">
28047 <primary><option>smtp_etrn_command</option></primary>
28048 </indexterm>
28049 </para>
28050 <informaltable frame="all">
28051 <tgroup cols="4" colsep="0" rowsep="0">
28052 <colspec colwidth="8*" align="left"/>
28053 <colspec colwidth="6*" align="center"/>
28054 <colspec colwidth="6*" align="center"/>
28055 <colspec colwidth="6*" align="right"/>
28056 <tbody>
28057 <row>
28058 <entry><option>smtp_etrn_command</option></entry>
28059 <entry>Use: <emphasis>main</emphasis></entry>
28060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28061 <entry>Default: <emphasis>unset</emphasis></entry>
28062 </row>
28063 </tbody>
28064 </tgroup>
28065 </informaltable>
28066 <para>
28067 <indexterm role="concept">
28068 <primary>ETRN</primary>
28069 <secondary>command to be run</secondary>
28070 </indexterm>
28071 <indexterm role="variable">
28072 <primary><varname>$domain</varname></primary>
28073 </indexterm>
28074 If this option is set, the given command is run whenever an SMTP ETRN
28075 command is received from a host that is permitted to issue such commands (see
28076 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
28077 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
28078 argument of the ETRN command, and no syntax checking is done on it. For
28079 example:
28080 </para>
28081 <literallayout class="monospaced">
28082 smtp_etrn_command = /etc/etrn_command $domain \
28083                     $sender_host_address
28084 </literallayout>
28085 <para>
28086 A new process is created to run the command, but Exim does not wait for it to
28087 complete. Consequently, its status cannot be checked. If the command cannot be
28088 run, a line is written to the panic log, but the ETRN caller still receives
28089 a 250 success response. Exim is normally running under its own uid when
28090 receiving SMTP, so it is not possible for it to change the uid before running
28091 the command.
28092 </para>
28093 <para>
28094 <indexterm role="option">
28095 <primary><option>smtp_etrn_serialize</option></primary>
28096 </indexterm>
28097 </para>
28098 <informaltable frame="all">
28099 <tgroup cols="4" colsep="0" rowsep="0">
28100 <colspec colwidth="8*" align="left"/>
28101 <colspec colwidth="6*" align="center"/>
28102 <colspec colwidth="6*" align="center"/>
28103 <colspec colwidth="6*" align="right"/>
28104 <tbody>
28105 <row>
28106 <entry><option>smtp_etrn_serialize</option></entry>
28107 <entry>Use: <emphasis>main</emphasis></entry>
28108 <entry>Type: <emphasis>boolean</emphasis></entry>
28109 <entry>Default: <emphasis>true</emphasis></entry>
28110 </row>
28111 </tbody>
28112 </tgroup>
28113 </informaltable>
28114 <para>
28115 <indexterm role="concept">
28116 <primary>ETRN</primary>
28117 <secondary>serializing</secondary>
28118 </indexterm>
28119 When this option is set, it prevents the simultaneous execution of more than
28120 one identical command as a result of ETRN in an SMTP connection. See
28121 section <xref linkend="SECTETRN"/> for details.
28122 </para>
28123 <para>
28124 <indexterm role="option">
28125 <primary><option>smtp_load_reserve</option></primary>
28126 </indexterm>
28127 </para>
28128 <informaltable frame="all">
28129 <tgroup cols="4" colsep="0" rowsep="0">
28130 <colspec colwidth="8*" align="left"/>
28131 <colspec colwidth="6*" align="center"/>
28132 <colspec colwidth="6*" align="center"/>
28133 <colspec colwidth="6*" align="right"/>
28134 <tbody>
28135 <row>
28136 <entry><option>smtp_load_reserve</option></entry>
28137 <entry>Use: <emphasis>main</emphasis></entry>
28138 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28139 <entry>Default: <emphasis>unset</emphasis></entry>
28140 </row>
28141 </tbody>
28142 </tgroup>
28143 </informaltable>
28144 <para>
28145 <indexterm role="concept">
28146 <primary>load average</primary>
28147 </indexterm>
28148 If the system load average ever gets higher than this, incoming SMTP calls are
28149 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
28150 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
28151 the load is over the limit. The option has no effect on ancient operating
28152 systems on which Exim cannot determine the load average. See also
28153 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
28154 </para>
28155 <para>
28156 <indexterm role="option">
28157 <primary><option>smtp_max_synprot_errors</option></primary>
28158 </indexterm>
28159 </para>
28160 <informaltable frame="all">
28161 <tgroup cols="4" colsep="0" rowsep="0">
28162 <colspec colwidth="8*" align="left"/>
28163 <colspec colwidth="6*" align="center"/>
28164 <colspec colwidth="6*" align="center"/>
28165 <colspec colwidth="6*" align="right"/>
28166 <tbody>
28167 <row>
28168 <entry><option>smtp_max_synprot_errors</option></entry>
28169 <entry>Use: <emphasis>main</emphasis></entry>
28170 <entry>Type: <emphasis>integer</emphasis></entry>
28171 <entry>Default: <emphasis>3</emphasis></entry>
28172 </row>
28173 </tbody>
28174 </tgroup>
28175 </informaltable>
28176 <para>
28177 <indexterm role="concept">
28178 <primary>SMTP</primary>
28179 <secondary>limiting syntax and protocol errors</secondary>
28180 </indexterm>
28181 <indexterm role="concept">
28182 <primary>limit</primary>
28183 <secondary>SMTP syntax and protocol errors</secondary>
28184 </indexterm>
28185 Exim rejects SMTP commands that contain syntax or protocol errors. In
28186 particular, a syntactically invalid email address, as in this command:
28187 </para>
28188 <literallayout class="monospaced">
28189 RCPT TO:&lt;abc xyz@a.b.c&gt;
28190 </literallayout>
28191 <para>
28192 causes immediate rejection of the command, before any other tests are done.
28193 (The ACL cannot be run if there is no valid address to set up for it.) An
28194 example of a protocol error is receiving RCPT before MAIL. If there are
28195 too many syntax or protocol errors in one SMTP session, the connection is
28196 dropped. The limit is set by this option.
28197 </para>
28198 <para>
28199 <indexterm role="concept">
28200 <primary>PIPELINING</primary>
28201 <secondary>expected errors</secondary>
28202 </indexterm>
28203 When the PIPELINING extension to SMTP is in use, some protocol errors are
28204 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
28205 Exim assumes that PIPELINING will be used if it advertises it (see
28206 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
28207 not count towards the limit.
28208 </para>
28209 <para>
28210 <indexterm role="option">
28211 <primary><option>smtp_max_unknown_commands</option></primary>
28212 </indexterm>
28213 </para>
28214 <informaltable frame="all">
28215 <tgroup cols="4" colsep="0" rowsep="0">
28216 <colspec colwidth="8*" align="left"/>
28217 <colspec colwidth="6*" align="center"/>
28218 <colspec colwidth="6*" align="center"/>
28219 <colspec colwidth="6*" align="right"/>
28220 <tbody>
28221 <row>
28222 <entry><option>smtp_max_unknown_commands</option></entry>
28223 <entry>Use: <emphasis>main</emphasis></entry>
28224 <entry>Type: <emphasis>integer</emphasis></entry>
28225 <entry>Default: <emphasis>3</emphasis></entry>
28226 </row>
28227 </tbody>
28228 </tgroup>
28229 </informaltable>
28230 <para>
28231 <indexterm role="concept">
28232 <primary>SMTP</primary>
28233 <secondary>limiting unknown commands</secondary>
28234 </indexterm>
28235 <indexterm role="concept">
28236 <primary>limit</primary>
28237 <secondary>unknown SMTP commands</secondary>
28238 </indexterm>
28239 If there are too many unrecognized commands in an incoming SMTP session, an
28240 Exim server drops the connection. This is a defence against some kinds of abuse
28241 that subvert web
28242 clients
28243 into making connections to SMTP ports; in these circumstances, a number of
28244 non-SMTP command lines are sent first.
28245 </para>
28246 <para>
28247 <indexterm role="option">
28248 <primary><option>smtp_ratelimit_hosts</option></primary>
28249 </indexterm>
28250 </para>
28251 <informaltable frame="all">
28252 <tgroup cols="4" colsep="0" rowsep="0">
28253 <colspec colwidth="8*" align="left"/>
28254 <colspec colwidth="6*" align="center"/>
28255 <colspec colwidth="6*" align="center"/>
28256 <colspec colwidth="6*" align="right"/>
28257 <tbody>
28258 <row>
28259 <entry><option>smtp_ratelimit_hosts</option></entry>
28260 <entry>Use: <emphasis>main</emphasis></entry>
28261 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28262 <entry>Default: <emphasis>unset</emphasis></entry>
28263 </row>
28264 </tbody>
28265 </tgroup>
28266 </informaltable>
28267 <para>
28268 <indexterm role="concept">
28269 <primary>SMTP</primary>
28270 <secondary>rate limiting</secondary>
28271 </indexterm>
28272 <indexterm role="concept">
28273 <primary>limit</primary>
28274 <secondary>rate of message arrival</secondary>
28275 </indexterm>
28276 <indexterm role="concept">
28277 <primary>RCPT</primary>
28278 <secondary>rate limiting</secondary>
28279 </indexterm>
28280 Some sites find it helpful to be able to limit the rate at which certain hosts
28281 can send them messages, and the rate at which an individual message can specify
28282 recipients.
28283 </para>
28284 <para>
28285 Exim has two rate-limiting facilities. This section describes the older
28286 facility, which can limit rates within a single connection. The newer
28287 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
28288 <xref linkend="SECTratelimiting"/> for details of the newer facility.
28289 </para>
28290 <para>
28291 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
28292 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
28293 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
28294 respectively. Each option, if set, must contain a set of four comma-separated
28295 values:
28296 </para>
28297 <itemizedlist>
28298 <listitem>
28299 <para>
28300 A threshold, before which there is no rate limiting.
28301 </para>
28302 </listitem>
28303 <listitem>
28304 <para>
28305 An initial time delay. Unlike other times in Exim, numbers with decimal
28306 fractional parts are allowed here.
28307 </para>
28308 </listitem>
28309 <listitem>
28310 <para>
28311 A factor by which to increase the delay each time.
28312 </para>
28313 </listitem>
28314 <listitem>
28315 <para>
28316 A maximum value for the delay. This should normally be less than 5 minutes,
28317 because after that time, the client is liable to timeout the SMTP command.
28318 </para>
28319 </listitem>
28320 </itemizedlist>
28321 <para>
28322 For example, these settings have been used successfully at the site which
28323 first suggested this feature, for controlling mail from their customers:
28324 </para>
28325 <literallayout class="monospaced">
28326 smtp_ratelimit_mail = 2,0.5s,1.05,4m
28327 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
28328 </literallayout>
28329 <para>
28330 The first setting specifies delays that are applied to MAIL commands after
28331 two have been received over a single connection. The initial delay is 0.5
28332 seconds, increasing by a factor of 1.05 each time. The second setting applies
28333 delays to RCPT commands when more than four occur in a single message.
28334 </para>
28335 <para>
28336 <indexterm role="option">
28337 <primary><option>smtp_ratelimit_mail</option></primary>
28338 </indexterm>
28339 </para>
28340 <informaltable frame="all">
28341 <tgroup cols="4" colsep="0" rowsep="0">
28342 <colspec colwidth="8*" align="left"/>
28343 <colspec colwidth="6*" align="center"/>
28344 <colspec colwidth="6*" align="center"/>
28345 <colspec colwidth="6*" align="right"/>
28346 <tbody>
28347 <row>
28348 <entry><option>smtp_ratelimit_mail</option></entry>
28349 <entry>Use: <emphasis>main</emphasis></entry>
28350 <entry>Type: <emphasis>string</emphasis></entry>
28351 <entry>Default: <emphasis>unset</emphasis></entry>
28352 </row>
28353 </tbody>
28354 </tgroup>
28355 </informaltable>
28356 <para>
28357 See <option>smtp_ratelimit_hosts</option> above.
28358 </para>
28359 <para>
28360 <indexterm role="option">
28361 <primary><option>smtp_ratelimit_rcpt</option></primary>
28362 </indexterm>
28363 </para>
28364 <informaltable frame="all">
28365 <tgroup cols="4" colsep="0" rowsep="0">
28366 <colspec colwidth="8*" align="left"/>
28367 <colspec colwidth="6*" align="center"/>
28368 <colspec colwidth="6*" align="center"/>
28369 <colspec colwidth="6*" align="right"/>
28370 <tbody>
28371 <row>
28372 <entry><option>smtp_ratelimit_rcpt</option></entry>
28373 <entry>Use: <emphasis>main</emphasis></entry>
28374 <entry>Type: <emphasis>string</emphasis></entry>
28375 <entry>Default: <emphasis>unset</emphasis></entry>
28376 </row>
28377 </tbody>
28378 </tgroup>
28379 </informaltable>
28380 <para>
28381 See <option>smtp_ratelimit_hosts</option> above.
28382 </para>
28383 <para>
28384 <indexterm role="option">
28385 <primary><option>smtp_receive_timeout</option></primary>
28386 </indexterm>
28387 </para>
28388 <informaltable frame="all">
28389 <tgroup cols="4" colsep="0" rowsep="0">
28390 <colspec colwidth="8*" align="left"/>
28391 <colspec colwidth="6*" align="center"/>
28392 <colspec colwidth="6*" align="center"/>
28393 <colspec colwidth="6*" align="right"/>
28394 <tbody>
28395 <row>
28396 <entry><option>smtp_receive_timeout</option></entry>
28397 <entry>Use: <emphasis>main</emphasis></entry>
28398 <entry>Type: <emphasis>time</emphasis></entry>
28399 <entry>Default: <emphasis>5m</emphasis></entry>
28400 </row>
28401 </tbody>
28402 </tgroup>
28403 </informaltable>
28404 <para>
28405 <indexterm role="concept">
28406 <primary>timeout</primary>
28407 <secondary>for SMTP input</secondary>
28408 </indexterm>
28409 <indexterm role="concept">
28410 <primary>SMTP</primary>
28411 <secondary>input timeout</secondary>
28412 </indexterm>
28413 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
28414 input, including batch SMTP. If a line of input (either an SMTP command or a
28415 data line) is not received within this time, the SMTP connection is dropped and
28416 the message is abandoned.
28417 A line is written to the log containing one of the following messages:
28418 </para>
28419 <literallayout class="monospaced">
28420 SMTP command timeout on connection from...
28421 SMTP data timeout on connection from...
28422 </literallayout>
28423 <para>
28424 The former means that Exim was expecting to read an SMTP command; the latter
28425 means that it was in the DATA phase, reading the contents of a message.
28426 </para>
28427 <para>
28428 <indexterm role="option">
28429 <primary><option>-os</option></primary>
28430 </indexterm>
28431 The value set by this option can be overridden by the
28432 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
28433 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
28434 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
28435 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
28436 </para>
28437 <para>
28438 <indexterm role="option">
28439 <primary><option>smtp_reserve_hosts</option></primary>
28440 </indexterm>
28441 </para>
28442 <informaltable frame="all">
28443 <tgroup cols="4" colsep="0" rowsep="0">
28444 <colspec colwidth="8*" align="left"/>
28445 <colspec colwidth="6*" align="center"/>
28446 <colspec colwidth="6*" align="center"/>
28447 <colspec colwidth="6*" align="right"/>
28448 <tbody>
28449 <row>
28450 <entry><option>smtp_reserve_hosts</option></entry>
28451 <entry>Use: <emphasis>main</emphasis></entry>
28452 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28453 <entry>Default: <emphasis>unset</emphasis></entry>
28454 </row>
28455 </tbody>
28456 </tgroup>
28457 </informaltable>
28458 <para>
28459 This option defines hosts for which SMTP connections are reserved; see
28460 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
28461 </para>
28462 <para>
28463 <indexterm role="option">
28464 <primary><option>smtp_return_error_details</option></primary>
28465 </indexterm>
28466 </para>
28467 <informaltable frame="all">
28468 <tgroup cols="4" colsep="0" rowsep="0">
28469 <colspec colwidth="8*" align="left"/>
28470 <colspec colwidth="6*" align="center"/>
28471 <colspec colwidth="6*" align="center"/>
28472 <colspec colwidth="6*" align="right"/>
28473 <tbody>
28474 <row>
28475 <entry><option>smtp_return_error_details</option></entry>
28476 <entry>Use: <emphasis>main</emphasis></entry>
28477 <entry>Type: <emphasis>boolean</emphasis></entry>
28478 <entry>Default: <emphasis>false</emphasis></entry>
28479 </row>
28480 </tbody>
28481 </tgroup>
28482 </informaltable>
28483 <para>
28484 <indexterm role="concept">
28485 <primary>SMTP</primary>
28486 <secondary>details policy failures</secondary>
28487 </indexterm>
28488 <indexterm role="concept">
28489 <primary>policy control</primary>
28490 <secondary>rejection, returning details</secondary>
28491 </indexterm>
28492 In the default state, Exim uses bland messages such as
28493 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
28494 reasons. Many sysadmins like this because it gives away little information
28495 to spammers. However, some other sysadmins who are applying strict checking
28496 policies want to give out much fuller information about failures. Setting
28497 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
28498 example, instead of <quote>Administrative prohibition</quote>, it might give:
28499 </para>
28500 <literallayout class="monospaced">
28501 550-Rejected after DATA: '&gt;' missing at end of address:
28502 550 failing address in "From" header is: &lt;user@dom.ain
28503 </literallayout>
28504 <para>
28505 <indexterm role="option">
28506 <primary><option>spamd_address</option></primary>
28507 </indexterm>
28508 </para>
28509 <informaltable frame="all">
28510 <tgroup cols="4" colsep="0" rowsep="0">
28511 <colspec colwidth="8*" align="left"/>
28512 <colspec colwidth="6*" align="center"/>
28513 <colspec colwidth="6*" align="center"/>
28514 <colspec colwidth="6*" align="right"/>
28515 <tbody>
28516 <row>
28517 <entry><option>spamd_address</option></entry>
28518 <entry>Use: <emphasis>main</emphasis></entry>
28519 <entry>Type: <emphasis>string</emphasis></entry>
28520 <entry>Default: <emphasis>see below</emphasis></entry>
28521 </row>
28522 </tbody>
28523 </tgroup>
28524 </informaltable>
28525 <para>
28526 This option is available when Exim is compiled with the content-scanning
28527 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
28528 The default value is
28529 </para>
28530 <literallayout class="monospaced">
28531 127.0.0.1 783
28532 </literallayout>
28533 <para>
28534 See section <xref linkend="SECTscanspamass"/> for more details.
28535 </para>
28536 <para>
28537 <indexterm role="option">
28538 <primary><option>split_spool_directory</option></primary>
28539 </indexterm>
28540 </para>
28541 <informaltable frame="all">
28542 <tgroup cols="4" colsep="0" rowsep="0">
28543 <colspec colwidth="8*" align="left"/>
28544 <colspec colwidth="6*" align="center"/>
28545 <colspec colwidth="6*" align="center"/>
28546 <colspec colwidth="6*" align="right"/>
28547 <tbody>
28548 <row>
28549 <entry><option>split_spool_directory</option></entry>
28550 <entry>Use: <emphasis>main</emphasis></entry>
28551 <entry>Type: <emphasis>boolean</emphasis></entry>
28552 <entry>Default: <emphasis>false</emphasis></entry>
28553 </row>
28554 </tbody>
28555 </tgroup>
28556 </informaltable>
28557 <para>
28558 <indexterm role="concept">
28559 <primary>multiple spool directories</primary>
28560 </indexterm>
28561 <indexterm role="concept">
28562 <primary>spool directory</primary>
28563 <secondary>split</secondary>
28564 </indexterm>
28565 <indexterm role="concept">
28566 <primary>directories, multiple</primary>
28567 </indexterm>
28568 If this option is set, it causes Exim to split its input directory into 62
28569 subdirectories, each with a single alphanumeric character as its name. The
28570 sixth character of the message id is used to allocate messages to
28571 subdirectories; this is the least significant base-62 digit of the time of
28572 arrival of the message.
28573 </para>
28574 <para>
28575 Splitting up the spool in this way may provide better performance on systems
28576 where there are long mail queues, by reducing the number of files in any one
28577 directory. The msglog directory is also split up in a similar way to the input
28578 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
28579 are still placed in the single directory <filename>msglog.OLD</filename>.
28580 </para>
28581 <para>
28582 It is not necessary to take any special action for existing messages when
28583 changing <option>split_spool_directory</option>. Exim notices messages that are in the
28584 <quote>wrong</quote> place, and continues to process them. If the option is turned off
28585 after a period of being on, the subdirectories will eventually empty and be
28586 automatically deleted.
28587 </para>
28588 <para>
28589 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
28590 changes. Instead of creating a list of all messages in the queue, and then
28591 trying to deliver each one in turn, it constructs a list of those in one
28592 sub-directory and tries to deliver them, before moving on to the next
28593 sub-directory. The sub-directories are processed in a random order. This
28594 spreads out the scanning of the input directories, and uses less memory. It is
28595 particularly beneficial when there are lots of messages on the queue. However,
28596 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
28597 entire queue has to be scanned and sorted before any deliveries can start.
28598 </para>
28599 <para>
28600 <indexterm role="option">
28601 <primary><option>spool_directory</option></primary>
28602 </indexterm>
28603 </para>
28604 <informaltable frame="all">
28605 <tgroup cols="4" colsep="0" rowsep="0">
28606 <colspec colwidth="8*" align="left"/>
28607 <colspec colwidth="6*" align="center"/>
28608 <colspec colwidth="6*" align="center"/>
28609 <colspec colwidth="6*" align="right"/>
28610 <tbody>
28611 <row>
28612 <entry><option>spool_directory</option></entry>
28613 <entry>Use: <emphasis>main</emphasis></entry>
28614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28615 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28616 </row>
28617 </tbody>
28618 </tgroup>
28619 </informaltable>
28620 <para>
28621 <indexterm role="concept">
28622 <primary>spool directory</primary>
28623 <secondary>path to</secondary>
28624 </indexterm>
28625 This defines the directory in which Exim keeps its spool, that is, the messages
28626 it is waiting to deliver. The default value is taken from the compile-time
28627 configuration setting, if there is one. If not, this option must be set. The
28628 string is expanded, so it can contain, for example, a reference to
28629 <varname>$primary_hostname</varname>.
28630 </para>
28631 <para>
28632 If the spool directory name is fixed on your installation, it is recommended
28633 that you set it at build time rather than from this option, particularly if the
28634 log files are being written to the spool directory (see <option>log_file_path</option>).
28635 Otherwise log files cannot be used for errors that are detected early on, such
28636 as failures in the configuration file.
28637 </para>
28638 <para>
28639 By using this option to override the compiled-in path, it is possible to run
28640 tests of Exim without using the standard spool.
28641 </para>
28642 <para>
28643 <indexterm role="option">
28644 <primary><option>sqlite_lock_timeout</option></primary>
28645 </indexterm>
28646 </para>
28647 <informaltable frame="all">
28648 <tgroup cols="4" colsep="0" rowsep="0">
28649 <colspec colwidth="8*" align="left"/>
28650 <colspec colwidth="6*" align="center"/>
28651 <colspec colwidth="6*" align="center"/>
28652 <colspec colwidth="6*" align="right"/>
28653 <tbody>
28654 <row>
28655 <entry><option>sqlite_lock_timeout</option></entry>
28656 <entry>Use: <emphasis>main</emphasis></entry>
28657 <entry>Type: <emphasis>time</emphasis></entry>
28658 <entry>Default: <emphasis>5s</emphasis></entry>
28659 </row>
28660 </tbody>
28661 </tgroup>
28662 </informaltable>
28663 <para>
28664 <indexterm role="concept">
28665 <primary>sqlite lookup type</primary>
28666 <secondary>lock timeout</secondary>
28667 </indexterm>
28668 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
28669 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
28670 </para>
28671 <para>
28672 <indexterm role="option">
28673 <primary><option>strict_acl_vars</option></primary>
28674 </indexterm>
28675 </para>
28676 <informaltable frame="all">
28677 <tgroup cols="4" colsep="0" rowsep="0">
28678 <colspec colwidth="8*" align="left"/>
28679 <colspec colwidth="6*" align="center"/>
28680 <colspec colwidth="6*" align="center"/>
28681 <colspec colwidth="6*" align="right"/>
28682 <tbody>
28683 <row>
28684 <entry><option>strict_acl_vars</option></entry>
28685 <entry>Use: <emphasis>main</emphasis></entry>
28686 <entry>Type: <emphasis>boolean</emphasis></entry>
28687 <entry>Default: <emphasis>false</emphasis></entry>
28688 </row>
28689 </tbody>
28690 </tgroup>
28691 </informaltable>
28692 <para>
28693 <indexterm role="concept">
28694 <primary>access control lists (ACLs)</primary>
28695 <secondary>variables, handling unset</secondary>
28696 </indexterm>
28697 This option controls what happens if a syntactically valid but undefined ACL
28698 variable is referenced. If it is false (the default), an empty string
28699 is substituted; if it is true, an error is generated. See section
28700 <xref linkend="SECTaclvariables"/> for details of ACL variables.
28701 </para>
28702 <para>
28703 <indexterm role="option">
28704 <primary><option>strip_excess_angle_brackets</option></primary>
28705 </indexterm>
28706 </para>
28707 <informaltable frame="all">
28708 <tgroup cols="4" colsep="0" rowsep="0">
28709 <colspec colwidth="8*" align="left"/>
28710 <colspec colwidth="6*" align="center"/>
28711 <colspec colwidth="6*" align="center"/>
28712 <colspec colwidth="6*" align="right"/>
28713 <tbody>
28714 <row>
28715 <entry><option>strip_excess_angle_brackets</option></entry>
28716 <entry>Use: <emphasis>main</emphasis></entry>
28717 <entry>Type: <emphasis>boolean</emphasis></entry>
28718 <entry>Default: <emphasis>false</emphasis></entry>
28719 </row>
28720 </tbody>
28721 </tgroup>
28722 </informaltable>
28723 <para>
28724 <indexterm role="concept">
28725 <primary>angle brackets, excess</primary>
28726 </indexterm>
28727 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
28728 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
28729 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
28730 passed on to another MTA, the excess angle brackets are not passed on. If this
28731 option is not set, multiple pairs of angle brackets cause a syntax error.
28732 </para>
28733 <para>
28734 <indexterm role="option">
28735 <primary><option>strip_trailing_dot</option></primary>
28736 </indexterm>
28737 </para>
28738 <informaltable frame="all">
28739 <tgroup cols="4" colsep="0" rowsep="0">
28740 <colspec colwidth="8*" align="left"/>
28741 <colspec colwidth="6*" align="center"/>
28742 <colspec colwidth="6*" align="center"/>
28743 <colspec colwidth="6*" align="right"/>
28744 <tbody>
28745 <row>
28746 <entry><option>strip_trailing_dot</option></entry>
28747 <entry>Use: <emphasis>main</emphasis></entry>
28748 <entry>Type: <emphasis>boolean</emphasis></entry>
28749 <entry>Default: <emphasis>false</emphasis></entry>
28750 </row>
28751 </tbody>
28752 </tgroup>
28753 </informaltable>
28754 <para>
28755 <indexterm role="concept">
28756 <primary>trailing dot on domain</primary>
28757 </indexterm>
28758 <indexterm role="concept">
28759 <primary>dot</primary>
28760 <secondary>trailing on domain</secondary>
28761 </indexterm>
28762 If this option is set, a trailing dot at the end of a domain in an address is
28763 ignored. If this is in the envelope and the message is passed on to another
28764 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
28765 domain causes a syntax error.
28766 However, addresses in header lines are checked only when an ACL requests header
28767 syntax checking.
28768 </para>
28769 <para>
28770 <indexterm role="option">
28771 <primary><option>syslog_duplication</option></primary>
28772 </indexterm>
28773 </para>
28774 <informaltable frame="all">
28775 <tgroup cols="4" colsep="0" rowsep="0">
28776 <colspec colwidth="8*" align="left"/>
28777 <colspec colwidth="6*" align="center"/>
28778 <colspec colwidth="6*" align="center"/>
28779 <colspec colwidth="6*" align="right"/>
28780 <tbody>
28781 <row>
28782 <entry><option>syslog_duplication</option></entry>
28783 <entry>Use: <emphasis>main</emphasis></entry>
28784 <entry>Type: <emphasis>boolean</emphasis></entry>
28785 <entry>Default: <emphasis>true</emphasis></entry>
28786 </row>
28787 </tbody>
28788 </tgroup>
28789 </informaltable>
28790 <para>
28791 <indexterm role="concept">
28792 <primary>syslog</primary>
28793 <secondary>duplicate log lines; suppressing</secondary>
28794 </indexterm>
28795 When Exim is logging to syslog, it writes the log lines for its three
28796 separate logs at different syslog priorities so that they can in principle
28797 be separated on the logging hosts. Some installations do not require this
28798 separation, and in those cases, the duplication of certain log lines is a
28799 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
28800 particular log line is written to syslog. For lines that normally go to
28801 both the main log and the reject log, the reject log version (possibly
28802 containing message header lines) is written, at LOG_NOTICE priority.
28803 Lines that normally go to both the main and the panic log are written at
28804 the LOG_ALERT priority.
28805 </para>
28806 <para>
28807 <indexterm role="option">
28808 <primary><option>syslog_facility</option></primary>
28809 </indexterm>
28810 </para>
28811 <informaltable frame="all">
28812 <tgroup cols="4" colsep="0" rowsep="0">
28813 <colspec colwidth="8*" align="left"/>
28814 <colspec colwidth="6*" align="center"/>
28815 <colspec colwidth="6*" align="center"/>
28816 <colspec colwidth="6*" align="right"/>
28817 <tbody>
28818 <row>
28819 <entry><option>syslog_facility</option></entry>
28820 <entry>Use: <emphasis>main</emphasis></entry>
28821 <entry>Type: <emphasis>string</emphasis></entry>
28822 <entry>Default: <emphasis>unset</emphasis></entry>
28823 </row>
28824 </tbody>
28825 </tgroup>
28826 </informaltable>
28827 <para>
28828 <indexterm role="concept">
28829 <primary>syslog</primary>
28830 <secondary>facility; setting</secondary>
28831 </indexterm>
28832 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
28833 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
28834 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
28835 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
28836 details of Exim&#x2019;s logging.
28837 </para>
28838 <para>
28839 <indexterm role="option">
28840 <primary><option>syslog_processname</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>syslog_processname</option></entry>
28852 <entry>Use: <emphasis>main</emphasis></entry>
28853 <entry>Type: <emphasis>string</emphasis></entry>
28854 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
28855 </row>
28856 </tbody>
28857 </tgroup>
28858 </informaltable>
28859 <para>
28860 <indexterm role="concept">
28861 <primary>syslog</primary>
28862 <secondary>process name; setting</secondary>
28863 </indexterm>
28864 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
28865 syslog. The value must be no longer than 32 characters. See chapter
28866 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
28867 </para>
28868 <para>
28869 <indexterm role="option">
28870 <primary><option>syslog_timestamp</option></primary>
28871 </indexterm>
28872 </para>
28873 <informaltable frame="all">
28874 <tgroup cols="4" colsep="0" rowsep="0">
28875 <colspec colwidth="8*" align="left"/>
28876 <colspec colwidth="6*" align="center"/>
28877 <colspec colwidth="6*" align="center"/>
28878 <colspec colwidth="6*" align="right"/>
28879 <tbody>
28880 <row>
28881 <entry><option>syslog_timestamp</option></entry>
28882 <entry>Use: <emphasis>main</emphasis></entry>
28883 <entry>Type: <emphasis>boolean</emphasis></entry>
28884 <entry>Default: <emphasis>true</emphasis></entry>
28885 </row>
28886 </tbody>
28887 </tgroup>
28888 </informaltable>
28889 <para>
28890 <indexterm role="concept">
28891 <primary>syslog</primary>
28892 <secondary>timestamps</secondary>
28893 </indexterm>
28894 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
28895 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
28896 details of Exim&#x2019;s logging.
28897 </para>
28898 <para>
28899 <indexterm role="option">
28900 <primary><option>system_filter</option></primary>
28901 </indexterm>
28902 </para>
28903 <informaltable frame="all">
28904 <tgroup cols="4" colsep="0" rowsep="0">
28905 <colspec colwidth="8*" align="left"/>
28906 <colspec colwidth="6*" align="center"/>
28907 <colspec colwidth="6*" align="center"/>
28908 <colspec colwidth="6*" align="right"/>
28909 <tbody>
28910 <row>
28911 <entry><option>system_filter</option></entry>
28912 <entry>Use: <emphasis>main</emphasis></entry>
28913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28914 <entry>Default: <emphasis>unset</emphasis></entry>
28915 </row>
28916 </tbody>
28917 </tgroup>
28918 </informaltable>
28919 <para>
28920 <indexterm role="concept">
28921 <primary>filter</primary>
28922 <secondary>system filter</secondary>
28923 </indexterm>
28924 <indexterm role="concept">
28925 <primary>system filter</primary>
28926 <secondary>specifying</secondary>
28927 </indexterm>
28928 <indexterm role="concept">
28929 <primary>Sieve filter</primary>
28930 <secondary>not available for system filter</secondary>
28931 </indexterm>
28932 This option specifies an Exim filter file that is applied to all messages at
28933 the start of each delivery attempt, before any routing is done. System filters
28934 must be Exim filters; they cannot be Sieve filters. If the system filter
28935 generates any deliveries to files or pipes, or any new mail messages, the
28936 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
28937 which transports are to be used. Details of this facility are given in chapter
28938 <xref linkend="CHAPsystemfilter"/>.
28939 </para>
28940 <para>
28941 <indexterm role="option">
28942 <primary><option>system_filter_directory_transport</option></primary>
28943 </indexterm>
28944 </para>
28945 <informaltable frame="all">
28946 <tgroup cols="4" colsep="0" rowsep="0">
28947 <colspec colwidth="8*" align="left"/>
28948 <colspec colwidth="6*" align="center"/>
28949 <colspec colwidth="6*" align="center"/>
28950 <colspec colwidth="6*" align="right"/>
28951 <tbody>
28952 <row>
28953 <entry><option>system_filter_directory_transport</option></entry>
28954 <entry>Use: <emphasis>main</emphasis></entry>
28955 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28956 <entry>Default: <emphasis>unset</emphasis></entry>
28957 </row>
28958 </tbody>
28959 </tgroup>
28960 </informaltable>
28961 <para>
28962 <indexterm role="variable">
28963 <primary><varname>$address_file</varname></primary>
28964 </indexterm>
28965 This sets the name of the transport driver that is to be used when the
28966 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
28967 implying delivery of each message into a separate file in some directory.
28968 During the delivery, the variable <varname>$address_file</varname> contains the path name.
28969 </para>
28970 <para>
28971 <indexterm role="option">
28972 <primary><option>system_filter_file_transport</option></primary>
28973 </indexterm>
28974 </para>
28975 <informaltable frame="all">
28976 <tgroup cols="4" colsep="0" rowsep="0">
28977 <colspec colwidth="8*" align="left"/>
28978 <colspec colwidth="6*" align="center"/>
28979 <colspec colwidth="6*" align="center"/>
28980 <colspec colwidth="6*" align="right"/>
28981 <tbody>
28982 <row>
28983 <entry><option>system_filter_file_transport</option></entry>
28984 <entry>Use: <emphasis>main</emphasis></entry>
28985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28986 <entry>Default: <emphasis>unset</emphasis></entry>
28987 </row>
28988 </tbody>
28989 </tgroup>
28990 </informaltable>
28991 <para>
28992 <indexterm role="concept">
28993 <primary>file</primary>
28994 <secondary>transport for system filter</secondary>
28995 </indexterm>
28996 This sets the name of the transport driver that is to be used when the <option>save</option>
28997 command in a system message filter specifies a path not ending in <quote>/</quote>. During
28998 the delivery, the variable <varname>$address_file</varname> contains the path name.
28999 </para>
29000 <para>
29001 <indexterm role="option">
29002 <primary><option>system_filter_group</option></primary>
29003 </indexterm>
29004 </para>
29005 <informaltable frame="all">
29006 <tgroup cols="4" colsep="0" rowsep="0">
29007 <colspec colwidth="8*" align="left"/>
29008 <colspec colwidth="6*" align="center"/>
29009 <colspec colwidth="6*" align="center"/>
29010 <colspec colwidth="6*" align="right"/>
29011 <tbody>
29012 <row>
29013 <entry><option>system_filter_group</option></entry>
29014 <entry>Use: <emphasis>main</emphasis></entry>
29015 <entry>Type: <emphasis>string</emphasis></entry>
29016 <entry>Default: <emphasis>unset</emphasis></entry>
29017 </row>
29018 </tbody>
29019 </tgroup>
29020 </informaltable>
29021 <para>
29022 <indexterm role="concept">
29023 <primary>gid (group id)</primary>
29024 <secondary>system filter</secondary>
29025 </indexterm>
29026 This option is used only when <option>system_filter_user</option> is also set. It sets the
29027 gid under which the system filter is run, overriding any gid that is associated
29028 with the user. The value may be numerical or symbolic.
29029 </para>
29030 <para>
29031 <indexterm role="option">
29032 <primary><option>system_filter_pipe_transport</option></primary>
29033 </indexterm>
29034 </para>
29035 <informaltable frame="all">
29036 <tgroup cols="4" colsep="0" rowsep="0">
29037 <colspec colwidth="8*" align="left"/>
29038 <colspec colwidth="6*" align="center"/>
29039 <colspec colwidth="6*" align="center"/>
29040 <colspec colwidth="6*" align="right"/>
29041 <tbody>
29042 <row>
29043 <entry><option>system_filter_pipe_transport</option></entry>
29044 <entry>Use: <emphasis>main</emphasis></entry>
29045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29046 <entry>Default: <emphasis>unset</emphasis></entry>
29047 </row>
29048 </tbody>
29049 </tgroup>
29050 </informaltable>
29051 <para>
29052 <indexterm role="concept">
29053 <primary><command>pipe</command> transport</primary>
29054 <secondary>for system filter</secondary>
29055 </indexterm>
29056 <indexterm role="variable">
29057 <primary><varname>$address_pipe</varname></primary>
29058 </indexterm>
29059 This specifies the transport driver that is to be used when a <option>pipe</option> command
29060 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
29061 contains the pipe command.
29062 </para>
29063 <para>
29064 <indexterm role="option">
29065 <primary><option>system_filter_reply_transport</option></primary>
29066 </indexterm>
29067 </para>
29068 <informaltable frame="all">
29069 <tgroup cols="4" colsep="0" rowsep="0">
29070 <colspec colwidth="8*" align="left"/>
29071 <colspec colwidth="6*" align="center"/>
29072 <colspec colwidth="6*" align="center"/>
29073 <colspec colwidth="6*" align="right"/>
29074 <tbody>
29075 <row>
29076 <entry><option>system_filter_reply_transport</option></entry>
29077 <entry>Use: <emphasis>main</emphasis></entry>
29078 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29079 <entry>Default: <emphasis>unset</emphasis></entry>
29080 </row>
29081 </tbody>
29082 </tgroup>
29083 </informaltable>
29084 <para>
29085 <indexterm role="concept">
29086 <primary><command>autoreply</command> transport</primary>
29087 <secondary>for system filter</secondary>
29088 </indexterm>
29089 This specifies the transport driver that is to be used when a <option>mail</option> command
29090 is used in a system filter.
29091 </para>
29092 <para>
29093 <indexterm role="option">
29094 <primary><option>system_filter_user</option></primary>
29095 </indexterm>
29096 </para>
29097 <informaltable frame="all">
29098 <tgroup cols="4" colsep="0" rowsep="0">
29099 <colspec colwidth="8*" align="left"/>
29100 <colspec colwidth="6*" align="center"/>
29101 <colspec colwidth="6*" align="center"/>
29102 <colspec colwidth="6*" align="right"/>
29103 <tbody>
29104 <row>
29105 <entry><option>system_filter_user</option></entry>
29106 <entry>Use: <emphasis>main</emphasis></entry>
29107 <entry>Type: <emphasis>string</emphasis></entry>
29108 <entry>Default: <emphasis>unset</emphasis></entry>
29109 </row>
29110 </tbody>
29111 </tgroup>
29112 </informaltable>
29113 <para>
29114 <indexterm role="concept">
29115 <primary>uid (user id)</primary>
29116 <secondary>system filter</secondary>
29117 </indexterm>
29118 If this option is set to root, the system filter is run in the main Exim
29119 delivery process, as root.  Otherwise, the system filter runs in a separate
29120 process, as the given user, defaulting to the Exim run-time user.
29121 Unless the string consists entirely of digits, it
29122 is looked up in the password data. Failure to find the named user causes a
29123 configuration error. The gid is either taken from the password data, or
29124 specified by <option>system_filter_group</option>. When the uid is specified numerically,
29125 <option>system_filter_group</option> is required to be set.
29126 </para>
29127 <para>
29128 If the system filter generates any pipe, file, or reply deliveries, the uid
29129 under which the filter is run is used when transporting them, unless a
29130 transport option overrides.
29131 </para>
29132 <para>
29133 <indexterm role="option">
29134 <primary><option>tcp_nodelay</option></primary>
29135 </indexterm>
29136 </para>
29137 <informaltable frame="all">
29138 <tgroup cols="4" colsep="0" rowsep="0">
29139 <colspec colwidth="8*" align="left"/>
29140 <colspec colwidth="6*" align="center"/>
29141 <colspec colwidth="6*" align="center"/>
29142 <colspec colwidth="6*" align="right"/>
29143 <tbody>
29144 <row>
29145 <entry><option>tcp_nodelay</option></entry>
29146 <entry>Use: <emphasis>main</emphasis></entry>
29147 <entry>Type: <emphasis>boolean</emphasis></entry>
29148 <entry>Default: <emphasis>true</emphasis></entry>
29149 </row>
29150 </tbody>
29151 </tgroup>
29152 </informaltable>
29153 <para>
29154 <indexterm role="concept">
29155 <primary>daemon</primary>
29156 <secondary>TCP_NODELAY on sockets</secondary>
29157 </indexterm>
29158 <indexterm role="concept">
29159 <primary>Nagle algorithm</primary>
29160 </indexterm>
29161 <indexterm role="concept">
29162 <primary>TCP_NODELAY on listening sockets</primary>
29163 </indexterm>
29164 If this option is set false, it stops the Exim daemon setting the
29165 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
29166 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
29167 performance in interactive (character-by-character) situations. Turning it off
29168 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
29169 However, it appears that some broken clients cannot cope, and time out. Hence
29170 this option. It affects only those sockets that are set up for listening by the
29171 daemon. Sockets created by the smtp transport for delivering mail always set
29172 TCP_NODELAY.
29173 </para>
29174 <para>
29175 <indexterm role="option">
29176 <primary><option>timeout_frozen_after</option></primary>
29177 </indexterm>
29178 </para>
29179 <informaltable frame="all">
29180 <tgroup cols="4" colsep="0" rowsep="0">
29181 <colspec colwidth="8*" align="left"/>
29182 <colspec colwidth="6*" align="center"/>
29183 <colspec colwidth="6*" align="center"/>
29184 <colspec colwidth="6*" align="right"/>
29185 <tbody>
29186 <row>
29187 <entry><option>timeout_frozen_after</option></entry>
29188 <entry>Use: <emphasis>main</emphasis></entry>
29189 <entry>Type: <emphasis>time</emphasis></entry>
29190 <entry>Default: <emphasis>0s</emphasis></entry>
29191 </row>
29192 </tbody>
29193 </tgroup>
29194 </informaltable>
29195 <para>
29196 <indexterm role="concept">
29197 <primary>frozen messages</primary>
29198 <secondary>timing out</secondary>
29199 </indexterm>
29200 <indexterm role="concept">
29201 <primary>timeout</primary>
29202 <secondary>frozen messages</secondary>
29203 </indexterm>
29204 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
29205 message of any kind that has been on the queue for longer than the given time
29206 is automatically cancelled at the next queue run. If the frozen message is a
29207 bounce message, it is just discarded; otherwise, a bounce is sent to the
29208 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
29209 If you want to timeout frozen bounce messages earlier than other kinds of
29210 frozen message, see <option>ignore_bounce_errors_after</option>.
29211 </para>
29212 <para>
29213 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
29214 frozen messages remain on the queue forever (except for any frozen bounce
29215 messages that are released by <option>ignore_bounce_errors_after</option>).
29216 </para>
29217 <para>
29218 <indexterm role="option">
29219 <primary><option>timezone</option></primary>
29220 </indexterm>
29221 </para>
29222 <informaltable frame="all">
29223 <tgroup cols="4" colsep="0" rowsep="0">
29224 <colspec colwidth="8*" align="left"/>
29225 <colspec colwidth="6*" align="center"/>
29226 <colspec colwidth="6*" align="center"/>
29227 <colspec colwidth="6*" align="right"/>
29228 <tbody>
29229 <row>
29230 <entry><option>timezone</option></entry>
29231 <entry>Use: <emphasis>main</emphasis></entry>
29232 <entry>Type: <emphasis>string</emphasis></entry>
29233 <entry>Default: <emphasis>unset</emphasis></entry>
29234 </row>
29235 </tbody>
29236 </tgroup>
29237 </informaltable>
29238 <para>
29239 <indexterm role="concept">
29240 <primary>timezone, setting</primary>
29241 </indexterm>
29242 The value of <option>timezone</option> is used to set the environment variable TZ while
29243 running Exim (if it is different on entry). This ensures that all timestamps
29244 created by Exim are in the required timezone. If you want all your timestamps
29245 to be in UTC (aka GMT) you should set
29246 </para>
29247 <literallayout class="monospaced">
29248 timezone = UTC
29249 </literallayout>
29250 <para>
29251 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
29252 or, if that is not set, from the value of the TZ environment variable when Exim
29253 is built. If <option>timezone</option> is set to the empty string, either at build or run
29254 time, any existing TZ variable is removed from the environment when Exim
29255 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
29256 unfortunately not all, operating systems.
29257 </para>
29258 <para>
29259 <indexterm role="option">
29260 <primary><option>tls_advertise_hosts</option></primary>
29261 </indexterm>
29262 </para>
29263 <informaltable frame="all">
29264 <tgroup cols="4" colsep="0" rowsep="0">
29265 <colspec colwidth="8*" align="left"/>
29266 <colspec colwidth="6*" align="center"/>
29267 <colspec colwidth="6*" align="center"/>
29268 <colspec colwidth="6*" align="right"/>
29269 <tbody>
29270 <row>
29271 <entry><option>tls_advertise_hosts</option></entry>
29272 <entry>Use: <emphasis>main</emphasis></entry>
29273 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29274 <entry>Default: <emphasis>unset</emphasis></entry>
29275 </row>
29276 </tbody>
29277 </tgroup>
29278 </informaltable>
29279 <para>
29280 <indexterm role="concept">
29281 <primary>TLS</primary>
29282 <secondary>advertising</secondary>
29283 </indexterm>
29284 <indexterm role="concept">
29285 <primary>encryption</primary>
29286 <secondary>on SMTP connection</secondary>
29287 </indexterm>
29288 <indexterm role="concept">
29289 <primary>SMTP</primary>
29290 <secondary>encrypted connection</secondary>
29291 </indexterm>
29292 When Exim is built with support for TLS encrypted connections, the availability
29293 of the STARTTLS command to set up an encrypted session is advertised in
29294 response to EHLO only to those client hosts that match this option. See
29295 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
29296 </para>
29297 <para>
29298 <indexterm role="option">
29299 <primary><option>tls_certificate</option></primary>
29300 </indexterm>
29301 </para>
29302 <informaltable frame="all">
29303 <tgroup cols="4" colsep="0" rowsep="0">
29304 <colspec colwidth="8*" align="left"/>
29305 <colspec colwidth="6*" align="center"/>
29306 <colspec colwidth="6*" align="center"/>
29307 <colspec colwidth="6*" align="right"/>
29308 <tbody>
29309 <row>
29310 <entry><option>tls_certificate</option></entry>
29311 <entry>Use: <emphasis>main</emphasis></entry>
29312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29313 <entry>Default: <emphasis>unset</emphasis></entry>
29314 </row>
29315 </tbody>
29316 </tgroup>
29317 </informaltable>
29318 <para>
29319 <indexterm role="concept">
29320 <primary>TLS</primary>
29321 <secondary>server certificate; location of</secondary>
29322 </indexterm>
29323 <indexterm role="concept">
29324 <primary>certificate</primary>
29325 <secondary>server, location of</secondary>
29326 </indexterm>
29327 The value of this option is expanded, and must then be the absolute path to a
29328 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
29329 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
29330 <xref linkend="CHAPTLS"/> for further details.
29331 </para>
29332 <para>
29333 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
29334 receiving incoming messages as a server. If you want to supply certificates for
29335 use when sending messages as a client, you must set the <option>tls_certificate</option>
29336 option in the relevant <command>smtp</command> transport.
29337 </para>
29338 <para>
29339 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
29340 if the OpenSSL build supports TLS extensions and the TLS client sends the
29341 Server Name Indication extension, then this option and others documented in
29342 <xref linkend="SECTtlssni"/> will be re-expanded.
29343 </para>
29344 <para>
29345 <indexterm role="option">
29346 <primary><option>tls_crl</option></primary>
29347 </indexterm>
29348 </para>
29349 <informaltable frame="all">
29350 <tgroup cols="4" colsep="0" rowsep="0">
29351 <colspec colwidth="8*" align="left"/>
29352 <colspec colwidth="6*" align="center"/>
29353 <colspec colwidth="6*" align="center"/>
29354 <colspec colwidth="6*" align="right"/>
29355 <tbody>
29356 <row>
29357 <entry><option>tls_crl</option></entry>
29358 <entry>Use: <emphasis>main</emphasis></entry>
29359 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29360 <entry>Default: <emphasis>unset</emphasis></entry>
29361 </row>
29362 </tbody>
29363 </tgroup>
29364 </informaltable>
29365 <para>
29366 <indexterm role="concept">
29367 <primary>TLS</primary>
29368 <secondary>server certificate revocation list</secondary>
29369 </indexterm>
29370 <indexterm role="concept">
29371 <primary>certificate</primary>
29372 <secondary>revocation list for server</secondary>
29373 </indexterm>
29374 This option specifies a certificate revocation list. The expanded value must
29375 be the name of a file that contains a CRL in PEM format.
29376 </para>
29377 <para>
29378 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29379 </para>
29380 <para>
29381 <indexterm role="option">
29382 <primary><option>tls_dh_max_bits</option></primary>
29383 </indexterm>
29384 </para>
29385 <informaltable frame="all">
29386 <tgroup cols="4" colsep="0" rowsep="0">
29387 <colspec colwidth="8*" align="left"/>
29388 <colspec colwidth="6*" align="center"/>
29389 <colspec colwidth="6*" align="center"/>
29390 <colspec colwidth="6*" align="right"/>
29391 <tbody>
29392 <row>
29393 <entry><option>tls_dh_max_bits</option></entry>
29394 <entry>Use: <emphasis>main</emphasis></entry>
29395 <entry>Type: <emphasis>integer</emphasis></entry>
29396 <entry>Default: <emphasis>2236</emphasis></entry>
29397 </row>
29398 </tbody>
29399 </tgroup>
29400 </informaltable>
29401 <para>
29402 <indexterm role="concept">
29403 <primary>TLS</primary>
29404 <secondary>D-H bit count</secondary>
29405 </indexterm>
29406 The number of bits used for Diffie-Hellman key-exchange may be suggested by
29407 the chosen TLS library.  That value might prove to be too high for
29408 interoperability.  This option provides a maximum clamp on the value
29409 suggested, trading off security for interoperability.
29410 </para>
29411 <para>
29412 The value must be at least 1024.
29413 </para>
29414 <para>
29415 The value 2236 was chosen because, at time of adding the option, it was the
29416 hard-coded maximum value supported by the NSS cryptographic library, as used
29417 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
29418 </para>
29419 <para>
29420 If you prefer more security and are willing to break some clients, raise this
29421 number.
29422 </para>
29423 <para>
29424 Note that the value passed to GnuTLS for *generating* a new prime may be a
29425 little less than this figure, because GnuTLS is inexact and may produce a
29426 larger prime than requested.
29427 </para>
29428 <para>
29429 <indexterm role="option">
29430 <primary><option>tls_dhparam</option></primary>
29431 </indexterm>
29432 </para>
29433 <informaltable frame="all">
29434 <tgroup cols="4" colsep="0" rowsep="0">
29435 <colspec colwidth="8*" align="left"/>
29436 <colspec colwidth="6*" align="center"/>
29437 <colspec colwidth="6*" align="center"/>
29438 <colspec colwidth="6*" align="right"/>
29439 <tbody>
29440 <row>
29441 <entry><option>tls_dhparam</option></entry>
29442 <entry>Use: <emphasis>main</emphasis></entry>
29443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29444 <entry>Default: <emphasis>unset</emphasis></entry>
29445 </row>
29446 </tbody>
29447 </tgroup>
29448 </informaltable>
29449 <para>
29450 <indexterm role="concept">
29451 <primary>TLS</primary>
29452 <secondary>D-H parameters for server</secondary>
29453 </indexterm>
29454 The value of this option is expanded and indicates the source of DH parameters
29455 to be used by Exim.
29456 </para>
29457 <para>
29458 If it is a filename starting with a <literal>/</literal>, then it names a file from which DH
29459 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
29460 PKCS#3 representation of the DH prime.  If the file does not exist, for
29461 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
29462 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
29463 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
29464 and treated as though the <option>tls_dhparam</option> were set to "none".
29465 </para>
29466 <para>
29467 If this option expands to the string "none", then no DH parameters will be
29468 loaded by Exim.
29469 </para>
29470 <para>
29471 If this option expands to the string "historic" and Exim is using GnuTLS, then
29472 Exim will attempt to load a file from inside the spool directory.  If the file
29473 does not exist, Exim will attempt to create it.
29474 See section <xref linkend="SECTgnutlsparam"/> for further details.
29475 </para>
29476 <para>
29477 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
29478 a default DH prime; the default is the 2048 bit prime described in section
29479 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
29480 in IKE is assigned number 23.
29481 </para>
29482 <para>
29483 Otherwise, the option must expand to the name used by Exim for any of a number
29484 of DH primes specified in RFC 2409, RFC 3526 and RFC 5114.  As names, Exim uses
29485 "ike" followed by the number used by IKE, of "default" which corresponds to
29486 "ike23".
29487 </para>
29488 <para>
29489 The available primes are:
29490 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
29491 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
29492 <literal>ike22</literal>, <literal>ike23</literal> (aka <literal>default</literal>) and <literal>ike24</literal>.
29493 </para>
29494 <para>
29495 Some of these will be too small to be accepted by clients.
29496 Some may be too large to be accepted by clients.
29497 </para>
29498 <para revisionflag="changed">
29499 The TLS protocol does not negotiate an acceptable size for this; clients tend
29500 to hard-drop connections if what is offered by the server is unacceptable,
29501 whether too large or too small, and there&#x2019;s no provision for the client to
29502 tell the server what these constraints are.  Thus, as a server operator, you
29503 need to make an educated guess as to what is most likely to work for your
29504 userbase.
29505 </para>
29506 <para revisionflag="changed">
29507 Some known size constraints suggest that a bit-size in the range 2048 to 2236
29508 is most likely to maximise interoperability.  The upper bound comes from
29509 applications using the Mozilla Network Security Services (NSS) library, which
29510 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
29511 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
29512 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
29513 acceptable bound from 1024 to 2048.
29514 </para>
29515 <para>
29516 <indexterm role="option">
29517 <primary><option>tls_on_connect_ports</option></primary>
29518 </indexterm>
29519 </para>
29520 <informaltable frame="all">
29521 <tgroup cols="4" colsep="0" rowsep="0">
29522 <colspec colwidth="8*" align="left"/>
29523 <colspec colwidth="6*" align="center"/>
29524 <colspec colwidth="6*" align="center"/>
29525 <colspec colwidth="6*" align="right"/>
29526 <tbody>
29527 <row>
29528 <entry><option>tls_on_connect_ports</option></entry>
29529 <entry>Use: <emphasis>main</emphasis></entry>
29530 <entry>Type: <emphasis>string list</emphasis></entry>
29531 <entry>Default: <emphasis>unset</emphasis></entry>
29532 </row>
29533 </tbody>
29534 </tgroup>
29535 </informaltable>
29536 <para>
29537 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
29538 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
29539 set up without waiting for the client to issue a STARTTLS command. For
29540 further details, see section <xref linkend="SECTsupobssmt"/>.
29541 </para>
29542 <para>
29543 <indexterm role="option">
29544 <primary><option>tls_privatekey</option></primary>
29545 </indexterm>
29546 </para>
29547 <informaltable frame="all">
29548 <tgroup cols="4" colsep="0" rowsep="0">
29549 <colspec colwidth="8*" align="left"/>
29550 <colspec colwidth="6*" align="center"/>
29551 <colspec colwidth="6*" align="center"/>
29552 <colspec colwidth="6*" align="right"/>
29553 <tbody>
29554 <row>
29555 <entry><option>tls_privatekey</option></entry>
29556 <entry>Use: <emphasis>main</emphasis></entry>
29557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29558 <entry>Default: <emphasis>unset</emphasis></entry>
29559 </row>
29560 </tbody>
29561 </tgroup>
29562 </informaltable>
29563 <para>
29564 <indexterm role="concept">
29565 <primary>TLS</primary>
29566 <secondary>server private key; location of</secondary>
29567 </indexterm>
29568 The value of this option is expanded, and must then be the absolute path to a
29569 file which contains the server&#x2019;s private key. If this option is unset, or if
29570 the expansion is forced to fail, or the result is an empty string, the private
29571 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
29572 <xref linkend="CHAPTLS"/> for further details.
29573 </para>
29574 <para>
29575 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29576 </para>
29577 <para>
29578 <indexterm role="option">
29579 <primary><option>tls_remember_esmtp</option></primary>
29580 </indexterm>
29581 </para>
29582 <informaltable frame="all">
29583 <tgroup cols="4" colsep="0" rowsep="0">
29584 <colspec colwidth="8*" align="left"/>
29585 <colspec colwidth="6*" align="center"/>
29586 <colspec colwidth="6*" align="center"/>
29587 <colspec colwidth="6*" align="right"/>
29588 <tbody>
29589 <row>
29590 <entry><option>tls_remember_esmtp</option></entry>
29591 <entry>Use: <emphasis>main</emphasis></entry>
29592 <entry>Type: <emphasis>boolean</emphasis></entry>
29593 <entry>Default: <emphasis>false</emphasis></entry>
29594 </row>
29595 </tbody>
29596 </tgroup>
29597 </informaltable>
29598 <para>
29599 <indexterm role="concept">
29600 <primary>TLS</primary>
29601 <secondary>esmtp state; remembering</secondary>
29602 </indexterm>
29603 <indexterm role="concept">
29604 <primary>TLS</primary>
29605 <secondary>broken clients</secondary>
29606 </indexterm>
29607 If this option is set true, Exim violates the RFCs by remembering that it is in
29608 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
29609 support for broken clients that fail to send a new EHLO after starting a
29610 TLS session.
29611 </para>
29612 <para>
29613 <indexterm role="option">
29614 <primary><option>tls_require_ciphers</option></primary>
29615 </indexterm>
29616 </para>
29617 <informaltable frame="all">
29618 <tgroup cols="4" colsep="0" rowsep="0">
29619 <colspec colwidth="8*" align="left"/>
29620 <colspec colwidth="6*" align="center"/>
29621 <colspec colwidth="6*" align="center"/>
29622 <colspec colwidth="6*" align="right"/>
29623 <tbody>
29624 <row>
29625 <entry><option>tls_require_ciphers</option></entry>
29626 <entry>Use: <emphasis>main</emphasis></entry>
29627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29628 <entry>Default: <emphasis>unset</emphasis></entry>
29629 </row>
29630 </tbody>
29631 </tgroup>
29632 </informaltable>
29633 <para>
29634 <indexterm role="concept">
29635 <primary>TLS</primary>
29636 <secondary>requiring specific ciphers</secondary>
29637 </indexterm>
29638 <indexterm role="concept">
29639 <primary>cipher</primary>
29640 <secondary>requiring specific</secondary>
29641 </indexterm>
29642 This option controls which ciphers can be used for incoming TLS connections.
29643 The <command>smtp</command> transport has an option of the same name for controlling outgoing
29644 connections. This option is expanded for each connection, so can be varied for
29645 different clients if required. The value of this option must be a list of
29646 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
29647 in somewhat different ways. If GnuTLS is being used, the client controls the
29648 preference order of the available ciphers. Details are given in sections
29649 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
29650 </para>
29651 <para>
29652 <indexterm role="option">
29653 <primary><option>tls_try_verify_hosts</option></primary>
29654 </indexterm>
29655 </para>
29656 <informaltable frame="all">
29657 <tgroup cols="4" colsep="0" rowsep="0">
29658 <colspec colwidth="8*" align="left"/>
29659 <colspec colwidth="6*" align="center"/>
29660 <colspec colwidth="6*" align="center"/>
29661 <colspec colwidth="6*" align="right"/>
29662 <tbody>
29663 <row>
29664 <entry><option>tls_try_verify_hosts</option></entry>
29665 <entry>Use: <emphasis>main</emphasis></entry>
29666 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29667 <entry>Default: <emphasis>unset</emphasis></entry>
29668 </row>
29669 </tbody>
29670 </tgroup>
29671 </informaltable>
29672 <para>
29673 <indexterm role="concept">
29674 <primary>TLS</primary>
29675 <secondary>client certificate verification</secondary>
29676 </indexterm>
29677 <indexterm role="concept">
29678 <primary>certificate</primary>
29679 <secondary>verification of client</secondary>
29680 </indexterm>
29681 See <option>tls_verify_hosts</option> below.
29682 </para>
29683 <para>
29684 <indexterm role="option">
29685 <primary><option>tls_verify_certificates</option></primary>
29686 </indexterm>
29687 </para>
29688 <informaltable frame="all">
29689 <tgroup cols="4" colsep="0" rowsep="0">
29690 <colspec colwidth="8*" align="left"/>
29691 <colspec colwidth="6*" align="center"/>
29692 <colspec colwidth="6*" align="center"/>
29693 <colspec colwidth="6*" align="right"/>
29694 <tbody>
29695 <row>
29696 <entry><option>tls_verify_certificates</option></entry>
29697 <entry>Use: <emphasis>main</emphasis></entry>
29698 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29699 <entry>Default: <emphasis>unset</emphasis></entry>
29700 </row>
29701 </tbody>
29702 </tgroup>
29703 </informaltable>
29704 <para>
29705 <indexterm role="concept">
29706 <primary>TLS</primary>
29707 <secondary>client certificate verification</secondary>
29708 </indexterm>
29709 <indexterm role="concept">
29710 <primary>certificate</primary>
29711 <secondary>verification of client</secondary>
29712 </indexterm>
29713 The value of this option is expanded, and must then be the absolute path to
29714 a file containing permitted certificates for clients that
29715 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
29716 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
29717 directory containing certificate files. This does not work with GnuTLS; the
29718 option must be set to the name of a single file if you are using GnuTLS.
29719 </para>
29720 <para>
29721 These certificates should be for the certificate authorities trusted, rather
29722 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
29723 the value is a file then the certificates are sent by Exim as a server to
29724 connecting clients, defining the list of accepted certificate authorities.
29725 Thus the values defined should be considered public data.  To avoid this,
29726 use OpenSSL with a directory.
29727 </para>
29728 <para>
29729 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
29730 </para>
29731 <para revisionflag="changed">
29732 A forced expansion failure or setting to an empty string is equivalent to
29733 being unset.
29734 </para>
29735 <para>
29736 <indexterm role="option">
29737 <primary><option>tls_verify_hosts</option></primary>
29738 </indexterm>
29739 </para>
29740 <informaltable frame="all">
29741 <tgroup cols="4" colsep="0" rowsep="0">
29742 <colspec colwidth="8*" align="left"/>
29743 <colspec colwidth="6*" align="center"/>
29744 <colspec colwidth="6*" align="center"/>
29745 <colspec colwidth="6*" align="right"/>
29746 <tbody>
29747 <row>
29748 <entry><option>tls_verify_hosts</option></entry>
29749 <entry>Use: <emphasis>main</emphasis></entry>
29750 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29751 <entry>Default: <emphasis>unset</emphasis></entry>
29752 </row>
29753 </tbody>
29754 </tgroup>
29755 </informaltable>
29756 <para>
29757 <indexterm role="concept">
29758 <primary>TLS</primary>
29759 <secondary>client certificate verification</secondary>
29760 </indexterm>
29761 <indexterm role="concept">
29762 <primary>certificate</primary>
29763 <secondary>verification of client</secondary>
29764 </indexterm>
29765 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
29766 certificates from clients. The expected certificates are defined by
29767 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
29768 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
29769 <option>tls_verify_certificates</option> is not set.
29770 </para>
29771 <para>
29772 Any client that matches <option>tls_verify_hosts</option> is constrained by
29773 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
29774 present one of the listed certificates. If it does not, the connection is
29775 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
29776 the host to use TLS. It can still send SMTP commands through unencrypted
29777 connections. Forcing a client to use TLS has to be done separately using an
29778 ACL to reject inappropriate commands when the connection is not encrypted.
29779 </para>
29780 <para>
29781 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
29782 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
29783 certificate and checks it against <option>tls_verify_certificates</option>, but does not
29784 abort the connection if there is no certificate or if it does not match. This
29785 state can be detected in an ACL, which makes it possible to implement policies
29786 such as <quote>accept for relay only if a verified certificate has been received,
29787 but accept for local delivery if encrypted, even without a verified
29788 certificate</quote>.
29789 </para>
29790 <para>
29791 Client hosts that match neither of these lists are not asked to present
29792 certificates.
29793 </para>
29794 <para>
29795 <indexterm role="option">
29796 <primary><option>trusted_groups</option></primary>
29797 </indexterm>
29798 </para>
29799 <informaltable frame="all">
29800 <tgroup cols="4" colsep="0" rowsep="0">
29801 <colspec colwidth="8*" align="left"/>
29802 <colspec colwidth="6*" align="center"/>
29803 <colspec colwidth="6*" align="center"/>
29804 <colspec colwidth="6*" align="right"/>
29805 <tbody>
29806 <row>
29807 <entry><option>trusted_groups</option></entry>
29808 <entry>Use: <emphasis>main</emphasis></entry>
29809 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29810 <entry>Default: <emphasis>unset</emphasis></entry>
29811 </row>
29812 </tbody>
29813 </tgroup>
29814 </informaltable>
29815 <para>
29816 <indexterm role="concept">
29817 <primary>trusted groups</primary>
29818 </indexterm>
29819 <indexterm role="concept">
29820 <primary>groups</primary>
29821 <secondary>trusted</secondary>
29822 </indexterm>
29823 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
29824 option is set, any process that is running in one of the listed groups, or
29825 which has one of them as a supplementary group, is trusted. The groups can be
29826 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
29827 details of what trusted callers are permitted to do. If neither
29828 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
29829 are trusted.
29830 </para>
29831 <para>
29832 <indexterm role="option">
29833 <primary><option>trusted_users</option></primary>
29834 </indexterm>
29835 </para>
29836 <informaltable frame="all">
29837 <tgroup cols="4" colsep="0" rowsep="0">
29838 <colspec colwidth="8*" align="left"/>
29839 <colspec colwidth="6*" align="center"/>
29840 <colspec colwidth="6*" align="center"/>
29841 <colspec colwidth="6*" align="right"/>
29842 <tbody>
29843 <row>
29844 <entry><option>trusted_users</option></entry>
29845 <entry>Use: <emphasis>main</emphasis></entry>
29846 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29847 <entry>Default: <emphasis>unset</emphasis></entry>
29848 </row>
29849 </tbody>
29850 </tgroup>
29851 </informaltable>
29852 <para>
29853 <indexterm role="concept">
29854 <primary>trusted users</primary>
29855 </indexterm>
29856 <indexterm role="concept">
29857 <primary>user</primary>
29858 <secondary>trusted</secondary>
29859 </indexterm>
29860 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
29861 option is set, any process that is running as one of the listed users is
29862 trusted. The users can be specified numerically or by name. See section
29863 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
29864 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
29865 Exim user are trusted.
29866 </para>
29867 <para>
29868 <indexterm role="option">
29869 <primary><option>unknown_login</option></primary>
29870 </indexterm>
29871 </para>
29872 <informaltable frame="all">
29873 <tgroup cols="4" colsep="0" rowsep="0">
29874 <colspec colwidth="8*" align="left"/>
29875 <colspec colwidth="6*" align="center"/>
29876 <colspec colwidth="6*" align="center"/>
29877 <colspec colwidth="6*" align="right"/>
29878 <tbody>
29879 <row>
29880 <entry><option>unknown_login</option></entry>
29881 <entry>Use: <emphasis>main</emphasis></entry>
29882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29883 <entry>Default: <emphasis>unset</emphasis></entry>
29884 </row>
29885 </tbody>
29886 </tgroup>
29887 </informaltable>
29888 <para>
29889 <indexterm role="concept">
29890 <primary>uid (user id)</primary>
29891 <secondary>unknown caller</secondary>
29892 </indexterm>
29893 <indexterm role="variable">
29894 <primary><varname>$caller_uid</varname></primary>
29895 </indexterm>
29896 This is a specialized feature for use in unusual configurations. By default, if
29897 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
29898 gives up. The <option>unknown_login</option> option can be used to set a login name to be
29899 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
29900 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
29901 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
29902 <option>-F</option> option.
29903 </para>
29904 <para>
29905 <indexterm role="option">
29906 <primary><option>unknown_username</option></primary>
29907 </indexterm>
29908 </para>
29909 <informaltable frame="all">
29910 <tgroup cols="4" colsep="0" rowsep="0">
29911 <colspec colwidth="8*" align="left"/>
29912 <colspec colwidth="6*" align="center"/>
29913 <colspec colwidth="6*" align="center"/>
29914 <colspec colwidth="6*" align="right"/>
29915 <tbody>
29916 <row>
29917 <entry><option>unknown_username</option></entry>
29918 <entry>Use: <emphasis>main</emphasis></entry>
29919 <entry>Type: <emphasis>string</emphasis></entry>
29920 <entry>Default: <emphasis>unset</emphasis></entry>
29921 </row>
29922 </tbody>
29923 </tgroup>
29924 </informaltable>
29925 <para>
29926 See <option>unknown_login</option>.
29927 </para>
29928 <para>
29929 <indexterm role="option">
29930 <primary><option>untrusted_set_sender</option></primary>
29931 </indexterm>
29932 </para>
29933 <informaltable frame="all">
29934 <tgroup cols="4" colsep="0" rowsep="0">
29935 <colspec colwidth="8*" align="left"/>
29936 <colspec colwidth="6*" align="center"/>
29937 <colspec colwidth="6*" align="center"/>
29938 <colspec colwidth="6*" align="right"/>
29939 <tbody>
29940 <row>
29941 <entry><option>untrusted_set_sender</option></entry>
29942 <entry>Use: <emphasis>main</emphasis></entry>
29943 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
29944 <entry>Default: <emphasis>unset</emphasis></entry>
29945 </row>
29946 </tbody>
29947 </tgroup>
29948 </informaltable>
29949 <para>
29950 <indexterm role="concept">
29951 <primary>trusted users</primary>
29952 </indexterm>
29953 <indexterm role="concept">
29954 <primary>sender</primary>
29955 <secondary>setting by untrusted user</secondary>
29956 </indexterm>
29957 <indexterm role="concept">
29958 <primary>untrusted user setting sender</primary>
29959 </indexterm>
29960 <indexterm role="concept">
29961 <primary>user</primary>
29962 <secondary>untrusted setting sender</secondary>
29963 </indexterm>
29964 <indexterm role="concept">
29965 <primary>envelope sender</primary>
29966 </indexterm>
29967 When an untrusted user submits a message to Exim using the standard input, Exim
29968 normally creates an envelope sender address from the user&#x2019;s login and the
29969 default qualification domain. Data from the <option>-f</option> option (for setting envelope
29970 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
29971 is used) is ignored.
29972 </para>
29973 <para>
29974 However, untrusted users are permitted to set an empty envelope sender address,
29975 to declare that a message should never generate any bounces. For example:
29976 </para>
29977 <literallayout class="monospaced">
29978 exim -f '&lt;&gt;' user@domain.example
29979 </literallayout>
29980 <para>
29981 <indexterm role="variable">
29982 <primary><varname>$sender_ident</varname></primary>
29983 </indexterm>
29984 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
29985 other envelope sender addresses in a controlled way. When it is set, untrusted
29986 users are allowed to set envelope sender addresses that match any of the
29987 patterns in the list. Like all address lists, the string is expanded. The
29988 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
29989 users to setting senders that start with their login ids
29990 followed by a hyphen
29991 by a setting like this:
29992 </para>
29993 <literallayout class="monospaced">
29994 untrusted_set_sender = ^$sender_ident-
29995 </literallayout>
29996 <para>
29997 If you want to allow untrusted users to set envelope sender addresses without
29998 restriction, you can use
29999 </para>
30000 <literallayout class="monospaced">
30001 untrusted_set_sender = *
30002 </literallayout>
30003 <para>
30004 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
30005 only to the setting of the envelope sender. It does not permit untrusted users
30006 to use the other options which trusted user can use to override message
30007 parameters. Furthermore, it does not stop Exim from removing an existing
30008 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
30009 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
30010 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
30011 described in section <xref linkend="SECTthesenhea"/>.
30012 </para>
30013 <para>
30014 The log line for a message&#x2019;s arrival shows the envelope sender following
30015 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
30016 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
30017 envelope sender address, the user&#x2019;s login is shown in parentheses after the
30018 sender address.
30019 </para>
30020 <para>
30021 <indexterm role="option">
30022 <primary><option>uucp_from_pattern</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>uucp_from_pattern</option></entry>
30034 <entry>Use: <emphasis>main</emphasis></entry>
30035 <entry>Type: <emphasis>string</emphasis></entry>
30036 <entry>Default: <emphasis>see below</emphasis></entry>
30037 </row>
30038 </tbody>
30039 </tgroup>
30040 </informaltable>
30041 <para>
30042 <indexterm role="concept">
30043 <primary><quote>From</quote> line</primary>
30044 </indexterm>
30045 <indexterm role="concept">
30046 <primary>UUCP</primary>
30047 <secondary><quote>From</quote> line</secondary>
30048 </indexterm>
30049 Some applications that pass messages to an MTA via a command line interface use
30050 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
30051 particular, this is used by UUCP software. Exim recognizes such a line by means
30052 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
30053 matches, the sender address is constructed by expanding the contents of
30054 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
30055 default pattern recognizes lines in the following two forms:
30056 </para>
30057 <literallayout class="monospaced">
30058 From ph10 Fri Jan  5 12:35 GMT 1996
30059 From ph10 Fri, 7 Jan 97 14:00:00 GMT
30060 </literallayout>
30061 <para>
30062 The pattern can be seen by running
30063 </para>
30064 <literallayout class="monospaced">
30065 exim -bP uucp_from_pattern
30066 </literallayout>
30067 <para>
30068 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
30069 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
30070 regular expression by a parenthesized subpattern. The default value for
30071 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
30072 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
30073 <option>ignore_fromline_hosts</option>.
30074 </para>
30075 <para>
30076 <indexterm role="option">
30077 <primary><option>uucp_from_sender</option></primary>
30078 </indexterm>
30079 </para>
30080 <informaltable frame="all">
30081 <tgroup cols="4" colsep="0" rowsep="0">
30082 <colspec colwidth="8*" align="left"/>
30083 <colspec colwidth="6*" align="center"/>
30084 <colspec colwidth="6*" align="center"/>
30085 <colspec colwidth="6*" align="right"/>
30086 <tbody>
30087 <row>
30088 <entry><option>uucp_from_sender</option></entry>
30089 <entry>Use: <emphasis>main</emphasis></entry>
30090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30091 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
30092 </row>
30093 </tbody>
30094 </tgroup>
30095 </informaltable>
30096 <para>
30097 See <option>uucp_from_pattern</option> above.
30098 </para>
30099 <para>
30100 <indexterm role="option">
30101 <primary><option>warn_message_file</option></primary>
30102 </indexterm>
30103 </para>
30104 <informaltable frame="all">
30105 <tgroup cols="4" colsep="0" rowsep="0">
30106 <colspec colwidth="8*" align="left"/>
30107 <colspec colwidth="6*" align="center"/>
30108 <colspec colwidth="6*" align="center"/>
30109 <colspec colwidth="6*" align="right"/>
30110 <tbody>
30111 <row>
30112 <entry><option>warn_message_file</option></entry>
30113 <entry>Use: <emphasis>main</emphasis></entry>
30114 <entry>Type: <emphasis>string</emphasis></entry>
30115 <entry>Default: <emphasis>unset</emphasis></entry>
30116 </row>
30117 </tbody>
30118 </tgroup>
30119 </informaltable>
30120 <para>
30121 <indexterm role="concept">
30122 <primary>warning of delay</primary>
30123 <secondary>customizing the message</secondary>
30124 </indexterm>
30125 <indexterm role="concept">
30126 <primary>customizing</primary>
30127 <secondary>warning message</secondary>
30128 </indexterm>
30129 This option defines a template file containing paragraphs of text to be used
30130 for constructing the warning message which is sent by Exim when a message has
30131 been on the queue for a specified amount of time, as specified by
30132 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
30133 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
30134 </para>
30135 <para>
30136 <indexterm role="option">
30137 <primary><option>write_rejectlog</option></primary>
30138 </indexterm>
30139 </para>
30140 <informaltable frame="all">
30141 <tgroup cols="4" colsep="0" rowsep="0">
30142 <colspec colwidth="8*" align="left"/>
30143 <colspec colwidth="6*" align="center"/>
30144 <colspec colwidth="6*" align="center"/>
30145 <colspec colwidth="6*" align="right"/>
30146 <tbody>
30147 <row>
30148 <entry><option>write_rejectlog</option></entry>
30149 <entry>Use: <emphasis>main</emphasis></entry>
30150 <entry>Type: <emphasis>boolean</emphasis></entry>
30151 <entry>Default: <emphasis>true</emphasis></entry>
30152 </row>
30153 </tbody>
30154 </tgroup>
30155 </informaltable>
30156 <para>
30157 <indexterm role="concept">
30158 <primary>reject log</primary>
30159 <secondary>disabling</secondary>
30160 </indexterm>
30161 If this option is set false, Exim no longer writes anything to the reject log.
30162 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
30163 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
30164 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
30165 </para>
30166 </section>
30167 </chapter>
30168
30169 <chapter id="CHAProutergeneric">
30170 <title>Generic options for routers</title>
30171 <para>
30172 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
30173 <primary>options</primary>
30174 <secondary>generic; for routers</secondary>
30175 </indexterm>
30176 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
30177 <primary>generic options</primary>
30178 <secondary>router</secondary>
30179 </indexterm>
30180 This chapter describes the generic options that apply to all routers.
30181 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
30182 </para>
30183 <para>
30184 For a general description of how a router operates, see sections
30185 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
30186 which the preconditions are tested. The order of expansion of the options that
30187 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
30188 <option>headers_remove</option>, <option>transport</option>.
30189 </para>
30190 <para>
30191 <indexterm role="option">
30192 <primary><option>address_data</option></primary>
30193 </indexterm>
30194 </para>
30195 <informaltable frame="all">
30196 <tgroup cols="4" colsep="0" rowsep="0">
30197 <colspec colwidth="8*" align="left"/>
30198 <colspec colwidth="6*" align="center"/>
30199 <colspec colwidth="6*" align="center"/>
30200 <colspec colwidth="6*" align="right"/>
30201 <tbody>
30202 <row>
30203 <entry><option>address_data</option></entry>
30204 <entry>Use: <emphasis>routers</emphasis></entry>
30205 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30206 <entry>Default: <emphasis>unset</emphasis></entry>
30207 </row>
30208 </tbody>
30209 </tgroup>
30210 </informaltable>
30211 <para>
30212 <indexterm role="concept">
30213 <primary>router</primary>
30214 <secondary>data attached to address</secondary>
30215 </indexterm>
30216 The string is expanded just before the router is run, that is, after all the
30217 precondition tests have succeeded. If the expansion is forced to fail, the
30218 router declines, the value of <option>address_data</option> remains unchanged, and the
30219 <option>more</option> option controls what happens next. Other expansion failures cause
30220 delivery of the address to be deferred.
30221 </para>
30222 <para>
30223 <indexterm role="variable">
30224 <primary><varname>$address_data</varname></primary>
30225 </indexterm>
30226 When the expansion succeeds, the value is retained with the address, and can be
30227 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
30228 routers, and the eventual transport.
30229 </para>
30230 <para>
30231 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
30232 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
30233 in the filter. This is not normally a problem, because such data is usually
30234 either not confidential or it <quote>belongs</quote> to the current user, but if you do
30235 put confidential data into <varname>$address_data</varname> you need to remember this point.
30236 </para>
30237 <para>
30238 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
30239 with the address, though it can be changed by another <option>address_data</option> setting
30240 on a subsequent router. If a router generates child addresses, the value of
30241 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
30242 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
30243 </para>
30244 <para>
30245 The idea of <option>address_data</option> is that you can use it to look up a lot of data
30246 for the address once, and then pick out parts of the data later. For example,
30247 you could use a single LDAP lookup to return a string of the form
30248 </para>
30249 <literallayout class="monospaced">
30250 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
30251 </literallayout>
30252 <para>
30253 In the transport you could pick out the mailbox by a setting such as
30254 </para>
30255 <literallayout class="monospaced">
30256 file = ${extract{mailbox}{$address_data}}
30257 </literallayout>
30258 <para>
30259 This makes the configuration file less messy, and also reduces the number of
30260 lookups (though Exim does cache lookups).
30261 </para>
30262 <para>
30263 <indexterm role="variable">
30264 <primary><varname>$sender_address_data</varname></primary>
30265 </indexterm>
30266 <indexterm role="variable">
30267 <primary><varname>$address_data</varname></primary>
30268 </indexterm>
30269 The <option>address_data</option> facility is also useful as a means of passing information
30270 from one router to another, and from a router to a transport. In addition, if
30271 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
30272 ACL, it remains available for use in the rest of the ACL statement. After
30273 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
30274 </para>
30275 <para>
30276 <indexterm role="option">
30277 <primary><option>address_test</option></primary>
30278 </indexterm>
30279 </para>
30280 <informaltable frame="all">
30281 <tgroup cols="4" colsep="0" rowsep="0">
30282 <colspec colwidth="8*" align="left"/>
30283 <colspec colwidth="6*" align="center"/>
30284 <colspec colwidth="6*" align="center"/>
30285 <colspec colwidth="6*" align="right"/>
30286 <tbody>
30287 <row>
30288 <entry><option>address_test</option></entry>
30289 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30290 <entry>Type: <emphasis>boolean</emphasis></entry>
30291 <entry>Default: <emphasis>true</emphasis></entry>
30292 </row>
30293 </tbody>
30294 </tgroup>
30295 </informaltable>
30296 <para>
30297 <indexterm role="option">
30298 <primary><option>-bt</option></primary>
30299 </indexterm>
30300 <indexterm role="concept">
30301 <primary>router</primary>
30302 <secondary>skipping when address testing</secondary>
30303 </indexterm>
30304 If this option is set false, the router is skipped when routing is being tested
30305 by means of the <option>-bt</option> command line option. This can be a convenience when
30306 your first router sends messages to an external scanner, because it saves you
30307 having to set the <quote>already scanned</quote> indicator when testing real address
30308 routing.
30309 </para>
30310 <para>
30311 <indexterm role="option">
30312 <primary><option>cannot_route_message</option></primary>
30313 </indexterm>
30314 </para>
30315 <informaltable frame="all">
30316 <tgroup cols="4" colsep="0" rowsep="0">
30317 <colspec colwidth="8*" align="left"/>
30318 <colspec colwidth="6*" align="center"/>
30319 <colspec colwidth="6*" align="center"/>
30320 <colspec colwidth="6*" align="right"/>
30321 <tbody>
30322 <row>
30323 <entry><option>cannot_route_message</option></entry>
30324 <entry>Use: <emphasis>routers</emphasis></entry>
30325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30326 <entry>Default: <emphasis>unset</emphasis></entry>
30327 </row>
30328 </tbody>
30329 </tgroup>
30330 </informaltable>
30331 <para>
30332 <indexterm role="concept">
30333 <primary>router</primary>
30334 <secondary>customizing <quote>cannot route</quote> message</secondary>
30335 </indexterm>
30336 <indexterm role="concept">
30337 <primary>customizing</primary>
30338 <secondary><quote>cannot route</quote> message</secondary>
30339 </indexterm>
30340 This option specifies a text message that is used when an address cannot be
30341 routed because Exim has run out of routers. The default message is
30342 <quote>Unrouteable address</quote>. This option is useful only on routers that have
30343 <option>more</option> set false, or on the very last router in a configuration, because the
30344 value that is used is taken from the last router that is considered. This
30345 includes a router that is skipped because its preconditions are not met, as
30346 well as a router that declines. For example, using the default configuration,
30347 you could put:
30348 </para>
30349 <literallayout class="monospaced">
30350 cannot_route_message = Remote domain not found in DNS
30351 </literallayout>
30352 <para>
30353 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
30354 and
30355 </para>
30356 <literallayout class="monospaced">
30357 cannot_route_message = Unknown local user
30358 </literallayout>
30359 <para>
30360 on the final router that checks for local users. If string expansion fails for
30361 this option, the default message is used. Unless the expansion failure was
30362 explicitly forced, a message about the failure is written to the main and panic
30363 logs, in addition to the normal message about the routing failure.
30364 </para>
30365 <para>
30366 <indexterm role="option">
30367 <primary><option>caseful_local_part</option></primary>
30368 </indexterm>
30369 </para>
30370 <informaltable frame="all">
30371 <tgroup cols="4" colsep="0" rowsep="0">
30372 <colspec colwidth="8*" align="left"/>
30373 <colspec colwidth="6*" align="center"/>
30374 <colspec colwidth="6*" align="center"/>
30375 <colspec colwidth="6*" align="right"/>
30376 <tbody>
30377 <row>
30378 <entry><option>caseful_local_part</option></entry>
30379 <entry>Use: <emphasis>routers</emphasis></entry>
30380 <entry>Type: <emphasis>boolean</emphasis></entry>
30381 <entry>Default: <emphasis>false</emphasis></entry>
30382 </row>
30383 </tbody>
30384 </tgroup>
30385 </informaltable>
30386 <para>
30387 <indexterm role="concept">
30388 <primary>case of local parts</primary>
30389 </indexterm>
30390 <indexterm role="concept">
30391 <primary>router</primary>
30392 <secondary>case of local parts</secondary>
30393 </indexterm>
30394 By default, routers handle the local parts of addresses in a case-insensitive
30395 manner, though the actual case is preserved for transmission with the message.
30396 If you want the case of letters to be significant in a router, you must set
30397 this option true. For individual router options that contain address or local
30398 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
30399 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
30400 more details.
30401 </para>
30402 <para>
30403 <indexterm role="variable">
30404 <primary><varname>$local_part</varname></primary>
30405 </indexterm>
30406 <indexterm role="variable">
30407 <primary><varname>$original_local_part</varname></primary>
30408 </indexterm>
30409 <indexterm role="variable">
30410 <primary><varname>$parent_local_part</varname></primary>
30411 </indexterm>
30412 The value of the <varname>$local_part</varname> variable is forced to lower case while a
30413 router is running unless <option>caseful_local_part</option> is set. When a router assigns
30414 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
30415 is the same as it was in the router. Similarly, when a router generates child
30416 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
30417 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
30418 </para>
30419 <para>
30420 This option applies to the processing of an address by a router. When a
30421 recipient address is being processed in an ACL, there is a separate <option>control</option>
30422 modifier that can be used to specify case-sensitive processing within the ACL
30423 (see section <xref linkend="SECTcontrols"/>).
30424 </para>
30425 <para>
30426 <indexterm role="option">
30427 <primary><option>check_local_user</option></primary>
30428 </indexterm>
30429 </para>
30430 <informaltable frame="all">
30431 <tgroup cols="4" colsep="0" rowsep="0">
30432 <colspec colwidth="8*" align="left"/>
30433 <colspec colwidth="6*" align="center"/>
30434 <colspec colwidth="6*" align="center"/>
30435 <colspec colwidth="6*" align="right"/>
30436 <tbody>
30437 <row>
30438 <entry><option>check_local_user</option></entry>
30439 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30440 <entry>Type: <emphasis>boolean</emphasis></entry>
30441 <entry>Default: <emphasis>false</emphasis></entry>
30442 </row>
30443 </tbody>
30444 </tgroup>
30445 </informaltable>
30446 <para>
30447 <indexterm role="concept">
30448 <primary>local user, checking in router</primary>
30449 </indexterm>
30450 <indexterm role="concept">
30451 <primary>router</primary>
30452 <secondary>checking for local user</secondary>
30453 </indexterm>
30454 <indexterm role="concept">
30455 <primary><filename>/etc/passwd</filename></primary>
30456 </indexterm>
30457 <indexterm role="variable">
30458 <primary><varname>$home</varname></primary>
30459 </indexterm>
30460 When this option is true, Exim checks that the local part of the recipient
30461 address (with affixes removed if relevant) is the name of an account on the
30462 local system. The check is done by calling the <function>getpwnam()</function> function rather
30463 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
30464 holding password data (such as NIS) are supported. If the local part is a local
30465 user, <varname>$home</varname> is set from the password data, and can be tested in other
30466 preconditions that are evaluated after this one (the order of evaluation is
30467 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
30468 overridden by <option>router_home_directory</option>. If the local part is not a local user,
30469 the router is skipped.
30470 </para>
30471 <para>
30472 If you want to check that the local part is either the name of a local user
30473 or matches something else, you cannot combine <option>check_local_user</option> with a
30474 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
30475 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
30476 setting to achieve this. For example:
30477 </para>
30478 <literallayout class="monospaced">
30479 local_parts = passwd;$local_part : lsearch;/etc/other/users
30480 </literallayout>
30481 <para>
30482 Note, however, that the side effects of <option>check_local_user</option> (such as setting
30483 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
30484 <option>local_parts</option> (or any other) precondition.
30485 </para>
30486 <para>
30487 <indexterm role="option">
30488 <primary><option>condition</option></primary>
30489 </indexterm>
30490 </para>
30491 <informaltable frame="all">
30492 <tgroup cols="4" colsep="0" rowsep="0">
30493 <colspec colwidth="8*" align="left"/>
30494 <colspec colwidth="6*" align="center"/>
30495 <colspec colwidth="6*" align="center"/>
30496 <colspec colwidth="6*" align="right"/>
30497 <tbody>
30498 <row>
30499 <entry><option>condition</option></entry>
30500 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30502 <entry>Default: <emphasis>unset</emphasis></entry>
30503 </row>
30504 </tbody>
30505 </tgroup>
30506 </informaltable>
30507 <para>
30508 <indexterm role="concept">
30509 <primary>router</primary>
30510 <secondary>customized precondition</secondary>
30511 </indexterm>
30512 This option specifies a general precondition test that has to succeed for the
30513 router to be called. The <option>condition</option> option is the last precondition to be
30514 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
30515 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
30516 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
30517 router is skipped, and the address is offered to the next one.
30518 </para>
30519 <para>
30520 If the result is any other value, the router is run (as this is the last
30521 precondition to be evaluated, all the other preconditions must be true).
30522 </para>
30523 <para>
30524 This option is unusual in that multiple <option>condition</option> options may be present.
30525 All <option>condition</option> options must succeed.
30526 </para>
30527 <para>
30528 The <option>condition</option> option provides a means of applying custom conditions to the
30529 running of routers. Note that in the case of a simple conditional expansion,
30530 the default expansion values are exactly what is wanted. For example:
30531 </para>
30532 <literallayout class="monospaced">
30533 condition = ${if &gt;{$message_age}{600}}
30534 </literallayout>
30535 <para>
30536 Because of the default behaviour of the string expansion, this is equivalent to
30537 </para>
30538 <literallayout class="monospaced">
30539 condition = ${if &gt;{$message_age}{600}{true}{}}
30540 </literallayout>
30541 <para>
30542 A multiple condition example, which succeeds:
30543 </para>
30544 <literallayout class="monospaced">
30545 condition = ${if &gt;{$message_age}{600}}
30546 condition = ${if !eq{${lc:$local_part}}{postmaster}}
30547 condition = foobar
30548 </literallayout>
30549 <para>
30550 If the expansion fails (other than forced failure) delivery is deferred. Some
30551 of the other precondition options are common special cases that could in fact
30552 be specified using <option>condition</option>.
30553 </para>
30554 <para>
30555 <indexterm role="option">
30556 <primary><option>debug_print</option></primary>
30557 </indexterm>
30558 </para>
30559 <informaltable frame="all">
30560 <tgroup cols="4" colsep="0" rowsep="0">
30561 <colspec colwidth="8*" align="left"/>
30562 <colspec colwidth="6*" align="center"/>
30563 <colspec colwidth="6*" align="center"/>
30564 <colspec colwidth="6*" align="right"/>
30565 <tbody>
30566 <row>
30567 <entry><option>debug_print</option></entry>
30568 <entry>Use: <emphasis>routers</emphasis></entry>
30569 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30570 <entry>Default: <emphasis>unset</emphasis></entry>
30571 </row>
30572 </tbody>
30573 </tgroup>
30574 </informaltable>
30575 <para>
30576 <indexterm role="concept">
30577 <primary>testing</primary>
30578 <secondary>variables in drivers</secondary>
30579 </indexterm>
30580 If this option is set and debugging is enabled (see the <option>-d</option> command line
30581 option) or in address-testing mode (see the <option>-bt</option> command line option),
30582 the string is expanded and included in the debugging output.
30583 If expansion of the string fails, the error message is written to the debugging
30584 output, and Exim carries on processing.
30585 This option is provided to help with checking out the values of variables and
30586 so on when debugging router configurations. For example, if a <option>condition</option>
30587 option appears not to be working, <option>debug_print</option> can be used to output the
30588 variables it references. The output happens after checks for <option>domains</option>,
30589 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
30590 are tested. A newline is added to the text if it does not end with one.
30591 The variable <varname>$router_name</varname> contains the name of the router.
30592 </para>
30593 <para>
30594 <indexterm role="option">
30595 <primary><option>disable_logging</option></primary>
30596 </indexterm>
30597 </para>
30598 <informaltable frame="all">
30599 <tgroup cols="4" colsep="0" rowsep="0">
30600 <colspec colwidth="8*" align="left"/>
30601 <colspec colwidth="6*" align="center"/>
30602 <colspec colwidth="6*" align="center"/>
30603 <colspec colwidth="6*" align="right"/>
30604 <tbody>
30605 <row>
30606 <entry><option>disable_logging</option></entry>
30607 <entry>Use: <emphasis>routers</emphasis></entry>
30608 <entry>Type: <emphasis>boolean</emphasis></entry>
30609 <entry>Default: <emphasis>false</emphasis></entry>
30610 </row>
30611 </tbody>
30612 </tgroup>
30613 </informaltable>
30614 <para>
30615 If this option is set true, nothing is logged for any routing errors
30616 or for any deliveries caused by this router. You should not set this option
30617 unless you really, really know what you are doing. See also the generic
30618 transport option of the same name.
30619 </para>
30620 <para>
30621 <indexterm role="option">
30622 <primary><option>domains</option></primary>
30623 </indexterm>
30624 </para>
30625 <informaltable frame="all">
30626 <tgroup cols="4" colsep="0" rowsep="0">
30627 <colspec colwidth="8*" align="left"/>
30628 <colspec colwidth="6*" align="center"/>
30629 <colspec colwidth="6*" align="center"/>
30630 <colspec colwidth="6*" align="right"/>
30631 <tbody>
30632 <row>
30633 <entry><option>domains</option></entry>
30634 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30635 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30636 <entry>Default: <emphasis>unset</emphasis></entry>
30637 </row>
30638 </tbody>
30639 </tgroup>
30640 </informaltable>
30641 <para>
30642 <indexterm role="concept">
30643 <primary>router</primary>
30644 <secondary>restricting to specific domains</secondary>
30645 </indexterm>
30646 <indexterm role="variable">
30647 <primary><varname>$domain_data</varname></primary>
30648 </indexterm>
30649 If this option is set, the router is skipped unless the current domain matches
30650 the list. If the match is achieved by means of a file lookup, the data that the
30651 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
30652 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
30653 a list of the order in which preconditions are evaluated.
30654 </para>
30655 <para>
30656 <indexterm role="option">
30657 <primary><option>driver</option></primary>
30658 </indexterm>
30659 </para>
30660 <informaltable frame="all">
30661 <tgroup cols="4" colsep="0" rowsep="0">
30662 <colspec colwidth="8*" align="left"/>
30663 <colspec colwidth="6*" align="center"/>
30664 <colspec colwidth="6*" align="center"/>
30665 <colspec colwidth="6*" align="right"/>
30666 <tbody>
30667 <row>
30668 <entry><option>driver</option></entry>
30669 <entry>Use: <emphasis>routers</emphasis></entry>
30670 <entry>Type: <emphasis>string</emphasis></entry>
30671 <entry>Default: <emphasis>unset</emphasis></entry>
30672 </row>
30673 </tbody>
30674 </tgroup>
30675 </informaltable>
30676 <para>
30677 This option must always be set. It specifies which of the available routers is
30678 to be used.
30679 </para>
30680 <para>
30681 <indexterm role="option">
30682 <primary><option>errors_to</option></primary>
30683 </indexterm>
30684 </para>
30685 <informaltable frame="all">
30686 <tgroup cols="4" colsep="0" rowsep="0">
30687 <colspec colwidth="8*" align="left"/>
30688 <colspec colwidth="6*" align="center"/>
30689 <colspec colwidth="6*" align="center"/>
30690 <colspec colwidth="6*" align="right"/>
30691 <tbody>
30692 <row>
30693 <entry><option>errors_to</option></entry>
30694 <entry>Use: <emphasis>routers</emphasis></entry>
30695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30696 <entry>Default: <emphasis>unset</emphasis></entry>
30697 </row>
30698 </tbody>
30699 </tgroup>
30700 </informaltable>
30701 <para>
30702 <indexterm role="concept">
30703 <primary>envelope sender</primary>
30704 </indexterm>
30705 <indexterm role="concept">
30706 <primary>router</primary>
30707 <secondary>changing address for errors</secondary>
30708 </indexterm>
30709 If a router successfully handles an address, it may assign the address to a
30710 transport for delivery or it may generate child addresses. In both cases, if
30711 there is a delivery problem during later processing, the resulting bounce
30712 message is sent to the address that results from expanding this string,
30713 provided that the address verifies successfully. The <option>errors_to</option> option is
30714 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
30715 </para>
30716 <para>
30717 The <option>errors_to</option> setting associated with an address can be overridden if it
30718 subsequently passes through other routers that have their own <option>errors_to</option>
30719 settings, or if the message is delivered by a transport with a <option>return_path</option>
30720 setting.
30721 </para>
30722 <para>
30723 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
30724 the expansion fails to verify, the errors address associated with the incoming
30725 address is used. At top level, this is the envelope sender. A non-forced
30726 expansion failure causes delivery to be deferred.
30727 </para>
30728 <para>
30729 If an address for which <option>errors_to</option> has been set ends up being delivered over
30730 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
30731 any bounces that are generated by other MTAs on the delivery route are also
30732 sent there. You can set <option>errors_to</option> to the empty string by either of these
30733 settings:
30734 </para>
30735 <literallayout class="monospaced">
30736 errors_to =
30737 errors_to = ""
30738 </literallayout>
30739 <para>
30740 An expansion item that yields an empty string has the same effect. If you do
30741 this, a locally detected delivery error for addresses processed by this router
30742 no longer gives rise to a bounce message; the error is discarded. If the
30743 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
30744 overridden by the <option>return_path</option> option on the transport.
30745 </para>
30746 <para>
30747 <indexterm role="variable">
30748 <primary><varname>$address_data</varname></primary>
30749 </indexterm>
30750 If for some reason you want to discard local errors, but use a non-empty
30751 MAIL command for remote delivery, you can preserve the original return
30752 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
30753 setting <option>return_path</option>.
30754 </para>
30755 <para>
30756 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
30757 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
30758 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
30759 </para>
30760 <para>
30761 <indexterm role="option">
30762 <primary><option>expn</option></primary>
30763 </indexterm>
30764 </para>
30765 <informaltable frame="all">
30766 <tgroup cols="4" colsep="0" rowsep="0">
30767 <colspec colwidth="8*" align="left"/>
30768 <colspec colwidth="6*" align="center"/>
30769 <colspec colwidth="6*" align="center"/>
30770 <colspec colwidth="6*" align="right"/>
30771 <tbody>
30772 <row>
30773 <entry><option>expn</option></entry>
30774 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30775 <entry>Type: <emphasis>boolean</emphasis></entry>
30776 <entry>Default: <emphasis>true</emphasis></entry>
30777 </row>
30778 </tbody>
30779 </tgroup>
30780 </informaltable>
30781 <para>
30782 <indexterm role="concept">
30783 <primary>address</primary>
30784 <secondary>testing</secondary>
30785 </indexterm>
30786 <indexterm role="concept">
30787 <primary>testing</primary>
30788 <secondary>addresses</secondary>
30789 </indexterm>
30790 <indexterm role="concept">
30791 <primary>EXPN</primary>
30792 <secondary>router skipping</secondary>
30793 </indexterm>
30794 <indexterm role="concept">
30795 <primary>router</primary>
30796 <secondary>skipping for EXPN</secondary>
30797 </indexterm>
30798 If this option is turned off, the router is skipped when testing an address
30799 as a result of processing an SMTP EXPN command. You might, for example,
30800 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
30801 on for the system alias file.
30802 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30803 are evaluated.
30804 </para>
30805 <para>
30806 The use of the SMTP EXPN command is controlled by an ACL (see chapter
30807 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
30808 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
30809 </para>
30810 <para>
30811 <indexterm role="option">
30812 <primary><option>fail_verify</option></primary>
30813 </indexterm>
30814 </para>
30815 <informaltable frame="all">
30816 <tgroup cols="4" colsep="0" rowsep="0">
30817 <colspec colwidth="8*" align="left"/>
30818 <colspec colwidth="6*" align="center"/>
30819 <colspec colwidth="6*" align="center"/>
30820 <colspec colwidth="6*" align="right"/>
30821 <tbody>
30822 <row>
30823 <entry><option>fail_verify</option></entry>
30824 <entry>Use: <emphasis>routers</emphasis></entry>
30825 <entry>Type: <emphasis>boolean</emphasis></entry>
30826 <entry>Default: <emphasis>false</emphasis></entry>
30827 </row>
30828 </tbody>
30829 </tgroup>
30830 </informaltable>
30831 <para>
30832 <indexterm role="concept">
30833 <primary>router</primary>
30834 <secondary>forcing verification failure</secondary>
30835 </indexterm>
30836 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
30837 <option>fail_verify_recipient</option> to the same value.
30838 </para>
30839 <para>
30840 <indexterm role="option">
30841 <primary><option>fail_verify_recipient</option></primary>
30842 </indexterm>
30843 </para>
30844 <informaltable frame="all">
30845 <tgroup cols="4" colsep="0" rowsep="0">
30846 <colspec colwidth="8*" align="left"/>
30847 <colspec colwidth="6*" align="center"/>
30848 <colspec colwidth="6*" align="center"/>
30849 <colspec colwidth="6*" align="right"/>
30850 <tbody>
30851 <row>
30852 <entry><option>fail_verify_recipient</option></entry>
30853 <entry>Use: <emphasis>routers</emphasis></entry>
30854 <entry>Type: <emphasis>boolean</emphasis></entry>
30855 <entry>Default: <emphasis>false</emphasis></entry>
30856 </row>
30857 </tbody>
30858 </tgroup>
30859 </informaltable>
30860 <para>
30861 If this option is true and an address is accepted by this router when
30862 verifying a recipient, verification fails.
30863 </para>
30864 <para>
30865 <indexterm role="option">
30866 <primary><option>fail_verify_sender</option></primary>
30867 </indexterm>
30868 </para>
30869 <informaltable frame="all">
30870 <tgroup cols="4" colsep="0" rowsep="0">
30871 <colspec colwidth="8*" align="left"/>
30872 <colspec colwidth="6*" align="center"/>
30873 <colspec colwidth="6*" align="center"/>
30874 <colspec colwidth="6*" align="right"/>
30875 <tbody>
30876 <row>
30877 <entry><option>fail_verify_sender</option></entry>
30878 <entry>Use: <emphasis>routers</emphasis></entry>
30879 <entry>Type: <emphasis>boolean</emphasis></entry>
30880 <entry>Default: <emphasis>false</emphasis></entry>
30881 </row>
30882 </tbody>
30883 </tgroup>
30884 </informaltable>
30885 <para>
30886 If this option is true and an address is accepted by this router when
30887 verifying a sender, verification fails.
30888 </para>
30889 <para>
30890 <indexterm role="option">
30891 <primary><option>fallback_hosts</option></primary>
30892 </indexterm>
30893 </para>
30894 <informaltable frame="all">
30895 <tgroup cols="4" colsep="0" rowsep="0">
30896 <colspec colwidth="8*" align="left"/>
30897 <colspec colwidth="6*" align="center"/>
30898 <colspec colwidth="6*" align="center"/>
30899 <colspec colwidth="6*" align="right"/>
30900 <tbody>
30901 <row>
30902 <entry><option>fallback_hosts</option></entry>
30903 <entry>Use: <emphasis>routers</emphasis></entry>
30904 <entry>Type: <emphasis>string list</emphasis></entry>
30905 <entry>Default: <emphasis>unset</emphasis></entry>
30906 </row>
30907 </tbody>
30908 </tgroup>
30909 </informaltable>
30910 <para>
30911 <indexterm role="concept">
30912 <primary>router</primary>
30913 <secondary>fallback hosts</secondary>
30914 </indexterm>
30915 <indexterm role="concept">
30916 <primary>fallback</primary>
30917 <secondary>hosts specified on router</secondary>
30918 </indexterm>
30919 String expansion is not applied to this option. The argument must be a
30920 colon-separated list of host names or IP addresses. The list separator can be
30921 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
30922 each name or address. In fact, the format of each item is exactly the same as
30923 defined for the list of hosts in a <command>manualroute</command> router (see section
30924 <xref linkend="SECTformatonehostitem"/>).
30925 </para>
30926 <para>
30927 If a router queues an address for a remote transport, this host list is
30928 associated with the address, and used instead of the transport&#x2019;s fallback host
30929 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
30930 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
30931 transport for further details.
30932 </para>
30933 <para>
30934 <indexterm role="option">
30935 <primary><option>group</option></primary>
30936 </indexterm>
30937 </para>
30938 <informaltable frame="all">
30939 <tgroup cols="4" colsep="0" rowsep="0">
30940 <colspec colwidth="8*" align="left"/>
30941 <colspec colwidth="6*" align="center"/>
30942 <colspec colwidth="6*" align="center"/>
30943 <colspec colwidth="6*" align="right"/>
30944 <tbody>
30945 <row>
30946 <entry><option>group</option></entry>
30947 <entry>Use: <emphasis>routers</emphasis></entry>
30948 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30949 <entry>Default: <emphasis>see below</emphasis></entry>
30950 </row>
30951 </tbody>
30952 </tgroup>
30953 </informaltable>
30954 <para>
30955 <indexterm role="concept">
30956 <primary>gid (group id)</primary>
30957 <secondary>local delivery</secondary>
30958 </indexterm>
30959 <indexterm role="concept">
30960 <primary>local transports</primary>
30961 <secondary>uid and gid</secondary>
30962 </indexterm>
30963 <indexterm role="concept">
30964 <primary>transport</primary>
30965 <secondary>local</secondary>
30966 </indexterm>
30967 <indexterm role="concept">
30968 <primary>router</primary>
30969 <secondary>setting group</secondary>
30970 </indexterm>
30971 When a router queues an address for a transport, and the transport does not
30972 specify a group, the group given here is used when running the delivery
30973 process.
30974 The group may be specified numerically or by name. If expansion fails, the
30975 error is logged and delivery is deferred.
30976 The default is unset, unless <option>check_local_user</option> is set, when the default
30977 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
30978 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
30979 </para>
30980 <para>
30981 <indexterm role="option">
30982 <primary><option>headers_add</option></primary>
30983 </indexterm>
30984 </para>
30985 <informaltable frame="all">
30986 <tgroup cols="4" colsep="0" rowsep="0">
30987 <colspec colwidth="8*" align="left"/>
30988 <colspec colwidth="6*" align="center"/>
30989 <colspec colwidth="6*" align="center"/>
30990 <colspec colwidth="6*" align="right"/>
30991 <tbody>
30992 <row>
30993 <entry><option>headers_add</option></entry>
30994 <entry>Use: <emphasis>routers</emphasis></entry>
30995 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30996 <entry>Default: <emphasis>unset</emphasis></entry>
30997 </row>
30998 </tbody>
30999 </tgroup>
31000 </informaltable>
31001 <para>
31002 <indexterm role="concept">
31003 <primary>header lines</primary>
31004 <secondary>adding</secondary>
31005 </indexterm>
31006 <indexterm role="concept">
31007 <primary>router</primary>
31008 <secondary>adding header lines</secondary>
31009 </indexterm>
31010 This option specifies a string of text that is expanded at routing time, and
31011 associated with any addresses that are accepted by the router. However, this
31012 option has no effect when an address is just being verified. The way in which
31013 the text is used to add header lines at transport time is described in section
31014 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
31015 message is in the process of being transported. This means that references to
31016 header lines in string expansions in the transport&#x2019;s configuration do not
31017 <quote>see</quote> the added header lines.
31018 </para>
31019 <para>
31020 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
31021 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
31022 the expansion is forced to fail, the option has no effect. Other expansion
31023 failures are treated as configuration errors.
31024 </para>
31025 <para revisionflag="changed">
31026 Unlike most options, <option>headers_add</option> can be specified multiple times
31027 for a router; all listed headers are added.
31028 </para>
31029 <para>
31030 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
31031 router that has the <option>one_time</option> option set.
31032 </para>
31033 <para>
31034 <indexterm role="concept">
31035 <primary>duplicate addresses</primary>
31036 </indexterm>
31037 <indexterm role="option">
31038 <primary><option>unseen</option></primary>
31039 </indexterm>
31040 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31041 additions are deleted when the address is passed on to subsequent routers.
31042 For a <option>redirect</option> router, if a generated address is the same as the incoming
31043 address, this can lead to duplicate addresses with different header
31044 modifications. Exim does not do duplicate deliveries (except, in certain
31045 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
31046 which of the duplicates is discarded, so this ambiguous situation should be
31047 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
31048 </para>
31049 <para>
31050 <indexterm role="option">
31051 <primary><option>headers_remove</option></primary>
31052 </indexterm>
31053 </para>
31054 <informaltable frame="all">
31055 <tgroup cols="4" colsep="0" rowsep="0">
31056 <colspec colwidth="8*" align="left"/>
31057 <colspec colwidth="6*" align="center"/>
31058 <colspec colwidth="6*" align="center"/>
31059 <colspec colwidth="6*" align="right"/>
31060 <tbody>
31061 <row>
31062 <entry><option>headers_remove</option></entry>
31063 <entry>Use: <emphasis>routers</emphasis></entry>
31064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31065 <entry>Default: <emphasis>unset</emphasis></entry>
31066 </row>
31067 </tbody>
31068 </tgroup>
31069 </informaltable>
31070 <para>
31071 <indexterm role="concept">
31072 <primary>header lines</primary>
31073 <secondary>removing</secondary>
31074 </indexterm>
31075 <indexterm role="concept">
31076 <primary>router</primary>
31077 <secondary>removing header lines</secondary>
31078 </indexterm>
31079 This option specifies a string of text that is expanded at routing time, and
31080 associated with any addresses that are accepted by the router. However, this
31081 option has no effect when an address is just being verified. The way in which
31082 the text is used to remove header lines at transport time is described in
31083 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
31084 the message is in the process of being transported. This means that references
31085 to header lines in string expansions in the transport&#x2019;s configuration still
31086 <quote>see</quote> the original header lines.
31087 </para>
31088 <para>
31089 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
31090 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
31091 the option has no effect. Other expansion failures are treated as configuration
31092 errors.
31093 </para>
31094 <para>
31095 Unlike most options, <option>headers_remove</option> can be specified multiple times
31096 for a router; all listed headers are removed.
31097 </para>
31098 <para>
31099 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
31100 router that has the <option>one_time</option> option set.
31101 </para>
31102 <para>
31103 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
31104 removal requests are deleted when the address is passed on to subsequent
31105 routers, and this can lead to problems with duplicates -- see the similar
31106 warning for <option>headers_add</option> above.
31107 </para>
31108 <para>
31109 <indexterm role="option">
31110 <primary><option>ignore_target_hosts</option></primary>
31111 </indexterm>
31112 </para>
31113 <informaltable frame="all">
31114 <tgroup cols="4" colsep="0" rowsep="0">
31115 <colspec colwidth="8*" align="left"/>
31116 <colspec colwidth="6*" align="center"/>
31117 <colspec colwidth="6*" align="center"/>
31118 <colspec colwidth="6*" align="right"/>
31119 <tbody>
31120 <row>
31121 <entry><option>ignore_target_hosts</option></entry>
31122 <entry>Use: <emphasis>routers</emphasis></entry>
31123 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31124 <entry>Default: <emphasis>unset</emphasis></entry>
31125 </row>
31126 </tbody>
31127 </tgroup>
31128 </informaltable>
31129 <para>
31130 <indexterm role="concept">
31131 <primary>IP address</primary>
31132 <secondary>discarding</secondary>
31133 </indexterm>
31134 <indexterm role="concept">
31135 <primary>router</primary>
31136 <secondary>discarding IP addresses</secondary>
31137 </indexterm>
31138 Although this option is a host list, it should normally contain IP address
31139 entries rather than names. If any host that is looked up by the router has an
31140 IP address that matches an item in this list, Exim behaves as if that IP
31141 address did not exist. This option allows you to cope with rogue DNS entries
31142 like
31143 </para>
31144 <literallayout class="monospaced">
31145 remote.domain.example.  A  127.0.0.1
31146 </literallayout>
31147 <para>
31148 by setting
31149 </para>
31150 <literallayout class="monospaced">
31151 ignore_target_hosts = 127.0.0.1
31152 </literallayout>
31153 <para>
31154 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
31155 discarded in this way, the router declines. In a conventional configuration, an
31156 attempt to mail to such a domain would normally provoke the <quote>unrouteable
31157 domain</quote> error, and an attempt to verify an address in the domain would fail.
31158 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
31159 router declines if presented with one of the listed addresses.
31160 </para>
31161 <para>
31162 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
31163 means of the first or the second of the following settings, respectively:
31164 </para>
31165 <literallayout class="monospaced">
31166 ignore_target_hosts = 0.0.0.0/0
31167 ignore_target_hosts = &lt;; 0::0/0
31168 </literallayout>
31169 <para>
31170 The pattern in the first line matches all IPv4 addresses, whereas the pattern
31171 in the second line matches all IPv6 addresses.
31172 </para>
31173 <para>
31174 This option may also be useful for ignoring link-local and site-local IPv6
31175 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
31176 is expanded before use as a list, it is possible to make it dependent on the
31177 domain that is being routed.
31178 </para>
31179 <para>
31180 <indexterm role="variable">
31181 <primary><varname>$host_address</varname></primary>
31182 </indexterm>
31183 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
31184 checked.
31185 </para>
31186 <para>
31187 <indexterm role="option">
31188 <primary><option>initgroups</option></primary>
31189 </indexterm>
31190 </para>
31191 <informaltable frame="all">
31192 <tgroup cols="4" colsep="0" rowsep="0">
31193 <colspec colwidth="8*" align="left"/>
31194 <colspec colwidth="6*" align="center"/>
31195 <colspec colwidth="6*" align="center"/>
31196 <colspec colwidth="6*" align="right"/>
31197 <tbody>
31198 <row>
31199 <entry><option>initgroups</option></entry>
31200 <entry>Use: <emphasis>routers</emphasis></entry>
31201 <entry>Type: <emphasis>boolean</emphasis></entry>
31202 <entry>Default: <emphasis>false</emphasis></entry>
31203 </row>
31204 </tbody>
31205 </tgroup>
31206 </informaltable>
31207 <para>
31208 <indexterm role="concept">
31209 <primary>additional groups</primary>
31210 </indexterm>
31211 <indexterm role="concept">
31212 <primary>groups</primary>
31213 <secondary>additional</secondary>
31214 </indexterm>
31215 <indexterm role="concept">
31216 <primary>local transports</primary>
31217 <secondary>uid and gid</secondary>
31218 </indexterm>
31219 <indexterm role="concept">
31220 <primary>transport</primary>
31221 <secondary>local</secondary>
31222 </indexterm>
31223 If the router queues an address for a transport, and this option is true, and
31224 the uid supplied by the router is not overridden by the transport, the
31225 <function>initgroups()</function> function is called when running the transport to ensure that
31226 any additional groups associated with the uid are set up. See also <option>group</option>
31227 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
31228 </para>
31229 <para>
31230 <indexterm role="option">
31231 <primary><option>local_part_prefix</option></primary>
31232 </indexterm>
31233 </para>
31234 <informaltable frame="all">
31235 <tgroup cols="4" colsep="0" rowsep="0">
31236 <colspec colwidth="8*" align="left"/>
31237 <colspec colwidth="6*" align="center"/>
31238 <colspec colwidth="6*" align="center"/>
31239 <colspec colwidth="6*" align="right"/>
31240 <tbody>
31241 <row>
31242 <entry><option>local_part_prefix</option></entry>
31243 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31244 <entry>Type: <emphasis>string list</emphasis></entry>
31245 <entry>Default: <emphasis>unset</emphasis></entry>
31246 </row>
31247 </tbody>
31248 </tgroup>
31249 </informaltable>
31250 <para>
31251 <indexterm role="concept">
31252 <primary>router</primary>
31253 <secondary>prefix for local part</secondary>
31254 </indexterm>
31255 <indexterm role="concept">
31256 <primary>prefix</primary>
31257 <secondary>for local part, used in router</secondary>
31258 </indexterm>
31259 If this option is set, the router is skipped unless the local part starts with
31260 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
31261 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
31262 evaluated.
31263 </para>
31264 <para>
31265 The list is scanned from left to right, and the first prefix that matches is
31266 used. A limited form of wildcard is available; if the prefix begins with an
31267 asterisk, it matches the longest possible sequence of arbitrary characters at
31268 the start of the local part. An asterisk should therefore always be followed by
31269 some character that does not occur in normal local parts.
31270 <indexterm role="concept">
31271 <primary>multiple mailboxes</primary>
31272 </indexterm>
31273 <indexterm role="concept">
31274 <primary>mailbox</primary>
31275 <secondary>multiple</secondary>
31276 </indexterm>
31277 Wildcarding can be used to set up multiple user mailboxes, as described in
31278 section <xref linkend="SECTmulbox"/>.
31279 </para>
31280 <para>
31281 <indexterm role="variable">
31282 <primary><varname>$local_part</varname></primary>
31283 </indexterm>
31284 <indexterm role="variable">
31285 <primary><varname>$local_part_prefix</varname></primary>
31286 </indexterm>
31287 During the testing of the <option>local_parts</option> option, and while the router is
31288 running, the prefix is removed from the local part, and is available in the
31289 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
31290 the router accepts the address, this remains true during subsequent delivery by
31291 a transport. In particular, the local part that is transmitted in the RCPT
31292 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
31293 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
31294 the relevant transport.
31295 </para>
31296 <para>
31297 When an address is being verified, <option>local_part_prefix</option> affects only the
31298 behaviour of the router. If the callout feature of verification is in use, this
31299 means that the full address, including the prefix, will be used during the
31300 callout.
31301 </para>
31302 <para>
31303 The prefix facility is commonly used to handle local parts of the form
31304 <option>owner-something</option>. Another common use is to support local parts of the form
31305 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
31306 to tell a user their forwarding is broken &ndash; by placing a router like this one
31307 immediately before the router that handles <filename>.forward</filename> files:
31308 </para>
31309 <literallayout class="monospaced">
31310 real_localuser:
31311   driver = accept
31312   local_part_prefix = real-
31313   check_local_user
31314   transport = local_delivery
31315 </literallayout>
31316 <para>
31317 For security, it would probably be a good idea to restrict the use of this
31318 router to locally-generated messages, using a condition such as this:
31319 </para>
31320 <literallayout class="monospaced">
31321   condition = ${if match {$sender_host_address}\
31322                          {\N^(|127\.0\.0\.1)$\N}}
31323 </literallayout>
31324 <para>
31325 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
31326 both conditions must be met if not optional. Care must be taken if wildcards
31327 are used in both a prefix and a suffix on the same router. Different
31328 separator characters must be used to avoid ambiguity.
31329 </para>
31330 <para>
31331 <indexterm role="option">
31332 <primary><option>local_part_prefix_optional</option></primary>
31333 </indexterm>
31334 </para>
31335 <informaltable frame="all">
31336 <tgroup cols="4" colsep="0" rowsep="0">
31337 <colspec colwidth="8*" align="left"/>
31338 <colspec colwidth="6*" align="center"/>
31339 <colspec colwidth="6*" align="center"/>
31340 <colspec colwidth="6*" align="right"/>
31341 <tbody>
31342 <row>
31343 <entry><option>local_part_prefix_optional</option></entry>
31344 <entry>Use: <emphasis>routers</emphasis></entry>
31345 <entry>Type: <emphasis>boolean</emphasis></entry>
31346 <entry>Default: <emphasis>false</emphasis></entry>
31347 </row>
31348 </tbody>
31349 </tgroup>
31350 </informaltable>
31351 <para>
31352 See <option>local_part_prefix</option> above.
31353 </para>
31354 <para>
31355 <indexterm role="option">
31356 <primary><option>local_part_suffix</option></primary>
31357 </indexterm>
31358 </para>
31359 <informaltable frame="all">
31360 <tgroup cols="4" colsep="0" rowsep="0">
31361 <colspec colwidth="8*" align="left"/>
31362 <colspec colwidth="6*" align="center"/>
31363 <colspec colwidth="6*" align="center"/>
31364 <colspec colwidth="6*" align="right"/>
31365 <tbody>
31366 <row>
31367 <entry><option>local_part_suffix</option></entry>
31368 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31369 <entry>Type: <emphasis>string list</emphasis></entry>
31370 <entry>Default: <emphasis>unset</emphasis></entry>
31371 </row>
31372 </tbody>
31373 </tgroup>
31374 </informaltable>
31375 <para>
31376 <indexterm role="concept">
31377 <primary>router</primary>
31378 <secondary>suffix for local part</secondary>
31379 </indexterm>
31380 <indexterm role="concept">
31381 <primary>suffix for local part</primary>
31382 <secondary>used in router</secondary>
31383 </indexterm>
31384 This option operates in the same way as <option>local_part_prefix</option>, except that the
31385 local part must end (rather than start) with the given string, the
31386 <option>local_part_suffix_optional</option> option determines whether the suffix is
31387 mandatory, and the wildcard * character, if present, must be the last
31388 character of the suffix. This option facility is commonly used to handle local
31389 parts of the form <option>something-request</option> and multiple user mailboxes of the form
31390 <option>username-foo</option>.
31391 </para>
31392 <para>
31393 <indexterm role="option">
31394 <primary><option>local_part_suffix_optional</option></primary>
31395 </indexterm>
31396 </para>
31397 <informaltable frame="all">
31398 <tgroup cols="4" colsep="0" rowsep="0">
31399 <colspec colwidth="8*" align="left"/>
31400 <colspec colwidth="6*" align="center"/>
31401 <colspec colwidth="6*" align="center"/>
31402 <colspec colwidth="6*" align="right"/>
31403 <tbody>
31404 <row>
31405 <entry><option>local_part_suffix_optional</option></entry>
31406 <entry>Use: <emphasis>routers</emphasis></entry>
31407 <entry>Type: <emphasis>boolean</emphasis></entry>
31408 <entry>Default: <emphasis>false</emphasis></entry>
31409 </row>
31410 </tbody>
31411 </tgroup>
31412 </informaltable>
31413 <para>
31414 See <option>local_part_suffix</option> above.
31415 </para>
31416 <para>
31417 <indexterm role="option">
31418 <primary><option>local_parts</option></primary>
31419 </indexterm>
31420 </para>
31421 <informaltable frame="all">
31422 <tgroup cols="4" colsep="0" rowsep="0">
31423 <colspec colwidth="8*" align="left"/>
31424 <colspec colwidth="6*" align="center"/>
31425 <colspec colwidth="6*" align="center"/>
31426 <colspec colwidth="6*" align="right"/>
31427 <tbody>
31428 <row>
31429 <entry><option>local_parts</option></entry>
31430 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31431 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
31432 <entry>Default: <emphasis>unset</emphasis></entry>
31433 </row>
31434 </tbody>
31435 </tgroup>
31436 </informaltable>
31437 <para>
31438 <indexterm role="concept">
31439 <primary>router</primary>
31440 <secondary>restricting to specific local parts</secondary>
31441 </indexterm>
31442 <indexterm role="concept">
31443 <primary>local part</primary>
31444 <secondary>checking in router</secondary>
31445 </indexterm>
31446 The router is run only if the local part of the address matches the list.
31447 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31448 are evaluated, and
31449 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
31450 string is expanded, it is possible to make it depend on the domain, for
31451 example:
31452 </para>
31453 <literallayout class="monospaced">
31454 local_parts = dbm;/usr/local/specials/$domain
31455 </literallayout>
31456 <para>
31457 <indexterm role="variable">
31458 <primary><varname>$local_part_data</varname></primary>
31459 </indexterm>
31460 If the match is achieved by a lookup, the data that the lookup returned
31461 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
31462 expansions of the router&#x2019;s private options. You might use this option, for
31463 example, if you have a large number of local virtual domains, and you want to
31464 send all postmaster mail to the same place without having to set up an alias in
31465 each virtual domain:
31466 </para>
31467 <literallayout class="monospaced">
31468 postmaster:
31469   driver = redirect
31470   local_parts = postmaster
31471   data = postmaster@real.domain.example
31472 </literallayout>
31473 <para>
31474 <indexterm role="option">
31475 <primary><option>log_as_local</option></primary>
31476 </indexterm>
31477 </para>
31478 <informaltable frame="all">
31479 <tgroup cols="4" colsep="0" rowsep="0">
31480 <colspec colwidth="8*" align="left"/>
31481 <colspec colwidth="6*" align="center"/>
31482 <colspec colwidth="6*" align="center"/>
31483 <colspec colwidth="6*" align="right"/>
31484 <tbody>
31485 <row>
31486 <entry><option>log_as_local</option></entry>
31487 <entry>Use: <emphasis>routers</emphasis></entry>
31488 <entry>Type: <emphasis>boolean</emphasis></entry>
31489 <entry>Default: <emphasis>see below</emphasis></entry>
31490 </row>
31491 </tbody>
31492 </tgroup>
31493 </informaltable>
31494 <para>
31495 <indexterm role="concept">
31496 <primary>log</primary>
31497 <secondary>delivery line</secondary>
31498 </indexterm>
31499 <indexterm role="concept">
31500 <primary>delivery</primary>
31501 <secondary>log line format</secondary>
31502 </indexterm>
31503 Exim has two logging styles for delivery, the idea being to make local
31504 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
31505 recipient address is given just as the local part, without a domain. The use of
31506 this style is controlled by this option. It defaults to true for the <command>accept</command>
31507 router, and false for all the others. This option applies only when a
31508 router assigns an address to a transport. It has no effect on routers that
31509 redirect addresses.
31510 </para>
31511 <para>
31512 <indexterm role="option">
31513 <primary><option>more</option></primary>
31514 </indexterm>
31515 </para>
31516 <informaltable frame="all">
31517 <tgroup cols="4" colsep="0" rowsep="0">
31518 <colspec colwidth="8*" align="left"/>
31519 <colspec colwidth="6*" align="center"/>
31520 <colspec colwidth="6*" align="center"/>
31521 <colspec colwidth="6*" align="right"/>
31522 <tbody>
31523 <row>
31524 <entry><option>more</option></entry>
31525 <entry>Use: <emphasis>routers</emphasis></entry>
31526 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
31527 <entry>Default: <emphasis>true</emphasis></entry>
31528 </row>
31529 </tbody>
31530 </tgroup>
31531 </informaltable>
31532 <para>
31533 The result of string expansion for this option must be a valid boolean value,
31534 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
31535 result causes an error, and delivery is deferred. If the expansion is forced to
31536 fail, the default value for the option (true) is used. Other failures cause
31537 delivery to be deferred.
31538 </para>
31539 <para>
31540 If this option is set false, and the router declines to handle the address, no
31541 further routers are tried, routing fails, and the address is bounced.
31542 <indexterm role="option">
31543 <primary><option>self</option></primary>
31544 </indexterm>
31545 However, if the router explicitly passes an address to the following router by
31546 means of the setting
31547 </para>
31548 <literallayout class="monospaced">
31549 self = pass
31550 </literallayout>
31551 <para>
31552 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
31553 does not affect the behaviour if one of the precondition tests fails. In that
31554 case, the address is always passed to the next router.
31555 </para>
31556 <para>
31557 Note that <option>address_data</option> is not considered to be a precondition. If its
31558 expansion is forced to fail, the router declines, and the value of <option>more</option>
31559 controls what happens next.
31560 </para>
31561 <para>
31562 <indexterm role="option">
31563 <primary><option>pass_on_timeout</option></primary>
31564 </indexterm>
31565 </para>
31566 <informaltable frame="all">
31567 <tgroup cols="4" colsep="0" rowsep="0">
31568 <colspec colwidth="8*" align="left"/>
31569 <colspec colwidth="6*" align="center"/>
31570 <colspec colwidth="6*" align="center"/>
31571 <colspec colwidth="6*" align="right"/>
31572 <tbody>
31573 <row>
31574 <entry><option>pass_on_timeout</option></entry>
31575 <entry>Use: <emphasis>routers</emphasis></entry>
31576 <entry>Type: <emphasis>boolean</emphasis></entry>
31577 <entry>Default: <emphasis>false</emphasis></entry>
31578 </row>
31579 </tbody>
31580 </tgroup>
31581 </informaltable>
31582 <para>
31583 <indexterm role="concept">
31584 <primary>timeout</primary>
31585 <secondary>of router</secondary>
31586 </indexterm>
31587 <indexterm role="concept">
31588 <primary>router</primary>
31589 <secondary>timeout</secondary>
31590 </indexterm>
31591 If a router times out during a host lookup, it normally causes deferral of the
31592 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
31593 router, overriding <option>no_more</option>. This may be helpful for systems that are
31594 intermittently connected to the Internet, or those that want to pass to a smart
31595 host any messages that cannot immediately be delivered.
31596 </para>
31597 <para>
31598 There are occasional other temporary errors that can occur while doing DNS
31599 lookups. They are treated in the same way as a timeout, and this option
31600 applies to all of them.
31601 </para>
31602 <para>
31603 <indexterm role="option">
31604 <primary><option>pass_router</option></primary>
31605 </indexterm>
31606 </para>
31607 <informaltable frame="all">
31608 <tgroup cols="4" colsep="0" rowsep="0">
31609 <colspec colwidth="8*" align="left"/>
31610 <colspec colwidth="6*" align="center"/>
31611 <colspec colwidth="6*" align="center"/>
31612 <colspec colwidth="6*" align="right"/>
31613 <tbody>
31614 <row>
31615 <entry><option>pass_router</option></entry>
31616 <entry>Use: <emphasis>routers</emphasis></entry>
31617 <entry>Type: <emphasis>string</emphasis></entry>
31618 <entry>Default: <emphasis>unset</emphasis></entry>
31619 </row>
31620 </tbody>
31621 </tgroup>
31622 </informaltable>
31623 <para>
31624 <indexterm role="concept">
31625 <primary>router</primary>
31626 <secondary>go to after <quote>pass</quote></secondary>
31627 </indexterm>
31628 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
31629 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
31630 routing to continue, and overriding a false setting of <option>more</option>. When one of
31631 these routers returns <quote>pass</quote>, the address is normally handed on to the next
31632 router in sequence. This can be changed by setting <option>pass_router</option> to the name
31633 of another router. However (unlike <option>redirect_router</option>) the named router must
31634 be below the current router, to avoid loops. Note that this option applies only
31635 to the special case of <quote>pass</quote>. It does not apply when a router returns
31636 <quote>decline</quote> because it cannot handle an address.
31637 </para>
31638 <para>
31639 <indexterm role="option">
31640 <primary><option>redirect_router</option></primary>
31641 </indexterm>
31642 </para>
31643 <informaltable frame="all">
31644 <tgroup cols="4" colsep="0" rowsep="0">
31645 <colspec colwidth="8*" align="left"/>
31646 <colspec colwidth="6*" align="center"/>
31647 <colspec colwidth="6*" align="center"/>
31648 <colspec colwidth="6*" align="right"/>
31649 <tbody>
31650 <row>
31651 <entry><option>redirect_router</option></entry>
31652 <entry>Use: <emphasis>routers</emphasis></entry>
31653 <entry>Type: <emphasis>string</emphasis></entry>
31654 <entry>Default: <emphasis>unset</emphasis></entry>
31655 </row>
31656 </tbody>
31657 </tgroup>
31658 </informaltable>
31659 <para>
31660 <indexterm role="concept">
31661 <primary>router</primary>
31662 <secondary>start at after redirection</secondary>
31663 </indexterm>
31664 Sometimes an administrator knows that it is pointless to reprocess addresses
31665 generated from alias or forward files with the same router again. For
31666 example, if an alias file translates real names into login ids there is no
31667 point searching the alias file a second time, especially if it is a large file.
31668 </para>
31669 <para>
31670 The <option>redirect_router</option> option can be set to the name of any router instance.
31671 It causes the routing of any generated addresses to start at the named router
31672 instead of at the first router. This option has no effect if the router in
31673 which it is set does not generate new addresses.
31674 </para>
31675 <para>
31676 <indexterm role="option">
31677 <primary><option>require_files</option></primary>
31678 </indexterm>
31679 </para>
31680 <informaltable frame="all">
31681 <tgroup cols="4" colsep="0" rowsep="0">
31682 <colspec colwidth="8*" align="left"/>
31683 <colspec colwidth="6*" align="center"/>
31684 <colspec colwidth="6*" align="center"/>
31685 <colspec colwidth="6*" align="right"/>
31686 <tbody>
31687 <row>
31688 <entry><option>require_files</option></entry>
31689 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
31690 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
31691 <entry>Default: <emphasis>unset</emphasis></entry>
31692 </row>
31693 </tbody>
31694 </tgroup>
31695 </informaltable>
31696 <para>
31697 <indexterm role="concept">
31698 <primary>file</primary>
31699 <secondary>requiring for router</secondary>
31700 </indexterm>
31701 <indexterm role="concept">
31702 <primary>router</primary>
31703 <secondary>requiring file existence</secondary>
31704 </indexterm>
31705 This option provides a general mechanism for predicating the running of a
31706 router on the existence or non-existence of certain files or directories.
31707 Before running a router, as one of its precondition tests, Exim works its way
31708 through the <option>require_files</option> list, expanding each item separately.
31709 </para>
31710 <para>
31711 Because the list is split before expansion, any colons in expansion items must
31712 be doubled, or the facility for using a different list separator must be used.
31713 If any expansion is forced to fail, the item is ignored. Other expansion
31714 failures cause routing of the address to be deferred.
31715 </para>
31716 <para>
31717 If any expanded string is empty, it is ignored. Otherwise, except as described
31718 below, each string must be a fully qualified file path, optionally preceded by
31719 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
31720 existence of the files or directories. The router is skipped if any paths not
31721 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
31722 </para>
31723 <para>
31724 <indexterm role="concept">
31725 <primary>NFS</primary>
31726 </indexterm>
31727 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
31728 the message is deferred. This can happen when NFS-mounted filesystems are
31729 unavailable.
31730 </para>
31731 <para>
31732 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
31733 options, so you cannot use it to check for the existence of a file in which to
31734 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
31735 full list of the order in which preconditions are evaluated.) However, as
31736 these options are all expanded, you can use the <option>exists</option> expansion condition
31737 to make such tests. The <option>require_files</option> option is intended for checking files
31738 that the router may be going to use internally, or which are needed by a
31739 transport (for example <filename>.procmailrc</filename>).
31740 </para>
31741 <para>
31742 During delivery, the <function>stat()</function> function is run as root, but there is a
31743 facility for some checking of the accessibility of a file by another user.
31744 This is not a proper permissions check, but just a <quote>rough</quote> check that
31745 operates as follows:
31746 </para>
31747 <para>
31748 If an item in a <option>require_files</option> list does not contain any forward slash
31749 characters, it is taken to be the user (and optional group, separated by a
31750 comma) to be checked for subsequent files in the list. If no group is specified
31751 but the user is specified symbolically, the gid associated with the uid is
31752 used. For example:
31753 </para>
31754 <literallayout class="monospaced">
31755 require_files = mail:/some/file
31756 require_files = $local_part:$home/.procmailrc
31757 </literallayout>
31758 <para>
31759 If a user or group name in a <option>require_files</option> list does not exist, the
31760 <option>require_files</option> condition fails.
31761 </para>
31762 <para>
31763 Exim performs the check by scanning along the components of the file path, and
31764 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
31765 directories, and <quote>r</quote> access on the final file. Note that this means that file
31766 access control lists, if the operating system has them, are ignored.
31767 </para>
31768 <para>
31769 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
31770 incoming SMTP message, Exim is not running as root, but under its own uid. This
31771 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
31772 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
31773 user is not permitted to read one of the directories on the file&#x2019;s path.
31774 </para>
31775 <para>
31776 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
31777 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
31778 without root access. In this case, if a check for access by a particular user
31779 is requested, Exim creates a subprocess that runs as that user, and tries the
31780 check again in that process.
31781 </para>
31782 <para>
31783 The default action for handling an unresolved EACCES is to consider it to
31784 be caused by a configuration error, and routing is deferred because the
31785 existence or non-existence of the file cannot be determined. However, in some
31786 circumstances it may be desirable to treat this condition as if the file did
31787 not exist. If the file name (or the exclamation mark that precedes the file
31788 name for non-existence) is preceded by a plus sign, the EACCES error is treated
31789 as if the file did not exist. For example:
31790 </para>
31791 <literallayout class="monospaced">
31792 require_files = +/some/file
31793 </literallayout>
31794 <para>
31795 If the router is not an essential part of verification (for example, it
31796 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
31797 option false so that the router is skipped when verifying.
31798 </para>
31799 <para>
31800 <indexterm role="option">
31801 <primary><option>retry_use_local_part</option></primary>
31802 </indexterm>
31803 </para>
31804 <informaltable frame="all">
31805 <tgroup cols="4" colsep="0" rowsep="0">
31806 <colspec colwidth="8*" align="left"/>
31807 <colspec colwidth="6*" align="center"/>
31808 <colspec colwidth="6*" align="center"/>
31809 <colspec colwidth="6*" align="right"/>
31810 <tbody>
31811 <row>
31812 <entry><option>retry_use_local_part</option></entry>
31813 <entry>Use: <emphasis>routers</emphasis></entry>
31814 <entry>Type: <emphasis>boolean</emphasis></entry>
31815 <entry>Default: <emphasis>see below</emphasis></entry>
31816 </row>
31817 </tbody>
31818 </tgroup>
31819 </informaltable>
31820 <para>
31821 <indexterm role="concept">
31822 <primary>hints database</primary>
31823 <secondary>retry keys</secondary>
31824 </indexterm>
31825 <indexterm role="concept">
31826 <primary>local part</primary>
31827 <secondary>in retry keys</secondary>
31828 </indexterm>
31829 When a delivery suffers a temporary routing failure, a retry record is created
31830 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
31831 domain, the key for the retry record should not involve the local part, but for
31832 other addresses, both the domain and the local part should be included.
31833 Usually, remote routing is of the former kind, and local routing is of the
31834 latter kind.
31835 </para>
31836 <para>
31837 This option controls whether the local part is used to form the key for retry
31838 hints for addresses that suffer temporary errors while being handled by this
31839 router. The default value is true for any router that has <option>check_local_user</option>
31840 set, and false otherwise. Note that this option does not apply to hints keys
31841 for transport delays; they are controlled by a generic transport option of the
31842 same name.
31843 </para>
31844 <para>
31845 The setting of <option>retry_use_local_part</option> applies only to the router on which it
31846 appears. If the router generates child addresses, they are routed
31847 independently; this setting does not become attached to them.
31848 </para>
31849 <para>
31850 <indexterm role="option">
31851 <primary><option>router_home_directory</option></primary>
31852 </indexterm>
31853 </para>
31854 <informaltable frame="all">
31855 <tgroup cols="4" colsep="0" rowsep="0">
31856 <colspec colwidth="8*" align="left"/>
31857 <colspec colwidth="6*" align="center"/>
31858 <colspec colwidth="6*" align="center"/>
31859 <colspec colwidth="6*" align="right"/>
31860 <tbody>
31861 <row>
31862 <entry><option>router_home_directory</option></entry>
31863 <entry>Use: <emphasis>routers</emphasis></entry>
31864 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31865 <entry>Default: <emphasis>unset</emphasis></entry>
31866 </row>
31867 </tbody>
31868 </tgroup>
31869 </informaltable>
31870 <para>
31871 <indexterm role="concept">
31872 <primary>router</primary>
31873 <secondary>home directory for</secondary>
31874 </indexterm>
31875 <indexterm role="concept">
31876 <primary>home directory</primary>
31877 <secondary>for router</secondary>
31878 </indexterm>
31879 <indexterm role="variable">
31880 <primary><varname>$home</varname></primary>
31881 </indexterm>
31882 This option sets a home directory for use while the router is running. (Compare
31883 <option>transport_home_directory</option>, which sets a home directory for later
31884 transporting.) In particular, if used on a <command>redirect</command> router, this option
31885 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
31886 forced expansion failure causes the option to be ignored &ndash; other failures
31887 cause the router to defer.
31888 </para>
31889 <para>
31890 Expansion of <option>router_home_directory</option> happens immediately after the
31891 <option>check_local_user</option> test (if configured), before any further expansions take
31892 place.
31893 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31894 are evaluated.)
31895 While the router is running, <option>router_home_directory</option> overrides the value of
31896 <varname>$home</varname> that came from <option>check_local_user</option>.
31897 </para>
31898 <para>
31899 When a router accepts an address and assigns it to a local transport (including
31900 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
31901 delivery), the home directory setting for the transport is taken from the first
31902 of these values that is set:
31903 </para>
31904 <itemizedlist>
31905 <listitem>
31906 <para>
31907 The <option>home_directory</option> option on the transport;
31908 </para>
31909 </listitem>
31910 <listitem>
31911 <para>
31912 The <option>transport_home_directory</option> option on the router;
31913 </para>
31914 </listitem>
31915 <listitem>
31916 <para>
31917 The password data if <option>check_local_user</option> is set on the router;
31918 </para>
31919 </listitem>
31920 <listitem>
31921 <para>
31922 The <option>router_home_directory</option> option on the router.
31923 </para>
31924 </listitem>
31925 </itemizedlist>
31926 <para>
31927 In other words, <option>router_home_directory</option> overrides the password data for the
31928 router, but not for the transport.
31929 </para>
31930 <para>
31931 <indexterm role="option">
31932 <primary><option>self</option></primary>
31933 </indexterm>
31934 </para>
31935 <informaltable frame="all">
31936 <tgroup cols="4" colsep="0" rowsep="0">
31937 <colspec colwidth="8*" align="left"/>
31938 <colspec colwidth="6*" align="center"/>
31939 <colspec colwidth="6*" align="center"/>
31940 <colspec colwidth="6*" align="right"/>
31941 <tbody>
31942 <row>
31943 <entry><option>self</option></entry>
31944 <entry>Use: <emphasis>routers</emphasis></entry>
31945 <entry>Type: <emphasis>string</emphasis></entry>
31946 <entry>Default: <emphasis>freeze</emphasis></entry>
31947 </row>
31948 </tbody>
31949 </tgroup>
31950 </informaltable>
31951 <para>
31952 <indexterm role="concept">
31953 <primary>MX record</primary>
31954 <secondary>pointing to local host</secondary>
31955 </indexterm>
31956 <indexterm role="concept">
31957 <primary>local host</primary>
31958 <secondary>MX pointing to</secondary>
31959 </indexterm>
31960 This option applies to those routers that use a recipient address to find a
31961 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
31962 and <command>manualroute</command> routers.
31963 Certain configurations of the <command>queryprogram</command> router can also specify a list
31964 of remote hosts.
31965 Usually such routers are configured to send the message to a remote host via an
31966 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
31967 host on the list turns out to be the local host.
31968 The way in which Exim checks for the local host is described in section
31969 <xref linkend="SECTreclocipadd"/>.
31970 </para>
31971 <para>
31972 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
31973 example, the router should be configured not to process this domain), or an
31974 error in the DNS (for example, the MX should not point to this host). For this
31975 reason, the default action is to log the incident, defer the address, and
31976 freeze the message. The following alternatives are provided for use in special
31977 cases:
31978 </para>
31979 <variablelist>
31980 <varlistentry>
31981 <term><option>defer</option></term>
31982 <listitem>
31983 <para>
31984 Delivery of the message is tried again later, but the message is not frozen.
31985 </para>
31986 </listitem></varlistentry>
31987 <varlistentry>
31988 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
31989 <listitem>
31990 <para>
31991 The domain is changed to the given domain, and the address is passed back to
31992 be reprocessed by the routers. No rewriting of headers takes place. This
31993 behaviour is essentially a redirection.
31994 </para>
31995 </listitem></varlistentry>
31996 <varlistentry>
31997 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
31998 <listitem>
31999 <para>
32000 The domain is changed to the given domain, and the address is passed back to be
32001 reprocessed by the routers. Any headers that contain the original domain are
32002 rewritten.
32003 </para>
32004 </listitem></varlistentry>
32005 <varlistentry>
32006 <term><option>pass</option></term>
32007 <listitem>
32008 <para>
32009 <indexterm role="option">
32010 <primary><option>more</option></primary>
32011 </indexterm>
32012 <indexterm role="variable">
32013 <primary><varname>$self_hostname</varname></primary>
32014 </indexterm>
32015 The router passes the address to the next router, or to the router named in the
32016 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
32017 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
32018 name of the local host that the router encountered. This can be used to
32019 distinguish between different cases for hosts with multiple names. The
32020 combination
32021 </para>
32022 <literallayout class="monospaced">
32023 self = pass
32024 no_more
32025 </literallayout>
32026 <para>
32027 ensures that only those addresses that routed to the local host are passed on.
32028 Without <option>no_more</option>, addresses that were declined for other reasons would also
32029 be passed to the next router.
32030 </para>
32031 </listitem></varlistentry>
32032 <varlistentry>
32033 <term><option>fail</option></term>
32034 <listitem>
32035 <para>
32036 Delivery fails and an error report is generated.
32037 </para>
32038 </listitem></varlistentry>
32039 <varlistentry>
32040 <term><option>send</option></term>
32041 <listitem>
32042 <para>
32043 <indexterm role="concept">
32044 <primary>local host</primary>
32045 <secondary>sending to</secondary>
32046 </indexterm>
32047 The anomaly is ignored and the address is queued for the transport. This
32048 setting should be used with extreme caution. For an <command>smtp</command> transport, it
32049 makes sense only in cases where the program that is listening on the SMTP port
32050 is not this version of Exim. That is, it must be some other MTA, or Exim with a
32051 different configuration file that handles the domain in another way.
32052 </para>
32053 </listitem></varlistentry>
32054 </variablelist>
32055 <para>
32056 <indexterm role="option">
32057 <primary><option>senders</option></primary>
32058 </indexterm>
32059 </para>
32060 <informaltable frame="all">
32061 <tgroup cols="4" colsep="0" rowsep="0">
32062 <colspec colwidth="8*" align="left"/>
32063 <colspec colwidth="6*" align="center"/>
32064 <colspec colwidth="6*" align="center"/>
32065 <colspec colwidth="6*" align="right"/>
32066 <tbody>
32067 <row>
32068 <entry><option>senders</option></entry>
32069 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32070 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32071 <entry>Default: <emphasis>unset</emphasis></entry>
32072 </row>
32073 </tbody>
32074 </tgroup>
32075 </informaltable>
32076 <para>
32077 <indexterm role="concept">
32078 <primary>router</primary>
32079 <secondary>checking senders</secondary>
32080 </indexterm>
32081 If this option is set, the router is skipped unless the message&#x2019;s sender
32082 address matches something on the list.
32083 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32084 are evaluated.
32085 </para>
32086 <para>
32087 There are issues concerning verification when the running of routers is
32088 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
32089 setting, it sets the sender to the null string. When using the <option>-bt</option> option
32090 to check a configuration file, it is necessary also to use the <option>-f</option> option to
32091 set an appropriate sender. For incoming mail, the sender is unset when
32092 verifying the sender, but is available when verifying any recipients. If the
32093 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
32094 matters.
32095 </para>
32096 <para>
32097 <indexterm role="option">
32098 <primary><option>translate_ip_address</option></primary>
32099 </indexterm>
32100 </para>
32101 <informaltable frame="all">
32102 <tgroup cols="4" colsep="0" rowsep="0">
32103 <colspec colwidth="8*" align="left"/>
32104 <colspec colwidth="6*" align="center"/>
32105 <colspec colwidth="6*" align="center"/>
32106 <colspec colwidth="6*" align="right"/>
32107 <tbody>
32108 <row>
32109 <entry><option>translate_ip_address</option></entry>
32110 <entry>Use: <emphasis>routers</emphasis></entry>
32111 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32112 <entry>Default: <emphasis>unset</emphasis></entry>
32113 </row>
32114 </tbody>
32115 </tgroup>
32116 </informaltable>
32117 <para>
32118 <indexterm role="concept">
32119 <primary>IP address</primary>
32120 <secondary>translating</secondary>
32121 </indexterm>
32122 <indexterm role="concept">
32123 <primary>packet radio</primary>
32124 </indexterm>
32125 <indexterm role="concept">
32126 <primary>router</primary>
32127 <secondary>IP address translation</secondary>
32128 </indexterm>
32129 There exist some rare networking situations (for example, packet radio) where
32130 it is helpful to be able to translate IP addresses generated by normal routing
32131 mechanisms into other IP addresses, thus performing a kind of manual IP
32132 routing. This should be done only if the normal IP routing of the TCP/IP stack
32133 is inadequate or broken. Because this is an extremely uncommon requirement, the
32134 code to support this option is not included in the Exim binary unless
32135 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
32136 </para>
32137 <para>
32138 <indexterm role="variable">
32139 <primary><varname>$host_address</varname></primary>
32140 </indexterm>
32141 The <option>translate_ip_address</option> string is expanded for every IP address generated
32142 by the router, with the generated address set in <varname>$host_address</varname>. If the
32143 expansion is forced to fail, no action is taken.
32144 For any other expansion error, delivery of the message is deferred.
32145 If the result of the expansion is an IP address, that replaces the original
32146 address; otherwise the result is assumed to be a host name &ndash; this is looked
32147 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
32148 produce one or more replacement IP addresses. For example, to subvert all IP
32149 addresses in some specific networks, this could be added to a router:
32150 </para>
32151 <literallayout class="monospaced">
32152 translate_ip_address = \
32153   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
32154     {$value}fail}}
32155 </literallayout>
32156 <para>
32157 The file would contain lines like
32158 </para>
32159 <literallayout class="monospaced">
32160 10.2.3.128/26    some.host
32161 10.8.4.34/26     10.44.8.15
32162 </literallayout>
32163 <para>
32164 You should not make use of this facility unless you really understand what you
32165 are doing.
32166 </para>
32167 <para>
32168 <indexterm role="option">
32169 <primary><option>transport</option></primary>
32170 </indexterm>
32171 </para>
32172 <informaltable frame="all">
32173 <tgroup cols="4" colsep="0" rowsep="0">
32174 <colspec colwidth="8*" align="left"/>
32175 <colspec colwidth="6*" align="center"/>
32176 <colspec colwidth="6*" align="center"/>
32177 <colspec colwidth="6*" align="right"/>
32178 <tbody>
32179 <row>
32180 <entry><option>transport</option></entry>
32181 <entry>Use: <emphasis>routers</emphasis></entry>
32182 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32183 <entry>Default: <emphasis>unset</emphasis></entry>
32184 </row>
32185 </tbody>
32186 </tgroup>
32187 </informaltable>
32188 <para>
32189 This option specifies the transport to be used when a router accepts an address
32190 and sets it up for delivery. A transport is never needed if a router is used
32191 only for verification. The value of the option is expanded at routing time,
32192 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
32193 and result must be the name of one of the configured transports. If it is not,
32194 delivery is deferred.
32195 </para>
32196 <para>
32197 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
32198 have some private options that set up transports for pipe and file deliveries
32199 (see chapter <xref linkend="CHAPredirect"/>).
32200 </para>
32201 <para>
32202 <indexterm role="option">
32203 <primary><option>transport_current_directory</option></primary>
32204 </indexterm>
32205 </para>
32206 <informaltable frame="all">
32207 <tgroup cols="4" colsep="0" rowsep="0">
32208 <colspec colwidth="8*" align="left"/>
32209 <colspec colwidth="6*" align="center"/>
32210 <colspec colwidth="6*" align="center"/>
32211 <colspec colwidth="6*" align="right"/>
32212 <tbody>
32213 <row>
32214 <entry><option>transport_current_directory</option></entry>
32215 <entry>Use: <emphasis>routers</emphasis></entry>
32216 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32217 <entry>Default: <emphasis>unset</emphasis></entry>
32218 </row>
32219 </tbody>
32220 </tgroup>
32221 </informaltable>
32222 <para>
32223 <indexterm role="concept">
32224 <primary>current directory for local transport</primary>
32225 </indexterm>
32226 This option associates a current directory with any address that is routed
32227 to a local transport. This can happen either because a transport is
32228 explicitly configured for the router, or because it generates a delivery to a
32229 file or a pipe. During the delivery process (that is, at transport time), this
32230 option string is expanded and is set as the current directory, unless
32231 overridden by a setting on the transport.
32232 If the expansion fails for any reason, including forced failure, an error is
32233 logged, and delivery is deferred.
32234 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
32235 environment.
32236 </para>
32237 <para>
32238 <indexterm role="option">
32239 <primary><option>transport_home_directory</option></primary>
32240 </indexterm>
32241 </para>
32242 <informaltable frame="all">
32243 <tgroup cols="4" colsep="0" rowsep="0">
32244 <colspec colwidth="8*" align="left"/>
32245 <colspec colwidth="6*" align="center"/>
32246 <colspec colwidth="6*" align="center"/>
32247 <colspec colwidth="6*" align="right"/>
32248 <tbody>
32249 <row>
32250 <entry><option>transport_home_directory</option></entry>
32251 <entry>Use: <emphasis>routers</emphasis></entry>
32252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32253 <entry>Default: <emphasis>see below</emphasis></entry>
32254 </row>
32255 </tbody>
32256 </tgroup>
32257 </informaltable>
32258 <para>
32259 <indexterm role="concept">
32260 <primary>home directory</primary>
32261 <secondary>for local transport</secondary>
32262 </indexterm>
32263 This option associates a home directory with any address that is routed to a
32264 local transport. This can happen either because a transport is explicitly
32265 configured for the router, or because it generates a delivery to a file or a
32266 pipe. During the delivery process (that is, at transport time), the option
32267 string is expanded and is set as the home directory, unless overridden by a
32268 setting of <option>home_directory</option> on the transport.
32269 If the expansion fails for any reason, including forced failure, an error is
32270 logged, and delivery is deferred.
32271 </para>
32272 <para>
32273 If the transport does not specify a home directory, and
32274 <option>transport_home_directory</option> is not set for the router, the home directory for
32275 the transport is taken from the password data if <option>check_local_user</option> is set for
32276 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
32277 is set; if not, no home directory is set for the transport.
32278 </para>
32279 <para>
32280 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
32281 environment.
32282 </para>
32283 <para>
32284 <indexterm role="option">
32285 <primary><option>unseen</option></primary>
32286 </indexterm>
32287 </para>
32288 <informaltable frame="all">
32289 <tgroup cols="4" colsep="0" rowsep="0">
32290 <colspec colwidth="8*" align="left"/>
32291 <colspec colwidth="6*" align="center"/>
32292 <colspec colwidth="6*" align="center"/>
32293 <colspec colwidth="6*" align="right"/>
32294 <tbody>
32295 <row>
32296 <entry><option>unseen</option></entry>
32297 <entry>Use: <emphasis>routers</emphasis></entry>
32298 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
32299 <entry>Default: <emphasis>false</emphasis></entry>
32300 </row>
32301 </tbody>
32302 </tgroup>
32303 </informaltable>
32304 <para>
32305 <indexterm role="concept">
32306 <primary>router</primary>
32307 <secondary>carrying on after success</secondary>
32308 </indexterm>
32309 The result of string expansion for this option must be a valid boolean value,
32310 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
32311 result causes an error, and delivery is deferred. If the expansion is forced to
32312 fail, the default value for the option (false) is used. Other failures cause
32313 delivery to be deferred.
32314 </para>
32315 <para>
32316 When this option is set true, routing does not cease if the router accepts the
32317 address. Instead, a copy of the incoming address is passed to the next router,
32318 overriding a false setting of <option>more</option>. There is little point in setting
32319 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
32320 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
32321 sometimes true and sometimes false).
32322 </para>
32323 <para>
32324 <indexterm role="concept">
32325 <primary>copy of message (<option>unseen</option> option)</primary>
32326 </indexterm>
32327 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
32328 qualifier in filter files. It can be used to cause copies of messages to be
32329 delivered to some other destination, while also carrying out a normal delivery.
32330 In effect, the current address is made into a <quote>parent</quote> that has two children
32331 &ndash; one that is delivered as specified by this router, and a clone that goes on
32332 to be routed further. For this reason, <option>unseen</option> may not be combined with the
32333 <option>one_time</option> option in a <command>redirect</command> router.
32334 </para>
32335 <para>
32336 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
32337 this router or by previous routers affect the <quote>unseen</quote> copy of the message
32338 only. The clone that continues to be processed by further routers starts with
32339 no added headers and none specified for removal. For a <option>redirect</option> router, if
32340 a generated address is the same as the incoming address, this can lead to
32341 duplicate addresses with different header modifications. Exim does not do
32342 duplicate deliveries (except, in certain circumstances, to pipes -- see section
32343 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
32344 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
32345 <option>redirect</option> router may be of help.
32346 </para>
32347 <para>
32348 Unlike the handling of header modifications, any data that was set by the
32349 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
32350 subsequent routers.
32351 </para>
32352 <para>
32353 <indexterm role="option">
32354 <primary><option>user</option></primary>
32355 </indexterm>
32356 </para>
32357 <informaltable frame="all">
32358 <tgroup cols="4" colsep="0" rowsep="0">
32359 <colspec colwidth="8*" align="left"/>
32360 <colspec colwidth="6*" align="center"/>
32361 <colspec colwidth="6*" align="center"/>
32362 <colspec colwidth="6*" align="right"/>
32363 <tbody>
32364 <row>
32365 <entry><option>user</option></entry>
32366 <entry>Use: <emphasis>routers</emphasis></entry>
32367 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32368 <entry>Default: <emphasis>see below</emphasis></entry>
32369 </row>
32370 </tbody>
32371 </tgroup>
32372 </informaltable>
32373 <para>
32374 <indexterm role="concept">
32375 <primary>uid (user id)</primary>
32376 <secondary>local delivery</secondary>
32377 </indexterm>
32378 <indexterm role="concept">
32379 <primary>local transports</primary>
32380 <secondary>uid and gid</secondary>
32381 </indexterm>
32382 <indexterm role="concept">
32383 <primary>transport</primary>
32384 <secondary>local</secondary>
32385 </indexterm>
32386 <indexterm role="concept">
32387 <primary>router</primary>
32388 <secondary>user for filter processing</secondary>
32389 </indexterm>
32390 <indexterm role="concept">
32391 <primary>filter</primary>
32392 <secondary>user for processing</secondary>
32393 </indexterm>
32394 When a router queues an address for a transport, and the transport does not
32395 specify a user, the user given here is used when running the delivery process.
32396 The user may be specified numerically or by name. If expansion fails, the
32397 error is logged and delivery is deferred.
32398 This user is also used by the <command>redirect</command> router when running a filter file.
32399 The default is unset, except when <option>check_local_user</option> is set. In this case,
32400 the default is taken from the password information. If the user is specified as
32401 a name, and <option>group</option> is not set, the group associated with the user is used.
32402 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
32403 <xref linkend="CHAPenvironment"/>.
32404 </para>
32405 <para>
32406 <indexterm role="option">
32407 <primary><option>verify</option></primary>
32408 </indexterm>
32409 </para>
32410 <informaltable frame="all">
32411 <tgroup cols="4" colsep="0" rowsep="0">
32412 <colspec colwidth="8*" align="left"/>
32413 <colspec colwidth="6*" align="center"/>
32414 <colspec colwidth="6*" align="center"/>
32415 <colspec colwidth="6*" align="right"/>
32416 <tbody>
32417 <row>
32418 <entry><option>verify</option></entry>
32419 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32420 <entry>Type: <emphasis>boolean</emphasis></entry>
32421 <entry>Default: <emphasis>true</emphasis></entry>
32422 </row>
32423 </tbody>
32424 </tgroup>
32425 </informaltable>
32426 <para>
32427 Setting this option has the effect of setting <option>verify_sender</option> and
32428 <option>verify_recipient</option> to the same value.
32429 </para>
32430 <para>
32431 <indexterm role="option">
32432 <primary><option>verify_only</option></primary>
32433 </indexterm>
32434 </para>
32435 <informaltable frame="all">
32436 <tgroup cols="4" colsep="0" rowsep="0">
32437 <colspec colwidth="8*" align="left"/>
32438 <colspec colwidth="6*" align="center"/>
32439 <colspec colwidth="6*" align="center"/>
32440 <colspec colwidth="6*" align="right"/>
32441 <tbody>
32442 <row>
32443 <entry><option>verify_only</option></entry>
32444 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32445 <entry>Type: <emphasis>boolean</emphasis></entry>
32446 <entry>Default: <emphasis>false</emphasis></entry>
32447 </row>
32448 </tbody>
32449 </tgroup>
32450 </informaltable>
32451 <para>
32452 <indexterm role="concept">
32453 <primary>EXPN</primary>
32454 <secondary>with <option>verify_only</option></secondary>
32455 </indexterm>
32456 <indexterm role="option">
32457 <primary><option>-bv</option></primary>
32458 </indexterm>
32459 <indexterm role="concept">
32460 <primary>router</primary>
32461 <secondary>used only when verifying</secondary>
32462 </indexterm>
32463 If this option is set, the router is used only when verifying an address,
32464 <phrase revisionflag="changed">delivering in cutthrough mode or</phrase>
32465 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
32466 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
32467 restricted to verifying only senders or recipients by means of
32468 <option>verify_sender</option> and <option>verify_recipient</option>.
32469 </para>
32470 <para>
32471 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
32472 SMTP message, Exim is not running as root, but under its own uid. If the router
32473 accesses any files, you need to make sure that they are accessible to the Exim
32474 user or group.
32475 </para>
32476 <para>
32477 <indexterm role="option">
32478 <primary><option>verify_recipient</option></primary>
32479 </indexterm>
32480 </para>
32481 <informaltable frame="all">
32482 <tgroup cols="4" colsep="0" rowsep="0">
32483 <colspec colwidth="8*" align="left"/>
32484 <colspec colwidth="6*" align="center"/>
32485 <colspec colwidth="6*" align="center"/>
32486 <colspec colwidth="6*" align="right"/>
32487 <tbody>
32488 <row>
32489 <entry><option>verify_recipient</option></entry>
32490 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32491 <entry>Type: <emphasis>boolean</emphasis></entry>
32492 <entry>Default: <emphasis>true</emphasis></entry>
32493 </row>
32494 </tbody>
32495 </tgroup>
32496 </informaltable>
32497 <para>
32498 If this option is false, the router is skipped when verifying recipient
32499 addresses,
32500 delivering in cutthrough mode
32501 or testing recipient verification using <option>-bv</option>.
32502 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32503 are evaluated.
32504 </para>
32505 <para>
32506 <indexterm role="option">
32507 <primary><option>verify_sender</option></primary>
32508 </indexterm>
32509 </para>
32510 <informaltable frame="all">
32511 <tgroup cols="4" colsep="0" rowsep="0">
32512 <colspec colwidth="8*" align="left"/>
32513 <colspec colwidth="6*" align="center"/>
32514 <colspec colwidth="6*" align="center"/>
32515 <colspec colwidth="6*" align="right"/>
32516 <tbody>
32517 <row>
32518 <entry><option>verify_sender</option></entry>
32519 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32520 <entry>Type: <emphasis>boolean</emphasis></entry>
32521 <entry>Default: <emphasis>true</emphasis></entry>
32522 </row>
32523 </tbody>
32524 </tgroup>
32525 </informaltable>
32526 <para>
32527 If this option is false, the router is skipped when verifying sender addresses
32528 or testing sender verification using <option>-bvs</option>.
32529 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
32530 are evaluated.
32531 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
32532 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
32533 </para>
32534 </chapter>
32535
32536 <chapter id="CHID4">
32537 <title>The accept router</title>
32538 <para>
32539 <indexterm role="concept">
32540 <primary><command>accept</command> router</primary>
32541 </indexterm>
32542 <indexterm role="concept">
32543 <primary>routers</primary>
32544 <secondary><command>accept</command></secondary>
32545 </indexterm>
32546 The <command>accept</command> router has no private options of its own. Unless it is being
32547 used purely for verification (see <option>verify_only</option>) a transport is required to
32548 be defined by the generic <option>transport</option> option. If the preconditions that are
32549 specified by generic options are met, the router accepts the address and queues
32550 it for the given transport. The most common use of this router is for setting
32551 up deliveries to local mailboxes. For example:
32552 </para>
32553 <literallayout class="monospaced">
32554 localusers:
32555   driver = accept
32556   domains = mydomain.example
32557   check_local_user
32558   transport = local_delivery
32559 </literallayout>
32560 <para>
32561 The <option>domains</option> condition in this example checks the domain of the address, and
32562 <option>check_local_user</option> checks that the local part is the login of a local user.
32563 When both preconditions are met, the <command>accept</command> router runs, and queues the
32564 address for the <command>local_delivery</command> transport.
32565 </para>
32566 </chapter>
32567
32568 <chapter id="CHAPdnslookup">
32569 <title>The dnslookup router</title>
32570 <para>
32571 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
32572 <primary><command>dnslookup</command> router</primary>
32573 </indexterm>
32574 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
32575 <primary>routers</primary>
32576 <secondary><command>dnslookup</command></secondary>
32577 </indexterm>
32578 The <command>dnslookup</command> router looks up the hosts that handle mail for the
32579 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
32580 unless <option>verify_only</option> is set.
32581 </para>
32582 <para>
32583 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
32584 SRV records. If none are found, or if SRV support is not configured,
32585 MX records are looked up. If no MX records exist, address records are sought.
32586 However, <option>mx_domains</option> can be set to disable the direct use of address
32587 records.
32588 </para>
32589 <para>
32590 MX records of equal priority are sorted by Exim into a random order. Exim then
32591 looks for address records for the host names obtained from MX or SRV records.
32592 When a host has more than one IP address, they are sorted into a random order,
32593 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
32594 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
32595 generic option, the router declines.
32596 </para>
32597 <para>
32598 Unless they have the highest priority (lowest MX value), MX records that point
32599 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
32600 are discarded, together with any other MX records of equal or lower priority.
32601 </para>
32602 <para>
32603 <indexterm role="concept">
32604 <primary>MX record</primary>
32605 <secondary>pointing to local host</secondary>
32606 </indexterm>
32607 <indexterm role="concept">
32608 <primary>local host</primary>
32609 <secondary>MX pointing to</secondary>
32610 </indexterm>
32611 <indexterm role="option">
32612 <primary><option>self</option></primary>
32613 <secondary>in <command>dnslookup</command> router</secondary>
32614 </indexterm>
32615 If the host pointed to by the highest priority MX record, or looked up as an
32616 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
32617 happens is controlled by the generic <option>self</option> option.
32618 </para>
32619 <section id="SECTprowitdnsloo">
32620 <title>Problems with DNS lookups</title>
32621 <para>
32622 There have been problems with DNS servers when SRV records are looked up.
32623 Some mis-behaving servers return a DNS error or timeout when a non-existent
32624 SRV record is sought. Similar problems have in the past been reported for
32625 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
32626 problem, but it is heavy-handed because it is a global option.
32627 </para>
32628 <para>
32629 For this reason, there are two options, <option>srv_fail_domains</option> and
32630 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
32631 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
32632 an attempt to look up an SRV or MX record causes one of these results, and the
32633 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
32634 such record</quote>. In the case of an SRV lookup, this means that the router
32635 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
32636 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
32637 case routing fails.
32638 </para>
32639 </section>
32640 <section id="SECTdnslookupdecline">
32641 <title>Declining addresses by dnslookup</title>
32642 <para>
32643 <indexterm role="concept">
32644 <primary><command>dnslookup</command> router</primary>
32645 <secondary>declines</secondary>
32646 </indexterm>
32647 There are a few cases where a <command>dnslookup</command> router will decline to accept
32648 an address; if such a router is expected to handle "all remaining non-local
32649 domains", then it is important to set <option>no_more</option>.
32650 </para>
32651 <para>
32652 Reasons for a <command>dnslookup</command> router to decline currently include:
32653 </para>
32654 <itemizedlist>
32655 <listitem>
32656 <para>
32657 The domain does not exist in DNS
32658 </para>
32659 </listitem>
32660 <listitem>
32661 <para>
32662 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
32663 convention (borrowed from SRV) used to indicate that there is no such service
32664 for this domain and to not fall back to trying A/AAAA records.
32665 </para>
32666 </listitem>
32667 <listitem>
32668 <para>
32669 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
32670 </para>
32671 </listitem>
32672 <listitem>
32673 <para>
32674 MX record points to a non-existent host.
32675 </para>
32676 </listitem>
32677 <listitem>
32678 <para>
32679 MX record points to an IP address and the main section option
32680 <option>allow_mx_to_ip</option> is not set.
32681 </para>
32682 </listitem>
32683 <listitem>
32684 <para>
32685 MX records exist and point to valid hosts, but all hosts resolve only to
32686 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
32687 </para>
32688 </listitem>
32689 <listitem>
32690 <para>
32691 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
32692 <option>dns_check_names_pattern</option> for handling one variant of this)
32693 </para>
32694 </listitem>
32695 <listitem>
32696 <para>
32697 <option>check_secondary_mx</option> is set on this router but the local host can
32698 not be found in the MX records (see below)
32699 </para>
32700 </listitem>
32701 </itemizedlist>
32702 </section>
32703 <section id="SECID118">
32704 <title>Private options for dnslookup</title>
32705 <para>
32706 <indexterm role="concept">
32707 <primary>options</primary>
32708 <secondary><command>dnslookup</command> router</secondary>
32709 </indexterm>
32710 The private options for the <command>dnslookup</command> router are as follows:
32711 </para>
32712 <para>
32713 <indexterm role="option">
32714 <primary><option>check_secondary_mx</option></primary>
32715 </indexterm>
32716 </para>
32717 <informaltable frame="all">
32718 <tgroup cols="4" colsep="0" rowsep="0">
32719 <colspec colwidth="8*" align="left"/>
32720 <colspec colwidth="6*" align="center"/>
32721 <colspec colwidth="6*" align="center"/>
32722 <colspec colwidth="6*" align="right"/>
32723 <tbody>
32724 <row>
32725 <entry><option>check_secondary_mx</option></entry>
32726 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32727 <entry>Type: <emphasis>boolean</emphasis></entry>
32728 <entry>Default: <emphasis>false</emphasis></entry>
32729 </row>
32730 </tbody>
32731 </tgroup>
32732 </informaltable>
32733 <para>
32734 <indexterm role="concept">
32735 <primary>MX record</primary>
32736 <secondary>checking for secondary</secondary>
32737 </indexterm>
32738 If this option is set, the router declines unless the local host is found in
32739 (and removed from) the list of hosts obtained by MX lookup. This can be used to
32740 process domains for which the local host is a secondary mail exchanger
32741 differently to other domains. The way in which Exim decides whether a host is
32742 the local host is described in section <xref linkend="SECTreclocipadd"/>.
32743 </para>
32744 <para>
32745 <indexterm role="option">
32746 <primary><option>check_srv</option></primary>
32747 </indexterm>
32748 </para>
32749 <informaltable frame="all">
32750 <tgroup cols="4" colsep="0" rowsep="0">
32751 <colspec colwidth="8*" align="left"/>
32752 <colspec colwidth="6*" align="center"/>
32753 <colspec colwidth="6*" align="center"/>
32754 <colspec colwidth="6*" align="right"/>
32755 <tbody>
32756 <row>
32757 <entry><option>check_srv</option></entry>
32758 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32759 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32760 <entry>Default: <emphasis>unset</emphasis></entry>
32761 </row>
32762 </tbody>
32763 </tgroup>
32764 </informaltable>
32765 <para>
32766 <indexterm role="concept">
32767 <primary>SRV record</primary>
32768 <secondary>enabling use of</secondary>
32769 </indexterm>
32770 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
32771 addition to MX and address records. The support is disabled by default. To
32772 enable SRV support, set the <option>check_srv</option> option to the name of the service
32773 required. For example,
32774 </para>
32775 <literallayout class="monospaced">
32776 check_srv = smtp
32777 </literallayout>
32778 <para>
32779 looks for SRV records that refer to the normal smtp service. The option is
32780 expanded, so the service name can vary from message to message or address
32781 to address. This might be helpful if SRV records are being used for a
32782 submission service. If the expansion is forced to fail, the <option>check_srv</option>
32783 option is ignored, and the router proceeds to look for MX records in the
32784 normal way.
32785 </para>
32786 <para>
32787 When the expansion succeeds, the router searches first for SRV records for
32788 the given service (it assumes TCP protocol). A single SRV record with a
32789 host name that consists of just a single dot indicates <quote>no such service for
32790 this domain</quote>; if this is encountered, the router declines. If other kinds of
32791 SRV record are found, they are used to construct a host list for delivery
32792 according to the rules of RFC 2782. MX records are not sought in this case.
32793 </para>
32794 <para>
32795 When no SRV records are found, MX records (and address records) are sought in
32796 the traditional way. In other words, SRV records take precedence over MX
32797 records, just as MX records take precedence over address records. Note that
32798 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
32799 defined it. It is apparently believed that MX records are sufficient for email
32800 and that SRV records should not be used for this purpose. However, SRV records
32801 have an additional <quote>weight</quote> feature which some people might find useful when
32802 trying to split an SMTP load between hosts of different power.
32803 </para>
32804 <para>
32805 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
32806 when there is a DNS lookup error.
32807 </para>
32808 <para>
32809 <indexterm role="option">
32810 <primary><option>mx_domains</option></primary>
32811 </indexterm>
32812 </para>
32813 <informaltable frame="all">
32814 <tgroup cols="4" colsep="0" rowsep="0">
32815 <colspec colwidth="8*" align="left"/>
32816 <colspec colwidth="6*" align="center"/>
32817 <colspec colwidth="6*" align="center"/>
32818 <colspec colwidth="6*" align="right"/>
32819 <tbody>
32820 <row>
32821 <entry><option>mx_domains</option></entry>
32822 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32823 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32824 <entry>Default: <emphasis>unset</emphasis></entry>
32825 </row>
32826 </tbody>
32827 </tgroup>
32828 </informaltable>
32829 <para>
32830 <indexterm role="concept">
32831 <primary>MX record</primary>
32832 <secondary>required to exist</secondary>
32833 </indexterm>
32834 <indexterm role="concept">
32835 <primary>SRV record</primary>
32836 <secondary>required to exist</secondary>
32837 </indexterm>
32838 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
32839 record in order to be recognized. (The name of this option could be improved.)
32840 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
32841 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
32842 setting:
32843 </para>
32844 <literallayout class="monospaced">
32845 mx_domains = ! *.discworld.fict.example : *.fict.example
32846 </literallayout>
32847 <para>
32848 This specifies that messages addressed to a domain that matches the list but
32849 has no MX record should be bounced immediately instead of being routed using
32850 the address record.
32851 </para>
32852 <para>
32853 <indexterm role="option">
32854 <primary><option>mx_fail_domains</option></primary>
32855 </indexterm>
32856 </para>
32857 <informaltable frame="all">
32858 <tgroup cols="4" colsep="0" rowsep="0">
32859 <colspec colwidth="8*" align="left"/>
32860 <colspec colwidth="6*" align="center"/>
32861 <colspec colwidth="6*" align="center"/>
32862 <colspec colwidth="6*" align="right"/>
32863 <tbody>
32864 <row>
32865 <entry><option>mx_fail_domains</option></entry>
32866 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32867 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32868 <entry>Default: <emphasis>unset</emphasis></entry>
32869 </row>
32870 </tbody>
32871 </tgroup>
32872 </informaltable>
32873 <para>
32874 If the DNS lookup for MX records for one of the domains in this list causes a
32875 DNS lookup error, Exim behaves as if no MX records were found. See section
32876 <xref linkend="SECTprowitdnsloo"/> for more discussion.
32877 </para>
32878 <para>
32879 <indexterm role="option">
32880 <primary><option>qualify_single</option></primary>
32881 </indexterm>
32882 </para>
32883 <informaltable frame="all">
32884 <tgroup cols="4" colsep="0" rowsep="0">
32885 <colspec colwidth="8*" align="left"/>
32886 <colspec colwidth="6*" align="center"/>
32887 <colspec colwidth="6*" align="center"/>
32888 <colspec colwidth="6*" align="right"/>
32889 <tbody>
32890 <row>
32891 <entry><option>qualify_single</option></entry>
32892 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32893 <entry>Type: <emphasis>boolean</emphasis></entry>
32894 <entry>Default: <emphasis>true</emphasis></entry>
32895 </row>
32896 </tbody>
32897 </tgroup>
32898 </informaltable>
32899 <para>
32900 <indexterm role="concept">
32901 <primary>DNS</primary>
32902 <secondary>resolver options</secondary>
32903 </indexterm>
32904 <indexterm role="concept">
32905 <primary>DNS</primary>
32906 <secondary>qualifying single-component names</secondary>
32907 </indexterm>
32908 When this option is true, the resolver option RES_DEFNAMES is set for DNS
32909 lookups. Typically, but not standardly, this causes the resolver to qualify
32910 single-component names with the default domain. For example, on a machine
32911 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
32912 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
32913 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
32914 <emphasis>resolv.conf</emphasis>.
32915 </para>
32916 <para>
32917 <indexterm role="option">
32918 <primary><option>rewrite_headers</option></primary>
32919 </indexterm>
32920 </para>
32921 <informaltable frame="all">
32922 <tgroup cols="4" colsep="0" rowsep="0">
32923 <colspec colwidth="8*" align="left"/>
32924 <colspec colwidth="6*" align="center"/>
32925 <colspec colwidth="6*" align="center"/>
32926 <colspec colwidth="6*" align="right"/>
32927 <tbody>
32928 <row>
32929 <entry><option>rewrite_headers</option></entry>
32930 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32931 <entry>Type: <emphasis>boolean</emphasis></entry>
32932 <entry>Default: <emphasis>true</emphasis></entry>
32933 </row>
32934 </tbody>
32935 </tgroup>
32936 </informaltable>
32937 <para>
32938 <indexterm role="concept">
32939 <primary>rewriting</primary>
32940 <secondary>header lines</secondary>
32941 </indexterm>
32942 <indexterm role="concept">
32943 <primary>header lines</primary>
32944 <secondary>rewriting</secondary>
32945 </indexterm>
32946 If the domain name in the address that is being processed is not fully
32947 qualified, it may be expanded to its full form by a DNS lookup. For example, if
32948 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
32949 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
32950 occur as a result of setting the <option>widen_domains</option> option. If
32951 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
32952 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
32953 header lines of the message are rewritten with the full domain name.
32954 </para>
32955 <para>
32956 This option should be turned off only when it is known that no message is
32957 ever going to be sent outside an environment where the abbreviation makes
32958 sense.
32959 </para>
32960 <para>
32961 When an MX record is looked up in the DNS and matches a wildcard record, name
32962 servers normally return a record containing the name that has been looked up,
32963 making it impossible to detect whether a wildcard was present or not. However,
32964 some name servers have recently been seen to return the wildcard entry. If the
32965 name returned by a DNS lookup begins with an asterisk, it is not used for
32966 header rewriting.
32967 </para>
32968 <para>
32969 <indexterm role="option">
32970 <primary><option>same_domain_copy_routing</option></primary>
32971 </indexterm>
32972 </para>
32973 <informaltable frame="all">
32974 <tgroup cols="4" colsep="0" rowsep="0">
32975 <colspec colwidth="8*" align="left"/>
32976 <colspec colwidth="6*" align="center"/>
32977 <colspec colwidth="6*" align="center"/>
32978 <colspec colwidth="6*" align="right"/>
32979 <tbody>
32980 <row>
32981 <entry><option>same_domain_copy_routing</option></entry>
32982 <entry>Use: <emphasis>dnslookup</emphasis></entry>
32983 <entry>Type: <emphasis>boolean</emphasis></entry>
32984 <entry>Default: <emphasis>false</emphasis></entry>
32985 </row>
32986 </tbody>
32987 </tgroup>
32988 </informaltable>
32989 <para>
32990 <indexterm role="concept">
32991 <primary>address</primary>
32992 <secondary>copying routing</secondary>
32993 </indexterm>
32994 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
32995 to the same list of hosts. However, this cannot be presumed, because the router
32996 options and preconditions may refer to the local part of the address. By
32997 default, therefore, Exim routes each address in a message independently. DNS
32998 servers run caches, so repeated DNS lookups are not normally expensive, and in
32999 any case, personal messages rarely have more than a few recipients.
33000 </para>
33001 <para>
33002 If you are running mailing lists with large numbers of subscribers at the same
33003 domain, and you are using a <command>dnslookup</command> router which is independent of the
33004 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33005 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
33006 routes an address to a remote transport, any other unrouted addresses in the
33007 message that have the same domain are automatically given the same routing
33008 without processing them independently,
33009 provided the following conditions are met:
33010 </para>
33011 <itemizedlist>
33012 <listitem>
33013 <para>
33014 No router that processed the address specified <option>headers_add</option> or
33015 <option>headers_remove</option>.
33016 </para>
33017 </listitem>
33018 <listitem>
33019 <para>
33020 The router did not change the address in any way, for example, by <quote>widening</quote>
33021 the domain.
33022 </para>
33023 </listitem>
33024 </itemizedlist>
33025 <para>
33026 <indexterm role="option">
33027 <primary><option>search_parents</option></primary>
33028 </indexterm>
33029 </para>
33030 <informaltable frame="all">
33031 <tgroup cols="4" colsep="0" rowsep="0">
33032 <colspec colwidth="8*" align="left"/>
33033 <colspec colwidth="6*" align="center"/>
33034 <colspec colwidth="6*" align="center"/>
33035 <colspec colwidth="6*" align="right"/>
33036 <tbody>
33037 <row>
33038 <entry><option>search_parents</option></entry>
33039 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33040 <entry>Type: <emphasis>boolean</emphasis></entry>
33041 <entry>Default: <emphasis>false</emphasis></entry>
33042 </row>
33043 </tbody>
33044 </tgroup>
33045 </informaltable>
33046 <para>
33047 <indexterm role="concept">
33048 <primary>DNS</primary>
33049 <secondary>resolver options</secondary>
33050 </indexterm>
33051 When this option is true, the resolver option RES_DNSRCH is set for DNS
33052 lookups. This is different from the <option>qualify_single</option> option in that it
33053 applies to domains containing dots. Typically, but not standardly, it causes
33054 the resolver to search for the name in the current domain and in parent
33055 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
33056 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
33057 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
33058 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
33059 </para>
33060 <para>
33061 Setting this option true can cause problems in domains that have a wildcard MX
33062 record, because any domain that does not have its own MX record matches the
33063 local wildcard.
33064 </para>
33065 <para>
33066 <indexterm role="option">
33067 <primary><option>srv_fail_domains</option></primary>
33068 </indexterm>
33069 </para>
33070 <informaltable frame="all">
33071 <tgroup cols="4" colsep="0" rowsep="0">
33072 <colspec colwidth="8*" align="left"/>
33073 <colspec colwidth="6*" align="center"/>
33074 <colspec colwidth="6*" align="center"/>
33075 <colspec colwidth="6*" align="right"/>
33076 <tbody>
33077 <row>
33078 <entry><option>srv_fail_domains</option></entry>
33079 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33080 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33081 <entry>Default: <emphasis>unset</emphasis></entry>
33082 </row>
33083 </tbody>
33084 </tgroup>
33085 </informaltable>
33086 <para>
33087 If the DNS lookup for SRV records for one of the domains in this list causes a
33088 DNS lookup error, Exim behaves as if no SRV records were found. See section
33089 <xref linkend="SECTprowitdnsloo"/> for more discussion.
33090 </para>
33091 <para>
33092 <indexterm role="option">
33093 <primary><option>widen_domains</option></primary>
33094 </indexterm>
33095 </para>
33096 <informaltable frame="all">
33097 <tgroup cols="4" colsep="0" rowsep="0">
33098 <colspec colwidth="8*" align="left"/>
33099 <colspec colwidth="6*" align="center"/>
33100 <colspec colwidth="6*" align="center"/>
33101 <colspec colwidth="6*" align="right"/>
33102 <tbody>
33103 <row>
33104 <entry><option>widen_domains</option></entry>
33105 <entry>Use: <emphasis>dnslookup</emphasis></entry>
33106 <entry>Type: <emphasis>string list</emphasis></entry>
33107 <entry>Default: <emphasis>unset</emphasis></entry>
33108 </row>
33109 </tbody>
33110 </tgroup>
33111 </informaltable>
33112 <para>
33113 <indexterm role="concept">
33114 <primary>domain</primary>
33115 <secondary>partial; widening</secondary>
33116 </indexterm>
33117 If a DNS lookup fails and this option is set, each of its strings in turn is
33118 added onto the end of the domain, and the lookup is tried again. For example,
33119 if
33120 </para>
33121 <literallayout class="monospaced">
33122 widen_domains = fict.example:ref.example
33123 </literallayout>
33124 <para>
33125 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
33126 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
33127 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
33128 and <option>search_parents</option> options can cause some widening to be undertaken inside
33129 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
33130 when verifying, unless <option>rewrite_headers</option> is false (not the default).
33131 </para>
33132 </section>
33133 <section id="SECID119">
33134 <title>Effect of qualify_single and search_parents</title>
33135 <para>
33136 When a domain from an envelope recipient is changed by the resolver as a result
33137 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
33138 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
33139 is set false. Exim then re-routes the address, using the full domain.
33140 </para>
33141 <para>
33142 These two options affect only the DNS lookup that takes place inside the router
33143 for the domain of the address that is being routed. They do not affect lookups
33144 such as that implied by
33145 </para>
33146 <literallayout class="monospaced">
33147 domains = @mx_any
33148 </literallayout>
33149 <para>
33150 that may happen while processing a router precondition before the router is
33151 entered. No widening ever takes place for these lookups.
33152 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
33153 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
33154 </para>
33155 </section>
33156 </chapter>
33157
33158 <chapter id="CHID5">
33159 <title>The ipliteral router</title>
33160 <para>
33161 <indexterm role="concept">
33162 <primary><command>ipliteral</command> router</primary>
33163 </indexterm>
33164 <indexterm role="concept">
33165 <primary>domain literal</primary>
33166 <secondary>routing</secondary>
33167 </indexterm>
33168 <indexterm role="concept">
33169 <primary>routers</primary>
33170 <secondary><command>ipliteral</command></secondary>
33171 </indexterm>
33172 This router has no private options. Unless it is being used purely for
33173 verification (see <option>verify_only</option>) a transport is required to be defined by the
33174 generic <option>transport</option> option. The router accepts the address if its domain part
33175 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
33176 router handles the address
33177 </para>
33178 <literallayout class="monospaced">
33179 root@[192.168.1.1]
33180 </literallayout>
33181 <para>
33182 by setting up delivery to the host with that IP address. IPv4 domain literals
33183 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
33184 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
33185 </para>
33186 <literallayout class="monospaced">
33187 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
33188 </literallayout>
33189 <para>
33190 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
33191 grounds that sooner or later somebody will try it.
33192 </para>
33193 <para>
33194 <indexterm role="option">
33195 <primary><option>self</option></primary>
33196 <secondary>in <command>ipliteral</command> router</secondary>
33197 </indexterm>
33198 If the IP address matches something in <option>ignore_target_hosts</option>, the router
33199 declines. If an IP literal turns out to refer to the local host, the generic
33200 <option>self</option> option determines what happens.
33201 </para>
33202 <para>
33203 The RFCs require support for domain literals; however, their use is
33204 controversial in today&#x2019;s Internet. If you want to use this router, you must
33205 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
33206 Exim will not recognize the domain literal syntax in addresses.
33207 </para>
33208 </chapter>
33209
33210 <chapter id="CHID6">
33211 <title>The iplookup router</title>
33212 <para>
33213 <indexterm role="concept">
33214 <primary><command>iplookup</command> router</primary>
33215 </indexterm>
33216 <indexterm role="concept">
33217 <primary>routers</primary>
33218 <secondary><command>iplookup</command></secondary>
33219 </indexterm>
33220 The <command>iplookup</command> router was written to fulfil a specific requirement in
33221 Cambridge University (which in fact no longer exists). For this reason, it is
33222 not included in the binary of Exim by default. If you want to include it, you
33223 must set
33224 </para>
33225 <literallayout class="monospaced">
33226 ROUTER_IPLOOKUP=yes
33227 </literallayout>
33228 <para>
33229 in your <filename>Local/Makefile</filename> configuration file.
33230 </para>
33231 <para>
33232 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
33233 connection to one or more specific hosts. The host can then return the same or
33234 a different address &ndash; in effect rewriting the recipient address in the
33235 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
33236 this process fails, the address can be passed on to other routers, or delivery
33237 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
33238 must not be specified for it.
33239 </para>
33240 <para>
33241 <indexterm role="concept">
33242 <primary>options</primary>
33243 <secondary><command>iplookup</command> router</secondary>
33244 </indexterm>
33245 <indexterm role="option">
33246 <primary><option>hosts</option></primary>
33247 </indexterm>
33248 </para>
33249 <informaltable frame="all">
33250 <tgroup cols="4" colsep="0" rowsep="0">
33251 <colspec colwidth="8*" align="left"/>
33252 <colspec colwidth="6*" align="center"/>
33253 <colspec colwidth="6*" align="center"/>
33254 <colspec colwidth="6*" align="right"/>
33255 <tbody>
33256 <row>
33257 <entry><option>hosts</option></entry>
33258 <entry>Use: <emphasis>iplookup</emphasis></entry>
33259 <entry>Type: <emphasis>string</emphasis></entry>
33260 <entry>Default: <emphasis>unset</emphasis></entry>
33261 </row>
33262 </tbody>
33263 </tgroup>
33264 </informaltable>
33265 <para>
33266 This option must be supplied. Its value is a colon-separated list of host
33267 names. The hosts are looked up using <function>gethostbyname()</function>
33268 (or <function>getipnodebyname()</function> when available)
33269 and are tried in order until one responds to the query. If none respond, what
33270 happens is controlled by <option>optional</option>.
33271 </para>
33272 <para>
33273 <indexterm role="option">
33274 <primary><option>optional</option></primary>
33275 </indexterm>
33276 </para>
33277 <informaltable frame="all">
33278 <tgroup cols="4" colsep="0" rowsep="0">
33279 <colspec colwidth="8*" align="left"/>
33280 <colspec colwidth="6*" align="center"/>
33281 <colspec colwidth="6*" align="center"/>
33282 <colspec colwidth="6*" align="right"/>
33283 <tbody>
33284 <row>
33285 <entry><option>optional</option></entry>
33286 <entry>Use: <emphasis>iplookup</emphasis></entry>
33287 <entry>Type: <emphasis>boolean</emphasis></entry>
33288 <entry>Default: <emphasis>false</emphasis></entry>
33289 </row>
33290 </tbody>
33291 </tgroup>
33292 </informaltable>
33293 <para>
33294 If <option>optional</option> is true, if no response is obtained from any host, the address
33295 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
33296 delivery to the address is deferred.
33297 </para>
33298 <para>
33299 <indexterm role="option">
33300 <primary><option>port</option></primary>
33301 </indexterm>
33302 </para>
33303 <informaltable frame="all">
33304 <tgroup cols="4" colsep="0" rowsep="0">
33305 <colspec colwidth="8*" align="left"/>
33306 <colspec colwidth="6*" align="center"/>
33307 <colspec colwidth="6*" align="center"/>
33308 <colspec colwidth="6*" align="right"/>
33309 <tbody>
33310 <row>
33311 <entry><option>port</option></entry>
33312 <entry>Use: <emphasis>iplookup</emphasis></entry>
33313 <entry>Type: <emphasis>integer</emphasis></entry>
33314 <entry>Default: <emphasis>0</emphasis></entry>
33315 </row>
33316 </tbody>
33317 </tgroup>
33318 </informaltable>
33319 <para>
33320 <indexterm role="concept">
33321 <primary>port</primary>
33322 <secondary><command>iplookup</command> router</secondary>
33323 </indexterm>
33324 This option must be supplied. It specifies the port number for the TCP or UDP
33325 call.
33326 </para>
33327 <para>
33328 <indexterm role="option">
33329 <primary><option>protocol</option></primary>
33330 </indexterm>
33331 </para>
33332 <informaltable frame="all">
33333 <tgroup cols="4" colsep="0" rowsep="0">
33334 <colspec colwidth="8*" align="left"/>
33335 <colspec colwidth="6*" align="center"/>
33336 <colspec colwidth="6*" align="center"/>
33337 <colspec colwidth="6*" align="right"/>
33338 <tbody>
33339 <row>
33340 <entry><option>protocol</option></entry>
33341 <entry>Use: <emphasis>iplookup</emphasis></entry>
33342 <entry>Type: <emphasis>string</emphasis></entry>
33343 <entry>Default: <emphasis>udp</emphasis></entry>
33344 </row>
33345 </tbody>
33346 </tgroup>
33347 </informaltable>
33348 <para>
33349 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
33350 protocols is to be used.
33351 </para>
33352 <para>
33353 <indexterm role="option">
33354 <primary><option>query</option></primary>
33355 </indexterm>
33356 </para>
33357 <informaltable frame="all">
33358 <tgroup cols="4" colsep="0" rowsep="0">
33359 <colspec colwidth="8*" align="left"/>
33360 <colspec colwidth="6*" align="center"/>
33361 <colspec colwidth="6*" align="center"/>
33362 <colspec colwidth="6*" align="right"/>
33363 <tbody>
33364 <row>
33365 <entry><option>query</option></entry>
33366 <entry>Use: <emphasis>iplookup</emphasis></entry>
33367 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33368 <entry>Default: <emphasis>see below</emphasis></entry>
33369 </row>
33370 </tbody>
33371 </tgroup>
33372 </informaltable>
33373 <para>
33374 This defines the content of the query that is sent to the remote hosts. The
33375 default value is:
33376 </para>
33377 <literallayout class="monospaced">
33378 $local_part@$domain $local_part@$domain
33379 </literallayout>
33380 <para>
33381 The repetition serves as a way of checking that a response is to the correct
33382 query in the default case (see <option>response_pattern</option> below).
33383 </para>
33384 <para>
33385 <indexterm role="option">
33386 <primary><option>reroute</option></primary>
33387 </indexterm>
33388 </para>
33389 <informaltable frame="all">
33390 <tgroup cols="4" colsep="0" rowsep="0">
33391 <colspec colwidth="8*" align="left"/>
33392 <colspec colwidth="6*" align="center"/>
33393 <colspec colwidth="6*" align="center"/>
33394 <colspec colwidth="6*" align="right"/>
33395 <tbody>
33396 <row>
33397 <entry><option>reroute</option></entry>
33398 <entry>Use: <emphasis>iplookup</emphasis></entry>
33399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33400 <entry>Default: <emphasis>unset</emphasis></entry>
33401 </row>
33402 </tbody>
33403 </tgroup>
33404 </informaltable>
33405 <para>
33406 If this option is not set, the rerouted address is precisely the byte string
33407 returned by the remote host, up to the first white space, if any. If set, the
33408 string is expanded to form the rerouted address. It can include parts matched
33409 in the response by <option>response_pattern</option> by means of numeric variables such as
33410 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
33411 whether or not a pattern is in use. In all cases, the rerouted address must end
33412 up in the form <emphasis>local_part@domain</emphasis>.
33413 </para>
33414 <para>
33415 <indexterm role="option">
33416 <primary><option>response_pattern</option></primary>
33417 </indexterm>
33418 </para>
33419 <informaltable frame="all">
33420 <tgroup cols="4" colsep="0" rowsep="0">
33421 <colspec colwidth="8*" align="left"/>
33422 <colspec colwidth="6*" align="center"/>
33423 <colspec colwidth="6*" align="center"/>
33424 <colspec colwidth="6*" align="right"/>
33425 <tbody>
33426 <row>
33427 <entry><option>response_pattern</option></entry>
33428 <entry>Use: <emphasis>iplookup</emphasis></entry>
33429 <entry>Type: <emphasis>string</emphasis></entry>
33430 <entry>Default: <emphasis>unset</emphasis></entry>
33431 </row>
33432 </tbody>
33433 </tgroup>
33434 </informaltable>
33435 <para>
33436 This option can be set to a regular expression that is applied to the string
33437 returned from the remote host. If the pattern does not match the response, the
33438 router declines. If <option>response_pattern</option> is not set, no checking of the
33439 response is done, unless the query was defaulted, in which case there is a
33440 check that the text returned after the first white space is the original
33441 address. This checks that the answer that has been received is in response to
33442 the correct question. For example, if the response is just a new domain, the
33443 following could be used:
33444 </para>
33445 <literallayout class="monospaced">
33446 response_pattern = ^([^@]+)$
33447 reroute = $local_part@$1
33448 </literallayout>
33449 <para>
33450 <indexterm role="option">
33451 <primary><option>timeout</option></primary>
33452 </indexterm>
33453 </para>
33454 <informaltable frame="all">
33455 <tgroup cols="4" colsep="0" rowsep="0">
33456 <colspec colwidth="8*" align="left"/>
33457 <colspec colwidth="6*" align="center"/>
33458 <colspec colwidth="6*" align="center"/>
33459 <colspec colwidth="6*" align="right"/>
33460 <tbody>
33461 <row>
33462 <entry><option>timeout</option></entry>
33463 <entry>Use: <emphasis>iplookup</emphasis></entry>
33464 <entry>Type: <emphasis>time</emphasis></entry>
33465 <entry>Default: <emphasis>5s</emphasis></entry>
33466 </row>
33467 </tbody>
33468 </tgroup>
33469 </informaltable>
33470 <para>
33471 This specifies the amount of time to wait for a response from the remote
33472 machine. The same timeout is used for the <function>connect()</function> function for a TCP
33473 call. It does not apply to UDP.
33474 </para>
33475 </chapter>
33476
33477 <chapter id="CHID7">
33478 <title>The manualroute router</title>
33479 <para>
33480 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
33481 <primary><command>manualroute</command> router</primary>
33482 </indexterm>
33483 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
33484 <primary>routers</primary>
33485 <secondary><command>manualroute</command></secondary>
33486 </indexterm>
33487 <indexterm role="concept">
33488 <primary>domain</primary>
33489 <secondary>manually routing</secondary>
33490 </indexterm>
33491 The <command>manualroute</command> router is so-called because it provides a way of manually
33492 routing an address according to its domain. It is mainly used when you want to
33493 route addresses to remote hosts according to your own rules, bypassing the
33494 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
33495 route to local transports, a facility that may be useful if you want to save
33496 messages for dial-in hosts in local files.
33497 </para>
33498 <para>
33499 The <command>manualroute</command> router compares a list of domain patterns with the domain
33500 it is trying to route. If there is no match, the router declines. Each pattern
33501 has associated with it a list of hosts and some other optional data, which may
33502 include a transport. The combination of a pattern and its data is called a
33503 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
33504 generic <option>transport</option> option must specify a transport, unless the router is
33505 being used purely for verification (see <option>verify_only</option>).
33506 </para>
33507 <para>
33508 <indexterm role="variable">
33509 <primary><varname>$host</varname></primary>
33510 </indexterm>
33511 In the case of verification, matching the domain pattern is sufficient for the
33512 router to accept the address. When actually routing an address for delivery,
33513 an address that matches a domain pattern is queued for the associated
33514 transport. If the transport is not a local one, a host list must be associated
33515 with the pattern; IP addresses are looked up for the hosts, and these are
33516 passed to the transport along with the mail address. For local transports, a
33517 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
33518 text string.
33519 </para>
33520 <para>
33521 The list of routing rules can be provided as an inline string in
33522 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
33523 or database by setting <option>route_data</option>. Only one of these settings may appear in
33524 any one instance of <command>manualroute</command>. The format of routing rules is described
33525 below, following the list of private options.
33526 </para>
33527 <section id="SECTprioptman">
33528 <title>Private options for manualroute</title>
33529 <para>
33530 <indexterm role="concept">
33531 <primary>options</primary>
33532 <secondary><command>manualroute</command> router</secondary>
33533 </indexterm>
33534 The private options for the <command>manualroute</command> router are as follows:
33535 </para>
33536 <para>
33537 <indexterm role="option">
33538 <primary><option>host_all_ignored</option></primary>
33539 </indexterm>
33540 </para>
33541 <informaltable frame="all">
33542 <tgroup cols="4" colsep="0" rowsep="0">
33543 <colspec colwidth="8*" align="left"/>
33544 <colspec colwidth="6*" align="center"/>
33545 <colspec colwidth="6*" align="center"/>
33546 <colspec colwidth="6*" align="right"/>
33547 <tbody>
33548 <row>
33549 <entry><option>host_all_ignored</option></entry>
33550 <entry>Use: <emphasis>manualroute</emphasis></entry>
33551 <entry>Type: <emphasis>string</emphasis></entry>
33552 <entry>Default: <emphasis>defer</emphasis></entry>
33553 </row>
33554 </tbody>
33555 </tgroup>
33556 </informaltable>
33557 <para>
33558 See <option>host_find_failed</option>.
33559 </para>
33560 <para>
33561 <indexterm role="option">
33562 <primary><option>host_find_failed</option></primary>
33563 </indexterm>
33564 </para>
33565 <informaltable frame="all">
33566 <tgroup cols="4" colsep="0" rowsep="0">
33567 <colspec colwidth="8*" align="left"/>
33568 <colspec colwidth="6*" align="center"/>
33569 <colspec colwidth="6*" align="center"/>
33570 <colspec colwidth="6*" align="right"/>
33571 <tbody>
33572 <row>
33573 <entry><option>host_find_failed</option></entry>
33574 <entry>Use: <emphasis>manualroute</emphasis></entry>
33575 <entry>Type: <emphasis>string</emphasis></entry>
33576 <entry>Default: <emphasis>freeze</emphasis></entry>
33577 </row>
33578 </tbody>
33579 </tgroup>
33580 </informaltable>
33581 <para>
33582 This option controls what happens when <command>manualroute</command> tries to find an IP
33583 address for a host, and the host does not exist. The option can be set to one
33584 of the following values:
33585 </para>
33586 <literallayout class="monospaced">
33587 decline
33588 defer
33589 fail
33590 freeze
33591 ignore
33592 pass
33593 </literallayout>
33594 <para>
33595 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
33596 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
33597 forces the address to be passed to the next router (or the router defined by
33598 <option>pass_router</option>),
33599 <indexterm role="option">
33600 <primary><option>more</option></primary>
33601 </indexterm>
33602 overriding <option>no_more</option>, whereas the latter passes the address to the next
33603 router only if <option>more</option> is true.
33604 </para>
33605 <para>
33606 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
33607 cannot be found. If all the hosts in the list are ignored, the behaviour is
33608 controlled by the <option>host_all_ignored</option> option. This takes the same values
33609 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
33610 </para>
33611 <para>
33612 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
33613 state; if a host lookup gets a temporary error, delivery is deferred unless the
33614 generic <option>pass_on_timeout</option> option is set.
33615 </para>
33616 <para>
33617 <indexterm role="option">
33618 <primary><option>hosts_randomize</option></primary>
33619 </indexterm>
33620 </para>
33621 <informaltable frame="all">
33622 <tgroup cols="4" colsep="0" rowsep="0">
33623 <colspec colwidth="8*" align="left"/>
33624 <colspec colwidth="6*" align="center"/>
33625 <colspec colwidth="6*" align="center"/>
33626 <colspec colwidth="6*" align="right"/>
33627 <tbody>
33628 <row>
33629 <entry><option>hosts_randomize</option></entry>
33630 <entry>Use: <emphasis>manualroute</emphasis></entry>
33631 <entry>Type: <emphasis>boolean</emphasis></entry>
33632 <entry>Default: <emphasis>false</emphasis></entry>
33633 </row>
33634 </tbody>
33635 </tgroup>
33636 </informaltable>
33637 <para>
33638 <indexterm role="concept">
33639 <primary>randomized host list</primary>
33640 </indexterm>
33641 <indexterm role="concept">
33642 <primary>host</primary>
33643 <secondary>list of; randomized</secondary>
33644 </indexterm>
33645 If this option is set, the order of the items in a host list in a routing rule
33646 is randomized each time the list is used, unless an option in the routing rule
33647 overrides (see below). Randomizing the order of a host list can be used to do
33648 crude load sharing. However, if more than one mail address is routed by the
33649 same router to the same host list, the host lists are considered to be the same
33650 (even though they may be randomized into different orders) for the purpose of
33651 deciding whether to batch the deliveries into a single SMTP transaction.
33652 </para>
33653 <para>
33654 When <option>hosts_randomize</option> is true, a host list may be split
33655 into groups whose order is separately randomized. This makes it possible to
33656 set up MX-like behaviour. The boundaries between groups are indicated by an
33657 item that is just <literal>+</literal> in the host list. For example:
33658 </para>
33659 <literallayout class="monospaced">
33660 route_list = * host1:host2:host3:+:host4:host5
33661 </literallayout>
33662 <para>
33663 The order of the first three hosts and the order of the last two hosts is
33664 randomized for each use, but the first three always end up before the last two.
33665 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
33666 randomized host list is passed to an <command>smtp</command> transport that also has
33667 <option>hosts_randomize set</option>, the list is not re-randomized.
33668 </para>
33669 <para>
33670 <indexterm role="option">
33671 <primary><option>route_data</option></primary>
33672 </indexterm>
33673 </para>
33674 <informaltable frame="all">
33675 <tgroup cols="4" colsep="0" rowsep="0">
33676 <colspec colwidth="8*" align="left"/>
33677 <colspec colwidth="6*" align="center"/>
33678 <colspec colwidth="6*" align="center"/>
33679 <colspec colwidth="6*" align="right"/>
33680 <tbody>
33681 <row>
33682 <entry><option>route_data</option></entry>
33683 <entry>Use: <emphasis>manualroute</emphasis></entry>
33684 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33685 <entry>Default: <emphasis>unset</emphasis></entry>
33686 </row>
33687 </tbody>
33688 </tgroup>
33689 </informaltable>
33690 <para>
33691 If this option is set, it must expand to yield the data part of a routing rule.
33692 Typically, the expansion string includes a lookup based on the domain. For
33693 example:
33694 </para>
33695 <literallayout class="monospaced">
33696 route_data = ${lookup{$domain}dbm{/etc/routes}}
33697 </literallayout>
33698 <para>
33699 If the expansion is forced to fail, or the result is an empty string, the
33700 router declines. Other kinds of expansion failure cause delivery to be
33701 deferred.
33702 </para>
33703 <para>
33704 <indexterm role="option">
33705 <primary><option>route_list</option></primary>
33706 </indexterm>
33707 </para>
33708 <informaltable frame="all">
33709 <tgroup cols="4" colsep="0" rowsep="0">
33710 <colspec colwidth="8*" align="left"/>
33711 <colspec colwidth="6*" align="center"/>
33712 <colspec colwidth="6*" align="center"/>
33713 <colspec colwidth="6*" align="right"/>
33714 <tbody>
33715 <row>
33716 <entry><option>route_list</option></entry>
33717 <entry>Use: <emphasis>manualroute</emphasis></entry>
33718 <entry>Type: <emphasis>string list</emphasis></entry>
33719 <entry>Default: <emphasis>unset</emphasis></entry>
33720 </row>
33721 </tbody>
33722 </tgroup>
33723 </informaltable>
33724 <para>
33725 This string is a list of routing rules, in the form defined below. Note that,
33726 unlike most string lists, the items are separated by semicolons. This is so
33727 that they may contain colon-separated host lists.
33728 </para>
33729 <para>
33730 <indexterm role="option">
33731 <primary><option>same_domain_copy_routing</option></primary>
33732 </indexterm>
33733 </para>
33734 <informaltable frame="all">
33735 <tgroup cols="4" colsep="0" rowsep="0">
33736 <colspec colwidth="8*" align="left"/>
33737 <colspec colwidth="6*" align="center"/>
33738 <colspec colwidth="6*" align="center"/>
33739 <colspec colwidth="6*" align="right"/>
33740 <tbody>
33741 <row>
33742 <entry><option>same_domain_copy_routing</option></entry>
33743 <entry>Use: <emphasis>manualroute</emphasis></entry>
33744 <entry>Type: <emphasis>boolean</emphasis></entry>
33745 <entry>Default: <emphasis>false</emphasis></entry>
33746 </row>
33747 </tbody>
33748 </tgroup>
33749 </informaltable>
33750 <para>
33751 <indexterm role="concept">
33752 <primary>address</primary>
33753 <secondary>copying routing</secondary>
33754 </indexterm>
33755 Addresses with the same domain are normally routed by the <command>manualroute</command>
33756 router to the same list of hosts. However, this cannot be presumed, because the
33757 router options and preconditions may refer to the local part of the address. By
33758 default, therefore, Exim routes each address in a message independently. DNS
33759 servers run caches, so repeated DNS lookups are not normally expensive, and in
33760 any case, personal messages rarely have more than a few recipients.
33761 </para>
33762 <para>
33763 If you are running mailing lists with large numbers of subscribers at the same
33764 domain, and you are using a <command>manualroute</command> router which is independent of the
33765 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
33766 lookups for identical domains in one message. In this case, when
33767 <command>manualroute</command> routes an address to a remote transport, any other unrouted
33768 addresses in the message that have the same domain are automatically given the
33769 same routing without processing them independently. However, this is only done
33770 if <option>headers_add</option> and <option>headers_remove</option> are unset.
33771 </para>
33772 </section>
33773 <section id="SECID120">
33774 <title>Routing rules in route_list</title>
33775 <para>
33776 The value of <option>route_list</option> is a string consisting of a sequence of routing
33777 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
33778 entered as two semicolons. Alternatively, the list separator can be changed as
33779 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
33780 Empty rules are ignored. The format of each rule is
33781 </para>
33782 <literallayout>
33783 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
33784 </literallayout>
33785 <para>
33786 The following example contains two rules, each with a simple domain pattern and
33787 no options:
33788 </para>
33789 <literallayout class="monospaced">
33790 route_list = \
33791   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
33792   thes.ref.example  mail-3.ref.example:mail-4.ref.example
33793 </literallayout>
33794 <para>
33795 The three parts of a rule are separated by white space. The pattern and the
33796 list of hosts can be enclosed in quotes if necessary, and if they are, the
33797 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
33798 single domain pattern, which is the only mandatory item in the rule. The
33799 pattern is in the same format as one item in a domain list (see section
33800 <xref linkend="SECTdomainlist"/>),
33801 except that it may not be the name of an interpolated file.
33802 That is, it may be wildcarded, or a regular expression, or a file or database
33803 lookup (with semicolons doubled, because of the use of semicolon as a separator
33804 in a <option>route_list</option>).
33805 </para>
33806 <para>
33807 The rules in <option>route_list</option> are searched in order until one of the patterns
33808 matches the domain that is being routed. The list of hosts and then options are
33809 then used as described below. If there is no match, the router declines. When
33810 <option>route_list</option> is set, <option>route_data</option> must not be set.
33811 </para>
33812 </section>
33813 <section id="SECID121">
33814 <title>Routing rules in route_data</title>
33815 <para>
33816 The use of <option>route_list</option> is convenient when there are only a small number of
33817 routing rules. For larger numbers, it is easier to use a file or database to
33818 hold the routing information, and use the <option>route_data</option> option instead.
33819 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
33820 Most commonly, <option>route_data</option> is set as a string that contains an
33821 expansion lookup. For example, suppose we place two routing rules in a file
33822 like this:
33823 </para>
33824 <literallayout class="monospaced">
33825 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
33826 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
33827 </literallayout>
33828 <para>
33829 This data can be accessed by setting
33830 </para>
33831 <literallayout class="monospaced">
33832 route_data = ${lookup{$domain}lsearch{/the/file/name}}
33833 </literallayout>
33834 <para>
33835 Failure of the lookup results in an empty string, causing the router to
33836 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
33837 requirement is that the result of expanding the string is a list of hosts,
33838 possibly followed by options, separated by white space. The list of hosts must
33839 be enclosed in quotes if it contains white space.
33840 </para>
33841 </section>
33842 <section id="SECID122">
33843 <title>Format of the list of hosts</title>
33844 <para>
33845 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
33846 always separately expanded before use. If the expansion fails, the router
33847 declines. The result of the expansion must be a colon-separated list of names
33848 and/or IP addresses, optionally also including ports. The format of each item
33849 in the list is described in the next section. The list separator can be changed
33850 as described in section <xref linkend="SECTlistconstruct"/>.
33851 </para>
33852 <para>
33853 If the list of hosts was obtained from a <option>route_list</option> item, the following
33854 variables are set during its expansion:
33855 </para>
33856 <itemizedlist>
33857 <listitem>
33858 <para>
33859 <indexterm role="concept">
33860 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
33861 <secondary>in <command>manualroute</command> router</secondary>
33862 </indexterm>
33863 If the domain was matched against a regular expression, the numeric variables
33864 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
33865 </para>
33866 <literallayout class="monospaced">
33867 route_list = ^domain(\d+)   host-$1.text.example
33868 </literallayout>
33869 </listitem>
33870 <listitem>
33871 <para>
33872 <varname>$0</varname> is always set to the entire domain.
33873 </para>
33874 </listitem>
33875 <listitem>
33876 <para>
33877 <varname>$1</varname> is also set when partial matching is done in a file lookup.
33878 </para>
33879 </listitem>
33880 <listitem>
33881 <para>
33882 <indexterm role="variable">
33883 <primary><varname>$value</varname></primary>
33884 </indexterm>
33885 If the pattern that matched the domain was a lookup item, the data that was
33886 looked up is available in the expansion variable <varname>$value</varname>. For example:
33887 </para>
33888 <literallayout class="monospaced">
33889 route_list = lsearch;;/some/file.routes  $value
33890 </literallayout>
33891 </listitem>
33892 </itemizedlist>
33893 <para>
33894 Note the doubling of the semicolon in the pattern that is necessary because
33895 semicolon is the default route list separator.
33896 </para>
33897 </section>
33898 <section id="SECTformatonehostitem">
33899 <title>Format of one host item</title>
33900 <para>
33901 Each item in the list of hosts is either a host name or an IP address,
33902 optionally with an attached port number. When no port is given, an IP address
33903 is not enclosed in brackets. When a port is specified, it overrides the port
33904 specification on the transport. The port is separated from the name or address
33905 by a colon. This leads to some complications:
33906 </para>
33907 <itemizedlist>
33908 <listitem>
33909 <para>
33910 Because colon is the default separator for the list of hosts, either
33911 the colon that specifies a port must be doubled, or the list separator must
33912 be changed. The following two examples have the same effect:
33913 </para>
33914 <literallayout class="monospaced">
33915 route_list = * "host1.tld::1225 : host2.tld::1226"
33916 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
33917 </literallayout>
33918 </listitem>
33919 <listitem>
33920 <para>
33921 When IPv6 addresses are involved, it gets worse, because they contain
33922 colons of their own. To make this case easier, it is permitted to
33923 enclose an IP address (either v4 or v6) in square brackets if a port
33924 number follows. For example:
33925 </para>
33926 <literallayout class="monospaced">
33927 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
33928 </literallayout>
33929 </listitem>
33930 </itemizedlist>
33931 </section>
33932 <section id="SECThostshowused">
33933 <title>How the list of hosts is used</title>
33934 <para>
33935 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
33936 the hosts is tried, in the order specified, when carrying out the SMTP
33937 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
33938 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
33939 transport.
33940 </para>
33941 <para>
33942 Hosts may be listed by name or by IP address. An unadorned name in the list of
33943 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
33944 interpreted as an indirection to a sublist of hosts obtained by looking up MX
33945 records in the DNS. For example:
33946 </para>
33947 <literallayout class="monospaced">
33948 route_list = *  x.y.z:p.q.r/MX:e.f.g
33949 </literallayout>
33950 <para>
33951 If this feature is used with a port specifier, the port must come last. For
33952 example:
33953 </para>
33954 <literallayout class="monospaced">
33955 route_list = *  dom1.tld/mx::1225
33956 </literallayout>
33957 <para>
33958 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
33959 randomized before any lookups are done. Exim then scans the list; for any name
33960 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
33961 be an interface on the local host and the item is not the first in the list,
33962 Exim discards it and any subsequent items. If it is the first item, what
33963 happens is controlled by the
33964 <indexterm role="option">
33965 <primary><option>self</option></primary>
33966 <secondary>in <command>manualroute</command> router</secondary>
33967 </indexterm>
33968 <option>self</option> option of the router.
33969 </para>
33970 <para>
33971 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
33972 hosts obtained by looking up MX records for the name. This is always a DNS
33973 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
33974 below) are not relevant here. The order of these hosts is determined by the
33975 preference values in the MX records, according to the usual rules. Because
33976 randomizing happens before the MX lookup, it does not affect the order that is
33977 defined by MX preferences.
33978 </para>
33979 <para>
33980 If the local host is present in the sublist obtained from MX records, but is
33981 not the most preferred host in that list, it and any equally or less
33982 preferred hosts are removed before the sublist is inserted into the main list.
33983 </para>
33984 <para>
33985 If the local host is the most preferred host in the MX list, what happens
33986 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
33987 is not the first item (that is, there are previous hosts in the main list),
33988 Exim discards this name and any subsequent items in the main list.
33989 </para>
33990 <para>
33991 If the MX item is first in the list of hosts, and the local host is the
33992 most preferred host, what happens is controlled by the <option>self</option> option of the
33993 router.
33994 </para>
33995 <para>
33996 DNS failures when lookup up the MX records are treated in the same way as DNS
33997 failures when looking up IP addresses: <option>pass_on_timeout</option> and
33998 <option>host_find_failed</option> are used when relevant.
33999 </para>
34000 <para>
34001 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
34002 whether obtained from an MX lookup or not.
34003 </para>
34004 </section>
34005 <section id="SECThowoptused">
34006 <title>How the options are used</title>
34007 <para>
34008 The options are a sequence of words; in practice no more than three are ever
34009 present. One of the words can be the name of a transport; this overrides the
34010 <option>transport</option> option on the router for this particular routing rule only. The
34011 other words (if present) control randomization of the list of hosts on a
34012 per-rule basis, and how the IP addresses of the hosts are to be found when
34013 routing to a remote transport. These options are as follows:
34014 </para>
34015 <itemizedlist>
34016 <listitem>
34017 <para>
34018 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
34019 setting of <option>hosts_randomize</option> for this routing rule only.
34020 </para>
34021 </listitem>
34022 <listitem>
34023 <para>
34024 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
34025 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
34026 </para>
34027 </listitem>
34028 <listitem>
34029 <para>
34030 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
34031 find IP addresses. This function may ultimately cause a DNS lookup, but it may
34032 also look in <filename>/etc/hosts</filename> or other sources of information.
34033 </para>
34034 </listitem>
34035 <listitem>
34036 <para>
34037 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
34038 no address records are found. If there is a temporary DNS error (such as a
34039 timeout), delivery is deferred.
34040 </para>
34041 </listitem>
34042 </itemizedlist>
34043 <para>
34044 For example:
34045 </para>
34046 <literallayout class="monospaced">
34047 route_list = domain1  host1:host2:host3  randomize bydns;\
34048              domain2  host4:host5
34049 </literallayout>
34050 <para>
34051 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
34052 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
34053 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
34054 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
34055 call.
34056 </para>
34057 <para>
34058 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
34059 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
34060 instead of TRY_AGAIN. That is why the default action is to try a DNS
34061 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
34062 function called.
34063 </para>
34064 <para>
34065 If no IP address for a host can be found, what happens is controlled by the
34066 <option>host_find_failed</option> option.
34067 </para>
34068 <para>
34069 <indexterm role="variable">
34070 <primary><varname>$host</varname></primary>
34071 </indexterm>
34072 When an address is routed to a local transport, IP addresses are not looked up.
34073 The host list is passed to the transport in the <varname>$host</varname> variable.
34074 </para>
34075 </section>
34076 <section id="SECID123">
34077 <title>Manualroute examples</title>
34078 <para>
34079 In some of the examples that follow, the presence of the <option>remote_smtp</option>
34080 transport, as defined in the default configuration file, is assumed:
34081 </para>
34082 <itemizedlist>
34083 <listitem>
34084 <para>
34085 <indexterm role="concept">
34086 <primary>smart host</primary>
34087 <secondary>example router</secondary>
34088 </indexterm>
34089 The <command>manualroute</command> router can be used to forward all external mail to a
34090 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
34091 named domain list that contains your local domains, for example:
34092 </para>
34093 <literallayout class="monospaced">
34094 domainlist local_domains = my.domain.example
34095 </literallayout>
34096 <para>
34097 You can arrange for all other domains to be routed to a smart host by making
34098 your first router something like this:
34099 </para>
34100 <literallayout class="monospaced">
34101 smart_route:
34102   driver = manualroute
34103   domains = !+local_domains
34104   transport = remote_smtp
34105   route_list = * smarthost.ref.example
34106 </literallayout>
34107 <para>
34108 This causes all non-local addresses to be sent to the single host
34109 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
34110 they are tried in order
34111 (but you can use <option>hosts_randomize</option> to vary the order each time).
34112 Another way of configuring the same thing is this:
34113 </para>
34114 <literallayout class="monospaced">
34115 smart_route:
34116   driver = manualroute
34117   transport = remote_smtp
34118   route_list = !+local_domains  smarthost.ref.example
34119 </literallayout>
34120 <para>
34121 There is no difference in behaviour between these two routers as they stand.
34122 However, they behave differently if <option>no_more</option> is added to them. In the first
34123 example, the router is skipped if the domain does not match the <option>domains</option>
34124 precondition; the following router is always tried. If the router runs, it
34125 always matches the domain and so can never decline. Therefore, <option>no_more</option>
34126 would have no effect. In the second case, the router is never skipped; it
34127 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
34128 <option>no_more</option> would prevent subsequent routers from running.
34129 </para>
34130 </listitem>
34131 <listitem>
34132 <para>
34133 <indexterm role="concept">
34134 <primary>mail hub example</primary>
34135 </indexterm>
34136 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
34137 records in the DNS and delivers it via its own private routing mechanism. Often
34138 the final destinations are behind a firewall, with the mail hub being the one
34139 machine that can connect to machines both inside and outside the firewall. The
34140 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
34141 to the correct hosts. For a small number of domains, the routing can be inline,
34142 using the <option>route_list</option> option, but for a larger number a file or database
34143 lookup is easier to manage.
34144 </para>
34145 <para>
34146 If the domain names are in fact the names of the machines to which the mail is
34147 to be sent by the mail hub, the configuration can be quite simple. For
34148 example:
34149 </para>
34150 <literallayout class="monospaced">
34151 hub_route:
34152   driver = manualroute
34153   transport = remote_smtp
34154   route_list = *.rhodes.tvs.example  $domain
34155 </literallayout>
34156 <para>
34157 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
34158 whose names are the same as the mail domains. A similar approach can be taken
34159 if the host name can be obtained from the domain name by a string manipulation
34160 that the expansion facilities can handle. Otherwise, a lookup based on the
34161 domain can be used to find the host:
34162 </para>
34163 <literallayout class="monospaced">
34164 through_firewall:
34165   driver = manualroute
34166   transport = remote_smtp
34167   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
34168 </literallayout>
34169 <para>
34170 The result of the lookup must be the name or IP address of the host (or
34171 hosts) to which the address is to be routed. If the lookup fails, the route
34172 data is empty, causing the router to decline. The address then passes to the
34173 next router.
34174 </para>
34175 </listitem>
34176 <listitem>
34177 <para>
34178 <indexterm role="concept">
34179 <primary>batched SMTP output example</primary>
34180 </indexterm>
34181 <indexterm role="concept">
34182 <primary>SMTP</primary>
34183 <secondary>batched outgoing; example</secondary>
34184 </indexterm>
34185 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
34186 SMTP format for onward transportation by some other means. This is one way of
34187 storing mail for a dial-up host when it is not connected. The route list entry
34188 can be as simple as a single domain name in a configuration like this:
34189 </para>
34190 <literallayout class="monospaced">
34191 save_in_file:
34192   driver = manualroute
34193   transport = batchsmtp_appendfile
34194   route_list = saved.domain.example
34195 </literallayout>
34196 <para>
34197 though often a pattern is used to pick up more than one domain. If there are
34198 several domains or groups of domains with different transport requirements,
34199 different transports can be listed in the routing information:
34200 </para>
34201 <literallayout class="monospaced">
34202 save_in_file:
34203   driver = manualroute
34204   route_list = \
34205     *.saved.domain1.example  $domain  batch_appendfile; \
34206     *.saved.domain2.example  \
34207       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
34208       batch_pipe
34209 </literallayout>
34210 <para>
34211 <indexterm role="variable">
34212 <primary><varname>$domain</varname></primary>
34213 </indexterm>
34214 <indexterm role="variable">
34215 <primary><varname>$host</varname></primary>
34216 </indexterm>
34217 The first of these just passes the domain in the <varname>$host</varname> variable, which
34218 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
34219 file lookup to find a value to pass, causing the router to decline to handle
34220 the address if the lookup fails.
34221 </para>
34222 </listitem>
34223 <listitem>
34224 <para>
34225 <indexterm role="concept">
34226 <primary>UUCP</primary>
34227 <secondary>example of router for</secondary>
34228 </indexterm>
34229 Routing mail directly to UUCP software is a specific case of the use of
34230 <command>manualroute</command> in a gateway to another mail environment. This is an example of
34231 one way it can be done:
34232 </para>
34233 <literallayout class="monospaced">
34234 # Transport
34235 uucp:
34236   driver = pipe
34237   user = nobody
34238   command = /usr/local/bin/uux -r - \
34239     ${substr_-5:$host}!rmail ${local_part}
34240   return_fail_output = true
34241
34242 # Router
34243 uucphost:
34244   transport = uucp
34245   driver = manualroute
34246   route_data = \
34247     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
34248 </literallayout>
34249 <para>
34250 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
34251 </para>
34252 <literallayout class="monospaced">
34253 darksite.ethereal.example:           darksite.UUCP
34254 </literallayout>
34255 <para>
34256 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
34257 makes clear the distinction between the domain name
34258 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
34259 </para>
34260 </listitem>
34261 </itemizedlist>
34262 <para>
34263 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
34264 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
34265 </para>
34266 </section>
34267 </chapter>
34268
34269 <chapter id="CHAPdriverlast">
34270 <title>The queryprogram router</title>
34271 <para>
34272 <indexterm role="concept" id="IIDquerou1" class="startofrange">
34273 <primary><command>queryprogram</command> router</primary>
34274 </indexterm>
34275 <indexterm role="concept" id="IIDquerou2" class="startofrange">
34276 <primary>routers</primary>
34277 <secondary><command>queryprogram</command></secondary>
34278 </indexterm>
34279 <indexterm role="concept">
34280 <primary>routing</primary>
34281 <secondary>by external program</secondary>
34282 </indexterm>
34283 The <command>queryprogram</command> router routes an address by running an external command
34284 and acting on its output. This is an expensive way to route, and is intended
34285 mainly for use in lightly-loaded systems, or for performing experiments.
34286 However, if it is possible to use the precondition options (<option>domains</option>,
34287 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
34288 be used in special cases, even on a busy host. There are the following private
34289 options:
34290 <indexterm role="concept">
34291 <primary>options</primary>
34292 <secondary><command>queryprogram</command> router</secondary>
34293 </indexterm>
34294 </para>
34295 <para>
34296 <indexterm role="option">
34297 <primary><option>command</option></primary>
34298 </indexterm>
34299 </para>
34300 <informaltable frame="all">
34301 <tgroup cols="4" colsep="0" rowsep="0">
34302 <colspec colwidth="8*" align="left"/>
34303 <colspec colwidth="6*" align="center"/>
34304 <colspec colwidth="6*" align="center"/>
34305 <colspec colwidth="6*" align="right"/>
34306 <tbody>
34307 <row>
34308 <entry><option>command</option></entry>
34309 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34310 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34311 <entry>Default: <emphasis>unset</emphasis></entry>
34312 </row>
34313 </tbody>
34314 </tgroup>
34315 </informaltable>
34316 <para>
34317 This option must be set. It specifies the command that is to be run. The
34318 command is split up into a command name and arguments, and then each is
34319 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
34320 <xref linkend="CHAPpipetransport"/>).
34321 </para>
34322 <para>
34323 <indexterm role="option">
34324 <primary><option>command_group</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>command_group</option></entry>
34336 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34337 <entry>Type: <emphasis>string</emphasis></entry>
34338 <entry>Default: <emphasis>unset</emphasis></entry>
34339 </row>
34340 </tbody>
34341 </tgroup>
34342 </informaltable>
34343 <para>
34344 <indexterm role="concept">
34345 <primary>gid (group id)</primary>
34346 <secondary>in <command>queryprogram</command> router</secondary>
34347 </indexterm>
34348 This option specifies a gid to be set when running the command while routing an
34349 address for deliver. It must be set if <option>command_user</option> specifies a numerical
34350 uid. If it begins with a digit, it is interpreted as the numerical value of the
34351 gid. Otherwise it is looked up using <function>getgrnam()</function>.
34352 </para>
34353 <para>
34354 <indexterm role="option">
34355 <primary><option>command_user</option></primary>
34356 </indexterm>
34357 </para>
34358 <informaltable frame="all">
34359 <tgroup cols="4" colsep="0" rowsep="0">
34360 <colspec colwidth="8*" align="left"/>
34361 <colspec colwidth="6*" align="center"/>
34362 <colspec colwidth="6*" align="center"/>
34363 <colspec colwidth="6*" align="right"/>
34364 <tbody>
34365 <row>
34366 <entry><option>command_user</option></entry>
34367 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34368 <entry>Type: <emphasis>string</emphasis></entry>
34369 <entry>Default: <emphasis>unset</emphasis></entry>
34370 </row>
34371 </tbody>
34372 </tgroup>
34373 </informaltable>
34374 <para>
34375 <indexterm role="concept">
34376 <primary>uid (user id)</primary>
34377 <secondary>for <command>queryprogram</command></secondary>
34378 </indexterm>
34379 This option must be set. It specifies the uid which is set when running the
34380 command while routing an address for delivery. If the value begins with a digit,
34381 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
34382 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
34383 not set, a value for the gid also.
34384 </para>
34385 <para>
34386 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
34387 root, which it does during a normal delivery in a conventional configuration.
34388 However, when an address is being verified during message reception, Exim is
34389 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
34390 is called from a non-root process, Exim cannot change uid or gid before running
34391 the command. In this circumstance the command runs under the current uid and
34392 gid.
34393 </para>
34394 <para>
34395 <indexterm role="option">
34396 <primary><option>current_directory</option></primary>
34397 </indexterm>
34398 </para>
34399 <informaltable frame="all">
34400 <tgroup cols="4" colsep="0" rowsep="0">
34401 <colspec colwidth="8*" align="left"/>
34402 <colspec colwidth="6*" align="center"/>
34403 <colspec colwidth="6*" align="center"/>
34404 <colspec colwidth="6*" align="right"/>
34405 <tbody>
34406 <row>
34407 <entry><option>current_directory</option></entry>
34408 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34409 <entry>Type: <emphasis>string</emphasis></entry>
34410 <entry>Default: <emphasis>/</emphasis></entry>
34411 </row>
34412 </tbody>
34413 </tgroup>
34414 </informaltable>
34415 <para>
34416 This option specifies an absolute path which is made the current directory
34417 before running the command.
34418 </para>
34419 <para>
34420 <indexterm role="option">
34421 <primary><option>timeout</option></primary>
34422 </indexterm>
34423 </para>
34424 <informaltable frame="all">
34425 <tgroup cols="4" colsep="0" rowsep="0">
34426 <colspec colwidth="8*" align="left"/>
34427 <colspec colwidth="6*" align="center"/>
34428 <colspec colwidth="6*" align="center"/>
34429 <colspec colwidth="6*" align="right"/>
34430 <tbody>
34431 <row>
34432 <entry><option>timeout</option></entry>
34433 <entry>Use: <emphasis>queryprogram</emphasis></entry>
34434 <entry>Type: <emphasis>time</emphasis></entry>
34435 <entry>Default: <emphasis>1h</emphasis></entry>
34436 </row>
34437 </tbody>
34438 </tgroup>
34439 </informaltable>
34440 <para>
34441 If the command does not complete within the timeout period, its process group
34442 is killed and the message is frozen. A value of zero time specifies no
34443 timeout.
34444 </para>
34445 <para>
34446 The standard output of the command is connected to a pipe, which is read when
34447 the command terminates. It should consist of a single line of output,
34448 containing up to five fields, separated by white space. The maximum length of
34449 the line is 1023 characters. Longer lines are silently truncated. The first
34450 field is one of the following words (case-insensitive):
34451 </para>
34452 <itemizedlist>
34453 <listitem>
34454 <para>
34455 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
34456 below).
34457 </para>
34458 </listitem>
34459 <listitem>
34460 <para>
34461 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
34462 <option>no_more</option> is set.
34463 </para>
34464 </listitem>
34465 <listitem>
34466 <para>
34467 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
34468 subsequent text on the line is an error message. If the router is run as part
34469 of address verification during an incoming SMTP message, the message is
34470 included in the SMTP response.
34471 </para>
34472 </listitem>
34473 <listitem>
34474 <para>
34475 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
34476 subsequent text on the line is an error message which is logged. It is not
34477 included in any SMTP response.
34478 </para>
34479 </listitem>
34480 <listitem>
34481 <para>
34482 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
34483 </para>
34484 </listitem>
34485 <listitem>
34486 <para>
34487 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
34488 <option>pass_router</option>), overriding <option>no_more</option>.
34489 </para>
34490 </listitem>
34491 <listitem>
34492 <para>
34493 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
34494 new addresses, which are routed independently, starting with the first router,
34495 or the router specified by <option>redirect_router</option>, if set.
34496 </para>
34497 </listitem>
34498 </itemizedlist>
34499 <para>
34500 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
34501 number of keyed data values, as follows (split into two lines here, to fit on
34502 the page):
34503 </para>
34504 <literallayout class="monospaced">
34505 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
34506 LOOKUP=byname|bydns DATA=&lt;text&gt;
34507 </literallayout>
34508 <para>
34509 The data items can be given in any order, and all are optional. If no transport
34510 is included, the transport specified by the generic <option>transport</option> option is
34511 used. The list of hosts and the lookup type are needed only if the transport is
34512 an <command>smtp</command> transport that does not itself supply a list of hosts.
34513 </para>
34514 <para>
34515 The format of the list of hosts is the same as for the <command>manualroute</command> router.
34516 As well as host names and IP addresses with optional port numbers, as described
34517 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
34518 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
34519 (see section <xref linkend="SECThostshowused"/>).
34520 </para>
34521 <para>
34522 If the lookup type is not specified, Exim behaves as follows when trying to
34523 find an IP address for each host: First, a DNS lookup is done. If this yields
34524 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
34525 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
34526 result of the lookup is the result of that call.
34527 </para>
34528 <para>
34529 <indexterm role="variable">
34530 <primary><varname>$address_data</varname></primary>
34531 </indexterm>
34532 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
34533 variable. For example, this return line
34534 </para>
34535 <literallayout class="monospaced">
34536 accept hosts=x1.y.example:x2.y.example data="rule1"
34537 </literallayout>
34538 <para>
34539 routes the address to the default transport, passing a list of two hosts. When
34540 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
34541 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
34542 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
34543 </para>
34544 </chapter>
34545
34546 <chapter id="CHAPredirect">
34547 <title>The redirect router</title>
34548 <para>
34549 <indexterm role="concept" id="IIDredrou1" class="startofrange">
34550 <primary><command>redirect</command> router</primary>
34551 </indexterm>
34552 <indexterm role="concept" id="IIDredrou2" class="startofrange">
34553 <primary>routers</primary>
34554 <secondary><command>redirect</command></secondary>
34555 </indexterm>
34556 <indexterm role="concept">
34557 <primary>alias file</primary>
34558 <secondary>in a <command>redirect</command> router</secondary>
34559 </indexterm>
34560 <indexterm role="concept">
34561 <primary>address redirection</primary>
34562 <secondary><command>redirect</command> router</secondary>
34563 </indexterm>
34564 The <command>redirect</command> router handles several kinds of address redirection. Its most
34565 common uses are for resolving local part aliases from a central alias file
34566 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
34567 files, but it has many other potential uses. The incoming address can be
34568 redirected in several different ways:
34569 </para>
34570 <itemizedlist>
34571 <listitem>
34572 <para>
34573 It can be replaced by one or more new addresses which are themselves routed
34574 independently.
34575 </para>
34576 </listitem>
34577 <listitem>
34578 <para>
34579 It can be routed to be delivered to a given file or directory.
34580 </para>
34581 </listitem>
34582 <listitem>
34583 <para>
34584 It can be routed to be delivered to a specified pipe command.
34585 </para>
34586 </listitem>
34587 <listitem>
34588 <para>
34589 It can cause an automatic reply to be generated.
34590 </para>
34591 </listitem>
34592 <listitem>
34593 <para>
34594 It can be forced to fail, optionally with a custom error message.
34595 </para>
34596 </listitem>
34597 <listitem>
34598 <para>
34599 It can be temporarily deferred, optionally with a custom message.
34600 </para>
34601 </listitem>
34602 <listitem>
34603 <para>
34604 It can be discarded.
34605 </para>
34606 </listitem>
34607 </itemizedlist>
34608 <para>
34609 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
34610 However, there are some private options which define transports for delivery to
34611 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
34612 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
34613 </para>
34614 <section id="SECID124">
34615 <title>Redirection data</title>
34616 <para>
34617 The router operates by interpreting a text string which it obtains either by
34618 expanding the contents of the <option>data</option> option, or by reading the entire
34619 contents of a file whose name is given in the <option>file</option> option. These two
34620 options are mutually exclusive. The first is commonly used for handling system
34621 aliases, in a configuration like this:
34622 </para>
34623 <literallayout class="monospaced">
34624 system_aliases:
34625   driver = redirect
34626   data = ${lookup{$local_part}lsearch{/etc/aliases}}
34627 </literallayout>
34628 <para>
34629 If the lookup fails, the expanded string in this example is empty. When the
34630 expansion of <option>data</option> results in an empty string, the router declines. A forced
34631 expansion failure also causes the router to decline; other expansion failures
34632 cause delivery to be deferred.
34633 </para>
34634 <para>
34635 A configuration using <option>file</option> is commonly used for handling users&#x2019;
34636 <filename>.forward</filename> files, like this:
34637 </para>
34638 <literallayout class="monospaced">
34639 userforward:
34640   driver = redirect
34641   check_local_user
34642   file = $home/.forward
34643   no_verify
34644 </literallayout>
34645 <para>
34646 If the file does not exist, or causes no action to be taken (for example, it is
34647 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
34648 is not the case when the file contains syntactically valid items that happen to
34649 yield empty addresses, for example, items containing only RFC 2822 address
34650 comments.
34651 </para>
34652 </section>
34653 <section id="SECID125">
34654 <title>Forward files and address verification</title>
34655 <para>
34656 <indexterm role="concept">
34657 <primary>address redirection</primary>
34658 <secondary>while verifying</secondary>
34659 </indexterm>
34660 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
34661 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
34662 </para>
34663 <itemizedlist>
34664 <listitem>
34665 <para>
34666 When Exim is receiving an incoming SMTP message from a remote host, it is
34667 running under the Exim uid, not as root. Exim is unable to change uid to read
34668 the file as the user, and it may not be able to read it as the Exim user. So in
34669 practice the router may not be able to operate.
34670 </para>
34671 </listitem>
34672 <listitem>
34673 <para>
34674 However, even when the router can operate, the existence of a <filename>.forward</filename> file
34675 is unimportant when verifying an address. What should be checked is whether the
34676 local part is a valid user name or not. Cutting out the redirection processing
34677 saves some resources.
34678 </para>
34679 </listitem>
34680 </itemizedlist>
34681 </section>
34682 <section id="SECID126">
34683 <title>Interpreting redirection data</title>
34684 <para>
34685 <indexterm role="concept">
34686 <primary>Sieve filter</primary>
34687 <secondary>specifying in redirection data</secondary>
34688 </indexterm>
34689 <indexterm role="concept">
34690 <primary>filter</primary>
34691 <secondary>specifying in redirection data</secondary>
34692 </indexterm>
34693 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
34694 can be interpreted in two different ways:
34695 </para>
34696 <itemizedlist>
34697 <listitem>
34698 <para>
34699 If the <option>allow_filter</option> option is set true, and the data begins with the text
34700 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
34701 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
34702 respectively. Details of the syntax and semantics of filter files are described
34703 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
34704 document is intended for use by end users.
34705 </para>
34706 </listitem>
34707 <listitem>
34708 <para>
34709 Otherwise, the data must be a comma-separated list of redirection items, as
34710 described in the next section.
34711 </para>
34712 </listitem>
34713 </itemizedlist>
34714 <para>
34715 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
34716 in a non-filter redirection list must always be an absolute path. A filter may
34717 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
34718 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
34719 for the <command>appendfile</command> transport.
34720 </para>
34721 </section>
34722 <section id="SECTitenonfilred">
34723 <title>Items in a non-filter redirection list</title>
34724 <para>
34725 <indexterm role="concept">
34726 <primary>address redirection</primary>
34727 <secondary>non-filter list items</secondary>
34728 </indexterm>
34729 When the redirection data is not an Exim or Sieve filter, for example, if it
34730 comes from a conventional alias or forward file, it consists of a list of
34731 addresses, file names, pipe commands, or certain special items (see section
34732 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
34733 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
34734 depending on their default values. The items in the list are separated by
34735 commas or newlines.
34736 If a comma is required in an item, the entire item must be enclosed in double
34737 quotes.
34738 </para>
34739 <para>
34740 Lines starting with a # character are comments, and are ignored, and # may
34741 also appear following a comma, in which case everything between the # and the
34742 next newline character is ignored.
34743 </para>
34744 <para>
34745 If an item is entirely enclosed in double quotes, these are removed. Otherwise
34746 double quotes are retained because some forms of mail address require their use
34747 (but never to enclose the entire address). In the following description,
34748 <quote>item</quote> refers to what remains after any surrounding double quotes have been
34749 removed.
34750 </para>
34751 <para>
34752 <indexterm role="variable">
34753 <primary><varname>$local_part</varname></primary>
34754 </indexterm>
34755 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
34756 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
34757 of the <option>quote_local_part</option> expansion operator, in case the local part contains
34758 special characters. For example, to redirect all mail for the domain
34759 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
34760 setting:
34761 </para>
34762 <literallayout class="monospaced">
34763 data = ${quote_local_part:$local_part}@newdomain.example
34764 </literallayout>
34765 </section>
34766 <section id="SECTredlocmai">
34767 <title>Redirecting to a local mailbox</title>
34768 <para>
34769 <indexterm role="concept">
34770 <primary>routing</primary>
34771 <secondary>loops in</secondary>
34772 </indexterm>
34773 <indexterm role="concept">
34774 <primary>loop</primary>
34775 <secondary>while routing, avoidance of</secondary>
34776 </indexterm>
34777 <indexterm role="concept">
34778 <primary>address redirection</primary>
34779 <secondary>to local mailbox</secondary>
34780 </indexterm>
34781 A redirection item may safely be the same as the address currently under
34782 consideration. This does not cause a routing loop, because a router is
34783 automatically skipped if any ancestor of the address that is being processed
34784 is the same as the current address and was processed by the current router.
34785 Such an address is therefore passed to the following routers, so it is handled
34786 as if there were no redirection. When making this loop-avoidance test, the
34787 complete local part, including any prefix or suffix, is used.
34788 </para>
34789 <para>
34790 <indexterm role="concept">
34791 <primary>address redirection</primary>
34792 <secondary>local part without domain</secondary>
34793 </indexterm>
34794 Specifying the same local part without a domain is a common usage in personal
34795 filter files when the user wants to have messages delivered to the local
34796 mailbox and also forwarded elsewhere. For example, the user whose login is
34797 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
34798 </para>
34799 <literallayout class="monospaced">
34800 cleo, cleopatra@egypt.example
34801 </literallayout>
34802 <para>
34803 <indexterm role="concept">
34804 <primary>backslash in alias file</primary>
34805 </indexterm>
34806 <indexterm role="concept">
34807 <primary>alias file</primary>
34808 <secondary>backslash in</secondary>
34809 </indexterm>
34810 For compatibility with other MTAs, such unqualified local parts may be
34811 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
34812 it does make a difference if more than one domain is being handled
34813 synonymously.
34814 </para>
34815 <para>
34816 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
34817 2822 address that does not include a domain, the item is qualified using the
34818 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
34819 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
34820 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
34821 </para>
34822 <para>
34823 Care must be taken if there are alias names for local users.
34824 Consider an MTA handling a single local domain where the system alias file
34825 contains:
34826 </para>
34827 <literallayout class="monospaced">
34828 Sam.Reman: spqr
34829 </literallayout>
34830 <para>
34831 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
34832 messages in the local mailbox, and also forward copies elsewhere. He creates
34833 this forward file:
34834 </para>
34835 <literallayout class="monospaced">
34836 Sam.Reman, spqr@reme.elsewhere.example
34837 </literallayout>
34838 <para>
34839 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
34840 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
34841 second time round, because it has previously routed it,
34842 and the following routers presumably cannot handle the alias. The forward file
34843 should really contain
34844 </para>
34845 <literallayout class="monospaced">
34846 spqr, spqr@reme.elsewhere.example
34847 </literallayout>
34848 <para>
34849 but because this is such a common error, the <option>check_ancestor</option> option (see
34850 below) exists to provide a way to get round it. This is normally set on a
34851 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
34852 </para>
34853 </section>
34854 <section id="SECTspecitredli">
34855 <title>Special items in redirection lists</title>
34856 <para>
34857 In addition to addresses, the following types of item may appear in redirection
34858 lists (that is, in non-filter redirection data):
34859 </para>
34860 <itemizedlist>
34861 <listitem>
34862 <para>
34863 <indexterm role="concept">
34864 <primary>pipe</primary>
34865 <secondary>in redirection list</secondary>
34866 </indexterm>
34867 <indexterm role="concept">
34868 <primary>address redirection</primary>
34869 <secondary>to pipe</secondary>
34870 </indexterm>
34871 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
34872 as a valid RFC 2822 address that includes a domain. A transport for running the
34873 command must be specified by the <option>pipe_transport</option> option.
34874 Normally, either the router or the transport specifies a user and a group under
34875 which to run the delivery. The default is to use the Exim user and group.
34876 </para>
34877 <para>
34878 Single or double quotes can be used for enclosing the individual arguments of
34879 the pipe command; no interpretation of escapes is done for single quotes. If
34880 the command contains a comma character, it is necessary to put the whole item
34881 in double quotes, for example:
34882 </para>
34883 <literallayout class="monospaced">
34884 "|/some/command ready,steady,go"
34885 </literallayout>
34886 <para>
34887 since items in redirection lists are terminated by commas. Do not, however,
34888 quote just the command. An item such as
34889 </para>
34890 <literallayout class="monospaced">
34891 |"/some/command ready,steady,go"
34892 </literallayout>
34893 <para>
34894 is interpreted as a pipe with a rather strange command name, and no arguments.
34895 </para>
34896 <para revisionflag="changed">
34897 Note that the above example assumes that the text comes from a lookup source
34898 of some sort, so that the quotes are part of the data.  If composing a
34899 redirect router with a <option>data</option> option directly specifying this command, the
34900 quotes will be used by the configuration parser to define the extent of one
34901 string, but will not be passed down into the redirect router itself.  There
34902 are two main approaches to get around this: escape quotes to be part of the
34903 data itself, or avoid using this mechanism and instead create a custom
34904 transport with the <option>command</option> option set and reference that transport from
34905 an <option>accept</option> router.
34906 </para>
34907 </listitem>
34908 <listitem>
34909 <para>
34910 <indexterm role="concept">
34911 <primary>file</primary>
34912 <secondary>in redirection list</secondary>
34913 </indexterm>
34914 <indexterm role="concept">
34915 <primary>address redirection</primary>
34916 <secondary>to file</secondary>
34917 </indexterm>
34918 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
34919 parse as a valid RFC 2822 address that includes a domain. For example,
34920 </para>
34921 <literallayout class="monospaced">
34922 /home/world/minbari
34923 </literallayout>
34924 <para>
34925 is treated as a file name, but
34926 </para>
34927 <literallayout class="monospaced">
34928 /s=molari/o=babylon/@x400gate.way
34929 </literallayout>
34930 <para>
34931 is treated as an address. For a file name, a transport must be specified using
34932 the <option>file_transport</option> option. However, if the generated path name ends with a
34933 forward slash character, it is interpreted as a directory name rather than a
34934 file name, and <option>directory_transport</option> is used instead.
34935 </para>
34936 <para>
34937 Normally, either the router or the transport specifies a user and a group under
34938 which to run the delivery. The default is to use the Exim user and group.
34939 </para>
34940 <para>
34941 <indexterm role="concept">
34942 <primary><filename>/dev/null</filename></primary>
34943 </indexterm>
34944 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
34945 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
34946 instead of a transport name. In this case the user and group are not used.
34947 </para>
34948 </listitem>
34949 <listitem>
34950 <para>
34951 <indexterm role="concept">
34952 <primary>included address list</primary>
34953 </indexterm>
34954 <indexterm role="concept">
34955 <primary>address redirection</primary>
34956 <secondary>included external list</secondary>
34957 </indexterm>
34958 If an item is of the form
34959 </para>
34960 <literallayout class="monospaced">
34961 :include:&lt;path name&gt;
34962 </literallayout>
34963 <para>
34964 a list of further items is taken from the given file and included at that
34965 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
34966 out-of-line addition to the list. The items in the included list are separated
34967 by commas or newlines and are not subject to expansion. If this is the first
34968 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
34969 the alias name. This example is incorrect:
34970 </para>
34971 <literallayout class="monospaced">
34972 list1    :include:/opt/lists/list1
34973 </literallayout>
34974 <para>
34975 It must be given as
34976 </para>
34977 <literallayout class="monospaced">
34978 list1:   :include:/opt/lists/list1
34979 </literallayout>
34980 </listitem>
34981 <listitem>
34982 <para>
34983 <indexterm role="concept">
34984 <primary>address redirection</primary>
34985 <secondary>to black hole</secondary>
34986 </indexterm>
34987 Sometimes you want to throw away mail to a particular local part. Making the
34988 <option>data</option> option expand to an empty string does not work, because that causes
34989 the router to decline. Instead, the alias item
34990 <indexterm role="concept">
34991 <primary>black hole</primary>
34992 </indexterm>
34993 <indexterm role="concept">
34994 <primary>abandoning mail</primary>
34995 </indexterm>
34996 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
34997 done, and no error message is generated. This has the same effect as specifing
34998 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
34999 </para>
35000 <para>
35001 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
35002 delivery is done for the original local part, even if other redirection items
35003 are present. If you are generating a multi-item list (for example, by reading a
35004 database) and need the ability to provide a no-op item, you must use
35005 <filename>/dev/null</filename>.
35006 </para>
35007 </listitem>
35008 <listitem>
35009 <para>
35010 <indexterm role="concept">
35011 <primary>delivery</primary>
35012 <secondary>forcing failure</secondary>
35013 </indexterm>
35014 <indexterm role="concept">
35015 <primary>delivery</primary>
35016 <secondary>forcing deferral</secondary>
35017 </indexterm>
35018 <indexterm role="concept">
35019 <primary>failing delivery</primary>
35020 <secondary>forcing</secondary>
35021 </indexterm>
35022 <indexterm role="concept">
35023 <primary>deferred delivery, forcing</primary>
35024 </indexterm>
35025 <indexterm role="concept">
35026 <primary>customizing</primary>
35027 <secondary>failure message</secondary>
35028 </indexterm>
35029 An attempt to deliver a particular address can be deferred or forced to fail by
35030 redirection items of the form
35031 </para>
35032 <literallayout class="monospaced">
35033 :defer:
35034 :fail:
35035 </literallayout>
35036 <para>
35037 respectively. When a redirection list contains such an item, it applies
35038 to the entire redirection; any other items in the list are ignored. Any
35039 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
35040 associated with the failure. For example, an alias file might contain:
35041 </para>
35042 <literallayout class="monospaced">
35043 X.Employee:  :fail: Gone away, no forwarding address
35044 </literallayout>
35045 <para>
35046 In the case of an address that is being verified from an ACL or as the subject
35047 of a
35048 <indexterm role="concept">
35049 <primary>VRFY</primary>
35050 <secondary>error text, display of</secondary>
35051 </indexterm>
35052 VRFY command, the text is included in the SMTP error response by
35053 default.
35054 <indexterm role="concept">
35055 <primary>EXPN</primary>
35056 <secondary>error text, display of</secondary>
35057 </indexterm>
35058 The text is not included in the response to an EXPN command. In non-SMTP cases
35059 the text is included in the error message that Exim generates.
35060 </para>
35061 <para>
35062 <indexterm role="concept">
35063 <primary>SMTP</primary>
35064 <secondary>error codes</secondary>
35065 </indexterm>
35066 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
35067 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
35068 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
35069 followed by a space, and the very first digit is the same as the default error
35070 code, the code from the message is used instead. If the very first digit is
35071 incorrect, a panic error is logged, and the default code is used. You can
35072 suppress the use of the supplied code in a redirect router by setting the
35073 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
35074 ignored.
35075 </para>
35076 <para>
35077 <indexterm role="variable">
35078 <primary><varname>$acl_verify_message</varname></primary>
35079 </indexterm>
35080 In an ACL, an explicitly provided message overrides the default, but the
35081 default message is available in the variable <varname>$acl_verify_message</varname> and can
35082 therefore be included in a custom message if this is desired.
35083 </para>
35084 <para>
35085 Normally the error text is the rest of the redirection list &ndash; a comma does
35086 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
35087 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
35088 as part of the continuation process, but they may exist in other kinds of
35089 lookup and in <emphasis>:include:</emphasis> files.
35090 </para>
35091 <para>
35092 During routing for message delivery (as opposed to verification), a redirection
35093 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
35094 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
35095 subsequent delivery attempt can happen at a later time. If an address is
35096 deferred for too long, it will ultimately fail, because the normal retry
35097 rules still apply.
35098 </para>
35099 </listitem>
35100 <listitem>
35101 <para>
35102 <indexterm role="concept">
35103 <primary>alias file</primary>
35104 <secondary>exception to default</secondary>
35105 </indexterm>
35106 Sometimes it is useful to use a single-key search type with a default (see
35107 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
35108 for exceptions to the default. These can be handled by aliasing them to
35109 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
35110 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
35111 results in an empty redirection list has the same effect.
35112 </para>
35113 </listitem>
35114 </itemizedlist>
35115 </section>
35116 <section id="SECTdupaddr">
35117 <title>Duplicate addresses</title>
35118 <para>
35119 <indexterm role="concept">
35120 <primary>duplicate addresses</primary>
35121 </indexterm>
35122 <indexterm role="concept">
35123 <primary>address duplicate, discarding</primary>
35124 </indexterm>
35125 <indexterm role="concept">
35126 <primary>pipe</primary>
35127 <secondary>duplicated</secondary>
35128 </indexterm>
35129 Exim removes duplicate addresses from the list to which it is delivering, so as
35130 to deliver just one copy to each address. This does not apply to deliveries
35131 routed to pipes by different immediate parent addresses, but an indirect
35132 aliasing scheme of the type
35133 </para>
35134 <literallayout class="monospaced">
35135 pipe:       |/some/command $local_part
35136 localpart1: pipe
35137 localpart2: pipe
35138 </literallayout>
35139 <para>
35140 does not work with a message that is addressed to both local parts, because
35141 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
35142 discarded as being the same as a previously handled address. However, a scheme
35143 such as
35144 </para>
35145 <literallayout class="monospaced">
35146 localpart1: |/some/command $local_part
35147 localpart2: |/some/command $local_part
35148 </literallayout>
35149 <para>
35150 does result in two different pipe deliveries, because the immediate parents of
35151 the pipes are distinct.
35152 </para>
35153 </section>
35154 <section id="SECID128">
35155 <title>Repeated redirection expansion</title>
35156 <para>
35157 <indexterm role="concept">
35158 <primary>repeated redirection expansion</primary>
35159 </indexterm>
35160 <indexterm role="concept">
35161 <primary>address redirection</primary>
35162 <secondary>repeated for each delivery attempt</secondary>
35163 </indexterm>
35164 When a message cannot be delivered to all of its recipients immediately,
35165 leading to two or more delivery attempts, redirection expansion is carried out
35166 afresh each time for those addresses whose children were not all previously
35167 delivered. If redirection is being used as a mailing list, this can lead to new
35168 members of the list receiving copies of old messages. The <option>one_time</option> option
35169 can be used to avoid this.
35170 </para>
35171 </section>
35172 <section id="SECID129">
35173 <title>Errors in redirection lists</title>
35174 <para>
35175 <indexterm role="concept">
35176 <primary>address redirection</primary>
35177 <secondary>errors</secondary>
35178 </indexterm>
35179 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
35180 error is skipped, and an entry is written to the main log. This may be useful
35181 for mailing lists that are automatically managed. Otherwise, if an error is
35182 detected while generating the list of new addresses, the original address is
35183 deferred. See also <option>syntax_errors_to</option>.
35184 </para>
35185 </section>
35186 <section id="SECID130">
35187 <title>Private options for the redirect router</title>
35188 <para>
35189 <indexterm role="concept">
35190 <primary>options</primary>
35191 <secondary><command>redirect</command> router</secondary>
35192 </indexterm>
35193 The private options for the <command>redirect</command> router are as follows:
35194 </para>
35195 <para>
35196 <indexterm role="option">
35197 <primary><option>allow_defer</option></primary>
35198 </indexterm>
35199 </para>
35200 <informaltable frame="all">
35201 <tgroup cols="4" colsep="0" rowsep="0">
35202 <colspec colwidth="8*" align="left"/>
35203 <colspec colwidth="6*" align="center"/>
35204 <colspec colwidth="6*" align="center"/>
35205 <colspec colwidth="6*" align="right"/>
35206 <tbody>
35207 <row>
35208 <entry><option>allow_defer</option></entry>
35209 <entry>Use: <emphasis>redirect</emphasis></entry>
35210 <entry>Type: <emphasis>boolean</emphasis></entry>
35211 <entry>Default: <emphasis>false</emphasis></entry>
35212 </row>
35213 </tbody>
35214 </tgroup>
35215 </informaltable>
35216 <para>
35217 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
35218 data, or the <option>defer</option> command in an Exim filter file.
35219 </para>
35220 <para>
35221 <indexterm role="option">
35222 <primary><option>allow_fail</option></primary>
35223 </indexterm>
35224 </para>
35225 <informaltable frame="all">
35226 <tgroup cols="4" colsep="0" rowsep="0">
35227 <colspec colwidth="8*" align="left"/>
35228 <colspec colwidth="6*" align="center"/>
35229 <colspec colwidth="6*" align="center"/>
35230 <colspec colwidth="6*" align="right"/>
35231 <tbody>
35232 <row>
35233 <entry><option>allow_fail</option></entry>
35234 <entry>Use: <emphasis>redirect</emphasis></entry>
35235 <entry>Type: <emphasis>boolean</emphasis></entry>
35236 <entry>Default: <emphasis>false</emphasis></entry>
35237 </row>
35238 </tbody>
35239 </tgroup>
35240 </informaltable>
35241 <para>
35242 <indexterm role="concept">
35243 <primary>failing delivery</primary>
35244 <secondary>from filter</secondary>
35245 </indexterm>
35246 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
35247 and the <option>fail</option> command may be used in an Exim filter file.
35248 </para>
35249 <para>
35250 <indexterm role="option">
35251 <primary><option>allow_filter</option></primary>
35252 </indexterm>
35253 </para>
35254 <informaltable frame="all">
35255 <tgroup cols="4" colsep="0" rowsep="0">
35256 <colspec colwidth="8*" align="left"/>
35257 <colspec colwidth="6*" align="center"/>
35258 <colspec colwidth="6*" align="center"/>
35259 <colspec colwidth="6*" align="right"/>
35260 <tbody>
35261 <row>
35262 <entry><option>allow_filter</option></entry>
35263 <entry>Use: <emphasis>redirect</emphasis></entry>
35264 <entry>Type: <emphasis>boolean</emphasis></entry>
35265 <entry>Default: <emphasis>false</emphasis></entry>
35266 </row>
35267 </tbody>
35268 </tgroup>
35269 </informaltable>
35270 <para>
35271 <indexterm role="concept">
35272 <primary>filter</primary>
35273 <secondary>enabling use of</secondary>
35274 </indexterm>
35275 <indexterm role="concept">
35276 <primary>Sieve filter</primary>
35277 <secondary>enabling use of</secondary>
35278 </indexterm>
35279 Setting this option allows Exim to interpret redirection data that starts with
35280 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
35281 are some features of Exim filter files that some administrators may wish to
35282 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
35283 </para>
35284 <para>
35285 It is also possible to lock out Exim filters or Sieve filters while allowing
35286 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
35287 </para>
35288 <para>
35289 The filter is run using the uid and gid set by the generic <option>user</option> and
35290 <option>group</option> options. These take their defaults from the password data if
35291 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
35292 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
35293 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
35294 </para>
35295 <para>
35296 <indexterm role="option">
35297 <primary><option>allow_freeze</option></primary>
35298 </indexterm>
35299 </para>
35300 <informaltable frame="all">
35301 <tgroup cols="4" colsep="0" rowsep="0">
35302 <colspec colwidth="8*" align="left"/>
35303 <colspec colwidth="6*" align="center"/>
35304 <colspec colwidth="6*" align="center"/>
35305 <colspec colwidth="6*" align="right"/>
35306 <tbody>
35307 <row>
35308 <entry><option>allow_freeze</option></entry>
35309 <entry>Use: <emphasis>redirect</emphasis></entry>
35310 <entry>Type: <emphasis>boolean</emphasis></entry>
35311 <entry>Default: <emphasis>false</emphasis></entry>
35312 </row>
35313 </tbody>
35314 </tgroup>
35315 </informaltable>
35316 <para>
35317 <indexterm role="concept">
35318 <primary>freezing messages</primary>
35319 <secondary>allowing in filter</secondary>
35320 </indexterm>
35321 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
35322 This command is more normally encountered in system filters, and is disabled by
35323 default for redirection filters because it isn&#x2019;t something you usually want to
35324 let ordinary users do.
35325 </para>
35326 <para>
35327 <indexterm role="option">
35328 <primary><option>check_ancestor</option></primary>
35329 </indexterm>
35330 </para>
35331 <informaltable frame="all">
35332 <tgroup cols="4" colsep="0" rowsep="0">
35333 <colspec colwidth="8*" align="left"/>
35334 <colspec colwidth="6*" align="center"/>
35335 <colspec colwidth="6*" align="center"/>
35336 <colspec colwidth="6*" align="right"/>
35337 <tbody>
35338 <row>
35339 <entry><option>check_ancestor</option></entry>
35340 <entry>Use: <emphasis>redirect</emphasis></entry>
35341 <entry>Type: <emphasis>boolean</emphasis></entry>
35342 <entry>Default: <emphasis>false</emphasis></entry>
35343 </row>
35344 </tbody>
35345 </tgroup>
35346 </informaltable>
35347 <para>
35348 This option is concerned with handling generated addresses that are the same
35349 as some address in the list of redirection ancestors of the current address.
35350 Although it is turned off by default in the code, it is set in the default
35351 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
35352 for this use of the <command>redirect</command> router.
35353 </para>
35354 <para>
35355 When <option>check_ancestor</option> is set, if a generated address (including the domain)
35356 is the same as any ancestor of the current address, it is replaced by a copy of
35357 the current address. This helps in the case where local part A is aliased to B,
35358 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
35359 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
35360 <filename>&nbsp;jb/.forward</filename> contains:
35361 </para>
35362 <literallayout class="monospaced">
35363 \Joe.Bloggs, &lt;other item(s)&gt;
35364 </literallayout>
35365 <para>
35366 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
35367 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
35368 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
35369 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
35370 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
35371 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
35372 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
35373 original address. See also the <option>repeat_use</option> option below.
35374 </para>
35375 <para>
35376 <indexterm role="option">
35377 <primary><option>check_group</option></primary>
35378 </indexterm>
35379 </para>
35380 <informaltable frame="all">
35381 <tgroup cols="4" colsep="0" rowsep="0">
35382 <colspec colwidth="8*" align="left"/>
35383 <colspec colwidth="6*" align="center"/>
35384 <colspec colwidth="6*" align="center"/>
35385 <colspec colwidth="6*" align="right"/>
35386 <tbody>
35387 <row>
35388 <entry><option>check_group</option></entry>
35389 <entry>Use: <emphasis>redirect</emphasis></entry>
35390 <entry>Type: <emphasis>boolean</emphasis></entry>
35391 <entry>Default: <emphasis>see below</emphasis></entry>
35392 </row>
35393 </tbody>
35394 </tgroup>
35395 </informaltable>
35396 <para>
35397 When the <option>file</option> option is used, the group owner of the file is checked only
35398 when this option is set. The permitted groups are those listed in the
35399 <option>owngroups</option> option, together with the user&#x2019;s default group if
35400 <option>check_local_user</option> is set. If the file has the wrong group, routing is
35401 deferred. The default setting for this option is true if <option>check_local_user</option>
35402 is set and the <option>modemask</option> option permits the group write bit, or if the
35403 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
35404 </para>
35405 <para>
35406 <indexterm role="option">
35407 <primary><option>check_owner</option></primary>
35408 </indexterm>
35409 </para>
35410 <informaltable frame="all">
35411 <tgroup cols="4" colsep="0" rowsep="0">
35412 <colspec colwidth="8*" align="left"/>
35413 <colspec colwidth="6*" align="center"/>
35414 <colspec colwidth="6*" align="center"/>
35415 <colspec colwidth="6*" align="right"/>
35416 <tbody>
35417 <row>
35418 <entry><option>check_owner</option></entry>
35419 <entry>Use: <emphasis>redirect</emphasis></entry>
35420 <entry>Type: <emphasis>boolean</emphasis></entry>
35421 <entry>Default: <emphasis>see below</emphasis></entry>
35422 </row>
35423 </tbody>
35424 </tgroup>
35425 </informaltable>
35426 <para>
35427 When the <option>file</option> option is used, the owner of the file is checked only when
35428 this option is set. If <option>check_local_user</option> is set, the local user is
35429 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
35430 option. The default value for this option is true if <option>check_local_user</option> or
35431 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
35432 </para>
35433 <para>
35434 <indexterm role="option">
35435 <primary><option>data</option></primary>
35436 </indexterm>
35437 </para>
35438 <informaltable frame="all">
35439 <tgroup cols="4" colsep="0" rowsep="0">
35440 <colspec colwidth="8*" align="left"/>
35441 <colspec colwidth="6*" align="center"/>
35442 <colspec colwidth="6*" align="center"/>
35443 <colspec colwidth="6*" align="right"/>
35444 <tbody>
35445 <row>
35446 <entry><option>data</option></entry>
35447 <entry>Use: <emphasis>redirect</emphasis></entry>
35448 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35449 <entry>Default: <emphasis>unset</emphasis></entry>
35450 </row>
35451 </tbody>
35452 </tgroup>
35453 </informaltable>
35454 <para>
35455 This option is mutually exclusive with <option>file</option>. One or other of them must be
35456 set, but not both. The contents of <option>data</option> are expanded, and then used as the
35457 list of forwarding items, or as a set of filtering instructions. If the
35458 expansion is forced to fail, or the result is an empty string or a string that
35459 has no effect (consists entirely of comments), the router declines.
35460 </para>
35461 <para>
35462 When filtering instructions are used, the string must begin with <quote>#Exim
35463 filter</quote>, and all comments in the string, including this initial one, must be
35464 terminated with newline characters. For example:
35465 </para>
35466 <literallayout class="monospaced">
35467 data = #Exim filter\n\
35468        if $h_to: contains Exim then save $home/mail/exim endif
35469 </literallayout>
35470 <para>
35471 If you are reading the data from a database where newlines cannot be included,
35472 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
35473 choice into a newline.
35474 </para>
35475 <para>
35476 <indexterm role="option">
35477 <primary><option>directory_transport</option></primary>
35478 </indexterm>
35479 </para>
35480 <informaltable frame="all">
35481 <tgroup cols="4" colsep="0" rowsep="0">
35482 <colspec colwidth="8*" align="left"/>
35483 <colspec colwidth="6*" align="center"/>
35484 <colspec colwidth="6*" align="center"/>
35485 <colspec colwidth="6*" align="right"/>
35486 <tbody>
35487 <row>
35488 <entry><option>directory_transport</option></entry>
35489 <entry>Use: <emphasis>redirect</emphasis></entry>
35490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35491 <entry>Default: <emphasis>unset</emphasis></entry>
35492 </row>
35493 </tbody>
35494 </tgroup>
35495 </informaltable>
35496 <para>
35497 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
35498 ending with a slash is specified as a new <quote>address</quote>. The transport used is
35499 specified by this option, which, after expansion, must be the name of a
35500 configured transport. This should normally be an <command>appendfile</command> transport.
35501 </para>
35502 <para>
35503 <indexterm role="option">
35504 <primary><option>file</option></primary>
35505 </indexterm>
35506 </para>
35507 <informaltable frame="all">
35508 <tgroup cols="4" colsep="0" rowsep="0">
35509 <colspec colwidth="8*" align="left"/>
35510 <colspec colwidth="6*" align="center"/>
35511 <colspec colwidth="6*" align="center"/>
35512 <colspec colwidth="6*" align="right"/>
35513 <tbody>
35514 <row>
35515 <entry><option>file</option></entry>
35516 <entry>Use: <emphasis>redirect</emphasis></entry>
35517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35518 <entry>Default: <emphasis>unset</emphasis></entry>
35519 </row>
35520 </tbody>
35521 </tgroup>
35522 </informaltable>
35523 <para>
35524 This option specifies the name of a file that contains the redirection data. It
35525 is mutually exclusive with the <option>data</option> option. The string is expanded before
35526 use; if the expansion is forced to fail, the router declines. Other expansion
35527 failures cause delivery to be deferred. The result of a successful expansion
35528 must be an absolute path. The entire file is read and used as the redirection
35529 data. If the data is an empty string or a string that has no effect (consists
35530 entirely of comments), the router declines.
35531 </para>
35532 <para>
35533 <indexterm role="concept">
35534 <primary>NFS</primary>
35535 <secondary>checking for file existence</secondary>
35536 </indexterm>
35537 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
35538 runs a check on the containing directory,
35539 unless <option>ignore_enotdir</option> is true (see below).
35540 If the directory does not appear to exist, delivery is deferred. This can
35541 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
35542 is a mount problem. If the containing directory does exist, but the file does
35543 not, the router declines.
35544 </para>
35545 <para>
35546 <indexterm role="option">
35547 <primary><option>file_transport</option></primary>
35548 </indexterm>
35549 </para>
35550 <informaltable frame="all">
35551 <tgroup cols="4" colsep="0" rowsep="0">
35552 <colspec colwidth="8*" align="left"/>
35553 <colspec colwidth="6*" align="center"/>
35554 <colspec colwidth="6*" align="center"/>
35555 <colspec colwidth="6*" align="right"/>
35556 <tbody>
35557 <row>
35558 <entry><option>file_transport</option></entry>
35559 <entry>Use: <emphasis>redirect</emphasis></entry>
35560 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35561 <entry>Default: <emphasis>unset</emphasis></entry>
35562 </row>
35563 </tbody>
35564 </tgroup>
35565 </informaltable>
35566 <para>
35567 <indexterm role="variable">
35568 <primary><varname>$address_file</varname></primary>
35569 </indexterm>
35570 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
35571 ending in a slash is specified as a new <quote>address</quote>. The transport used is
35572 specified by this option, which, after expansion, must be the name of a
35573 configured transport. This should normally be an <command>appendfile</command> transport. When
35574 it is running, the file name is in <varname>$address_file</varname>.
35575 </para>
35576 <para>
35577 <indexterm role="option">
35578 <primary><option>filter_prepend_home</option></primary>
35579 </indexterm>
35580 </para>
35581 <informaltable frame="all">
35582 <tgroup cols="4" colsep="0" rowsep="0">
35583 <colspec colwidth="8*" align="left"/>
35584 <colspec colwidth="6*" align="center"/>
35585 <colspec colwidth="6*" align="center"/>
35586 <colspec colwidth="6*" align="right"/>
35587 <tbody>
35588 <row>
35589 <entry><option>filter_prepend_home</option></entry>
35590 <entry>Use: <emphasis>redirect</emphasis></entry>
35591 <entry>Type: <emphasis>boolean</emphasis></entry>
35592 <entry>Default: <emphasis>true</emphasis></entry>
35593 </row>
35594 </tbody>
35595 </tgroup>
35596 </informaltable>
35597 <para>
35598 When this option is true, if a <command>save</command> command in an Exim filter specifies a
35599 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
35600 relative path. If this option is set false, this action does not happen. The
35601 relative path is then passed to the transport unmodified.
35602 </para>
35603 <para>
35604 <indexterm role="option">
35605 <primary><option>forbid_blackhole</option></primary>
35606 </indexterm>
35607 </para>
35608 <informaltable frame="all">
35609 <tgroup cols="4" colsep="0" rowsep="0">
35610 <colspec colwidth="8*" align="left"/>
35611 <colspec colwidth="6*" align="center"/>
35612 <colspec colwidth="6*" align="center"/>
35613 <colspec colwidth="6*" align="right"/>
35614 <tbody>
35615 <row>
35616 <entry><option>forbid_blackhole</option></entry>
35617 <entry>Use: <emphasis>redirect</emphasis></entry>
35618 <entry>Type: <emphasis>boolean</emphasis></entry>
35619 <entry>Default: <emphasis>false</emphasis></entry>
35620 </row>
35621 </tbody>
35622 </tgroup>
35623 </informaltable>
35624 <para>
35625 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
35626 redirection list.
35627 </para>
35628 <para>
35629 <indexterm role="option">
35630 <primary><option>forbid_exim_filter</option></primary>
35631 </indexterm>
35632 </para>
35633 <informaltable frame="all">
35634 <tgroup cols="4" colsep="0" rowsep="0">
35635 <colspec colwidth="8*" align="left"/>
35636 <colspec colwidth="6*" align="center"/>
35637 <colspec colwidth="6*" align="center"/>
35638 <colspec colwidth="6*" align="right"/>
35639 <tbody>
35640 <row>
35641 <entry><option>forbid_exim_filter</option></entry>
35642 <entry>Use: <emphasis>redirect</emphasis></entry>
35643 <entry>Type: <emphasis>boolean</emphasis></entry>
35644 <entry>Default: <emphasis>false</emphasis></entry>
35645 </row>
35646 </tbody>
35647 </tgroup>
35648 </informaltable>
35649 <para>
35650 If this option is set true, only Sieve filters are permitted when
35651 <option>allow_filter</option> is true.
35652 </para>
35653 <para>
35654 <indexterm role="option">
35655 <primary><option>forbid_file</option></primary>
35656 </indexterm>
35657 </para>
35658 <informaltable frame="all">
35659 <tgroup cols="4" colsep="0" rowsep="0">
35660 <colspec colwidth="8*" align="left"/>
35661 <colspec colwidth="6*" align="center"/>
35662 <colspec colwidth="6*" align="center"/>
35663 <colspec colwidth="6*" align="right"/>
35664 <tbody>
35665 <row>
35666 <entry><option>forbid_file</option></entry>
35667 <entry>Use: <emphasis>redirect</emphasis></entry>
35668 <entry>Type: <emphasis>boolean</emphasis></entry>
35669 <entry>Default: <emphasis>false</emphasis></entry>
35670 </row>
35671 </tbody>
35672 </tgroup>
35673 </informaltable>
35674 <para>
35675 <indexterm role="concept">
35676 <primary>delivery</primary>
35677 <secondary>to file; forbidding</secondary>
35678 </indexterm>
35679 <indexterm role="concept">
35680 <primary>Sieve filter</primary>
35681 <secondary>forbidding delivery to a file</secondary>
35682 </indexterm>
35683 <indexterm role="concept">
35684 <primary>Sieve filter</primary>
35685 <secondary><quote>keep</quote> facility; disabling</secondary>
35686 </indexterm>
35687 If this option is true, this router may not generate a new address that
35688 specifies delivery to a local file or directory, either from a filter or from a
35689 conventional forward file. This option is forced to be true if <option>one_time</option> is
35690 set. It applies to Sieve filters as well as to Exim filters, but if true, it
35691 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
35692 </para>
35693 <para>
35694 <indexterm role="option">
35695 <primary><option>forbid_filter_dlfunc</option></primary>
35696 </indexterm>
35697 </para>
35698 <informaltable frame="all">
35699 <tgroup cols="4" colsep="0" rowsep="0">
35700 <colspec colwidth="8*" align="left"/>
35701 <colspec colwidth="6*" align="center"/>
35702 <colspec colwidth="6*" align="center"/>
35703 <colspec colwidth="6*" align="right"/>
35704 <tbody>
35705 <row>
35706 <entry><option>forbid_filter_dlfunc</option></entry>
35707 <entry>Use: <emphasis>redirect</emphasis></entry>
35708 <entry>Type: <emphasis>boolean</emphasis></entry>
35709 <entry>Default: <emphasis>false</emphasis></entry>
35710 </row>
35711 </tbody>
35712 </tgroup>
35713 </informaltable>
35714 <para>
35715 <indexterm role="concept">
35716 <primary>filter</primary>
35717 <secondary>locking out certain features</secondary>
35718 </indexterm>
35719 If this option is true, string expansions in Exim filters are not allowed to
35720 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
35721 functions.
35722 </para>
35723 <para>
35724 <indexterm role="option">
35725 <primary><option>forbid_filter_existstest</option></primary>
35726 </indexterm>
35727 </para>
35728 <informaltable frame="all">
35729 <tgroup cols="4" colsep="0" rowsep="0">
35730 <colspec colwidth="8*" align="left"/>
35731 <colspec colwidth="6*" align="center"/>
35732 <colspec colwidth="6*" align="center"/>
35733 <colspec colwidth="6*" align="right"/>
35734 <tbody>
35735 <row>
35736 <entry><option>forbid_filter_existstest</option></entry>
35737 <entry>Use: <emphasis>redirect</emphasis></entry>
35738 <entry>Type: <emphasis>boolean</emphasis></entry>
35739 <entry>Default: <emphasis>false</emphasis></entry>
35740 </row>
35741 </tbody>
35742 </tgroup>
35743 </informaltable>
35744 <para>
35745 <indexterm role="concept">
35746 <primary>expansion</primary>
35747 <secondary>statting a file</secondary>
35748 </indexterm>
35749 If this option is true, string expansions in Exim filters are not allowed to
35750 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
35751 </para>
35752 <para>
35753 <indexterm role="option">
35754 <primary><option>forbid_filter_logwrite</option></primary>
35755 </indexterm>
35756 </para>
35757 <informaltable frame="all">
35758 <tgroup cols="4" colsep="0" rowsep="0">
35759 <colspec colwidth="8*" align="left"/>
35760 <colspec colwidth="6*" align="center"/>
35761 <colspec colwidth="6*" align="center"/>
35762 <colspec colwidth="6*" align="right"/>
35763 <tbody>
35764 <row>
35765 <entry><option>forbid_filter_logwrite</option></entry>
35766 <entry>Use: <emphasis>redirect</emphasis></entry>
35767 <entry>Type: <emphasis>boolean</emphasis></entry>
35768 <entry>Default: <emphasis>false</emphasis></entry>
35769 </row>
35770 </tbody>
35771 </tgroup>
35772 </informaltable>
35773 <para>
35774 If this option is true, use of the logging facility in Exim filters is not
35775 permitted. Logging is in any case available only if the filter is being run
35776 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
35777 <filename>.forward</filename> files).
35778 </para>
35779 <para>
35780 <indexterm role="option">
35781 <primary><option>forbid_filter_lookup</option></primary>
35782 </indexterm>
35783 </para>
35784 <informaltable frame="all">
35785 <tgroup cols="4" colsep="0" rowsep="0">
35786 <colspec colwidth="8*" align="left"/>
35787 <colspec colwidth="6*" align="center"/>
35788 <colspec colwidth="6*" align="center"/>
35789 <colspec colwidth="6*" align="right"/>
35790 <tbody>
35791 <row>
35792 <entry><option>forbid_filter_lookup</option></entry>
35793 <entry>Use: <emphasis>redirect</emphasis></entry>
35794 <entry>Type: <emphasis>boolean</emphasis></entry>
35795 <entry>Default: <emphasis>false</emphasis></entry>
35796 </row>
35797 </tbody>
35798 </tgroup>
35799 </informaltable>
35800 <para>
35801 If this option is true, string expansions in Exim filter files are not allowed
35802 to make use of <option>lookup</option> items.
35803 </para>
35804 <para>
35805 <indexterm role="option">
35806 <primary><option>forbid_filter_perl</option></primary>
35807 </indexterm>
35808 </para>
35809 <informaltable frame="all">
35810 <tgroup cols="4" colsep="0" rowsep="0">
35811 <colspec colwidth="8*" align="left"/>
35812 <colspec colwidth="6*" align="center"/>
35813 <colspec colwidth="6*" align="center"/>
35814 <colspec colwidth="6*" align="right"/>
35815 <tbody>
35816 <row>
35817 <entry><option>forbid_filter_perl</option></entry>
35818 <entry>Use: <emphasis>redirect</emphasis></entry>
35819 <entry>Type: <emphasis>boolean</emphasis></entry>
35820 <entry>Default: <emphasis>false</emphasis></entry>
35821 </row>
35822 </tbody>
35823 </tgroup>
35824 </informaltable>
35825 <para>
35826 This option has an effect only if Exim is built with embedded Perl support. If
35827 it is true, string expansions in Exim filter files are not allowed to make use
35828 of the embedded Perl support.
35829 </para>
35830 <para>
35831 <indexterm role="option">
35832 <primary><option>forbid_filter_readfile</option></primary>
35833 </indexterm>
35834 </para>
35835 <informaltable frame="all">
35836 <tgroup cols="4" colsep="0" rowsep="0">
35837 <colspec colwidth="8*" align="left"/>
35838 <colspec colwidth="6*" align="center"/>
35839 <colspec colwidth="6*" align="center"/>
35840 <colspec colwidth="6*" align="right"/>
35841 <tbody>
35842 <row>
35843 <entry><option>forbid_filter_readfile</option></entry>
35844 <entry>Use: <emphasis>redirect</emphasis></entry>
35845 <entry>Type: <emphasis>boolean</emphasis></entry>
35846 <entry>Default: <emphasis>false</emphasis></entry>
35847 </row>
35848 </tbody>
35849 </tgroup>
35850 </informaltable>
35851 <para>
35852 If this option is true, string expansions in Exim filter files are not allowed
35853 to make use of <option>readfile</option> items.
35854 </para>
35855 <para>
35856 <indexterm role="option">
35857 <primary><option>forbid_filter_readsocket</option></primary>
35858 </indexterm>
35859 </para>
35860 <informaltable frame="all">
35861 <tgroup cols="4" colsep="0" rowsep="0">
35862 <colspec colwidth="8*" align="left"/>
35863 <colspec colwidth="6*" align="center"/>
35864 <colspec colwidth="6*" align="center"/>
35865 <colspec colwidth="6*" align="right"/>
35866 <tbody>
35867 <row>
35868 <entry><option>forbid_filter_readsocket</option></entry>
35869 <entry>Use: <emphasis>redirect</emphasis></entry>
35870 <entry>Type: <emphasis>boolean</emphasis></entry>
35871 <entry>Default: <emphasis>false</emphasis></entry>
35872 </row>
35873 </tbody>
35874 </tgroup>
35875 </informaltable>
35876 <para>
35877 If this option is true, string expansions in Exim filter files are not allowed
35878 to make use of <option>readsocket</option> items.
35879 </para>
35880 <para>
35881 <indexterm role="option">
35882 <primary><option>forbid_filter_reply</option></primary>
35883 </indexterm>
35884 </para>
35885 <informaltable frame="all">
35886 <tgroup cols="4" colsep="0" rowsep="0">
35887 <colspec colwidth="8*" align="left"/>
35888 <colspec colwidth="6*" align="center"/>
35889 <colspec colwidth="6*" align="center"/>
35890 <colspec colwidth="6*" align="right"/>
35891 <tbody>
35892 <row>
35893 <entry><option>forbid_filter_reply</option></entry>
35894 <entry>Use: <emphasis>redirect</emphasis></entry>
35895 <entry>Type: <emphasis>boolean</emphasis></entry>
35896 <entry>Default: <emphasis>false</emphasis></entry>
35897 </row>
35898 </tbody>
35899 </tgroup>
35900 </informaltable>
35901 <para>
35902 If this option is true, this router may not generate an automatic reply
35903 message. Automatic replies can be generated only from Exim or Sieve filter
35904 files, not from traditional forward files. This option is forced to be true if
35905 <option>one_time</option> is set.
35906 </para>
35907 <para>
35908 <indexterm role="option">
35909 <primary><option>forbid_filter_run</option></primary>
35910 </indexterm>
35911 </para>
35912 <informaltable frame="all">
35913 <tgroup cols="4" colsep="0" rowsep="0">
35914 <colspec colwidth="8*" align="left"/>
35915 <colspec colwidth="6*" align="center"/>
35916 <colspec colwidth="6*" align="center"/>
35917 <colspec colwidth="6*" align="right"/>
35918 <tbody>
35919 <row>
35920 <entry><option>forbid_filter_run</option></entry>
35921 <entry>Use: <emphasis>redirect</emphasis></entry>
35922 <entry>Type: <emphasis>boolean</emphasis></entry>
35923 <entry>Default: <emphasis>false</emphasis></entry>
35924 </row>
35925 </tbody>
35926 </tgroup>
35927 </informaltable>
35928 <para>
35929 If this option is true, string expansions in Exim filter files are not allowed
35930 to make use of <option>run</option> items.
35931 </para>
35932 <para>
35933 <indexterm role="option">
35934 <primary><option>forbid_include</option></primary>
35935 </indexterm>
35936 </para>
35937 <informaltable frame="all">
35938 <tgroup cols="4" colsep="0" rowsep="0">
35939 <colspec colwidth="8*" align="left"/>
35940 <colspec colwidth="6*" align="center"/>
35941 <colspec colwidth="6*" align="center"/>
35942 <colspec colwidth="6*" align="right"/>
35943 <tbody>
35944 <row>
35945 <entry><option>forbid_include</option></entry>
35946 <entry>Use: <emphasis>redirect</emphasis></entry>
35947 <entry>Type: <emphasis>boolean</emphasis></entry>
35948 <entry>Default: <emphasis>false</emphasis></entry>
35949 </row>
35950 </tbody>
35951 </tgroup>
35952 </informaltable>
35953 <para>
35954 If this option is true, items of the form
35955 </para>
35956 <literallayout class="monospaced">
35957 :include:&lt;path name&gt;
35958 </literallayout>
35959 <para>
35960 are not permitted in non-filter redirection lists.
35961 </para>
35962 <para>
35963 <indexterm role="option">
35964 <primary><option>forbid_pipe</option></primary>
35965 </indexterm>
35966 </para>
35967 <informaltable frame="all">
35968 <tgroup cols="4" colsep="0" rowsep="0">
35969 <colspec colwidth="8*" align="left"/>
35970 <colspec colwidth="6*" align="center"/>
35971 <colspec colwidth="6*" align="center"/>
35972 <colspec colwidth="6*" align="right"/>
35973 <tbody>
35974 <row>
35975 <entry><option>forbid_pipe</option></entry>
35976 <entry>Use: <emphasis>redirect</emphasis></entry>
35977 <entry>Type: <emphasis>boolean</emphasis></entry>
35978 <entry>Default: <emphasis>false</emphasis></entry>
35979 </row>
35980 </tbody>
35981 </tgroup>
35982 </informaltable>
35983 <para>
35984 <indexterm role="concept">
35985 <primary>delivery</primary>
35986 <secondary>to pipe; forbidding</secondary>
35987 </indexterm>
35988 If this option is true, this router may not generate a new address which
35989 specifies delivery to a pipe, either from an Exim filter or from a conventional
35990 forward file. This option is forced to be true if <option>one_time</option> is set.
35991 </para>
35992 <para>
35993 <indexterm role="option">
35994 <primary><option>forbid_sieve_filter</option></primary>
35995 </indexterm>
35996 </para>
35997 <informaltable frame="all">
35998 <tgroup cols="4" colsep="0" rowsep="0">
35999 <colspec colwidth="8*" align="left"/>
36000 <colspec colwidth="6*" align="center"/>
36001 <colspec colwidth="6*" align="center"/>
36002 <colspec colwidth="6*" align="right"/>
36003 <tbody>
36004 <row>
36005 <entry><option>forbid_sieve_filter</option></entry>
36006 <entry>Use: <emphasis>redirect</emphasis></entry>
36007 <entry>Type: <emphasis>boolean</emphasis></entry>
36008 <entry>Default: <emphasis>false</emphasis></entry>
36009 </row>
36010 </tbody>
36011 </tgroup>
36012 </informaltable>
36013 <para>
36014 If this option is set true, only Exim filters are permitted when
36015 <option>allow_filter</option> is true.
36016 </para>
36017 <para>
36018 <indexterm role="concept">
36019 <primary>SMTP</primary>
36020 <secondary>error codes</secondary>
36021 </indexterm>
36022 <indexterm role="option">
36023 <primary><option>forbid_smtp_code</option></primary>
36024 </indexterm>
36025 </para>
36026 <informaltable frame="all">
36027 <tgroup cols="4" colsep="0" rowsep="0">
36028 <colspec colwidth="8*" align="left"/>
36029 <colspec colwidth="6*" align="center"/>
36030 <colspec colwidth="6*" align="center"/>
36031 <colspec colwidth="6*" align="right"/>
36032 <tbody>
36033 <row>
36034 <entry><option>forbid_smtp_code</option></entry>
36035 <entry>Use: <emphasis>redirect</emphasis></entry>
36036 <entry>Type: <emphasis>boolean</emphasis></entry>
36037 <entry>Default: <emphasis>false</emphasis></entry>
36038 </row>
36039 </tbody>
36040 </tgroup>
36041 </informaltable>
36042 <para>
36043 If this option is set true, any SMTP error codes that are present at the start
36044 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
36045 the default codes (451 and 550, respectively) are always used.
36046 </para>
36047 <para>
36048 <indexterm role="option">
36049 <primary><option>hide_child_in_errmsg</option></primary>
36050 </indexterm>
36051 </para>
36052 <informaltable frame="all">
36053 <tgroup cols="4" colsep="0" rowsep="0">
36054 <colspec colwidth="8*" align="left"/>
36055 <colspec colwidth="6*" align="center"/>
36056 <colspec colwidth="6*" align="center"/>
36057 <colspec colwidth="6*" align="right"/>
36058 <tbody>
36059 <row>
36060 <entry><option>hide_child_in_errmsg</option></entry>
36061 <entry>Use: <emphasis>redirect</emphasis></entry>
36062 <entry>Type: <emphasis>boolean</emphasis></entry>
36063 <entry>Default: <emphasis>false</emphasis></entry>
36064 </row>
36065 </tbody>
36066 </tgroup>
36067 </informaltable>
36068 <para>
36069 <indexterm role="concept">
36070 <primary>bounce message</primary>
36071 <secondary>redirection details; suppressing</secondary>
36072 </indexterm>
36073 If this option is true, it prevents Exim from quoting a child address if it
36074 generates a bounce or delay message for it. Instead it says <quote>an address
36075 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
36076 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
36077 bounce may well quote the generated address.
36078 </para>
36079 <para>
36080 <indexterm role="option">
36081 <primary><option>ignore_eacces</option></primary>
36082 </indexterm>
36083 </para>
36084 <informaltable frame="all">
36085 <tgroup cols="4" colsep="0" rowsep="0">
36086 <colspec colwidth="8*" align="left"/>
36087 <colspec colwidth="6*" align="center"/>
36088 <colspec colwidth="6*" align="center"/>
36089 <colspec colwidth="6*" align="right"/>
36090 <tbody>
36091 <row>
36092 <entry><option>ignore_eacces</option></entry>
36093 <entry>Use: <emphasis>redirect</emphasis></entry>
36094 <entry>Type: <emphasis>boolean</emphasis></entry>
36095 <entry>Default: <emphasis>false</emphasis></entry>
36096 </row>
36097 </tbody>
36098 </tgroup>
36099 </informaltable>
36100 <para>
36101 <indexterm role="concept">
36102 <primary>EACCES</primary>
36103 </indexterm>
36104 If this option is set and an attempt to open a redirection file yields the
36105 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
36106 file did not exist.
36107 </para>
36108 <para>
36109 <indexterm role="option">
36110 <primary><option>ignore_enotdir</option></primary>
36111 </indexterm>
36112 </para>
36113 <informaltable frame="all">
36114 <tgroup cols="4" colsep="0" rowsep="0">
36115 <colspec colwidth="8*" align="left"/>
36116 <colspec colwidth="6*" align="center"/>
36117 <colspec colwidth="6*" align="center"/>
36118 <colspec colwidth="6*" align="right"/>
36119 <tbody>
36120 <row>
36121 <entry><option>ignore_enotdir</option></entry>
36122 <entry>Use: <emphasis>redirect</emphasis></entry>
36123 <entry>Type: <emphasis>boolean</emphasis></entry>
36124 <entry>Default: <emphasis>false</emphasis></entry>
36125 </row>
36126 </tbody>
36127 </tgroup>
36128 </informaltable>
36129 <para>
36130 <indexterm role="concept">
36131 <primary>ENOTDIR</primary>
36132 </indexterm>
36133 If this option is set and an attempt to open a redirection file yields the
36134 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
36135 router behaves as if the file did not exist.
36136 </para>
36137 <para>
36138 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
36139 router that has the <option>file</option> option set discovers that the file does not exist
36140 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
36141 against unmounted NFS directories. If the parent can not be statted, delivery
36142 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
36143 is set, because that option tells Exim to ignore <quote>something on the path is not
36144 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
36145 that some operating systems give ENOENT where others give ENOTDIR.
36146 </para>
36147 <para>
36148 <indexterm role="option">
36149 <primary><option>include_directory</option></primary>
36150 </indexterm>
36151 </para>
36152 <informaltable frame="all">
36153 <tgroup cols="4" colsep="0" rowsep="0">
36154 <colspec colwidth="8*" align="left"/>
36155 <colspec colwidth="6*" align="center"/>
36156 <colspec colwidth="6*" align="center"/>
36157 <colspec colwidth="6*" align="right"/>
36158 <tbody>
36159 <row>
36160 <entry><option>include_directory</option></entry>
36161 <entry>Use: <emphasis>redirect</emphasis></entry>
36162 <entry>Type: <emphasis>string</emphasis></entry>
36163 <entry>Default: <emphasis>unset</emphasis></entry>
36164 </row>
36165 </tbody>
36166 </tgroup>
36167 </informaltable>
36168 <para>
36169 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
36170 redirection list must start with this directory.
36171 </para>
36172 <para>
36173 <indexterm role="option">
36174 <primary><option>modemask</option></primary>
36175 </indexterm>
36176 </para>
36177 <informaltable frame="all">
36178 <tgroup cols="4" colsep="0" rowsep="0">
36179 <colspec colwidth="8*" align="left"/>
36180 <colspec colwidth="6*" align="center"/>
36181 <colspec colwidth="6*" align="center"/>
36182 <colspec colwidth="6*" align="right"/>
36183 <tbody>
36184 <row>
36185 <entry><option>modemask</option></entry>
36186 <entry>Use: <emphasis>redirect</emphasis></entry>
36187 <entry>Type: <emphasis>octal integer</emphasis></entry>
36188 <entry>Default: <emphasis>022</emphasis></entry>
36189 </row>
36190 </tbody>
36191 </tgroup>
36192 </informaltable>
36193 <para>
36194 This specifies mode bits which must not be set for a file specified by the
36195 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
36196 </para>
36197 <para>
36198 <indexterm role="option">
36199 <primary><option>one_time</option></primary>
36200 </indexterm>
36201 </para>
36202 <informaltable frame="all">
36203 <tgroup cols="4" colsep="0" rowsep="0">
36204 <colspec colwidth="8*" align="left"/>
36205 <colspec colwidth="6*" align="center"/>
36206 <colspec colwidth="6*" align="center"/>
36207 <colspec colwidth="6*" align="right"/>
36208 <tbody>
36209 <row>
36210 <entry><option>one_time</option></entry>
36211 <entry>Use: <emphasis>redirect</emphasis></entry>
36212 <entry>Type: <emphasis>boolean</emphasis></entry>
36213 <entry>Default: <emphasis>false</emphasis></entry>
36214 </row>
36215 </tbody>
36216 </tgroup>
36217 </informaltable>
36218 <para>
36219 <indexterm role="concept">
36220 <primary>one-time aliasing/forwarding expansion</primary>
36221 </indexterm>
36222 <indexterm role="concept">
36223 <primary>alias file</primary>
36224 <secondary>one-time expansion</secondary>
36225 </indexterm>
36226 <indexterm role="concept">
36227 <primary>forward file</primary>
36228 <secondary>one-time expansion</secondary>
36229 </indexterm>
36230 <indexterm role="concept">
36231 <primary>mailing lists</primary>
36232 <secondary>one-time expansion</secondary>
36233 </indexterm>
36234 <indexterm role="concept">
36235 <primary>address redirection</primary>
36236 <secondary>one-time expansion</secondary>
36237 </indexterm>
36238 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
36239 files each time it tries to deliver a message causes a problem when one or more
36240 of the generated addresses fails be delivered at the first attempt. The problem
36241 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
36242 but of what happens when the redirection list changes during the time that the
36243 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
36244 lists, where new subscribers might receive copies of messages that were posted
36245 before they subscribed.
36246 </para>
36247 <para>
36248 If <option>one_time</option> is set and any addresses generated by the router fail to
36249 deliver at the first attempt, the failing addresses are added to the message as
36250 <quote>top level</quote> addresses, and the parent address that generated them is marked
36251 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
36252 attempt.
36253 </para>
36254 <para>
36255 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
36256 router would be lost if delivery did not succeed at the first attempt. For this
36257 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
36258 permitted when <option>one_time</option> is set.
36259 </para>
36260 <para>
36261 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
36262 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
36263 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
36264 </para>
36265 <para>
36266 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
36267 <option>one_time</option>.
36268 </para>
36269 <para>
36270 The original top-level address is remembered with each of the generated
36271 addresses, and is output in any log messages. However, any intermediate parent
36272 addresses are not recorded. This makes a difference to the log only if
36273 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
36274 typically be used for mailing lists, where there is normally just one level of
36275 expansion.
36276 </para>
36277 <para>
36278 <indexterm role="option">
36279 <primary><option>owners</option></primary>
36280 </indexterm>
36281 </para>
36282 <informaltable frame="all">
36283 <tgroup cols="4" colsep="0" rowsep="0">
36284 <colspec colwidth="8*" align="left"/>
36285 <colspec colwidth="6*" align="center"/>
36286 <colspec colwidth="6*" align="center"/>
36287 <colspec colwidth="6*" align="right"/>
36288 <tbody>
36289 <row>
36290 <entry><option>owners</option></entry>
36291 <entry>Use: <emphasis>redirect</emphasis></entry>
36292 <entry>Type: <emphasis>string list</emphasis></entry>
36293 <entry>Default: <emphasis>unset</emphasis></entry>
36294 </row>
36295 </tbody>
36296 </tgroup>
36297 </informaltable>
36298 <para>
36299 <indexterm role="concept">
36300 <primary>ownership</primary>
36301 <secondary>alias file</secondary>
36302 </indexterm>
36303 <indexterm role="concept">
36304 <primary>ownership</primary>
36305 <secondary>forward file</secondary>
36306 </indexterm>
36307 <indexterm role="concept">
36308 <primary>alias file</primary>
36309 <secondary>ownership</secondary>
36310 </indexterm>
36311 <indexterm role="concept">
36312 <primary>forward file</primary>
36313 <secondary>ownership</secondary>
36314 </indexterm>
36315 This specifies a list of permitted owners for the file specified by <option>file</option>.
36316 This list is in addition to the local user when <option>check_local_user</option> is set.
36317 See <option>check_owner</option> above.
36318 </para>
36319 <para>
36320 <indexterm role="option">
36321 <primary><option>owngroups</option></primary>
36322 </indexterm>
36323 </para>
36324 <informaltable frame="all">
36325 <tgroup cols="4" colsep="0" rowsep="0">
36326 <colspec colwidth="8*" align="left"/>
36327 <colspec colwidth="6*" align="center"/>
36328 <colspec colwidth="6*" align="center"/>
36329 <colspec colwidth="6*" align="right"/>
36330 <tbody>
36331 <row>
36332 <entry><option>owngroups</option></entry>
36333 <entry>Use: <emphasis>redirect</emphasis></entry>
36334 <entry>Type: <emphasis>string list</emphasis></entry>
36335 <entry>Default: <emphasis>unset</emphasis></entry>
36336 </row>
36337 </tbody>
36338 </tgroup>
36339 </informaltable>
36340 <para>
36341 This specifies a list of permitted groups for the file specified by <option>file</option>.
36342 The list is in addition to the local user&#x2019;s primary group when
36343 <option>check_local_user</option> is set. See <option>check_group</option> above.
36344 </para>
36345 <para>
36346 <indexterm role="option">
36347 <primary><option>pipe_transport</option></primary>
36348 </indexterm>
36349 </para>
36350 <informaltable frame="all">
36351 <tgroup cols="4" colsep="0" rowsep="0">
36352 <colspec colwidth="8*" align="left"/>
36353 <colspec colwidth="6*" align="center"/>
36354 <colspec colwidth="6*" align="center"/>
36355 <colspec colwidth="6*" align="right"/>
36356 <tbody>
36357 <row>
36358 <entry><option>pipe_transport</option></entry>
36359 <entry>Use: <emphasis>redirect</emphasis></entry>
36360 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36361 <entry>Default: <emphasis>unset</emphasis></entry>
36362 </row>
36363 </tbody>
36364 </tgroup>
36365 </informaltable>
36366 <para>
36367 <indexterm role="variable">
36368 <primary><varname>$address_pipe</varname></primary>
36369 </indexterm>
36370 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
36371 starting with a vertical bar character is specified as a new <quote>address</quote>. The
36372 transport used is specified by this option, which, after expansion, must be the
36373 name of a configured transport. This should normally be a <command>pipe</command> transport.
36374 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
36375 </para>
36376 <para>
36377 <indexterm role="option">
36378 <primary><option>qualify_domain</option></primary>
36379 </indexterm>
36380 </para>
36381 <informaltable frame="all">
36382 <tgroup cols="4" colsep="0" rowsep="0">
36383 <colspec colwidth="8*" align="left"/>
36384 <colspec colwidth="6*" align="center"/>
36385 <colspec colwidth="6*" align="center"/>
36386 <colspec colwidth="6*" align="right"/>
36387 <tbody>
36388 <row>
36389 <entry><option>qualify_domain</option></entry>
36390 <entry>Use: <emphasis>redirect</emphasis></entry>
36391 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36392 <entry>Default: <emphasis>unset</emphasis></entry>
36393 </row>
36394 </tbody>
36395 </tgroup>
36396 </informaltable>
36397 <para>
36398 <indexterm role="variable">
36399 <primary><varname>$qualify_recipient</varname></primary>
36400 </indexterm>
36401 If this option is set, and an unqualified address (one without a domain) is
36402 generated, and that address would normally be qualified by the global setting
36403 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
36404 expanding this string. If the expansion fails, the router declines. If you want
36405 to revert to the default, you can have the expansion generate
36406 <varname>$qualify_recipient</varname>.
36407 </para>
36408 <para>
36409 This option applies to all unqualified addresses generated by Exim filters,
36410 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
36411 not preceded by a backslash. Sieve filters cannot generate unqualified
36412 addresses.
36413 </para>
36414 <para>
36415 <indexterm role="option">
36416 <primary><option>qualify_preserve_domain</option></primary>
36417 </indexterm>
36418 </para>
36419 <informaltable frame="all">
36420 <tgroup cols="4" colsep="0" rowsep="0">
36421 <colspec colwidth="8*" align="left"/>
36422 <colspec colwidth="6*" align="center"/>
36423 <colspec colwidth="6*" align="center"/>
36424 <colspec colwidth="6*" align="right"/>
36425 <tbody>
36426 <row>
36427 <entry><option>qualify_preserve_domain</option></entry>
36428 <entry>Use: <emphasis>redirect</emphasis></entry>
36429 <entry>Type: <emphasis>boolean</emphasis></entry>
36430 <entry>Default: <emphasis>false</emphasis></entry>
36431 </row>
36432 </tbody>
36433 </tgroup>
36434 </informaltable>
36435 <para>
36436 <indexterm role="concept">
36437 <primary>domain</primary>
36438 <secondary>in redirection; preserving</secondary>
36439 </indexterm>
36440 <indexterm role="concept">
36441 <primary>preserving domain in redirection</primary>
36442 </indexterm>
36443 <indexterm role="concept">
36444 <primary>address redirection</primary>
36445 <secondary>domain; preserving</secondary>
36446 </indexterm>
36447 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
36448 set (a configuration error occurs if it is). If an unqualified address (one
36449 without a domain) is generated, it is qualified with the domain of the parent
36450 address (the immediately preceding ancestor) instead of the global
36451 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
36452 this applies whether or not the address is preceded by a backslash.
36453 </para>
36454 <para>
36455 <indexterm role="option">
36456 <primary><option>repeat_use</option></primary>
36457 </indexterm>
36458 </para>
36459 <informaltable frame="all">
36460 <tgroup cols="4" colsep="0" rowsep="0">
36461 <colspec colwidth="8*" align="left"/>
36462 <colspec colwidth="6*" align="center"/>
36463 <colspec colwidth="6*" align="center"/>
36464 <colspec colwidth="6*" align="right"/>
36465 <tbody>
36466 <row>
36467 <entry><option>repeat_use</option></entry>
36468 <entry>Use: <emphasis>redirect</emphasis></entry>
36469 <entry>Type: <emphasis>boolean</emphasis></entry>
36470 <entry>Default: <emphasis>true</emphasis></entry>
36471 </row>
36472 </tbody>
36473 </tgroup>
36474 </informaltable>
36475 <para>
36476 If this option is set false, the router is skipped for a child address that has
36477 any ancestor that was routed by this router. This test happens before any of
36478 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
36479 only when the ancestor is the same as the current address. See also
36480 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
36481 </para>
36482 <para>
36483 <indexterm role="option">
36484 <primary><option>reply_transport</option></primary>
36485 </indexterm>
36486 </para>
36487 <informaltable frame="all">
36488 <tgroup cols="4" colsep="0" rowsep="0">
36489 <colspec colwidth="8*" align="left"/>
36490 <colspec colwidth="6*" align="center"/>
36491 <colspec colwidth="6*" align="center"/>
36492 <colspec colwidth="6*" align="right"/>
36493 <tbody>
36494 <row>
36495 <entry><option>reply_transport</option></entry>
36496 <entry>Use: <emphasis>redirect</emphasis></entry>
36497 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36498 <entry>Default: <emphasis>unset</emphasis></entry>
36499 </row>
36500 </tbody>
36501 </tgroup>
36502 </informaltable>
36503 <para>
36504 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
36505 <option>vacation</option> command is used in a filter file. The transport used is specified
36506 by this option, which, after expansion, must be the name of a configured
36507 transport. This should normally be an <command>autoreply</command> transport. Other transports
36508 are unlikely to do anything sensible or useful.
36509 </para>
36510 <para>
36511 <indexterm role="option">
36512 <primary><option>rewrite</option></primary>
36513 </indexterm>
36514 </para>
36515 <informaltable frame="all">
36516 <tgroup cols="4" colsep="0" rowsep="0">
36517 <colspec colwidth="8*" align="left"/>
36518 <colspec colwidth="6*" align="center"/>
36519 <colspec colwidth="6*" align="center"/>
36520 <colspec colwidth="6*" align="right"/>
36521 <tbody>
36522 <row>
36523 <entry><option>rewrite</option></entry>
36524 <entry>Use: <emphasis>redirect</emphasis></entry>
36525 <entry>Type: <emphasis>boolean</emphasis></entry>
36526 <entry>Default: <emphasis>true</emphasis></entry>
36527 </row>
36528 </tbody>
36529 </tgroup>
36530 </informaltable>
36531 <para>
36532 <indexterm role="concept">
36533 <primary>address redirection</primary>
36534 <secondary>disabling rewriting</secondary>
36535 </indexterm>
36536 If this option is set false, addresses generated by the router are not
36537 subject to address rewriting. Otherwise, they are treated like new addresses
36538 and are rewritten according to the global rewriting rules.
36539 </para>
36540 <para>
36541 <indexterm role="option">
36542 <primary><option>sieve_subaddress</option></primary>
36543 </indexterm>
36544 </para>
36545 <informaltable frame="all">
36546 <tgroup cols="4" colsep="0" rowsep="0">
36547 <colspec colwidth="8*" align="left"/>
36548 <colspec colwidth="6*" align="center"/>
36549 <colspec colwidth="6*" align="center"/>
36550 <colspec colwidth="6*" align="right"/>
36551 <tbody>
36552 <row>
36553 <entry><option>sieve_subaddress</option></entry>
36554 <entry>Use: <emphasis>redirect</emphasis></entry>
36555 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36556 <entry>Default: <emphasis>unset</emphasis></entry>
36557 </row>
36558 </tbody>
36559 </tgroup>
36560 </informaltable>
36561 <para>
36562 The value of this option is passed to a Sieve filter to specify the
36563 :subaddress part of an address.
36564 </para>
36565 <para>
36566 <indexterm role="option">
36567 <primary><option>sieve_useraddress</option></primary>
36568 </indexterm>
36569 </para>
36570 <informaltable frame="all">
36571 <tgroup cols="4" colsep="0" rowsep="0">
36572 <colspec colwidth="8*" align="left"/>
36573 <colspec colwidth="6*" align="center"/>
36574 <colspec colwidth="6*" align="center"/>
36575 <colspec colwidth="6*" align="right"/>
36576 <tbody>
36577 <row>
36578 <entry><option>sieve_useraddress</option></entry>
36579 <entry>Use: <emphasis>redirect</emphasis></entry>
36580 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36581 <entry>Default: <emphasis>unset</emphasis></entry>
36582 </row>
36583 </tbody>
36584 </tgroup>
36585 </informaltable>
36586 <para>
36587 The value of this option is passed to a Sieve filter to specify the :user part
36588 of an address. However, if it is unset, the entire original local part
36589 (including any prefix or suffix) is used for :user.
36590 </para>
36591 <para>
36592 <indexterm role="option">
36593 <primary><option>sieve_vacation_directory</option></primary>
36594 </indexterm>
36595 </para>
36596 <informaltable frame="all">
36597 <tgroup cols="4" colsep="0" rowsep="0">
36598 <colspec colwidth="8*" align="left"/>
36599 <colspec colwidth="6*" align="center"/>
36600 <colspec colwidth="6*" align="center"/>
36601 <colspec colwidth="6*" align="right"/>
36602 <tbody>
36603 <row>
36604 <entry><option>sieve_vacation_directory</option></entry>
36605 <entry>Use: <emphasis>redirect</emphasis></entry>
36606 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36607 <entry>Default: <emphasis>unset</emphasis></entry>
36608 </row>
36609 </tbody>
36610 </tgroup>
36611 </informaltable>
36612 <para>
36613 <indexterm role="concept">
36614 <primary>Sieve filter</primary>
36615 <secondary>vacation directory</secondary>
36616 </indexterm>
36617 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
36618 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
36619 (do not put anything else in that directory), and ensure that the
36620 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
36621 needs their own directory; Exim will create it if necessary.
36622 </para>
36623 <para>
36624 <indexterm role="option">
36625 <primary><option>skip_syntax_errors</option></primary>
36626 </indexterm>
36627 </para>
36628 <informaltable frame="all">
36629 <tgroup cols="4" colsep="0" rowsep="0">
36630 <colspec colwidth="8*" align="left"/>
36631 <colspec colwidth="6*" align="center"/>
36632 <colspec colwidth="6*" align="center"/>
36633 <colspec colwidth="6*" align="right"/>
36634 <tbody>
36635 <row>
36636 <entry><option>skip_syntax_errors</option></entry>
36637 <entry>Use: <emphasis>redirect</emphasis></entry>
36638 <entry>Type: <emphasis>boolean</emphasis></entry>
36639 <entry>Default: <emphasis>false</emphasis></entry>
36640 </row>
36641 </tbody>
36642 </tgroup>
36643 </informaltable>
36644 <para>
36645 <indexterm role="concept">
36646 <primary>forward file</primary>
36647 <secondary>broken</secondary>
36648 </indexterm>
36649 <indexterm role="concept">
36650 <primary>address redirection</primary>
36651 <secondary>broken files</secondary>
36652 </indexterm>
36653 <indexterm role="concept">
36654 <primary>alias file</primary>
36655 <secondary>broken</secondary>
36656 </indexterm>
36657 <indexterm role="concept">
36658 <primary>broken alias or forward files</primary>
36659 </indexterm>
36660 <indexterm role="concept">
36661 <primary>ignoring faulty addresses</primary>
36662 </indexterm>
36663 <indexterm role="concept">
36664 <primary>skipping faulty addresses</primary>
36665 </indexterm>
36666 <indexterm role="concept">
36667 <primary>error</primary>
36668 <secondary>skipping bad syntax</secondary>
36669 </indexterm>
36670 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
36671 non-filter redirection data are skipped, and each failing address is logged. If
36672 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
36673 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
36674 are expanded and placed at the head of the error message generated by
36675 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
36676 be the same address as the generic <option>errors_to</option> option. The
36677 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
36678 </para>
36679 <para>
36680 If all the addresses in a redirection list are skipped because of syntax
36681 errors, the router declines to handle the original address, and it is passed to
36682 the following routers.
36683 </para>
36684 <para>
36685 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
36686 error in the filter causes filtering to be abandoned without any action being
36687 taken. The incident is logged, and the router declines to handle the address,
36688 so it is passed to the following routers.
36689 </para>
36690 <para>
36691 <indexterm role="concept">
36692 <primary>Sieve filter</primary>
36693 <secondary>syntax errors in</secondary>
36694 </indexterm>
36695 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
36696 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
36697 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
36698 </para>
36699 <para>
36700 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
36701 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
36702 option, used with an address that does not get redirected, can be used to
36703 notify users of these errors, by means of a router like this:
36704 </para>
36705 <literallayout class="monospaced">
36706 userforward:
36707   driver = redirect
36708   allow_filter
36709   check_local_user
36710   file = $home/.forward
36711   file_transport = address_file
36712   pipe_transport = address_pipe
36713   reply_transport = address_reply
36714   no_verify
36715   skip_syntax_errors
36716   syntax_errors_to = real-$local_part@$domain
36717   syntax_errors_text = \
36718    This is an automatically generated message. An error has\n\
36719    been found in your .forward file. Details of the error are\n\
36720    reported below. While this error persists, you will receive\n\
36721    a copy of this message for every message that is addressed\n\
36722    to you. If your .forward file is a filter file, or if it is\n\
36723    a non-filter file containing no valid forwarding addresses,\n\
36724    a copy of each incoming message will be put in your normal\n\
36725    mailbox. If a non-filter file contains at least one valid\n\
36726    forwarding address, forwarding to the valid addresses will\n\
36727    happen, and those will be the only deliveries that occur.
36728 </literallayout>
36729 <para>
36730 You also need a router to ensure that local addresses that are prefixed by
36731 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
36732 put this immediately before the <command>userforward</command> router:
36733 </para>
36734 <literallayout class="monospaced">
36735 real_localuser:
36736   driver = accept
36737   check_local_user
36738   local_part_prefix = real-
36739   transport = local_delivery
36740 </literallayout>
36741 <para>
36742 For security, it would probably be a good idea to restrict the use of this
36743 router to locally-generated messages, using a condition such as this:
36744 </para>
36745 <literallayout class="monospaced">
36746   condition = ${if match {$sender_host_address}\
36747                          {\N^(|127\.0\.0\.1)$\N}}
36748 </literallayout>
36749 <para>
36750 <indexterm role="option">
36751 <primary><option>syntax_errors_text</option></primary>
36752 </indexterm>
36753 </para>
36754 <informaltable frame="all">
36755 <tgroup cols="4" colsep="0" rowsep="0">
36756 <colspec colwidth="8*" align="left"/>
36757 <colspec colwidth="6*" align="center"/>
36758 <colspec colwidth="6*" align="center"/>
36759 <colspec colwidth="6*" align="right"/>
36760 <tbody>
36761 <row>
36762 <entry><option>syntax_errors_text</option></entry>
36763 <entry>Use: <emphasis>redirect</emphasis></entry>
36764 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36765 <entry>Default: <emphasis>unset</emphasis></entry>
36766 </row>
36767 </tbody>
36768 </tgroup>
36769 </informaltable>
36770 <para>
36771 See <option>skip_syntax_errors</option> above.
36772 </para>
36773 <para>
36774 <indexterm role="option">
36775 <primary><option>syntax_errors_to</option></primary>
36776 </indexterm>
36777 </para>
36778 <informaltable frame="all">
36779 <tgroup cols="4" colsep="0" rowsep="0">
36780 <colspec colwidth="8*" align="left"/>
36781 <colspec colwidth="6*" align="center"/>
36782 <colspec colwidth="6*" align="center"/>
36783 <colspec colwidth="6*" align="right"/>
36784 <tbody>
36785 <row>
36786 <entry><option>syntax_errors_to</option></entry>
36787 <entry>Use: <emphasis>redirect</emphasis></entry>
36788 <entry>Type: <emphasis>string</emphasis></entry>
36789 <entry>Default: <emphasis>unset</emphasis></entry>
36790 </row>
36791 </tbody>
36792 </tgroup>
36793 </informaltable>
36794 <para>
36795 See <option>skip_syntax_errors</option> above.
36796 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
36797 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
36798 </para>
36799 </section>
36800 </chapter>
36801
36802 <chapter id="CHAPenvironment">
36803 <title>Environment for running local transports</title>
36804 <titleabbrev>Environment for local transports</titleabbrev>
36805 <para>
36806 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
36807 <primary>local transports</primary>
36808 <secondary>environment for</secondary>
36809 </indexterm>
36810 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
36811 <primary>environment for local transports</primary>
36812 </indexterm>
36813 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
36814 <primary>transport</primary>
36815 <secondary>local; environment for</secondary>
36816 </indexterm>
36817 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
36818 transport can be thought of as similar to a pipe.) Exim always runs transports
36819 in subprocesses, under specified uids and gids. Typical deliveries to local
36820 mailboxes run under the uid and gid of the local user.
36821 </para>
36822 <para>
36823 Exim also sets a specific current directory while running the transport; for
36824 some transports a home directory setting is also relevant. The <command>pipe</command>
36825 transport is the only one that sets up environment variables; see section
36826 <xref linkend="SECTpipeenv"/> for details.
36827 </para>
36828 <para>
36829 The values used for the uid, gid, and the directories may come from several
36830 different places. In many cases, the router that handles the address associates
36831 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
36832 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
36833 configuration, and these override anything that comes from the router.
36834 </para>
36835 <section id="SECID131">
36836 <title>Concurrent deliveries</title>
36837 <para>
36838 <indexterm role="concept">
36839 <primary>concurrent deliveries</primary>
36840 </indexterm>
36841 <indexterm role="concept">
36842 <primary>simultaneous deliveries</primary>
36843 </indexterm>
36844 If two different messages for the same local recipient arrive more or less
36845 simultaneously, the two delivery processes are likely to run concurrently. When
36846 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
36847 rules to stop concurrent processes from writing to the same file at the same
36848 time.
36849 </para>
36850 <para>
36851 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
36852 locking that is needed. Here is a silly example:
36853 </para>
36854 <literallayout class="monospaced">
36855 my_transport:
36856   driver = pipe
36857   command = /bin/sh -c 'cat &gt;&gt;/some/file'
36858 </literallayout>
36859 <para>
36860 This is supposed to write the message at the end of the file. However, if two
36861 messages arrive at the same time, the file will be scrambled. You can use the
36862 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
36863 file using the same algorithm that Exim itself uses.
36864 </para>
36865 </section>
36866 <section id="SECTenvuidgid">
36867 <title>Uids and gids</title>
36868 <para>
36869 <indexterm role="concept">
36870 <primary>local transports</primary>
36871 <secondary>uid and gid</secondary>
36872 </indexterm>
36873 <indexterm role="concept">
36874 <primary>transport</primary>
36875 <secondary>local; uid and gid</secondary>
36876 </indexterm>
36877 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
36878 overrides any group that the router set in the address, even if <option>user</option> is not
36879 set for the transport. This makes it possible, for example, to run local mail
36880 delivery under the uid of the recipient (set by the router), but in a special
36881 group (set by the transport). For example:
36882 </para>
36883 <literallayout class="monospaced">
36884 # Routers ...
36885 # User/group are set by check_local_user in this router
36886 local_users:
36887   driver = accept
36888   check_local_user
36889   transport = group_delivery
36890
36891 # Transports ...
36892 # This transport overrides the group
36893 group_delivery:
36894   driver = appendfile
36895   file = /var/spool/mail/$local_part
36896   group = mail
36897 </literallayout>
36898 <para>
36899 If <option>user</option> is set for a transport, its value overrides what is set in the
36900 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
36901 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
36902 set.
36903 </para>
36904 <para>
36905 <indexterm role="option">
36906 <primary><option>initgroups</option></primary>
36907 </indexterm>
36908 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
36909 function is called for the groups associated with that uid if the
36910 <option>initgroups</option> option is set for the transport. When the uid is not specified
36911 by the transport, but is associated with the address by a router, the option
36912 for calling <function>initgroups()</function> is taken from the router configuration.
36913 </para>
36914 <para>
36915 <indexterm role="concept">
36916 <primary><command>pipe</command> transport</primary>
36917 <secondary>uid for</secondary>
36918 </indexterm>
36919 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
36920 is set and <option>user</option> is not set, the uid of the process that called Exim to
36921 receive the message is used, and if <option>group</option> is not set, the corresponding
36922 original gid is also used.
36923 </para>
36924 <para>
36925 This is the detailed preference order for obtaining a gid; the first of the
36926 following that is set is used:
36927 </para>
36928 <itemizedlist>
36929 <listitem>
36930 <para>
36931 A <option>group</option> setting of the transport;
36932 </para>
36933 </listitem>
36934 <listitem>
36935 <para>
36936 A <option>group</option> setting of the router;
36937 </para>
36938 </listitem>
36939 <listitem>
36940 <para>
36941 A gid associated with a user setting of the router, either as a result of
36942 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
36943 </para>
36944 </listitem>
36945 <listitem>
36946 <para>
36947 The group associated with a non-numeric <option>user</option> setting of the transport;
36948 </para>
36949 </listitem>
36950 <listitem>
36951 <para>
36952 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
36953 the uid is the creator&#x2019;s uid;
36954 </para>
36955 </listitem>
36956 <listitem>
36957 <para>
36958 The Exim gid if the Exim uid is being used as a default.
36959 </para>
36960 </listitem>
36961 </itemizedlist>
36962 <para>
36963 If, for example, the user is specified numerically on the router and there are
36964 no group settings, no gid is available. In this situation, an error occurs.
36965 This is different for the uid, for which there always is an ultimate default.
36966 The first of the following that is set is used:
36967 </para>
36968 <itemizedlist>
36969 <listitem>
36970 <para>
36971 A <option>user</option> setting of the transport;
36972 </para>
36973 </listitem>
36974 <listitem>
36975 <para>
36976 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
36977 </para>
36978 </listitem>
36979 <listitem>
36980 <para>
36981 A <option>user</option> setting of the router;
36982 </para>
36983 </listitem>
36984 <listitem>
36985 <para>
36986 A <option>check_local_user</option> setting of the router;
36987 </para>
36988 </listitem>
36989 <listitem>
36990 <para>
36991 The Exim uid.
36992 </para>
36993 </listitem>
36994 </itemizedlist>
36995 <para>
36996 Of course, an error will still occur if the uid that is chosen is on the
36997 <option>never_users</option> list.
36998 </para>
36999 </section>
37000 <section id="SECID132">
37001 <title>Current and home directories</title>
37002 <para>
37003 <indexterm role="concept">
37004 <primary>current directory for local transport</primary>
37005 </indexterm>
37006 <indexterm role="concept">
37007 <primary>home directory</primary>
37008 <secondary>for local transport</secondary>
37009 </indexterm>
37010 <indexterm role="concept">
37011 <primary>transport</primary>
37012 <secondary>local; home directory for</secondary>
37013 </indexterm>
37014 <indexterm role="concept">
37015 <primary>transport</primary>
37016 <secondary>local; current directory for</secondary>
37017 </indexterm>
37018 Routers may set current and home directories for local transports by means of
37019 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
37020 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
37021 are set, they override the router&#x2019;s values. In detail, the home directory
37022 for a local transport is taken from the first of these values that is set:
37023 </para>
37024 <itemizedlist>
37025 <listitem>
37026 <para>
37027 The <option>home_directory</option> option on the transport;
37028 </para>
37029 </listitem>
37030 <listitem>
37031 <para>
37032 The <option>transport_home_directory</option> option on the router;
37033 </para>
37034 </listitem>
37035 <listitem>
37036 <para>
37037 The password data if <option>check_local_user</option> is set on the router;
37038 </para>
37039 </listitem>
37040 <listitem>
37041 <para>
37042 The <option>router_home_directory</option> option on the router.
37043 </para>
37044 </listitem>
37045 </itemizedlist>
37046 <para>
37047 The current directory is taken from the first of these values that is set:
37048 </para>
37049 <itemizedlist>
37050 <listitem>
37051 <para>
37052 The <option>current_directory</option> option on the transport;
37053 </para>
37054 </listitem>
37055 <listitem>
37056 <para>
37057 The <option>transport_current_directory</option> option on the router.
37058 </para>
37059 </listitem>
37060 </itemizedlist>
37061 <para>
37062 If neither the router nor the transport sets a current directory, Exim uses the
37063 value of the home directory, if it is set. Otherwise it sets the current
37064 directory to <filename>/</filename> before running a local transport.
37065 </para>
37066 </section>
37067 <section id="SECID133">
37068 <title>Expansion variables derived from the address</title>
37069 <para>
37070 <indexterm role="variable">
37071 <primary><varname>$domain</varname></primary>
37072 </indexterm>
37073 <indexterm role="variable">
37074 <primary><varname>$local_part</varname></primary>
37075 </indexterm>
37076 <indexterm role="variable">
37077 <primary><varname>$original_domain</varname></primary>
37078 </indexterm>
37079 Normally a local delivery is handling a single address, and in that case the
37080 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
37081 deliveries. However, in some circumstances more than one address may be handled
37082 at once (for example, while writing batch SMTP for onward transmission by some
37083 other means). In this case, the variables associated with the local part are
37084 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
37085 and <varname>$original_domain</varname> is never set.
37086 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
37087 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
37088 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
37089 </para>
37090 </section>
37091 </chapter>
37092
37093 <chapter id="CHAPtransportgeneric">
37094 <title>Generic options for transports</title>
37095 <para>
37096 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
37097 <primary>generic options</primary>
37098 <secondary>transport</secondary>
37099 </indexterm>
37100 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
37101 <primary>options</primary>
37102 <secondary>generic; for transports</secondary>
37103 </indexterm>
37104 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
37105 <primary>transport</primary>
37106 <secondary>generic options for</secondary>
37107 </indexterm>
37108 The following generic options apply to all transports:
37109 </para>
37110 <para>
37111 <indexterm role="option">
37112 <primary><option>body_only</option></primary>
37113 </indexterm>
37114 </para>
37115 <informaltable frame="all">
37116 <tgroup cols="4" colsep="0" rowsep="0">
37117 <colspec colwidth="8*" align="left"/>
37118 <colspec colwidth="6*" align="center"/>
37119 <colspec colwidth="6*" align="center"/>
37120 <colspec colwidth="6*" align="right"/>
37121 <tbody>
37122 <row>
37123 <entry><option>body_only</option></entry>
37124 <entry>Use: <emphasis>transports</emphasis></entry>
37125 <entry>Type: <emphasis>boolean</emphasis></entry>
37126 <entry>Default: <emphasis>false</emphasis></entry>
37127 </row>
37128 </tbody>
37129 </tgroup>
37130 </informaltable>
37131 <para>
37132 <indexterm role="concept">
37133 <primary>transport</primary>
37134 <secondary>body only</secondary>
37135 </indexterm>
37136 <indexterm role="concept">
37137 <primary>message</primary>
37138 <secondary>transporting body only</secondary>
37139 </indexterm>
37140 <indexterm role="concept">
37141 <primary>body of message</primary>
37142 <secondary>transporting</secondary>
37143 </indexterm>
37144 If this option is set, the message&#x2019;s headers are not transported. It is
37145 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
37146 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
37147 <option>message_suffix</option> should be checked, because this option does not
37148 automatically suppress them.
37149 </para>
37150 <para>
37151 <indexterm role="option">
37152 <primary><option>current_directory</option></primary>
37153 </indexterm>
37154 </para>
37155 <informaltable frame="all">
37156 <tgroup cols="4" colsep="0" rowsep="0">
37157 <colspec colwidth="8*" align="left"/>
37158 <colspec colwidth="6*" align="center"/>
37159 <colspec colwidth="6*" align="center"/>
37160 <colspec colwidth="6*" align="right"/>
37161 <tbody>
37162 <row>
37163 <entry><option>current_directory</option></entry>
37164 <entry>Use: <emphasis>transports</emphasis></entry>
37165 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37166 <entry>Default: <emphasis>unset</emphasis></entry>
37167 </row>
37168 </tbody>
37169 </tgroup>
37170 </informaltable>
37171 <para>
37172 <indexterm role="concept">
37173 <primary>transport</primary>
37174 <secondary>current directory for</secondary>
37175 </indexterm>
37176 This specifies the current directory that is to be set while running the
37177 transport, overriding any value that may have been set by the router.
37178 If the expansion fails for any reason, including forced failure, an error is
37179 logged, and delivery is deferred.
37180 </para>
37181 <para>
37182 <indexterm role="option">
37183 <primary><option>disable_logging</option></primary>
37184 </indexterm>
37185 </para>
37186 <informaltable frame="all">
37187 <tgroup cols="4" colsep="0" rowsep="0">
37188 <colspec colwidth="8*" align="left"/>
37189 <colspec colwidth="6*" align="center"/>
37190 <colspec colwidth="6*" align="center"/>
37191 <colspec colwidth="6*" align="right"/>
37192 <tbody>
37193 <row>
37194 <entry><option>disable_logging</option></entry>
37195 <entry>Use: <emphasis>transports</emphasis></entry>
37196 <entry>Type: <emphasis>boolean</emphasis></entry>
37197 <entry>Default: <emphasis>false</emphasis></entry>
37198 </row>
37199 </tbody>
37200 </tgroup>
37201 </informaltable>
37202 <para>
37203 If this option is set true, nothing is logged for any
37204 deliveries by the transport or for any
37205 transport errors. You should not set this option unless you really, really know
37206 what you are doing.
37207 </para>
37208 <para>
37209 <indexterm role="option">
37210 <primary><option>debug_print</option></primary>
37211 </indexterm>
37212 </para>
37213 <informaltable frame="all">
37214 <tgroup cols="4" colsep="0" rowsep="0">
37215 <colspec colwidth="8*" align="left"/>
37216 <colspec colwidth="6*" align="center"/>
37217 <colspec colwidth="6*" align="center"/>
37218 <colspec colwidth="6*" align="right"/>
37219 <tbody>
37220 <row>
37221 <entry><option>debug_print</option></entry>
37222 <entry>Use: <emphasis>transports</emphasis></entry>
37223 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37224 <entry>Default: <emphasis>unset</emphasis></entry>
37225 </row>
37226 </tbody>
37227 </tgroup>
37228 </informaltable>
37229 <para>
37230 <indexterm role="concept">
37231 <primary>testing</primary>
37232 <secondary>variables in drivers</secondary>
37233 </indexterm>
37234 If this option is set and debugging is enabled (see the <option>-d</option> command line
37235 option), the string is expanded and included in the debugging output when the
37236 transport is run.
37237 If expansion of the string fails, the error message is written to the debugging
37238 output, and Exim carries on processing.
37239 This facility is provided to help with checking out the values of variables and
37240 so on when debugging driver configurations. For example, if a <option>headers_add</option>
37241 option is not working properly, <option>debug_print</option> could be used to output the
37242 variables it references. A newline is added to the text if it does not end with
37243 one.
37244 </para>
37245 <para revisionflag="changed">
37246 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
37247 transport and the router that called it.
37248 </para>
37249 <para>
37250 <indexterm role="option">
37251 <primary><option>delivery_date_add</option></primary>
37252 </indexterm>
37253 </para>
37254 <informaltable frame="all">
37255 <tgroup cols="4" colsep="0" rowsep="0">
37256 <colspec colwidth="8*" align="left"/>
37257 <colspec colwidth="6*" align="center"/>
37258 <colspec colwidth="6*" align="center"/>
37259 <colspec colwidth="6*" align="right"/>
37260 <tbody>
37261 <row>
37262 <entry><option>delivery_date_add</option></entry>
37263 <entry>Use: <emphasis>transports</emphasis></entry>
37264 <entry>Type: <emphasis>boolean</emphasis></entry>
37265 <entry>Default: <emphasis>false</emphasis></entry>
37266 </row>
37267 </tbody>
37268 </tgroup>
37269 </informaltable>
37270 <para>
37271 <indexterm role="concept">
37272 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
37273 </indexterm>
37274 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
37275 This gives the actual time the delivery was made. As this is not a standard
37276 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
37277 requests its removal from incoming messages, so that delivered messages can
37278 safely be resent to other recipients.
37279 </para>
37280 <para>
37281 <indexterm role="option">
37282 <primary><option>driver</option></primary>
37283 </indexterm>
37284 </para>
37285 <informaltable frame="all">
37286 <tgroup cols="4" colsep="0" rowsep="0">
37287 <colspec colwidth="8*" align="left"/>
37288 <colspec colwidth="6*" align="center"/>
37289 <colspec colwidth="6*" align="center"/>
37290 <colspec colwidth="6*" align="right"/>
37291 <tbody>
37292 <row>
37293 <entry><option>driver</option></entry>
37294 <entry>Use: <emphasis>transports</emphasis></entry>
37295 <entry>Type: <emphasis>string</emphasis></entry>
37296 <entry>Default: <emphasis>unset</emphasis></entry>
37297 </row>
37298 </tbody>
37299 </tgroup>
37300 </informaltable>
37301 <para>
37302 This specifies which of the available transport drivers is to be used.
37303 There is no default, and this option must be set for every transport.
37304 </para>
37305 <para>
37306 <indexterm role="option">
37307 <primary><option>envelope_to_add</option></primary>
37308 </indexterm>
37309 </para>
37310 <informaltable frame="all">
37311 <tgroup cols="4" colsep="0" rowsep="0">
37312 <colspec colwidth="8*" align="left"/>
37313 <colspec colwidth="6*" align="center"/>
37314 <colspec colwidth="6*" align="center"/>
37315 <colspec colwidth="6*" align="right"/>
37316 <tbody>
37317 <row>
37318 <entry><option>envelope_to_add</option></entry>
37319 <entry>Use: <emphasis>transports</emphasis></entry>
37320 <entry>Type: <emphasis>boolean</emphasis></entry>
37321 <entry>Default: <emphasis>false</emphasis></entry>
37322 </row>
37323 </tbody>
37324 </tgroup>
37325 </informaltable>
37326 <para>
37327 <indexterm role="concept">
37328 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
37329 </indexterm>
37330 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
37331 This gives the original address(es) in the incoming envelope that caused this
37332 delivery to happen. More than one address may be present if the transport is
37333 configured to handle several addresses at once, or if more than one original
37334 address was redirected to the same final address. As this is not a standard
37335 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
37336 its removal from incoming messages, so that delivered messages can safely be
37337 resent to other recipients.
37338 </para>
37339 <para>
37340 <indexterm role="option">
37341 <primary><option>group</option></primary>
37342 </indexterm>
37343 </para>
37344 <informaltable frame="all">
37345 <tgroup cols="4" colsep="0" rowsep="0">
37346 <colspec colwidth="8*" align="left"/>
37347 <colspec colwidth="6*" align="center"/>
37348 <colspec colwidth="6*" align="center"/>
37349 <colspec colwidth="6*" align="right"/>
37350 <tbody>
37351 <row>
37352 <entry><option>group</option></entry>
37353 <entry>Use: <emphasis>transports</emphasis></entry>
37354 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37355 <entry>Default: <emphasis>Exim group</emphasis></entry>
37356 </row>
37357 </tbody>
37358 </tgroup>
37359 </informaltable>
37360 <para>
37361 <indexterm role="concept">
37362 <primary>transport</primary>
37363 <secondary>group; specifying</secondary>
37364 </indexterm>
37365 This option specifies a gid for running the transport process, overriding any
37366 value that the router supplies, and also overriding any value associated with
37367 <option>user</option> (see below).
37368 </para>
37369 <para>
37370 <indexterm role="option">
37371 <primary><option>headers_add</option></primary>
37372 </indexterm>
37373 </para>
37374 <informaltable frame="all">
37375 <tgroup cols="4" colsep="0" rowsep="0">
37376 <colspec colwidth="8*" align="left"/>
37377 <colspec colwidth="6*" align="center"/>
37378 <colspec colwidth="6*" align="center"/>
37379 <colspec colwidth="6*" align="right"/>
37380 <tbody>
37381 <row>
37382 <entry><option>headers_add</option></entry>
37383 <entry>Use: <emphasis>transports</emphasis></entry>
37384 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37385 <entry>Default: <emphasis>unset</emphasis></entry>
37386 </row>
37387 </tbody>
37388 </tgroup>
37389 </informaltable>
37390 <para>
37391 <indexterm role="concept">
37392 <primary>header lines</primary>
37393 <secondary>adding in transport</secondary>
37394 </indexterm>
37395 <indexterm role="concept">
37396 <primary>transport</primary>
37397 <secondary>header lines; adding</secondary>
37398 </indexterm>
37399 This option specifies a string of text that is expanded and added to the header
37400 portion of a message as it is transported, as described in section
37401 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
37402 routers. If the result of the expansion is an empty string, or if the expansion
37403 is forced to fail, no action is taken. Other expansion failures are treated as
37404 errors and cause the delivery to be deferred.
37405 </para>
37406 <para revisionflag="changed">
37407 Unlike most options, <option>headers_add</option> can be specified multiple times
37408 for a transport; all listed headers are added.
37409 </para>
37410 <para>
37411 <indexterm role="option">
37412 <primary><option>headers_only</option></primary>
37413 </indexterm>
37414 </para>
37415 <informaltable frame="all">
37416 <tgroup cols="4" colsep="0" rowsep="0">
37417 <colspec colwidth="8*" align="left"/>
37418 <colspec colwidth="6*" align="center"/>
37419 <colspec colwidth="6*" align="center"/>
37420 <colspec colwidth="6*" align="right"/>
37421 <tbody>
37422 <row>
37423 <entry><option>headers_only</option></entry>
37424 <entry>Use: <emphasis>transports</emphasis></entry>
37425 <entry>Type: <emphasis>boolean</emphasis></entry>
37426 <entry>Default: <emphasis>false</emphasis></entry>
37427 </row>
37428 </tbody>
37429 </tgroup>
37430 </informaltable>
37431 <para>
37432 <indexterm role="concept">
37433 <primary>transport</primary>
37434 <secondary>header lines only</secondary>
37435 </indexterm>
37436 <indexterm role="concept">
37437 <primary>message</primary>
37438 <secondary>transporting headers only</secondary>
37439 </indexterm>
37440 <indexterm role="concept">
37441 <primary>header lines</primary>
37442 <secondary>transporting</secondary>
37443 </indexterm>
37444 If this option is set, the message&#x2019;s body is not transported. It is mutually
37445 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
37446 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
37447 checked, since this option does not automatically suppress them.
37448 </para>
37449 <para>
37450 <indexterm role="option">
37451 <primary><option>headers_remove</option></primary>
37452 </indexterm>
37453 </para>
37454 <informaltable frame="all">
37455 <tgroup cols="4" colsep="0" rowsep="0">
37456 <colspec colwidth="8*" align="left"/>
37457 <colspec colwidth="6*" align="center"/>
37458 <colspec colwidth="6*" align="center"/>
37459 <colspec colwidth="6*" align="right"/>
37460 <tbody>
37461 <row>
37462 <entry><option>headers_remove</option></entry>
37463 <entry>Use: <emphasis>transports</emphasis></entry>
37464 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37465 <entry>Default: <emphasis>unset</emphasis></entry>
37466 </row>
37467 </tbody>
37468 </tgroup>
37469 </informaltable>
37470 <para>
37471 <indexterm role="concept">
37472 <primary>header lines</primary>
37473 <secondary>removing</secondary>
37474 </indexterm>
37475 <indexterm role="concept">
37476 <primary>transport</primary>
37477 <secondary>header lines; removing</secondary>
37478 </indexterm>
37479 This option specifies a string that is expanded into a list of header names;
37480 these headers are omitted from the message as it is transported, as described
37481 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
37482 routers. If the result of the expansion is an empty string, or if the expansion
37483 is forced to fail, no action is taken. Other expansion failures are treated as
37484 errors and cause the delivery to be deferred.
37485 </para>
37486 <para>
37487 Unlike most options, <option>headers_remove</option> can be specified multiple times
37488 for a router; all listed headers are added.
37489 </para>
37490 <para>
37491 <indexterm role="option">
37492 <primary><option>headers_rewrite</option></primary>
37493 </indexterm>
37494 </para>
37495 <informaltable frame="all">
37496 <tgroup cols="4" colsep="0" rowsep="0">
37497 <colspec colwidth="8*" align="left"/>
37498 <colspec colwidth="6*" align="center"/>
37499 <colspec colwidth="6*" align="center"/>
37500 <colspec colwidth="6*" align="right"/>
37501 <tbody>
37502 <row>
37503 <entry><option>headers_rewrite</option></entry>
37504 <entry>Use: <emphasis>transports</emphasis></entry>
37505 <entry>Type: <emphasis>string</emphasis></entry>
37506 <entry>Default: <emphasis>unset</emphasis></entry>
37507 </row>
37508 </tbody>
37509 </tgroup>
37510 </informaltable>
37511 <para>
37512 <indexterm role="concept">
37513 <primary>transport</primary>
37514 <secondary>header lines; rewriting</secondary>
37515 </indexterm>
37516 <indexterm role="concept">
37517 <primary>rewriting</primary>
37518 <secondary>at transport time</secondary>
37519 </indexterm>
37520 This option allows addresses in header lines to be rewritten at transport time,
37521 that is, as the message is being copied to its destination. The contents of the
37522 option are a colon-separated list of rewriting rules. Each rule is in exactly
37523 the same form as one of the general rewriting rules that are applied when a
37524 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
37525 example,
37526 </para>
37527 <literallayout class="monospaced">
37528 headers_rewrite = a@b c@d f : \
37529                   x@y w@z
37530 </literallayout>
37531 <para>
37532 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
37533 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
37534 header lines just before they are written out at transport time, so they affect
37535 only those copies of the message that pass through the transport. However, only
37536 the message&#x2019;s original header lines, and any that were added by a system
37537 filter, are rewritten. If a router or transport adds header lines, they are not
37538 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
37539 envelope. You can change the return path using <option>return_path</option>, but you cannot
37540 change envelope recipients at this time.
37541 </para>
37542 <para>
37543 <indexterm role="option">
37544 <primary><option>home_directory</option></primary>
37545 </indexterm>
37546 </para>
37547 <informaltable frame="all">
37548 <tgroup cols="4" colsep="0" rowsep="0">
37549 <colspec colwidth="8*" align="left"/>
37550 <colspec colwidth="6*" align="center"/>
37551 <colspec colwidth="6*" align="center"/>
37552 <colspec colwidth="6*" align="right"/>
37553 <tbody>
37554 <row>
37555 <entry><option>home_directory</option></entry>
37556 <entry>Use: <emphasis>transports</emphasis></entry>
37557 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37558 <entry>Default: <emphasis>unset</emphasis></entry>
37559 </row>
37560 </tbody>
37561 </tgroup>
37562 </informaltable>
37563 <para>
37564 <indexterm role="concept">
37565 <primary>transport</primary>
37566 <secondary>home directory for</secondary>
37567 </indexterm>
37568 <indexterm role="variable">
37569 <primary><varname>$home</varname></primary>
37570 </indexterm>
37571 This option specifies a home directory setting for a local transport,
37572 overriding any value that may be set by the router. The home directory is
37573 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
37574 used as the current directory if no current directory is set by the
37575 <option>current_directory</option> option on the transport or the
37576 <option>transport_current_directory</option> option on the router. If the expansion fails
37577 for any reason, including forced failure, an error is logged, and delivery is
37578 deferred.
37579 </para>
37580 <para>
37581 <indexterm role="option">
37582 <primary><option>initgroups</option></primary>
37583 </indexterm>
37584 </para>
37585 <informaltable frame="all">
37586 <tgroup cols="4" colsep="0" rowsep="0">
37587 <colspec colwidth="8*" align="left"/>
37588 <colspec colwidth="6*" align="center"/>
37589 <colspec colwidth="6*" align="center"/>
37590 <colspec colwidth="6*" align="right"/>
37591 <tbody>
37592 <row>
37593 <entry><option>initgroups</option></entry>
37594 <entry>Use: <emphasis>transports</emphasis></entry>
37595 <entry>Type: <emphasis>boolean</emphasis></entry>
37596 <entry>Default: <emphasis>false</emphasis></entry>
37597 </row>
37598 </tbody>
37599 </tgroup>
37600 </informaltable>
37601 <para>
37602 <indexterm role="concept">
37603 <primary>additional groups</primary>
37604 </indexterm>
37605 <indexterm role="concept">
37606 <primary>groups</primary>
37607 <secondary>additional</secondary>
37608 </indexterm>
37609 <indexterm role="concept">
37610 <primary>transport</primary>
37611 <secondary>group; additional</secondary>
37612 </indexterm>
37613 If this option is true and the uid for the delivery process is provided by the
37614 transport, the <function>initgroups()</function> function is called when running the transport
37615 to ensure that any additional groups associated with the uid are set up.
37616 </para>
37617 <para>
37618 <indexterm role="option">
37619 <primary><option>message_size_limit</option></primary>
37620 </indexterm>
37621 </para>
37622 <informaltable frame="all">
37623 <tgroup cols="4" colsep="0" rowsep="0">
37624 <colspec colwidth="8*" align="left"/>
37625 <colspec colwidth="6*" align="center"/>
37626 <colspec colwidth="6*" align="center"/>
37627 <colspec colwidth="6*" align="right"/>
37628 <tbody>
37629 <row>
37630 <entry><option>message_size_limit</option></entry>
37631 <entry>Use: <emphasis>transports</emphasis></entry>
37632 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37633 <entry>Default: <emphasis>0</emphasis></entry>
37634 </row>
37635 </tbody>
37636 </tgroup>
37637 </informaltable>
37638 <para>
37639 <indexterm role="concept">
37640 <primary>limit</primary>
37641 <secondary>message size per transport</secondary>
37642 </indexterm>
37643 <indexterm role="concept">
37644 <primary>size</primary>
37645 <secondary>of message, limit</secondary>
37646 </indexterm>
37647 <indexterm role="concept">
37648 <primary>transport</primary>
37649 <secondary>message size; limiting</secondary>
37650 </indexterm>
37651 This option controls the size of messages passed through the transport. It is
37652 expanded before use; the result of the expansion must be a sequence of decimal
37653 digits, optionally followed by K or M. If the expansion fails for any reason,
37654 including forced failure, or if the result is not of the required form,
37655 delivery is deferred. If the value is greater than zero and the size of a
37656 message exceeds this limit, the address is failed. If there is any chance that
37657 the resulting bounce message could be routed to the same transport, you should
37658 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
37659 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
37660 delivered.
37661 </para>
37662 <para>
37663 <indexterm role="option">
37664 <primary><option>rcpt_include_affixes</option></primary>
37665 </indexterm>
37666 </para>
37667 <informaltable frame="all">
37668 <tgroup cols="4" colsep="0" rowsep="0">
37669 <colspec colwidth="8*" align="left"/>
37670 <colspec colwidth="6*" align="center"/>
37671 <colspec colwidth="6*" align="center"/>
37672 <colspec colwidth="6*" align="right"/>
37673 <tbody>
37674 <row>
37675 <entry><option>rcpt_include_affixes</option></entry>
37676 <entry>Use: <emphasis>transports</emphasis></entry>
37677 <entry>Type: <emphasis>boolean</emphasis></entry>
37678 <entry>Default: <emphasis>false</emphasis></entry>
37679 </row>
37680 </tbody>
37681 </tgroup>
37682 </informaltable>
37683 <para>
37684 <indexterm role="concept">
37685 <primary>prefix</primary>
37686 <secondary>for local part, including in envelope</secondary>
37687 </indexterm>
37688 <indexterm role="concept">
37689 <primary>suffix for local part</primary>
37690 <secondary>including in envelope</secondary>
37691 </indexterm>
37692 <indexterm role="concept">
37693 <primary>local part</primary>
37694 <secondary>prefix</secondary>
37695 </indexterm>
37696 <indexterm role="concept">
37697 <primary>local part</primary>
37698 <secondary>suffix</secondary>
37699 </indexterm>
37700 When this option is false (the default), and an address that has had any
37701 affixes (prefixes or suffixes) removed from the local part is delivered by any
37702 form of SMTP or LMTP, the affixes are not included. For example, if a router
37703 that contains
37704 </para>
37705 <literallayout class="monospaced">
37706 local_part_prefix = *-
37707 </literallayout>
37708 <para>
37709 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
37710 is delivered with
37711 </para>
37712 <literallayout class="monospaced">
37713 RCPT TO:&lt;xyz@some.domain&gt;
37714 </literallayout>
37715 <para>
37716 This is also the case when an ACL-time callout is being used to verify a
37717 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
37718 whole local part is included in the RCPT command. This option applies to BSMTP
37719 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
37720 <command>lmtp</command> and <command>smtp</command> transports.
37721 </para>
37722 <para>
37723 <indexterm role="option">
37724 <primary><option>retry_use_local_part</option></primary>
37725 </indexterm>
37726 </para>
37727 <informaltable frame="all">
37728 <tgroup cols="4" colsep="0" rowsep="0">
37729 <colspec colwidth="8*" align="left"/>
37730 <colspec colwidth="6*" align="center"/>
37731 <colspec colwidth="6*" align="center"/>
37732 <colspec colwidth="6*" align="right"/>
37733 <tbody>
37734 <row>
37735 <entry><option>retry_use_local_part</option></entry>
37736 <entry>Use: <emphasis>transports</emphasis></entry>
37737 <entry>Type: <emphasis>boolean</emphasis></entry>
37738 <entry>Default: <emphasis>see below</emphasis></entry>
37739 </row>
37740 </tbody>
37741 </tgroup>
37742 </informaltable>
37743 <para>
37744 <indexterm role="concept">
37745 <primary>hints database</primary>
37746 <secondary>retry keys</secondary>
37747 </indexterm>
37748 When a delivery suffers a temporary failure, a retry record is created
37749 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
37750 is based on the name and/or IP address of the failing remote host. For local
37751 deliveries, the key is normally the entire address, including both the local
37752 part and the domain. This is suitable for most common cases of local delivery
37753 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
37754 deliveries to that mailbox, not to the whole domain.
37755 </para>
37756 <para>
37757 However, in some special cases you may want to treat a temporary local delivery
37758 as a failure associated with the domain, and not with a particular local part.
37759 (For example, if you are storing all mail for some domain in files.) You can do
37760 this by setting <option>retry_use_local_part</option> false.
37761 </para>
37762 <para>
37763 For all the local transports, its default value is true. For remote transports,
37764 the default value is false for tidiness, but changing the value has no effect
37765 on a remote transport in the current implementation.
37766 </para>
37767 <para>
37768 <indexterm role="option">
37769 <primary><option>return_path</option></primary>
37770 </indexterm>
37771 </para>
37772 <informaltable frame="all">
37773 <tgroup cols="4" colsep="0" rowsep="0">
37774 <colspec colwidth="8*" align="left"/>
37775 <colspec colwidth="6*" align="center"/>
37776 <colspec colwidth="6*" align="center"/>
37777 <colspec colwidth="6*" align="right"/>
37778 <tbody>
37779 <row>
37780 <entry><option>return_path</option></entry>
37781 <entry>Use: <emphasis>transports</emphasis></entry>
37782 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37783 <entry>Default: <emphasis>unset</emphasis></entry>
37784 </row>
37785 </tbody>
37786 </tgroup>
37787 </informaltable>
37788 <para>
37789 <indexterm role="concept">
37790 <primary>envelope sender</primary>
37791 </indexterm>
37792 <indexterm role="concept">
37793 <primary>transport</primary>
37794 <secondary>return path; changing</secondary>
37795 </indexterm>
37796 <indexterm role="concept">
37797 <primary>return path</primary>
37798 <secondary>changing in transport</secondary>
37799 </indexterm>
37800 If this option is set, the string is expanded at transport time and replaces
37801 the existing return path (envelope sender) value in the copy of the message
37802 that is being delivered. An empty return path is permitted. This feature is
37803 designed for remote deliveries, where the value of this option is used in the
37804 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
37805 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
37806 header line, if one is added to the message (see the next option).
37807 </para>
37808 <para>
37809 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
37810 <option>return_path_on_delivery</option> to the log selector.
37811 </para>
37812 <para>
37813 <indexterm role="variable">
37814 <primary><varname>$return_path</varname></primary>
37815 </indexterm>
37816 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
37817 either the message&#x2019;s envelope sender, or an address set by the
37818 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
37819 replacement occurs; if it fails for another reason, delivery is deferred. This
37820 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
37821 section <xref linkend="SECTverp"/>.
37822 </para>
37823 <para>
37824 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
37825 remote server rejects a message at SMTP time, the bounce message is not sent to
37826 the value of this option. It is sent to the previously set errors address.
37827 This defaults to the incoming sender address, but can be changed by setting
37828 <option>errors_to</option> in a router.
37829 </para>
37830 <para>
37831 <indexterm role="option">
37832 <primary><option>return_path_add</option></primary>
37833 </indexterm>
37834 </para>
37835 <informaltable frame="all">
37836 <tgroup cols="4" colsep="0" rowsep="0">
37837 <colspec colwidth="8*" align="left"/>
37838 <colspec colwidth="6*" align="center"/>
37839 <colspec colwidth="6*" align="center"/>
37840 <colspec colwidth="6*" align="right"/>
37841 <tbody>
37842 <row>
37843 <entry><option>return_path_add</option></entry>
37844 <entry>Use: <emphasis>transports</emphasis></entry>
37845 <entry>Type: <emphasis>boolean</emphasis></entry>
37846 <entry>Default: <emphasis>false</emphasis></entry>
37847 </row>
37848 </tbody>
37849 </tgroup>
37850 </informaltable>
37851 <para>
37852 <indexterm role="concept">
37853 <primary><emphasis>Return-path:</emphasis> header line</primary>
37854 </indexterm>
37855 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
37856 Although the return path is normally available in the prefix line of BSD
37857 mailboxes, this is commonly not displayed by MUAs, and so the user does not
37858 have easy access to it.
37859 </para>
37860 <para>
37861 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
37862 the delivery SMTP server makes the final delivery</quote>. This implies that this
37863 header should not be present in incoming messages. Exim has a configuration
37864 option, <option>return_path_remove</option>, which requests removal of this header from
37865 incoming messages, so that delivered messages can safely be resent to other
37866 recipients.
37867 </para>
37868 <para>
37869 <indexterm role="option">
37870 <primary><option>shadow_condition</option></primary>
37871 </indexterm>
37872 </para>
37873 <informaltable frame="all">
37874 <tgroup cols="4" colsep="0" rowsep="0">
37875 <colspec colwidth="8*" align="left"/>
37876 <colspec colwidth="6*" align="center"/>
37877 <colspec colwidth="6*" align="center"/>
37878 <colspec colwidth="6*" align="right"/>
37879 <tbody>
37880 <row>
37881 <entry><option>shadow_condition</option></entry>
37882 <entry>Use: <emphasis>transports</emphasis></entry>
37883 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37884 <entry>Default: <emphasis>unset</emphasis></entry>
37885 </row>
37886 </tbody>
37887 </tgroup>
37888 </informaltable>
37889 <para>
37890 See <option>shadow_transport</option> below.
37891 </para>
37892 <para>
37893 <indexterm role="option">
37894 <primary><option>shadow_transport</option></primary>
37895 </indexterm>
37896 </para>
37897 <informaltable frame="all">
37898 <tgroup cols="4" colsep="0" rowsep="0">
37899 <colspec colwidth="8*" align="left"/>
37900 <colspec colwidth="6*" align="center"/>
37901 <colspec colwidth="6*" align="center"/>
37902 <colspec colwidth="6*" align="right"/>
37903 <tbody>
37904 <row>
37905 <entry><option>shadow_transport</option></entry>
37906 <entry>Use: <emphasis>transports</emphasis></entry>
37907 <entry>Type: <emphasis>string</emphasis></entry>
37908 <entry>Default: <emphasis>unset</emphasis></entry>
37909 </row>
37910 </tbody>
37911 </tgroup>
37912 </informaltable>
37913 <para>
37914 <indexterm role="concept">
37915 <primary>shadow transport</primary>
37916 </indexterm>
37917 <indexterm role="concept">
37918 <primary>transport</primary>
37919 <secondary>shadow</secondary>
37920 </indexterm>
37921 A local transport may set the <option>shadow_transport</option> option to the name of
37922 another local transport. Shadow remote transports are not supported.
37923 </para>
37924 <para>
37925 Whenever a delivery to the main transport succeeds, and either
37926 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
37927 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
37928 passed to the shadow transport, with the same delivery address or addresses. If
37929 expansion fails, no action is taken except that non-forced expansion failures
37930 cause a log line to be written.
37931 </para>
37932 <para>
37933 The result of the shadow transport is discarded and does not affect the
37934 subsequent processing of the message. Only a single level of shadowing is
37935 provided; the <option>shadow_transport</option> option is ignored on any transport when it
37936 is running as a shadow. Options concerned with output from pipes are also
37937 ignored. The log line for the successful delivery has an item added on the end,
37938 of the form
37939 </para>
37940 <literallayout class="monospaced">
37941 ST=&lt;shadow transport name&gt;
37942 </literallayout>
37943 <para>
37944 If the shadow transport did not succeed, the error message is put in
37945 parentheses afterwards. Shadow transports can be used for a number of different
37946 purposes, including keeping more detailed log information than Exim normally
37947 provides, and implementing automatic acknowledgment policies based on message
37948 headers that some sites insist on.
37949 </para>
37950 <para>
37951 <indexterm role="option">
37952 <primary><option>transport_filter</option></primary>
37953 </indexterm>
37954 </para>
37955 <informaltable frame="all">
37956 <tgroup cols="4" colsep="0" rowsep="0">
37957 <colspec colwidth="8*" align="left"/>
37958 <colspec colwidth="6*" align="center"/>
37959 <colspec colwidth="6*" align="center"/>
37960 <colspec colwidth="6*" align="right"/>
37961 <tbody>
37962 <row>
37963 <entry><option>transport_filter</option></entry>
37964 <entry>Use: <emphasis>transports</emphasis></entry>
37965 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37966 <entry>Default: <emphasis>unset</emphasis></entry>
37967 </row>
37968 </tbody>
37969 </tgroup>
37970 </informaltable>
37971 <para>
37972 <indexterm role="concept">
37973 <primary>transport</primary>
37974 <secondary>filter</secondary>
37975 </indexterm>
37976 <indexterm role="concept">
37977 <primary>filter</primary>
37978 <secondary>transport filter</secondary>
37979 </indexterm>
37980 This option sets up a filtering (in the Unix shell sense) process for messages
37981 at transport time. It should not be confused with mail filtering as set up by
37982 individual users or via a system filter.
37983 </para>
37984 <para>
37985 When the message is about to be written out, the command specified by
37986 <option>transport_filter</option> is started up in a separate, parallel process, and
37987 the entire message, including the header lines, is passed to it on its standard
37988 input (this in fact is done from a third process, to avoid deadlock). The
37989 command must be specified as an absolute path.
37990 </para>
37991 <para>
37992 The lines of the message that are written to the transport filter are
37993 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
37994 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
37995 lines beginning with a dot, and also before any processing implied by the
37996 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
37997 <command>pipe</command> transports.
37998 </para>
37999 <para>
38000 The standard error for the filter process is set to the same destination as its
38001 standard output; this is read and written to the message&#x2019;s ultimate
38002 destination. The process that writes the message to the filter, the
38003 filter itself, and the original process that reads the result and delivers it
38004 are all run in parallel, like a shell pipeline.
38005 </para>
38006 <para>
38007 The filter can perform any transformations it likes, but of course should take
38008 care not to break RFC 2822 syntax. Exim does not check the result, except to
38009 test for a final newline when SMTP is in use. All messages transmitted over
38010 SMTP must end with a newline, so Exim supplies one if it is missing.
38011 </para>
38012 <para>
38013 <indexterm role="concept">
38014 <primary>content scanning</primary>
38015 <secondary>per user</secondary>
38016 </indexterm>
38017 A transport filter can be used to provide content-scanning on a per-user basis
38018 at delivery time if the only required effect of the scan is to modify the
38019 message. For example, a content scan could insert a new header line containing
38020 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
38021 not possible to discard a message at this stage.
38022 </para>
38023 <para>
38024 <indexterm role="concept">
38025 <primary>SMTP</primary>
38026 <secondary>SIZE</secondary>
38027 </indexterm>
38028 A problem might arise if the filter increases the size of a message that is
38029 being sent down an SMTP connection. If the receiving SMTP server has indicated
38030 support for the SIZE parameter, Exim will have sent the size of the message
38031 at the start of the SMTP session. If what is actually sent is substantially
38032 more, the server might reject the message. This can be worked round by setting
38033 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
38034 additions to the message, or to disable the use of SIZE altogether.
38035 </para>
38036 <para>
38037 <indexterm role="variable">
38038 <primary><varname>$pipe_addresses</varname></primary>
38039 </indexterm>
38040 The value of the <option>transport_filter</option> option is the command string for starting
38041 the filter, which is run directly from Exim, not under a shell. The string is
38042 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
38043 Exim breaks it up into arguments and then expands each argument separately (see
38044 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
38045 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
38046 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
38047 an ideal name for this feature here, but as it was already implemented for the
38048 <command>pipe</command> transport, it seemed sensible not to change it.)
38049 </para>
38050 <para>
38051 <indexterm role="variable">
38052 <primary><varname>$host</varname></primary>
38053 </indexterm>
38054 <indexterm role="variable">
38055 <primary><varname>$host_address</varname></primary>
38056 </indexterm>
38057 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
38058 transport is a remote one. They contain the name and IP address of the host to
38059 which the message is being sent. For example:
38060 </para>
38061 <literallayout class="monospaced">
38062 transport_filter = /some/directory/transport-filter.pl \
38063   $host $host_address $sender_address $pipe_addresses
38064 </literallayout>
38065 <para>
38066 Two problems arise if you want to use more complicated expansion items to
38067 generate transport filter commands, both of which due to the fact that the
38068 command is split up <emphasis>before</emphasis> expansion.
38069 </para>
38070 <itemizedlist>
38071 <listitem>
38072 <para>
38073 If an expansion item contains white space, you must quote it, so that it is all
38074 part of the same command item. If the entire option setting is one such
38075 expansion item, you have to take care what kind of quoting you use. For
38076 example:
38077 </para>
38078 <literallayout class="monospaced">
38079 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
38080 </literallayout>
38081 <para>
38082 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
38083 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
38084 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
38085 the single quotes were missing, the line would be split into two items,
38086 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
38087 Exim tried to expand the first one.
38088 </para>
38089 </listitem>
38090 <listitem>
38091 <para>
38092 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
38093 expansion cannot generate multiple arguments, or a command name followed by
38094 arguments. Consider this example:
38095 </para>
38096 <literallayout class="monospaced">
38097 transport_filter = ${lookup{$host}lsearch{/a/file}\
38098                     {$value}{/bin/cat}}
38099 </literallayout>
38100 <para>
38101 The result of the lookup is interpreted as the name of the command, even
38102 if it contains white space. The simplest way round this is to use a shell:
38103 </para>
38104 <literallayout class="monospaced">
38105 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
38106                                {$value}{/bin/cat}}
38107 </literallayout>
38108 </listitem>
38109 </itemizedlist>
38110 <para>
38111 The filter process is run under the same uid and gid as the normal delivery.
38112 For remote deliveries this is the Exim uid/gid by default. The command should
38113 normally yield a zero return code. Transport filters are not supposed to fail.
38114 A non-zero code is taken to mean that the transport filter encountered some
38115 serious problem. Delivery of the message is deferred; the message remains on
38116 the queue and is tried again later. It is not possible to cause a message to be
38117 bounced from a transport filter.
38118 </para>
38119 <para>
38120 If a transport filter is set on an autoreply transport, the original message is
38121 passed through the filter as it is being copied into the newly generated
38122 message, which happens if the <option>return_message</option> option is set.
38123 </para>
38124 <para>
38125 <indexterm role="option">
38126 <primary><option>transport_filter_timeout</option></primary>
38127 </indexterm>
38128 </para>
38129 <informaltable frame="all">
38130 <tgroup cols="4" colsep="0" rowsep="0">
38131 <colspec colwidth="8*" align="left"/>
38132 <colspec colwidth="6*" align="center"/>
38133 <colspec colwidth="6*" align="center"/>
38134 <colspec colwidth="6*" align="right"/>
38135 <tbody>
38136 <row>
38137 <entry><option>transport_filter_timeout</option></entry>
38138 <entry>Use: <emphasis>transports</emphasis></entry>
38139 <entry>Type: <emphasis>time</emphasis></entry>
38140 <entry>Default: <emphasis>5m</emphasis></entry>
38141 </row>
38142 </tbody>
38143 </tgroup>
38144 </informaltable>
38145 <para>
38146 <indexterm role="concept">
38147 <primary>transport</primary>
38148 <secondary>filter, timeout</secondary>
38149 </indexterm>
38150 When Exim is reading the output of a transport filter, it applies a timeout
38151 that can be set by this option. Exceeding the timeout is normally treated as a
38152 temporary delivery failure. However, if a transport filter is used with a
38153 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
38154 way as a timeout in the pipe command itself. By default, a timeout is a hard
38155 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
38156 becomes a temporary error.
38157 </para>
38158 <para>
38159 <indexterm role="option">
38160 <primary><option>user</option></primary>
38161 </indexterm>
38162 </para>
38163 <informaltable frame="all">
38164 <tgroup cols="4" colsep="0" rowsep="0">
38165 <colspec colwidth="8*" align="left"/>
38166 <colspec colwidth="6*" align="center"/>
38167 <colspec colwidth="6*" align="center"/>
38168 <colspec colwidth="6*" align="right"/>
38169 <tbody>
38170 <row>
38171 <entry><option>user</option></entry>
38172 <entry>Use: <emphasis>transports</emphasis></entry>
38173 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38174 <entry>Default: <emphasis>Exim user</emphasis></entry>
38175 </row>
38176 </tbody>
38177 </tgroup>
38178 </informaltable>
38179 <para>
38180 <indexterm role="concept">
38181 <primary>uid (user id)</primary>
38182 <secondary>local delivery</secondary>
38183 </indexterm>
38184 <indexterm role="concept">
38185 <primary>transport</primary>
38186 <secondary>user, specifying</secondary>
38187 </indexterm>
38188 This option specifies the user under whose uid the delivery process is to be
38189 run, overriding any uid that may have been set by the router. If the user is
38190 given as a name, the uid is looked up from the password data, and the
38191 associated group is taken as the value of the gid to be used if the <option>group</option>
38192 option is not set.
38193 </para>
38194 <para>
38195 For deliveries that use local transports, a user and group are normally
38196 specified explicitly or implicitly (for example, as a result of
38197 <option>check_local_user</option>) by the router or transport.
38198 </para>
38199 <para>
38200 <indexterm role="concept">
38201 <primary>hints database</primary>
38202 <secondary>access by remote transport</secondary>
38203 </indexterm>
38204 For remote transports, you should leave this option unset unless you really are
38205 sure you know what you are doing. When a remote transport is running, it needs
38206 to be able to access Exim&#x2019;s hints databases, because each host may have its own
38207 retry data.
38208 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
38209 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
38210 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
38211 </para>
38212 </chapter>
38213
38214 <chapter id="CHAPbatching">
38215 <title>Address batching in local transports</title>
38216 <titleabbrev>Address batching</titleabbrev>
38217 <para>
38218 <indexterm role="concept">
38219 <primary>transport</primary>
38220 <secondary>local; address batching in</secondary>
38221 </indexterm>
38222 The only remote transport (<command>smtp</command>) is normally configured to handle more than
38223 one address at a time, so that when several addresses are routed to the same
38224 remote host, just one copy of the message is sent. Local transports, however,
38225 normally handle one address at a time. That is, a separate instance of the
38226 transport is run for each address that is routed to the transport. A separate
38227 copy of the message is delivered each time.
38228 </para>
38229 <para>
38230 <indexterm role="concept">
38231 <primary>batched local delivery</primary>
38232 </indexterm>
38233 <indexterm role="option">
38234 <primary><option>batch_max</option></primary>
38235 </indexterm>
38236 <indexterm role="option">
38237 <primary><option>batch_id</option></primary>
38238 </indexterm>
38239 In special cases, it may be desirable to handle several addresses at once in a
38240 local transport, for example:
38241 </para>
38242 <itemizedlist>
38243 <listitem>
38244 <para>
38245 In an <command>appendfile</command> transport, when storing messages in files for later
38246 delivery by some other means, a single copy of the message with multiple
38247 recipients saves space.
38248 </para>
38249 </listitem>
38250 <listitem>
38251 <para>
38252 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
38253 a single copy saves time, and is the normal way LMTP is expected to work.
38254 </para>
38255 </listitem>
38256 <listitem>
38257 <para>
38258 In a <command>pipe</command> transport, when passing the message
38259 to a scanner program or
38260 to some other delivery mechanism such as UUCP, multiple recipients may be
38261 acceptable.
38262 </para>
38263 </listitem>
38264 </itemizedlist>
38265 <para>
38266 These three local transports all have the same options for controlling multiple
38267 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
38268 repeating the information for each transport, these options are described here.
38269 </para>
38270 <para>
38271 The <option>batch_max</option> option specifies the maximum number of addresses that can be
38272 delivered together in a single run of the transport. Its default value is one
38273 (no batching). When more than one address is routed to a transport that has a
38274 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
38275 (that is, in a single run of the transport with multiple recipients), subject
38276 to certain conditions:
38277 </para>
38278 <itemizedlist>
38279 <listitem>
38280 <para>
38281 <indexterm role="variable">
38282 <primary><varname>$local_part</varname></primary>
38283 </indexterm>
38284 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
38285 batching is possible.
38286 </para>
38287 </listitem>
38288 <listitem>
38289 <para>
38290 <indexterm role="variable">
38291 <primary><varname>$domain</varname></primary>
38292 </indexterm>
38293 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
38294 addresses with the same domain are batched.
38295 </para>
38296 </listitem>
38297 <listitem>
38298 <para>
38299 <indexterm role="concept">
38300 <primary>customizing</primary>
38301 <secondary>batching condition</secondary>
38302 </indexterm>
38303 If <option>batch_id</option> is set, it is expanded for each address, and only those
38304 addresses with the same expanded value are batched. This allows you to specify
38305 customized batching conditions. Failure of the expansion for any reason,
38306 including forced failure, disables batching, but it does not stop the delivery
38307 from taking place.
38308 </para>
38309 </listitem>
38310 <listitem>
38311 <para>
38312 Batched addresses must also have the same errors address (where to send
38313 delivery errors), the same header additions and removals, the same user and
38314 group for the transport, and if a host list is present, the first host must
38315 be the same.
38316 </para>
38317 </listitem>
38318 </itemizedlist>
38319 <para>
38320 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
38321 both when the file or pipe command is specified in the transport, and when it
38322 is specified by a <command>redirect</command> router, but all the batched addresses must of
38323 course be routed to the same file or pipe command. These two transports have an
38324 option called <option>use_bsmtp</option>, which causes them to deliver the message in
38325 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
38326 <option>check_string</option> and <option>escape_string</option> options are forced to the values
38327 </para>
38328 <literallayout class="monospaced">
38329 check_string = "."
38330 escape_string = ".."
38331 </literallayout>
38332 <para>
38333 when batched SMTP is in use. A full description of the batch SMTP mechanism is
38334 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
38335 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
38336 </para>
38337 <para>
38338 <indexterm role="concept">
38339 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
38340 </indexterm>
38341 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
38342 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
38343 that are being processed together. If you are using a batching <command>appendfile</command>
38344 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
38345 addresses is to set the <option>envelope_to_add</option> option.
38346 </para>
38347 <para>
38348 <indexterm role="concept">
38349 <primary><command>pipe</command> transport</primary>
38350 <secondary>with multiple addresses</secondary>
38351 </indexterm>
38352 <indexterm role="variable">
38353 <primary><varname>$pipe_addresses</varname></primary>
38354 </indexterm>
38355 If you are using a <command>pipe</command> transport without BSMTP, and setting the
38356 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
38357 the command. This is not a true variable; it is a bit of magic that causes each
38358 of the recipient addresses to be inserted into the command as a separate
38359 argument. This provides a way of accessing all the addresses that are being
38360 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
38361 are specified by a <command>redirect</command> router.
38362 </para>
38363 </chapter>
38364
38365 <chapter id="CHAPappendfile">
38366 <title>The appendfile transport</title>
38367 <para>
38368 <indexterm role="concept" id="IIDapptra1" class="startofrange">
38369 <primary><command>appendfile</command> transport</primary>
38370 </indexterm>
38371 <indexterm role="concept" id="IIDapptra2" class="startofrange">
38372 <primary>transports</primary>
38373 <secondary><command>appendfile</command></secondary>
38374 </indexterm>
38375 <indexterm role="concept">
38376 <primary>directory creation</primary>
38377 </indexterm>
38378 <indexterm role="concept">
38379 <primary>creating directories</primary>
38380 </indexterm>
38381 The <command>appendfile</command> transport delivers a message by appending it to an existing
38382 file, or by creating an entirely new file in a specified directory. Single
38383 files to which messages are appended can be in the traditional Unix mailbox
38384 format, or optionally in the MBX format supported by the Pine MUA and
38385 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
38386 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
38387 to give added protection against failures that happen part-way through the
38388 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
38389 supported. For all file formats, Exim attempts to create as many levels of
38390 directory as necessary, provided that <option>create_directory</option> is set.
38391 </para>
38392 <para>
38393 The code for the optional formats is not included in the Exim binary by
38394 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
38395 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
38396 included.
38397 </para>
38398 <para>
38399 <indexterm role="concept">
38400 <primary>quota</primary>
38401 <secondary>system</secondary>
38402 </indexterm>
38403 Exim recognizes system quota errors, and generates an appropriate message. Exim
38404 also supports its own quota control within the transport, for use when the
38405 system facility is unavailable or cannot be used for some reason.
38406 </para>
38407 <para>
38408 If there is an error while appending to a file (for example, quota exceeded or
38409 partition filled), Exim attempts to reset the file&#x2019;s length and last
38410 modification time back to what they were before. If there is an error while
38411 creating an entirely new file, the new file is removed.
38412 </para>
38413 <para>
38414 Before appending to a file, a number of security checks are made, and the
38415 file is locked. A detailed description is given below, after the list of
38416 private options.
38417 </para>
38418 <para>
38419 The <command>appendfile</command> transport is most commonly used for local deliveries to
38420 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
38421 putting messages into files for remote delivery by some means other than Exim.
38422 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
38423 option).
38424 </para>
38425 <section id="SECTfildiropt">
38426 <title>The file and directory options</title>
38427 <para>
38428 The <option>file</option> option specifies a single file, to which the message is appended;
38429 the <option>directory</option> option specifies a directory, in which a new file containing
38430 the message is created. Only one of these two options can be set, and for
38431 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
38432 </para>
38433 <para>
38434 <indexterm role="variable">
38435 <primary><varname>$address_file</varname></primary>
38436 </indexterm>
38437 <indexterm role="variable">
38438 <primary><varname>$local_part</varname></primary>
38439 </indexterm>
38440 However, <command>appendfile</command> is also used for delivering messages to files or
38441 directories whose names (or parts of names) are obtained from alias,
38442 forwarding, or filtering operations (for example, a <option>save</option> command in a
38443 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
38444 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
38445 name (or partial name) of the file or directory generated by the redirection
38446 operation. There are two cases:
38447 </para>
38448 <itemizedlist>
38449 <listitem>
38450 <para>
38451 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
38452 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
38453 common case when users with local accounts use filtering to sort mail into
38454 different folders. See for example, the <command>address_file</command> transport in the
38455 default configuration. If the path ends with a slash, it is assumed to be the
38456 name of a directory. A delivery to a directory can also be forced by setting
38457 <option>maildir_format</option> or <option>mailstore_format</option>.
38458 </para>
38459 </listitem>
38460 <listitem>
38461 <para>
38462 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
38463 used to determine the file or directory name for the delivery. Normally, the
38464 contents of <varname>$address_file</varname> are used in some way in the string expansion.
38465 </para>
38466 </listitem>
38467 </itemizedlist>
38468 <para>
38469 <indexterm role="concept">
38470 <primary>Sieve filter</primary>
38471 <secondary>configuring <command>appendfile</command></secondary>
38472 </indexterm>
38473 <indexterm role="concept">
38474 <primary>Sieve filter</primary>
38475 <secondary>relative mailbox path handling</secondary>
38476 </indexterm>
38477 As an example of the second case, consider an environment where users do not
38478 have home directories. They may be permitted to use Exim filter commands of the
38479 form:
38480 </para>
38481 <literallayout class="monospaced">
38482 save folder23
38483 </literallayout>
38484 <para>
38485 or Sieve filter commands of the form:
38486 </para>
38487 <literallayout class="monospaced">
38488 require "fileinto";
38489 fileinto "folder23";
38490 </literallayout>
38491 <para>
38492 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
38493 must transform the relative path into an appropriate absolute file name. In the
38494 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
38495 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
38496 way of handling this requirement:
38497 </para>
38498 <literallayout class="monospaced">
38499 file = ${if eq{$address_file}{inbox} \
38500             {/var/mail/$local_part} \
38501             {${if eq{${substr_0_1:$address_file}}{/} \
38502                   {$address_file} \
38503                   {$home/mail/$address_file} \
38504             }} \
38505        }
38506 </literallayout>
38507 <para>
38508 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
38509 location, absolute paths are used without change, and other folders are in the
38510 <filename>mail</filename> directory within the home directory.
38511 </para>
38512 <para>
38513 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
38514 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
38515 the router. In particular, this is the case if <option>check_local_user</option> is set. If
38516 you want to prevent this happening at routing time, you can set
38517 <option>router_home_directory</option> empty. This forces the router to pass the relative
38518 path to the transport.
38519 </para>
38520 <para>
38521 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
38522 the <option>file</option> or <option>directory</option> option is still used if it is set.
38523 </para>
38524 </section>
38525 <section id="SECID134">
38526 <title>Private options for appendfile</title>
38527 <para>
38528 <indexterm role="concept">
38529 <primary>options</primary>
38530 <secondary><command>appendfile</command> transport</secondary>
38531 </indexterm>
38532 </para>
38533 <para>
38534 <indexterm role="option">
38535 <primary><option>allow_fifo</option></primary>
38536 </indexterm>
38537 </para>
38538 <informaltable frame="all">
38539 <tgroup cols="4" colsep="0" rowsep="0">
38540 <colspec colwidth="8*" align="left"/>
38541 <colspec colwidth="6*" align="center"/>
38542 <colspec colwidth="6*" align="center"/>
38543 <colspec colwidth="6*" align="right"/>
38544 <tbody>
38545 <row>
38546 <entry><option>allow_fifo</option></entry>
38547 <entry>Use: <emphasis>appendfile</emphasis></entry>
38548 <entry>Type: <emphasis>boolean</emphasis></entry>
38549 <entry>Default: <emphasis>false</emphasis></entry>
38550 </row>
38551 </tbody>
38552 </tgroup>
38553 </informaltable>
38554 <para>
38555 <indexterm role="concept">
38556 <primary>fifo (named pipe)</primary>
38557 </indexterm>
38558 <indexterm role="concept">
38559 <primary>named pipe (fifo)</primary>
38560 </indexterm>
38561 <indexterm role="concept">
38562 <primary>pipe</primary>
38563 <secondary>named (fifo)</secondary>
38564 </indexterm>
38565 Setting this option permits delivery to named pipes (FIFOs) as well as to
38566 regular files. If no process is reading the named pipe at delivery time, the
38567 delivery is deferred.
38568 </para>
38569 <para>
38570 <indexterm role="option">
38571 <primary><option>allow_symlink</option></primary>
38572 </indexterm>
38573 </para>
38574 <informaltable frame="all">
38575 <tgroup cols="4" colsep="0" rowsep="0">
38576 <colspec colwidth="8*" align="left"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="center"/>
38579 <colspec colwidth="6*" align="right"/>
38580 <tbody>
38581 <row>
38582 <entry><option>allow_symlink</option></entry>
38583 <entry>Use: <emphasis>appendfile</emphasis></entry>
38584 <entry>Type: <emphasis>boolean</emphasis></entry>
38585 <entry>Default: <emphasis>false</emphasis></entry>
38586 </row>
38587 </tbody>
38588 </tgroup>
38589 </informaltable>
38590 <para>
38591 <indexterm role="concept">
38592 <primary>symbolic link</primary>
38593 <secondary>to mailbox</secondary>
38594 </indexterm>
38595 <indexterm role="concept">
38596 <primary>mailbox</primary>
38597 <secondary>symbolic link</secondary>
38598 </indexterm>
38599 By default, <command>appendfile</command> will not deliver if the path name for the file is
38600 that of a symbolic link. Setting this option relaxes that constraint, but there
38601 are security issues involved in the use of symbolic links. Be sure you know
38602 what you are doing if you set this. Details of exactly what this option affects
38603 are included in the discussion which follows this list of options.
38604 </para>
38605 <para>
38606 <indexterm role="option">
38607 <primary><option>batch_id</option></primary>
38608 </indexterm>
38609 </para>
38610 <informaltable frame="all">
38611 <tgroup cols="4" colsep="0" rowsep="0">
38612 <colspec colwidth="8*" align="left"/>
38613 <colspec colwidth="6*" align="center"/>
38614 <colspec colwidth="6*" align="center"/>
38615 <colspec colwidth="6*" align="right"/>
38616 <tbody>
38617 <row>
38618 <entry><option>batch_id</option></entry>
38619 <entry>Use: <emphasis>appendfile</emphasis></entry>
38620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38621 <entry>Default: <emphasis>unset</emphasis></entry>
38622 </row>
38623 </tbody>
38624 </tgroup>
38625 </informaltable>
38626 <para>
38627 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38628 However, batching is automatically disabled for <command>appendfile</command> deliveries that
38629 happen as a result of forwarding or aliasing or other redirection directly to a
38630 file.
38631 </para>
38632 <para>
38633 <indexterm role="option">
38634 <primary><option>batch_max</option></primary>
38635 </indexterm>
38636 </para>
38637 <informaltable frame="all">
38638 <tgroup cols="4" colsep="0" rowsep="0">
38639 <colspec colwidth="8*" align="left"/>
38640 <colspec colwidth="6*" align="center"/>
38641 <colspec colwidth="6*" align="center"/>
38642 <colspec colwidth="6*" align="right"/>
38643 <tbody>
38644 <row>
38645 <entry><option>batch_max</option></entry>
38646 <entry>Use: <emphasis>appendfile</emphasis></entry>
38647 <entry>Type: <emphasis>integer</emphasis></entry>
38648 <entry>Default: <emphasis>1</emphasis></entry>
38649 </row>
38650 </tbody>
38651 </tgroup>
38652 </informaltable>
38653 <para>
38654 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38655 </para>
38656 <para>
38657 <indexterm role="option">
38658 <primary><option>check_group</option></primary>
38659 </indexterm>
38660 </para>
38661 <informaltable frame="all">
38662 <tgroup cols="4" colsep="0" rowsep="0">
38663 <colspec colwidth="8*" align="left"/>
38664 <colspec colwidth="6*" align="center"/>
38665 <colspec colwidth="6*" align="center"/>
38666 <colspec colwidth="6*" align="right"/>
38667 <tbody>
38668 <row>
38669 <entry><option>check_group</option></entry>
38670 <entry>Use: <emphasis>appendfile</emphasis></entry>
38671 <entry>Type: <emphasis>boolean</emphasis></entry>
38672 <entry>Default: <emphasis>false</emphasis></entry>
38673 </row>
38674 </tbody>
38675 </tgroup>
38676 </informaltable>
38677 <para>
38678 When this option is set, the group owner of the file defined by the <option>file</option>
38679 option is checked to see that it is the same as the group under which the
38680 delivery process is running. The default setting is false because the default
38681 file mode is 0600, which means that the group is irrelevant.
38682 </para>
38683 <para>
38684 <indexterm role="option">
38685 <primary><option>check_owner</option></primary>
38686 </indexterm>
38687 </para>
38688 <informaltable frame="all">
38689 <tgroup cols="4" colsep="0" rowsep="0">
38690 <colspec colwidth="8*" align="left"/>
38691 <colspec colwidth="6*" align="center"/>
38692 <colspec colwidth="6*" align="center"/>
38693 <colspec colwidth="6*" align="right"/>
38694 <tbody>
38695 <row>
38696 <entry><option>check_owner</option></entry>
38697 <entry>Use: <emphasis>appendfile</emphasis></entry>
38698 <entry>Type: <emphasis>boolean</emphasis></entry>
38699 <entry>Default: <emphasis>true</emphasis></entry>
38700 </row>
38701 </tbody>
38702 </tgroup>
38703 </informaltable>
38704 <para>
38705 When this option is set, the owner of the file defined by the <option>file</option> option
38706 is checked to ensure that it is the same as the user under which the delivery
38707 process is running.
38708 </para>
38709 <para>
38710 <indexterm role="option">
38711 <primary><option>check_string</option></primary>
38712 </indexterm>
38713 </para>
38714 <informaltable frame="all">
38715 <tgroup cols="4" colsep="0" rowsep="0">
38716 <colspec colwidth="8*" align="left"/>
38717 <colspec colwidth="6*" align="center"/>
38718 <colspec colwidth="6*" align="center"/>
38719 <colspec colwidth="6*" align="right"/>
38720 <tbody>
38721 <row>
38722 <entry><option>check_string</option></entry>
38723 <entry>Use: <emphasis>appendfile</emphasis></entry>
38724 <entry>Type: <emphasis>string</emphasis></entry>
38725 <entry>Default: <emphasis>see below</emphasis></entry>
38726 </row>
38727 </tbody>
38728 </tgroup>
38729 </informaltable>
38730 <para>
38731 <indexterm role="concept">
38732 <primary><quote>From</quote> line</primary>
38733 </indexterm>
38734 As <command>appendfile</command> writes the message, the start of each line is tested for
38735 matching <option>check_string</option>, and if it does, the initial matching characters are
38736 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
38737 a literal string, not a regular expression, and the case of any letters it
38738 contains is significant.
38739 </para>
38740 <para>
38741 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
38742 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
38743 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
38744 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
38745 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
38746 </para>
38747 <para>
38748 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
38749 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
38750 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
38751 if another format is used. For example, to deliver to mailboxes in MMDF format:
38752 <indexterm role="concept">
38753 <primary>MMDF format mailbox</primary>
38754 </indexterm>
38755 <indexterm role="concept">
38756 <primary>mailbox</primary>
38757 <secondary>MMDF format</secondary>
38758 </indexterm>
38759 </para>
38760 <literallayout class="monospaced">
38761 check_string = "\1\1\1\1\n"
38762 escape_string = "\1\1\1\1 \n"
38763 message_prefix = "\1\1\1\1\n"
38764 message_suffix = "\1\1\1\1\n"
38765 </literallayout>
38766 <para>
38767 <indexterm role="option">
38768 <primary><option>create_directory</option></primary>
38769 </indexterm>
38770 </para>
38771 <informaltable frame="all">
38772 <tgroup cols="4" colsep="0" rowsep="0">
38773 <colspec colwidth="8*" align="left"/>
38774 <colspec colwidth="6*" align="center"/>
38775 <colspec colwidth="6*" align="center"/>
38776 <colspec colwidth="6*" align="right"/>
38777 <tbody>
38778 <row>
38779 <entry><option>create_directory</option></entry>
38780 <entry>Use: <emphasis>appendfile</emphasis></entry>
38781 <entry>Type: <emphasis>boolean</emphasis></entry>
38782 <entry>Default: <emphasis>true</emphasis></entry>
38783 </row>
38784 </tbody>
38785 </tgroup>
38786 </informaltable>
38787 <para>
38788 <indexterm role="concept">
38789 <primary>directory creation</primary>
38790 </indexterm>
38791 When this option is true, Exim attempts to create any missing superior
38792 directories for the file that it is about to write. A created directory&#x2019;s mode
38793 is given by the <option>directory_mode</option> option.
38794 </para>
38795 <para>
38796 The group ownership of a newly created directory is highly dependent on the
38797 operating system (and possibly the file system) that is being used. For
38798 example, in Solaris, if the parent directory has the setgid bit set, its group
38799 is propagated to the child; if not, the currently set group is used. However,
38800 in FreeBSD, the parent&#x2019;s group is always used.
38801 </para>
38802 <para>
38803 <indexterm role="option">
38804 <primary><option>create_file</option></primary>
38805 </indexterm>
38806 </para>
38807 <informaltable frame="all">
38808 <tgroup cols="4" colsep="0" rowsep="0">
38809 <colspec colwidth="8*" align="left"/>
38810 <colspec colwidth="6*" align="center"/>
38811 <colspec colwidth="6*" align="center"/>
38812 <colspec colwidth="6*" align="right"/>
38813 <tbody>
38814 <row>
38815 <entry><option>create_file</option></entry>
38816 <entry>Use: <emphasis>appendfile</emphasis></entry>
38817 <entry>Type: <emphasis>string</emphasis></entry>
38818 <entry>Default: <emphasis>anywhere</emphasis></entry>
38819 </row>
38820 </tbody>
38821 </tgroup>
38822 </informaltable>
38823 <para>
38824 This option constrains the location of files and directories that are created
38825 by this transport. It applies to files defined by the <option>file</option> option and
38826 directories defined by the <option>directory</option> option. In the case of maildir
38827 delivery, it applies to the top level directory, not the maildir directories
38828 beneath.
38829 </para>
38830 <para>
38831 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
38832 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
38833 set for the transport. This option is not useful when an explicit file name is
38834 given for normal mailbox deliveries. It is intended for the case when file
38835 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
38836 by an <command>appendfile</command> transport called <option>address_file</option>. See also
38837 <option>file_must_exist</option>.
38838 </para>
38839 <para>
38840 <indexterm role="option">
38841 <primary><option>directory</option></primary>
38842 </indexterm>
38843 </para>
38844 <informaltable frame="all">
38845 <tgroup cols="4" colsep="0" rowsep="0">
38846 <colspec colwidth="8*" align="left"/>
38847 <colspec colwidth="6*" align="center"/>
38848 <colspec colwidth="6*" align="center"/>
38849 <colspec colwidth="6*" align="right"/>
38850 <tbody>
38851 <row>
38852 <entry><option>directory</option></entry>
38853 <entry>Use: <emphasis>appendfile</emphasis></entry>
38854 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38855 <entry>Default: <emphasis>unset</emphasis></entry>
38856 </row>
38857 </tbody>
38858 </tgroup>
38859 </informaltable>
38860 <para>
38861 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
38862 or <option>directory</option> must be set, unless the delivery is the direct result of a
38863 redirection (see section <xref linkend="SECTfildiropt"/>).
38864 </para>
38865 <para>
38866 When <option>directory</option> is set, the string is expanded, and the message is delivered
38867 into a new file or files in or below the given directory, instead of being
38868 appended to a single mailbox file. A number of different formats are provided
38869 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
38870 <xref linkend="SECTopdir"/> for further details of this form of delivery.
38871 </para>
38872 <para>
38873 <indexterm role="option">
38874 <primary><option>directory_file</option></primary>
38875 </indexterm>
38876 </para>
38877 <informaltable frame="all">
38878 <tgroup cols="4" colsep="0" rowsep="0">
38879 <colspec colwidth="8*" align="left"/>
38880 <colspec colwidth="6*" align="center"/>
38881 <colspec colwidth="6*" align="center"/>
38882 <colspec colwidth="6*" align="right"/>
38883 <tbody>
38884 <row>
38885 <entry><option>directory_file</option></entry>
38886 <entry>Use: <emphasis>appendfile</emphasis></entry>
38887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38888 <entry>Default: <emphasis>see below</emphasis></entry>
38889 </row>
38890 </tbody>
38891 </tgroup>
38892 </informaltable>
38893 <para>
38894 <indexterm role="concept">
38895 <primary>base62</primary>
38896 </indexterm>
38897 <indexterm role="variable">
38898 <primary><varname>$inode</varname></primary>
38899 </indexterm>
38900 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
38901 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
38902 whose name is obtained by expanding this string. The default value is:
38903 </para>
38904 <literallayout class="monospaced">
38905 q${base62:$tod_epoch}-$inode
38906 </literallayout>
38907 <para>
38908 This generates a unique name from the current time, in base 62 form, and the
38909 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
38910 option.
38911 </para>
38912 <para>
38913 <indexterm role="option">
38914 <primary><option>directory_mode</option></primary>
38915 </indexterm>
38916 </para>
38917 <informaltable frame="all">
38918 <tgroup cols="4" colsep="0" rowsep="0">
38919 <colspec colwidth="8*" align="left"/>
38920 <colspec colwidth="6*" align="center"/>
38921 <colspec colwidth="6*" align="center"/>
38922 <colspec colwidth="6*" align="right"/>
38923 <tbody>
38924 <row>
38925 <entry><option>directory_mode</option></entry>
38926 <entry>Use: <emphasis>appendfile</emphasis></entry>
38927 <entry>Type: <emphasis>octal integer</emphasis></entry>
38928 <entry>Default: <emphasis>0700</emphasis></entry>
38929 </row>
38930 </tbody>
38931 </tgroup>
38932 </informaltable>
38933 <para>
38934 If <command>appendfile</command> creates any directories as a result of the
38935 <option>create_directory</option> option, their mode is specified by this option.
38936 </para>
38937 <para>
38938 <indexterm role="option">
38939 <primary><option>escape_string</option></primary>
38940 </indexterm>
38941 </para>
38942 <informaltable frame="all">
38943 <tgroup cols="4" colsep="0" rowsep="0">
38944 <colspec colwidth="8*" align="left"/>
38945 <colspec colwidth="6*" align="center"/>
38946 <colspec colwidth="6*" align="center"/>
38947 <colspec colwidth="6*" align="right"/>
38948 <tbody>
38949 <row>
38950 <entry><option>escape_string</option></entry>
38951 <entry>Use: <emphasis>appendfile</emphasis></entry>
38952 <entry>Type: <emphasis>string</emphasis></entry>
38953 <entry>Default: <emphasis>see description</emphasis></entry>
38954 </row>
38955 </tbody>
38956 </tgroup>
38957 </informaltable>
38958 <para>
38959 See <option>check_string</option> above.
38960 </para>
38961 <para>
38962 <indexterm role="option">
38963 <primary><option>file</option></primary>
38964 </indexterm>
38965 </para>
38966 <informaltable frame="all">
38967 <tgroup cols="4" colsep="0" rowsep="0">
38968 <colspec colwidth="8*" align="left"/>
38969 <colspec colwidth="6*" align="center"/>
38970 <colspec colwidth="6*" align="center"/>
38971 <colspec colwidth="6*" align="right"/>
38972 <tbody>
38973 <row>
38974 <entry><option>file</option></entry>
38975 <entry>Use: <emphasis>appendfile</emphasis></entry>
38976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38977 <entry>Default: <emphasis>unset</emphasis></entry>
38978 </row>
38979 </tbody>
38980 </tgroup>
38981 </informaltable>
38982 <para>
38983 This option is mutually exclusive with the <option>directory</option> option, but one of
38984 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
38985 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
38986 specifies a single file, to which the message is appended. One or more of
38987 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
38988 <option>file</option>.
38989 </para>
38990 <para>
38991 <indexterm role="concept">
38992 <primary>NFS</primary>
38993 <secondary>lock file</secondary>
38994 </indexterm>
38995 <indexterm role="concept">
38996 <primary>locking files</primary>
38997 </indexterm>
38998 <indexterm role="concept">
38999 <primary>lock files</primary>
39000 </indexterm>
39001 If you are using more than one host to deliver over NFS into the same
39002 mailboxes, you should always use lock files.
39003 </para>
39004 <para>
39005 The string value is expanded for each delivery, and must yield an absolute
39006 path. The most common settings of this option are variations on one of these
39007 examples:
39008 </para>
39009 <literallayout class="monospaced">
39010 file = /var/spool/mail/$local_part
39011 file = /home/$local_part/inbox
39012 file = $home/inbox
39013 </literallayout>
39014 <para>
39015 <indexterm role="concept">
39016 <primary><quote>sticky</quote> bit</primary>
39017 </indexterm>
39018 In the first example, all deliveries are done into the same directory. If Exim
39019 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
39020 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
39021 deliveries to be possible, or alternatively the <option>group</option> option can be used to
39022 run the delivery under a group id which has write access to the directory.
39023 </para>
39024 <para>
39025 <indexterm role="option">
39026 <primary><option>file_format</option></primary>
39027 </indexterm>
39028 </para>
39029 <informaltable frame="all">
39030 <tgroup cols="4" colsep="0" rowsep="0">
39031 <colspec colwidth="8*" align="left"/>
39032 <colspec colwidth="6*" align="center"/>
39033 <colspec colwidth="6*" align="center"/>
39034 <colspec colwidth="6*" align="right"/>
39035 <tbody>
39036 <row>
39037 <entry><option>file_format</option></entry>
39038 <entry>Use: <emphasis>appendfile</emphasis></entry>
39039 <entry>Type: <emphasis>string</emphasis></entry>
39040 <entry>Default: <emphasis>unset</emphasis></entry>
39041 </row>
39042 </tbody>
39043 </tgroup>
39044 </informaltable>
39045 <para>
39046 <indexterm role="concept">
39047 <primary>file</primary>
39048 <secondary>mailbox; checking existing format</secondary>
39049 </indexterm>
39050 This option requests the transport to check the format of an existing file
39051 before adding to it. The check consists of matching a specific string at the
39052 start of the file. The value of the option consists of an even number of
39053 colon-separated strings. The first of each pair is the test string, and the
39054 second is the name of a transport. If the transport associated with a matched
39055 string is not the current transport, control is passed over to the other
39056 transport. For example, suppose the standard <command>local_delivery</command> transport has
39057 this added to it:
39058 </para>
39059 <literallayout class="monospaced">
39060 file_format = "From       : local_delivery :\
39061                \1\1\1\1\n : local_mmdf_delivery"
39062 </literallayout>
39063 <para>
39064 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
39065 a mailbox begins with four binary ones followed by a newline, control is passed
39066 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
39067 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
39068 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
39069 match any string, or if the transport named for a given string is not defined,
39070 delivery is deferred.
39071 </para>
39072 <para>
39073 <indexterm role="option">
39074 <primary><option>file_must_exist</option></primary>
39075 </indexterm>
39076 </para>
39077 <informaltable frame="all">
39078 <tgroup cols="4" colsep="0" rowsep="0">
39079 <colspec colwidth="8*" align="left"/>
39080 <colspec colwidth="6*" align="center"/>
39081 <colspec colwidth="6*" align="center"/>
39082 <colspec colwidth="6*" align="right"/>
39083 <tbody>
39084 <row>
39085 <entry><option>file_must_exist</option></entry>
39086 <entry>Use: <emphasis>appendfile</emphasis></entry>
39087 <entry>Type: <emphasis>boolean</emphasis></entry>
39088 <entry>Default: <emphasis>false</emphasis></entry>
39089 </row>
39090 </tbody>
39091 </tgroup>
39092 </informaltable>
39093 <para>
39094 If this option is true, the file specified by the <option>file</option> option must exist.
39095 A temporary error occurs if it does not, causing delivery to be deferred.
39096 If this option is false, the file is created if it does not exist.
39097 </para>
39098 <para>
39099 <indexterm role="option">
39100 <primary><option>lock_fcntl_timeout</option></primary>
39101 </indexterm>
39102 </para>
39103 <informaltable frame="all">
39104 <tgroup cols="4" colsep="0" rowsep="0">
39105 <colspec colwidth="8*" align="left"/>
39106 <colspec colwidth="6*" align="center"/>
39107 <colspec colwidth="6*" align="center"/>
39108 <colspec colwidth="6*" align="right"/>
39109 <tbody>
39110 <row>
39111 <entry><option>lock_fcntl_timeout</option></entry>
39112 <entry>Use: <emphasis>appendfile</emphasis></entry>
39113 <entry>Type: <emphasis>time</emphasis></entry>
39114 <entry>Default: <emphasis>0s</emphasis></entry>
39115 </row>
39116 </tbody>
39117 </tgroup>
39118 </informaltable>
39119 <para>
39120 <indexterm role="concept">
39121 <primary>timeout</primary>
39122 <secondary>mailbox locking</secondary>
39123 </indexterm>
39124 <indexterm role="concept">
39125 <primary>mailbox</primary>
39126 <secondary>locking, blocking and non-blocking</secondary>
39127 </indexterm>
39128 <indexterm role="concept">
39129 <primary>locking files</primary>
39130 </indexterm>
39131 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
39132 when locking an open mailbox file. If the call fails, the delivery process
39133 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
39134 Non-blocking calls are used so that the file is not kept open during the wait
39135 for the lock; the reason for this is to make it as safe as possible for
39136 deliveries over NFS in the case when processes might be accessing an NFS
39137 mailbox without using a lock file. This should not be done, but
39138 misunderstandings and hence misconfigurations are not unknown.
39139 </para>
39140 <para>
39141 On a busy system, however, the performance of a non-blocking lock approach is
39142 not as good as using a blocking lock with a timeout. In this case, the waiting
39143 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
39144 and can proceed as soon as the previous lock holder releases it.
39145 </para>
39146 <para>
39147 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
39148 timeout, are used. There may still be some retrying: the maximum number of
39149 retries is
39150 </para>
39151 <literallayout class="monospaced">
39152 (lock_retries * lock_interval) / lock_fcntl_timeout
39153 </literallayout>
39154 <para>
39155 rounded up to the next whole number. In other words, the total time during
39156 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
39157 <option>lock_fcntl_timeout</option> is set very large.
39158 </para>
39159 <para>
39160 You should consider setting this option if you are getting a lot of delayed
39161 local deliveries because of errors of the form
39162 </para>
39163 <literallayout class="monospaced">
39164 failed to lock mailbox /some/file (fcntl)
39165 </literallayout>
39166 <para>
39167 <indexterm role="option">
39168 <primary><option>lock_flock_timeout</option></primary>
39169 </indexterm>
39170 </para>
39171 <informaltable frame="all">
39172 <tgroup cols="4" colsep="0" rowsep="0">
39173 <colspec colwidth="8*" align="left"/>
39174 <colspec colwidth="6*" align="center"/>
39175 <colspec colwidth="6*" align="center"/>
39176 <colspec colwidth="6*" align="right"/>
39177 <tbody>
39178 <row>
39179 <entry><option>lock_flock_timeout</option></entry>
39180 <entry>Use: <emphasis>appendfile</emphasis></entry>
39181 <entry>Type: <emphasis>time</emphasis></entry>
39182 <entry>Default: <emphasis>0s</emphasis></entry>
39183 </row>
39184 </tbody>
39185 </tgroup>
39186 </informaltable>
39187 <para>
39188 This timeout applies to file locking when using <function>flock()</function> (see
39189 <option>use_flock</option>); the timeout operates in a similar manner to
39190 <option>lock_fcntl_timeout</option>.
39191 </para>
39192 <para>
39193 <indexterm role="option">
39194 <primary><option>lock_interval</option></primary>
39195 </indexterm>
39196 </para>
39197 <informaltable frame="all">
39198 <tgroup cols="4" colsep="0" rowsep="0">
39199 <colspec colwidth="8*" align="left"/>
39200 <colspec colwidth="6*" align="center"/>
39201 <colspec colwidth="6*" align="center"/>
39202 <colspec colwidth="6*" align="right"/>
39203 <tbody>
39204 <row>
39205 <entry><option>lock_interval</option></entry>
39206 <entry>Use: <emphasis>appendfile</emphasis></entry>
39207 <entry>Type: <emphasis>time</emphasis></entry>
39208 <entry>Default: <emphasis>3s</emphasis></entry>
39209 </row>
39210 </tbody>
39211 </tgroup>
39212 </informaltable>
39213 <para>
39214 This specifies the time to wait between attempts to lock the file. See below
39215 for details of locking.
39216 </para>
39217 <para>
39218 <indexterm role="option">
39219 <primary><option>lock_retries</option></primary>
39220 </indexterm>
39221 </para>
39222 <informaltable frame="all">
39223 <tgroup cols="4" colsep="0" rowsep="0">
39224 <colspec colwidth="8*" align="left"/>
39225 <colspec colwidth="6*" align="center"/>
39226 <colspec colwidth="6*" align="center"/>
39227 <colspec colwidth="6*" align="right"/>
39228 <tbody>
39229 <row>
39230 <entry><option>lock_retries</option></entry>
39231 <entry>Use: <emphasis>appendfile</emphasis></entry>
39232 <entry>Type: <emphasis>integer</emphasis></entry>
39233 <entry>Default: <emphasis>10</emphasis></entry>
39234 </row>
39235 </tbody>
39236 </tgroup>
39237 </informaltable>
39238 <para>
39239 This specifies the maximum number of attempts to lock the file. A value of zero
39240 is treated as 1. See below for details of locking.
39241 </para>
39242 <para>
39243 <indexterm role="option">
39244 <primary><option>lockfile_mode</option></primary>
39245 </indexterm>
39246 </para>
39247 <informaltable frame="all">
39248 <tgroup cols="4" colsep="0" rowsep="0">
39249 <colspec colwidth="8*" align="left"/>
39250 <colspec colwidth="6*" align="center"/>
39251 <colspec colwidth="6*" align="center"/>
39252 <colspec colwidth="6*" align="right"/>
39253 <tbody>
39254 <row>
39255 <entry><option>lockfile_mode</option></entry>
39256 <entry>Use: <emphasis>appendfile</emphasis></entry>
39257 <entry>Type: <emphasis>octal integer</emphasis></entry>
39258 <entry>Default: <emphasis>0600</emphasis></entry>
39259 </row>
39260 </tbody>
39261 </tgroup>
39262 </informaltable>
39263 <para>
39264 This specifies the mode of the created lock file, when a lock file is being
39265 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
39266 </para>
39267 <para>
39268 <indexterm role="option">
39269 <primary><option>lockfile_timeout</option></primary>
39270 </indexterm>
39271 </para>
39272 <informaltable frame="all">
39273 <tgroup cols="4" colsep="0" rowsep="0">
39274 <colspec colwidth="8*" align="left"/>
39275 <colspec colwidth="6*" align="center"/>
39276 <colspec colwidth="6*" align="center"/>
39277 <colspec colwidth="6*" align="right"/>
39278 <tbody>
39279 <row>
39280 <entry><option>lockfile_timeout</option></entry>
39281 <entry>Use: <emphasis>appendfile</emphasis></entry>
39282 <entry>Type: <emphasis>time</emphasis></entry>
39283 <entry>Default: <emphasis>30m</emphasis></entry>
39284 </row>
39285 </tbody>
39286 </tgroup>
39287 </informaltable>
39288 <para>
39289 <indexterm role="concept">
39290 <primary>timeout</primary>
39291 <secondary>mailbox locking</secondary>
39292 </indexterm>
39293 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
39294 exists and is older than this value, it is assumed to have been left behind by
39295 accident, and Exim attempts to remove it.
39296 </para>
39297 <para>
39298 <indexterm role="option">
39299 <primary><option>mailbox_filecount</option></primary>
39300 </indexterm>
39301 </para>
39302 <informaltable frame="all">
39303 <tgroup cols="4" colsep="0" rowsep="0">
39304 <colspec colwidth="8*" align="left"/>
39305 <colspec colwidth="6*" align="center"/>
39306 <colspec colwidth="6*" align="center"/>
39307 <colspec colwidth="6*" align="right"/>
39308 <tbody>
39309 <row>
39310 <entry><option>mailbox_filecount</option></entry>
39311 <entry>Use: <emphasis>appendfile</emphasis></entry>
39312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39313 <entry>Default: <emphasis>unset</emphasis></entry>
39314 </row>
39315 </tbody>
39316 </tgroup>
39317 </informaltable>
39318 <para>
39319 <indexterm role="concept">
39320 <primary>mailbox</primary>
39321 <secondary>specifying size of</secondary>
39322 </indexterm>
39323 <indexterm role="concept">
39324 <primary>size</primary>
39325 <secondary>of mailbox</secondary>
39326 </indexterm>
39327 If this option is set, it is expanded, and the result is taken as the current
39328 number of files in the mailbox. It must be a decimal number, optionally
39329 followed by K or M. This provides a way of obtaining this information from an
39330 external source that maintains the data.
39331 </para>
39332 <para>
39333 <indexterm role="option">
39334 <primary><option>mailbox_size</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>mailbox_size</option></entry>
39346 <entry>Use: <emphasis>appendfile</emphasis></entry>
39347 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39348 <entry>Default: <emphasis>unset</emphasis></entry>
39349 </row>
39350 </tbody>
39351 </tgroup>
39352 </informaltable>
39353 <para>
39354 <indexterm role="concept">
39355 <primary>mailbox</primary>
39356 <secondary>specifying size of</secondary>
39357 </indexterm>
39358 <indexterm role="concept">
39359 <primary>size</primary>
39360 <secondary>of mailbox</secondary>
39361 </indexterm>
39362 If this option is set, it is expanded, and the result is taken as the current
39363 size the mailbox. It must be a decimal number, optionally followed by K or M.
39364 This provides a way of obtaining this information from an external source that
39365 maintains the data. This is likely to be helpful for maildir deliveries where
39366 it is computationally expensive to compute the size of a mailbox.
39367 </para>
39368 <para>
39369 <indexterm role="option">
39370 <primary><option>maildir_format</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>maildir_format</option></entry>
39382 <entry>Use: <emphasis>appendfile</emphasis></entry>
39383 <entry>Type: <emphasis>boolean</emphasis></entry>
39384 <entry>Default: <emphasis>false</emphasis></entry>
39385 </row>
39386 </tbody>
39387 </tgroup>
39388 </informaltable>
39389 <para>
39390 <indexterm role="concept">
39391 <primary>maildir format</primary>
39392 <secondary>specifying</secondary>
39393 </indexterm>
39394 If this option is set with the <option>directory</option> option, the delivery is into a new
39395 file, in the <quote>maildir</quote> format that is used by other mail software. When the
39396 transport is activated directly from a <command>redirect</command> router (for example, the
39397 <command>address_file</command> transport in the default configuration), setting
39398 <option>maildir_format</option> causes the path received from the router to be treated as a
39399 directory, whether or not it ends with <literal>/</literal>. This option is available only if
39400 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
39401 <xref linkend="SECTmaildirdelivery"/> below for further details.
39402 </para>
39403 <para>
39404 <indexterm role="option">
39405 <primary><option>maildir_quota_directory_regex</option></primary>
39406 </indexterm>
39407 </para>
39408 <informaltable frame="all">
39409 <tgroup cols="4" colsep="0" rowsep="0">
39410 <colspec colwidth="8*" align="left"/>
39411 <colspec colwidth="6*" align="center"/>
39412 <colspec colwidth="6*" align="center"/>
39413 <colspec colwidth="6*" align="right"/>
39414 <tbody>
39415 <row>
39416 <entry><option>maildir_quota_directory_regex</option></entry>
39417 <entry>Use: <emphasis>appendfile</emphasis></entry>
39418 <entry>Type: <emphasis>string</emphasis></entry>
39419 <entry>Default: <emphasis>See below</emphasis></entry>
39420 </row>
39421 </tbody>
39422 </tgroup>
39423 </informaltable>
39424 <para>
39425 <indexterm role="concept">
39426 <primary>maildir format</primary>
39427 <secondary>quota; directories included in</secondary>
39428 </indexterm>
39429 <indexterm role="concept">
39430 <primary>quota</primary>
39431 <secondary>maildir; directories included in</secondary>
39432 </indexterm>
39433 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
39434 a regular expression for specifying directories, relative to the quota
39435 directory (see <option>quota_directory</option>), that should be included in the quota
39436 calculation. The default value is:
39437 </para>
39438 <literallayout class="monospaced">
39439 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
39440 </literallayout>
39441 <para>
39442 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
39443 (directories whose names begin with a dot). If you want to exclude the
39444 <filename>Trash</filename>
39445 folder from the count (as some sites do), you need to change this setting to
39446 </para>
39447 <literallayout class="monospaced">
39448 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
39449 </literallayout>
39450 <para>
39451 This uses a negative lookahead in the regular expression to exclude the
39452 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
39453 calculations, quota processing is bypassed for any messages that are delivered
39454 directly into that directory.
39455 </para>
39456 <para>
39457 <indexterm role="option">
39458 <primary><option>maildir_retries</option></primary>
39459 </indexterm>
39460 </para>
39461 <informaltable frame="all">
39462 <tgroup cols="4" colsep="0" rowsep="0">
39463 <colspec colwidth="8*" align="left"/>
39464 <colspec colwidth="6*" align="center"/>
39465 <colspec colwidth="6*" align="center"/>
39466 <colspec colwidth="6*" align="right"/>
39467 <tbody>
39468 <row>
39469 <entry><option>maildir_retries</option></entry>
39470 <entry>Use: <emphasis>appendfile</emphasis></entry>
39471 <entry>Type: <emphasis>integer</emphasis></entry>
39472 <entry>Default: <emphasis>10</emphasis></entry>
39473 </row>
39474 </tbody>
39475 </tgroup>
39476 </informaltable>
39477 <para>
39478 This option specifies the number of times to retry when writing a file in
39479 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
39480 </para>
39481 <para>
39482 <indexterm role="option">
39483 <primary><option>maildir_tag</option></primary>
39484 </indexterm>
39485 </para>
39486 <informaltable frame="all">
39487 <tgroup cols="4" colsep="0" rowsep="0">
39488 <colspec colwidth="8*" align="left"/>
39489 <colspec colwidth="6*" align="center"/>
39490 <colspec colwidth="6*" align="center"/>
39491 <colspec colwidth="6*" align="right"/>
39492 <tbody>
39493 <row>
39494 <entry><option>maildir_tag</option></entry>
39495 <entry>Use: <emphasis>appendfile</emphasis></entry>
39496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39497 <entry>Default: <emphasis>unset</emphasis></entry>
39498 </row>
39499 </tbody>
39500 </tgroup>
39501 </informaltable>
39502 <para>
39503 This option applies only to deliveries in maildir format, and is described in
39504 section <xref linkend="SECTmaildirdelivery"/> below.
39505 </para>
39506 <para>
39507 <indexterm role="option">
39508 <primary><option>maildir_use_size_file</option></primary>
39509 </indexterm>
39510 </para>
39511 <informaltable frame="all">
39512 <tgroup cols="4" colsep="0" rowsep="0">
39513 <colspec colwidth="8*" align="left"/>
39514 <colspec colwidth="6*" align="center"/>
39515 <colspec colwidth="6*" align="center"/>
39516 <colspec colwidth="6*" align="right"/>
39517 <tbody>
39518 <row>
39519 <entry><option>maildir_use_size_file</option></entry>
39520 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
39521 <entry>Type: <emphasis>boolean</emphasis></entry>
39522 <entry>Default: <emphasis>false</emphasis></entry>
39523 </row>
39524 </tbody>
39525 </tgroup>
39526 </informaltable>
39527 <para>
39528 <indexterm role="concept">
39529 <primary>maildir format</primary>
39530 <secondary><filename>maildirsize</filename> file</secondary>
39531 </indexterm>
39532 The result of string expansion for this option must be a valid boolean value.
39533 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
39534 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
39535 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
39536 value is zero. See <option>maildir_quota_directory_regex</option> above and section
39537 <xref linkend="SECTmaildirdelivery"/> below for further details.
39538 </para>
39539 <para>
39540 <indexterm role="option">
39541 <primary><option>maildirfolder_create_regex</option></primary>
39542 </indexterm>
39543 </para>
39544 <informaltable frame="all">
39545 <tgroup cols="4" colsep="0" rowsep="0">
39546 <colspec colwidth="8*" align="left"/>
39547 <colspec colwidth="6*" align="center"/>
39548 <colspec colwidth="6*" align="center"/>
39549 <colspec colwidth="6*" align="right"/>
39550 <tbody>
39551 <row>
39552 <entry><option>maildirfolder_create_regex</option></entry>
39553 <entry>Use: <emphasis>appendfile</emphasis></entry>
39554 <entry>Type: <emphasis>string</emphasis></entry>
39555 <entry>Default: <emphasis>unset</emphasis></entry>
39556 </row>
39557 </tbody>
39558 </tgroup>
39559 </informaltable>
39560 <para>
39561 <indexterm role="concept">
39562 <primary>maildir format</primary>
39563 <secondary><filename>maildirfolder</filename> file</secondary>
39564 </indexterm>
39565 <indexterm role="concept">
39566 <primary><filename>maildirfolder</filename>, creating</primary>
39567 </indexterm>
39568 The value of this option is a regular expression. If it is unset, it has no
39569 effect. Otherwise, before a maildir delivery takes place, the pattern is
39570 matched against the name of the maildir directory, that is, the directory
39571 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
39572 delivery. If there is a match, Exim checks for the existence of a file called
39573 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
39574 See section <xref linkend="SECTmaildirdelivery"/> for more details.
39575 </para>
39576 <para>
39577 <indexterm role="option">
39578 <primary><option>mailstore_format</option></primary>
39579 </indexterm>
39580 </para>
39581 <informaltable frame="all">
39582 <tgroup cols="4" colsep="0" rowsep="0">
39583 <colspec colwidth="8*" align="left"/>
39584 <colspec colwidth="6*" align="center"/>
39585 <colspec colwidth="6*" align="center"/>
39586 <colspec colwidth="6*" align="right"/>
39587 <tbody>
39588 <row>
39589 <entry><option>mailstore_format</option></entry>
39590 <entry>Use: <emphasis>appendfile</emphasis></entry>
39591 <entry>Type: <emphasis>boolean</emphasis></entry>
39592 <entry>Default: <emphasis>false</emphasis></entry>
39593 </row>
39594 </tbody>
39595 </tgroup>
39596 </informaltable>
39597 <para>
39598 <indexterm role="concept">
39599 <primary>mailstore format</primary>
39600 <secondary>specifying</secondary>
39601 </indexterm>
39602 If this option is set with the <option>directory</option> option, the delivery is into two
39603 new files in  <quote>mailstore</quote> format. The option is available only if
39604 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
39605 below for further details.
39606 </para>
39607 <para>
39608 <indexterm role="option">
39609 <primary><option>mailstore_prefix</option></primary>
39610 </indexterm>
39611 </para>
39612 <informaltable frame="all">
39613 <tgroup cols="4" colsep="0" rowsep="0">
39614 <colspec colwidth="8*" align="left"/>
39615 <colspec colwidth="6*" align="center"/>
39616 <colspec colwidth="6*" align="center"/>
39617 <colspec colwidth="6*" align="right"/>
39618 <tbody>
39619 <row>
39620 <entry><option>mailstore_prefix</option></entry>
39621 <entry>Use: <emphasis>appendfile</emphasis></entry>
39622 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39623 <entry>Default: <emphasis>unset</emphasis></entry>
39624 </row>
39625 </tbody>
39626 </tgroup>
39627 </informaltable>
39628 <para>
39629 This option applies only to deliveries in mailstore format, and is described in
39630 section <xref linkend="SECTopdir"/> below.
39631 </para>
39632 <para>
39633 <indexterm role="option">
39634 <primary><option>mailstore_suffix</option></primary>
39635 </indexterm>
39636 </para>
39637 <informaltable frame="all">
39638 <tgroup cols="4" colsep="0" rowsep="0">
39639 <colspec colwidth="8*" align="left"/>
39640 <colspec colwidth="6*" align="center"/>
39641 <colspec colwidth="6*" align="center"/>
39642 <colspec colwidth="6*" align="right"/>
39643 <tbody>
39644 <row>
39645 <entry><option>mailstore_suffix</option></entry>
39646 <entry>Use: <emphasis>appendfile</emphasis></entry>
39647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39648 <entry>Default: <emphasis>unset</emphasis></entry>
39649 </row>
39650 </tbody>
39651 </tgroup>
39652 </informaltable>
39653 <para>
39654 This option applies only to deliveries in mailstore format, and is described in
39655 section <xref linkend="SECTopdir"/> below.
39656 </para>
39657 <para>
39658 <indexterm role="option">
39659 <primary><option>mbx_format</option></primary>
39660 </indexterm>
39661 </para>
39662 <informaltable frame="all">
39663 <tgroup cols="4" colsep="0" rowsep="0">
39664 <colspec colwidth="8*" align="left"/>
39665 <colspec colwidth="6*" align="center"/>
39666 <colspec colwidth="6*" align="center"/>
39667 <colspec colwidth="6*" align="right"/>
39668 <tbody>
39669 <row>
39670 <entry><option>mbx_format</option></entry>
39671 <entry>Use: <emphasis>appendfile</emphasis></entry>
39672 <entry>Type: <emphasis>boolean</emphasis></entry>
39673 <entry>Default: <emphasis>false</emphasis></entry>
39674 </row>
39675 </tbody>
39676 </tgroup>
39677 </informaltable>
39678 <para>
39679 <indexterm role="concept">
39680 <primary>locking files</primary>
39681 </indexterm>
39682 <indexterm role="concept">
39683 <primary>file</primary>
39684 <secondary>locking</secondary>
39685 </indexterm>
39686 <indexterm role="concept">
39687 <primary>file</primary>
39688 <secondary>MBX format</secondary>
39689 </indexterm>
39690 <indexterm role="concept">
39691 <primary>MBX format, specifying</primary>
39692 </indexterm>
39693 This option is available only if Exim has been compiled with SUPPORT_MBX
39694 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
39695 the message is appended to the mailbox file in MBX format instead of
39696 traditional Unix format. This format is supported by Pine4 and its associated
39697 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
39698 </para>
39699 <para>
39700 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
39701 automatically changed by the use of <option>mbx_format</option>. They should normally be set
39702 empty when using MBX format, so this option almost always appears in this
39703 combination:
39704 </para>
39705 <literallayout class="monospaced">
39706 mbx_format = true
39707 message_prefix =
39708 message_suffix =
39709 </literallayout>
39710 <para>
39711 If none of the locking options are mentioned in the configuration,
39712 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
39713 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
39714 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
39715 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
39716 should not be used if any program that does not use this form of locking is
39717 going to access the mailbox, nor should it be used if the mailbox file is NFS
39718 mounted, because it works only when the mailbox is accessed from a single host.
39719 </para>
39720 <para>
39721 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
39722 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
39723 (this means for the whole of a Pine or IMAP session), Exim will not be able to
39724 append messages to it.
39725 </para>
39726 <para>
39727 <indexterm role="option">
39728 <primary><option>message_prefix</option></primary>
39729 </indexterm>
39730 </para>
39731 <informaltable frame="all">
39732 <tgroup cols="4" colsep="0" rowsep="0">
39733 <colspec colwidth="8*" align="left"/>
39734 <colspec colwidth="6*" align="center"/>
39735 <colspec colwidth="6*" align="center"/>
39736 <colspec colwidth="6*" align="right"/>
39737 <tbody>
39738 <row>
39739 <entry><option>message_prefix</option></entry>
39740 <entry>Use: <emphasis>appendfile</emphasis></entry>
39741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39742 <entry>Default: <emphasis>see below</emphasis></entry>
39743 </row>
39744 </tbody>
39745 </tgroup>
39746 </informaltable>
39747 <para>
39748 <indexterm role="concept">
39749 <primary><quote>From</quote> line</primary>
39750 </indexterm>
39751 The string specified here is expanded and output at the start of every message.
39752 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
39753 in which case it is:
39754 </para>
39755 <literallayout class="monospaced">
39756 message_prefix = "From ${if def:return_path{$return_path}\
39757   {MAILER-DAEMON}} $tod_bsdinbox\n"
39758 </literallayout>
39759 <para>
39760 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
39761 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
39762 </para>
39763 <para>
39764 <indexterm role="option">
39765 <primary><option>message_suffix</option></primary>
39766 </indexterm>
39767 </para>
39768 <informaltable frame="all">
39769 <tgroup cols="4" colsep="0" rowsep="0">
39770 <colspec colwidth="8*" align="left"/>
39771 <colspec colwidth="6*" align="center"/>
39772 <colspec colwidth="6*" align="center"/>
39773 <colspec colwidth="6*" align="right"/>
39774 <tbody>
39775 <row>
39776 <entry><option>message_suffix</option></entry>
39777 <entry>Use: <emphasis>appendfile</emphasis></entry>
39778 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39779 <entry>Default: <emphasis>see below</emphasis></entry>
39780 </row>
39781 </tbody>
39782 </tgroup>
39783 </informaltable>
39784 <para>
39785 The string specified here is expanded and output at the end of every message.
39786 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
39787 in which case it is a single newline character. The suffix can be suppressed by
39788 setting
39789 </para>
39790 <literallayout class="monospaced">
39791 message_suffix =
39792 </literallayout>
39793 <para>
39794 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
39795 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
39796 </para>
39797 <para>
39798 <indexterm role="option">
39799 <primary><option>mode</option></primary>
39800 </indexterm>
39801 </para>
39802 <informaltable frame="all">
39803 <tgroup cols="4" colsep="0" rowsep="0">
39804 <colspec colwidth="8*" align="left"/>
39805 <colspec colwidth="6*" align="center"/>
39806 <colspec colwidth="6*" align="center"/>
39807 <colspec colwidth="6*" align="right"/>
39808 <tbody>
39809 <row>
39810 <entry><option>mode</option></entry>
39811 <entry>Use: <emphasis>appendfile</emphasis></entry>
39812 <entry>Type: <emphasis>octal integer</emphasis></entry>
39813 <entry>Default: <emphasis>0600</emphasis></entry>
39814 </row>
39815 </tbody>
39816 </tgroup>
39817 </informaltable>
39818 <para>
39819 If the output file is created, it is given this mode. If it already exists and
39820 has wider permissions, they are reduced to this mode. If it has narrower
39821 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
39822 if the delivery is the result of a <option>save</option> command in a filter file specifying
39823 a particular mode, the mode of the output file is always forced to take that
39824 value, and this option is ignored.
39825 </para>
39826 <para>
39827 <indexterm role="option">
39828 <primary><option>mode_fail_narrower</option></primary>
39829 </indexterm>
39830 </para>
39831 <informaltable frame="all">
39832 <tgroup cols="4" colsep="0" rowsep="0">
39833 <colspec colwidth="8*" align="left"/>
39834 <colspec colwidth="6*" align="center"/>
39835 <colspec colwidth="6*" align="center"/>
39836 <colspec colwidth="6*" align="right"/>
39837 <tbody>
39838 <row>
39839 <entry><option>mode_fail_narrower</option></entry>
39840 <entry>Use: <emphasis>appendfile</emphasis></entry>
39841 <entry>Type: <emphasis>boolean</emphasis></entry>
39842 <entry>Default: <emphasis>true</emphasis></entry>
39843 </row>
39844 </tbody>
39845 </tgroup>
39846 </informaltable>
39847 <para>
39848 This option applies in the case when an existing mailbox file has a narrower
39849 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
39850 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
39851 continues with the delivery attempt, using the existing mode of the file.
39852 </para>
39853 <para>
39854 <indexterm role="option">
39855 <primary><option>notify_comsat</option></primary>
39856 </indexterm>
39857 </para>
39858 <informaltable frame="all">
39859 <tgroup cols="4" colsep="0" rowsep="0">
39860 <colspec colwidth="8*" align="left"/>
39861 <colspec colwidth="6*" align="center"/>
39862 <colspec colwidth="6*" align="center"/>
39863 <colspec colwidth="6*" align="right"/>
39864 <tbody>
39865 <row>
39866 <entry><option>notify_comsat</option></entry>
39867 <entry>Use: <emphasis>appendfile</emphasis></entry>
39868 <entry>Type: <emphasis>boolean</emphasis></entry>
39869 <entry>Default: <emphasis>false</emphasis></entry>
39870 </row>
39871 </tbody>
39872 </tgroup>
39873 </informaltable>
39874 <para>
39875 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
39876 successful delivery to a user mailbox. This is the daemon that notifies logged
39877 on users about incoming mail.
39878 </para>
39879 <para>
39880 <indexterm role="option">
39881 <primary><option>quota</option></primary>
39882 </indexterm>
39883 </para>
39884 <informaltable frame="all">
39885 <tgroup cols="4" colsep="0" rowsep="0">
39886 <colspec colwidth="8*" align="left"/>
39887 <colspec colwidth="6*" align="center"/>
39888 <colspec colwidth="6*" align="center"/>
39889 <colspec colwidth="6*" align="right"/>
39890 <tbody>
39891 <row>
39892 <entry><option>quota</option></entry>
39893 <entry>Use: <emphasis>appendfile</emphasis></entry>
39894 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39895 <entry>Default: <emphasis>unset</emphasis></entry>
39896 </row>
39897 </tbody>
39898 </tgroup>
39899 </informaltable>
39900 <para>
39901 <indexterm role="concept">
39902 <primary>quota</primary>
39903 <secondary>imposed by Exim</secondary>
39904 </indexterm>
39905 This option imposes a limit on the size of the file to which Exim is appending,
39906 or to the total space used in the directory tree when the <option>directory</option> option
39907 is set. In the latter case, computation of the space used is expensive, because
39908 all the files in the directory (and any sub-directories) have to be
39909 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
39910 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
39911 have no shell access to their mailboxes).
39912 </para>
39913 <para>
39914 As there is no interlock against two simultaneous deliveries into a
39915 multi-file mailbox, it is possible for the quota to be overrun in this case.
39916 For single-file mailboxes, of course, an interlock is a necessity.
39917 </para>
39918 <para>
39919 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
39920 may be a lot less than the actual amount of disk space allocated to the file.
39921 If the sizes of a number of files are being added up, the rounding effect can
39922 become quite noticeable, especially on systems that have large block sizes.
39923 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
39924 the obvious value which users understand most easily.
39925 </para>
39926 <para>
39927 The value of the option is expanded, and must then be a numerical value
39928 (decimal point allowed), optionally followed by one of the letters K, M, or G,
39929 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
39930 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
39931 be handled.
39932 </para>
39933 <para>
39934 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
39935 </para>
39936 <para>
39937 The expansion happens while Exim is running as root, before it changes uid for
39938 the delivery. This means that files that are inaccessible to the end user can
39939 be used to hold quota values that are looked up in the expansion. When delivery
39940 fails because this quota is exceeded, the handling of the error is as for
39941 system quota failures.
39942 </para>
39943 <para>
39944 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
39945 mailbox to the specified maximum size, though the value is not accurate to the
39946 last byte, owing to separator lines and additional headers that may get added
39947 during message delivery. When a mailbox is nearly full, large messages may get
39948 refused even though small ones are accepted, because the size of the current
39949 message is added to the quota when the check is made. This behaviour can be
39950 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
39951 for exceeding the quota does not include the current message. Thus, deliveries
39952 continue until the quota has been exceeded; thereafter, no further messages are
39953 delivered. See also <option>quota_warn_threshold</option>.
39954 </para>
39955 <para>
39956 <indexterm role="option">
39957 <primary><option>quota_directory</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>quota_directory</option></entry>
39969 <entry>Use: <emphasis>appendfile</emphasis></entry>
39970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39971 <entry>Default: <emphasis>unset</emphasis></entry>
39972 </row>
39973 </tbody>
39974 </tgroup>
39975 </informaltable>
39976 <para>
39977 This option defines the directory to check for quota purposes when delivering
39978 into individual files. The default is the delivery directory, or, if a file
39979 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
39980 delivery directory.
39981 </para>
39982 <para>
39983 <indexterm role="option">
39984 <primary><option>quota_filecount</option></primary>
39985 </indexterm>
39986 </para>
39987 <informaltable frame="all">
39988 <tgroup cols="4" colsep="0" rowsep="0">
39989 <colspec colwidth="8*" align="left"/>
39990 <colspec colwidth="6*" align="center"/>
39991 <colspec colwidth="6*" align="center"/>
39992 <colspec colwidth="6*" align="right"/>
39993 <tbody>
39994 <row>
39995 <entry><option>quota_filecount</option></entry>
39996 <entry>Use: <emphasis>appendfile</emphasis></entry>
39997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39998 <entry>Default: <emphasis>0</emphasis></entry>
39999 </row>
40000 </tbody>
40001 </tgroup>
40002 </informaltable>
40003 <para>
40004 This option applies when the <option>directory</option> option is set. It limits the total
40005 number of files in the directory (compare the inode limit in system quotas). It
40006 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
40007 failure causes delivery to be deferred. A value of zero is interpreted as
40008 <quote>no quota</quote>.
40009 </para>
40010 <para>
40011 <indexterm role="option">
40012 <primary><option>quota_is_inclusive</option></primary>
40013 </indexterm>
40014 </para>
40015 <informaltable frame="all">
40016 <tgroup cols="4" colsep="0" rowsep="0">
40017 <colspec colwidth="8*" align="left"/>
40018 <colspec colwidth="6*" align="center"/>
40019 <colspec colwidth="6*" align="center"/>
40020 <colspec colwidth="6*" align="right"/>
40021 <tbody>
40022 <row>
40023 <entry><option>quota_is_inclusive</option></entry>
40024 <entry>Use: <emphasis>appendfile</emphasis></entry>
40025 <entry>Type: <emphasis>boolean</emphasis></entry>
40026 <entry>Default: <emphasis>true</emphasis></entry>
40027 </row>
40028 </tbody>
40029 </tgroup>
40030 </informaltable>
40031 <para>
40032 See <option>quota</option> above.
40033 </para>
40034 <para>
40035 <indexterm role="option">
40036 <primary><option>quota_size_regex</option></primary>
40037 </indexterm>
40038 </para>
40039 <informaltable frame="all">
40040 <tgroup cols="4" colsep="0" rowsep="0">
40041 <colspec colwidth="8*" align="left"/>
40042 <colspec colwidth="6*" align="center"/>
40043 <colspec colwidth="6*" align="center"/>
40044 <colspec colwidth="6*" align="right"/>
40045 <tbody>
40046 <row>
40047 <entry><option>quota_size_regex</option></entry>
40048 <entry>Use: <emphasis>appendfile</emphasis></entry>
40049 <entry>Type: <emphasis>string</emphasis></entry>
40050 <entry>Default: <emphasis>unset</emphasis></entry>
40051 </row>
40052 </tbody>
40053 </tgroup>
40054 </informaltable>
40055 <para>
40056 This option applies when one of the delivery modes that writes a separate file
40057 for each message is being used. When Exim wants to find the size of one of
40058 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
40059 If this is set to a regular expression that matches the file name, and it
40060 captures one string, that string is interpreted as a representation of the
40061 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
40062 </para>
40063 <para>
40064 This feature is useful only when users have no shell access to their mailboxes
40065 &ndash; otherwise they could defeat the quota simply by renaming the files. This
40066 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
40067 the file length to the file name. For example:
40068 </para>
40069 <literallayout class="monospaced">
40070 maildir_tag = ,S=$message_size
40071 quota_size_regex = ,S=(\d+)
40072 </literallayout>
40073 <para>
40074 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
40075 number of lines in the message.
40076 </para>
40077 <para>
40078 The regular expression should not assume that the length is at the end of the
40079 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
40080 sometimes add other information onto the ends of message file names.
40081 </para>
40082 <para>
40083 Section <xref linkend="SECID136"/> contains further information.
40084 </para>
40085 <para>
40086 <indexterm role="option">
40087 <primary><option>quota_warn_message</option></primary>
40088 </indexterm>
40089 </para>
40090 <informaltable frame="all">
40091 <tgroup cols="4" colsep="0" rowsep="0">
40092 <colspec colwidth="8*" align="left"/>
40093 <colspec colwidth="6*" align="center"/>
40094 <colspec colwidth="6*" align="center"/>
40095 <colspec colwidth="6*" align="right"/>
40096 <tbody>
40097 <row>
40098 <entry><option>quota_warn_message</option></entry>
40099 <entry>Use: <emphasis>appendfile</emphasis></entry>
40100 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40101 <entry>Default: <emphasis>see below</emphasis></entry>
40102 </row>
40103 </tbody>
40104 </tgroup>
40105 </informaltable>
40106 <para>
40107 See below for the use of this option. If it is not set when
40108 <option>quota_warn_threshold</option> is set, it defaults to
40109 </para>
40110 <literallayout class="monospaced">
40111 quota_warn_message = "\
40112   To: $local_part@$domain\n\
40113   Subject: Your mailbox\n\n\
40114   This message is automatically created \
40115   by mail delivery software.\n\n\
40116   The size of your mailbox has exceeded \
40117   a warning threshold that is\n\
40118   set by the system administrator.\n"
40119 </literallayout>
40120 <para>
40121 <indexterm role="option">
40122 <primary><option>quota_warn_threshold</option></primary>
40123 </indexterm>
40124 </para>
40125 <informaltable frame="all">
40126 <tgroup cols="4" colsep="0" rowsep="0">
40127 <colspec colwidth="8*" align="left"/>
40128 <colspec colwidth="6*" align="center"/>
40129 <colspec colwidth="6*" align="center"/>
40130 <colspec colwidth="6*" align="right"/>
40131 <tbody>
40132 <row>
40133 <entry><option>quota_warn_threshold</option></entry>
40134 <entry>Use: <emphasis>appendfile</emphasis></entry>
40135 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40136 <entry>Default: <emphasis>0</emphasis></entry>
40137 </row>
40138 </tbody>
40139 </tgroup>
40140 </informaltable>
40141 <para>
40142 <indexterm role="concept">
40143 <primary>quota</primary>
40144 <secondary>warning threshold</secondary>
40145 </indexterm>
40146 <indexterm role="concept">
40147 <primary>mailbox</primary>
40148 <secondary>size warning</secondary>
40149 </indexterm>
40150 <indexterm role="concept">
40151 <primary>size</primary>
40152 <secondary>of mailbox</secondary>
40153 </indexterm>
40154 This option is expanded in the same way as <option>quota</option> (see above). If the
40155 resulting value is greater than zero, and delivery of the message causes the
40156 size of the file or total space in the directory tree to cross the given
40157 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
40158 may be specified as a percentage of it by following the value with a percent
40159 sign. For example:
40160 </para>
40161 <literallayout class="monospaced">
40162 quota = 10M
40163 quota_warn_threshold = 75%
40164 </literallayout>
40165 <para>
40166 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
40167 percent sign is ignored.
40168 </para>
40169 <para>
40170 The warning message itself is specified by the <option>quota_warn_message</option> option,
40171 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
40172 warning message. These do not necessarily have to include the recipient(s) of
40173 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
40174 can include any other header lines that you want. If you do not include a
40175 <emphasis>From:</emphasis> line, the default is:
40176 </para>
40177 <literallayout class="monospaced">
40178 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
40179 </literallayout>
40180 <para>
40181 <indexterm role="option">
40182 <primary><option>errors_reply_to</option></primary>
40183 </indexterm>
40184 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
40185 option.
40186 </para>
40187 <para>
40188 The <option>quota</option> option does not have to be set in order to use this option; they
40189 are independent of one another except when the threshold is specified as a
40190 percentage.
40191 </para>
40192 <para>
40193 <indexterm role="option">
40194 <primary><option>use_bsmtp</option></primary>
40195 </indexterm>
40196 </para>
40197 <informaltable frame="all">
40198 <tgroup cols="4" colsep="0" rowsep="0">
40199 <colspec colwidth="8*" align="left"/>
40200 <colspec colwidth="6*" align="center"/>
40201 <colspec colwidth="6*" align="center"/>
40202 <colspec colwidth="6*" align="right"/>
40203 <tbody>
40204 <row>
40205 <entry><option>use_bsmtp</option></entry>
40206 <entry>Use: <emphasis>appendfile</emphasis></entry>
40207 <entry>Type: <emphasis>boolean</emphasis></entry>
40208 <entry>Default: <emphasis>false</emphasis></entry>
40209 </row>
40210 </tbody>
40211 </tgroup>
40212 </informaltable>
40213 <para>
40214 <indexterm role="concept">
40215 <primary>envelope sender</primary>
40216 </indexterm>
40217 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
40218 format, with the envelope sender and recipient(s) included as SMTP commands. If
40219 you want to include a leading HELO command with such messages, you can do
40220 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
40221 for details of batch SMTP.
40222 </para>
40223 <para>
40224 <indexterm role="option">
40225 <primary><option>use_crlf</option></primary>
40226 </indexterm>
40227 </para>
40228 <informaltable frame="all">
40229 <tgroup cols="4" colsep="0" rowsep="0">
40230 <colspec colwidth="8*" align="left"/>
40231 <colspec colwidth="6*" align="center"/>
40232 <colspec colwidth="6*" align="center"/>
40233 <colspec colwidth="6*" align="right"/>
40234 <tbody>
40235 <row>
40236 <entry><option>use_crlf</option></entry>
40237 <entry>Use: <emphasis>appendfile</emphasis></entry>
40238 <entry>Type: <emphasis>boolean</emphasis></entry>
40239 <entry>Default: <emphasis>false</emphasis></entry>
40240 </row>
40241 </tbody>
40242 </tgroup>
40243 </informaltable>
40244 <para>
40245 <indexterm role="concept">
40246 <primary>carriage return</primary>
40247 </indexterm>
40248 <indexterm role="concept">
40249 <primary>linefeed</primary>
40250 </indexterm>
40251 This option causes lines to be terminated with the two-character CRLF sequence
40252 (carriage return, linefeed) instead of just a linefeed character. In the case
40253 of batched SMTP, the byte sequence written to the file is then an exact image
40254 of what would be sent down a real SMTP connection.
40255 </para>
40256 <para>
40257 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
40258 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
40259 in Berkeley-style mailboxes) are written verbatim, so must contain their own
40260 carriage return characters if these are needed. In cases where these options
40261 have non-empty defaults, the values end with a single linefeed, so they must be
40262 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40263 </para>
40264 <para>
40265 <indexterm role="option">
40266 <primary><option>use_fcntl_lock</option></primary>
40267 </indexterm>
40268 </para>
40269 <informaltable frame="all">
40270 <tgroup cols="4" colsep="0" rowsep="0">
40271 <colspec colwidth="8*" align="left"/>
40272 <colspec colwidth="6*" align="center"/>
40273 <colspec colwidth="6*" align="center"/>
40274 <colspec colwidth="6*" align="right"/>
40275 <tbody>
40276 <row>
40277 <entry><option>use_fcntl_lock</option></entry>
40278 <entry>Use: <emphasis>appendfile</emphasis></entry>
40279 <entry>Type: <emphasis>boolean</emphasis></entry>
40280 <entry>Default: <emphasis>see below</emphasis></entry>
40281 </row>
40282 </tbody>
40283 </tgroup>
40284 </informaltable>
40285 <para>
40286 This option controls the use of the <function>fcntl()</function> function to lock a file for
40287 exclusive use when a message is being appended. It is set by default unless
40288 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
40289 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
40290 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
40291 </para>
40292 <para>
40293 <indexterm role="option">
40294 <primary><option>use_flock_lock</option></primary>
40295 </indexterm>
40296 </para>
40297 <informaltable frame="all">
40298 <tgroup cols="4" colsep="0" rowsep="0">
40299 <colspec colwidth="8*" align="left"/>
40300 <colspec colwidth="6*" align="center"/>
40301 <colspec colwidth="6*" align="center"/>
40302 <colspec colwidth="6*" align="right"/>
40303 <tbody>
40304 <row>
40305 <entry><option>use_flock_lock</option></entry>
40306 <entry>Use: <emphasis>appendfile</emphasis></entry>
40307 <entry>Type: <emphasis>boolean</emphasis></entry>
40308 <entry>Default: <emphasis>false</emphasis></entry>
40309 </row>
40310 </tbody>
40311 </tgroup>
40312 </informaltable>
40313 <para>
40314 This option is provided to support the use of <function>flock()</function> for file locking, for
40315 the few situations where it is needed. Most modern operating systems support
40316 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
40317 each other. Exim uses <function>fcntl()</function> locking by default.
40318 </para>
40319 <para>
40320 This option is required only if you are using an operating system where
40321 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
40322 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
40323 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
40324 </para>
40325 <para>
40326 <indexterm role="concept">
40327 <primary>Solaris</primary>
40328 <secondary><function>flock()</function> support</secondary>
40329 </indexterm>
40330 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
40331 have it (and some, I think, provide a not quite right version built on top of
40332 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
40333 the ability to use it, and any attempt to do so will cause a configuration
40334 error.
40335 </para>
40336 <para>
40337 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
40338 is just being mapped onto <function>fcntl()</function> by the OS).
40339 </para>
40340 <para>
40341 <indexterm role="option">
40342 <primary><option>use_lockfile</option></primary>
40343 </indexterm>
40344 </para>
40345 <informaltable frame="all">
40346 <tgroup cols="4" colsep="0" rowsep="0">
40347 <colspec colwidth="8*" align="left"/>
40348 <colspec colwidth="6*" align="center"/>
40349 <colspec colwidth="6*" align="center"/>
40350 <colspec colwidth="6*" align="right"/>
40351 <tbody>
40352 <row>
40353 <entry><option>use_lockfile</option></entry>
40354 <entry>Use: <emphasis>appendfile</emphasis></entry>
40355 <entry>Type: <emphasis>boolean</emphasis></entry>
40356 <entry>Default: <emphasis>see below</emphasis></entry>
40357 </row>
40358 </tbody>
40359 </tgroup>
40360 </informaltable>
40361 <para>
40362 If this option is turned off, Exim does not attempt to create a lock file when
40363 appending to a mailbox file. In this situation, the only locking is by
40364 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
40365 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
40366 <function>fcntl()</function> rather than a lock file, and even then only when you are not
40367 delivering over NFS from more than one host.
40368 </para>
40369 <para>
40370 <indexterm role="concept">
40371 <primary>NFS</primary>
40372 <secondary>lock file</secondary>
40373 </indexterm>
40374 In order to append to an NFS file safely from more than one host, it is
40375 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
40376 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
40377 file corruption.
40378 </para>
40379 <para>
40380 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
40381 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
40382 except when <option>mbx_format</option> is set.
40383 </para>
40384 <para>
40385 <indexterm role="option">
40386 <primary><option>use_mbx_lock</option></primary>
40387 </indexterm>
40388 </para>
40389 <informaltable frame="all">
40390 <tgroup cols="4" colsep="0" rowsep="0">
40391 <colspec colwidth="8*" align="left"/>
40392 <colspec colwidth="6*" align="center"/>
40393 <colspec colwidth="6*" align="center"/>
40394 <colspec colwidth="6*" align="right"/>
40395 <tbody>
40396 <row>
40397 <entry><option>use_mbx_lock</option></entry>
40398 <entry>Use: <emphasis>appendfile</emphasis></entry>
40399 <entry>Type: <emphasis>boolean</emphasis></entry>
40400 <entry>Default: <emphasis>see below</emphasis></entry>
40401 </row>
40402 </tbody>
40403 </tgroup>
40404 </informaltable>
40405 <para>
40406 This option is available only if Exim has been compiled with SUPPORT_MBX
40407 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
40408 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
40409 of the locking options are mentioned in the configuration. The locking rules
40410 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
40411 the IMAP4 and POP daemons that come with it (see the discussion below). The
40412 rules allow for shared access to the mailbox. However, this kind of locking
40413 does not work when the mailbox is NFS mounted.
40414 </para>
40415 <para>
40416 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
40417 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
40418 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
40419 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
40420 </para>
40421 </section>
40422 <section id="SECTopappend">
40423 <title>Operational details for appending</title>
40424 <para>
40425 <indexterm role="concept">
40426 <primary>appending to a file</primary>
40427 </indexterm>
40428 <indexterm role="concept">
40429 <primary>file</primary>
40430 <secondary>appending</secondary>
40431 </indexterm>
40432 Before appending to a file, the following preparations are made:
40433 </para>
40434 <itemizedlist>
40435 <listitem>
40436 <para>
40437 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
40438 return is given.
40439 </para>
40440 </listitem>
40441 <listitem>
40442 <para>
40443 <indexterm role="concept">
40444 <primary>directory creation</primary>
40445 </indexterm>
40446 If any directories on the file&#x2019;s path are missing, Exim creates them if the
40447 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
40448 <option>directory_mode</option> option.
40449 </para>
40450 </listitem>
40451 <listitem>
40452 <para>
40453 If <option>file_format</option> is set, the format of an existing file is checked. If this
40454 indicates that a different transport should be used, control is passed to that
40455 transport.
40456 </para>
40457 </listitem>
40458 <listitem>
40459 <para>
40460 <indexterm role="concept">
40461 <primary>file</primary>
40462 <secondary>locking</secondary>
40463 </indexterm>
40464 <indexterm role="concept">
40465 <primary>locking files</primary>
40466 </indexterm>
40467 <indexterm role="concept">
40468 <primary>NFS</primary>
40469 <secondary>lock file</secondary>
40470 </indexterm>
40471 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
40472 reliably over NFS, as follows:
40473 </para>
40474 <orderedlist numeration="arabic">
40475 <listitem>
40476 <para>
40477 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
40478 current time, primary host name, and process id added, by opening for writing
40479 as a new file. If this fails with an access error, delivery is deferred.
40480 </para>
40481 </listitem>
40482 <listitem>
40483 <para>
40484 Close the hitching post file, and hard link it to the lock file name.
40485 </para>
40486 </listitem>
40487 <listitem>
40488 <para>
40489 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
40490 Unlink the hitching post name.
40491 </para>
40492 </listitem>
40493 <listitem>
40494 <para>
40495 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
40496 then unlink hitching post name. If the number of links is exactly two, creation
40497 of the lock file succeeded but something (for example, an NFS server crash and
40498 restart) caused this fact not to be communicated to the <function>link()</function> call.
40499 </para>
40500 </listitem>
40501 <listitem>
40502 <para>
40503 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
40504 up to <option>lock_retries</option> times. However, since any program that writes to a
40505 mailbox should complete its task very quickly, it is reasonable to time out old
40506 lock files that are normally the result of user agent and system crashes. If an
40507 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
40508 it before trying again.
40509 </para>
40510 </listitem>
40511 </orderedlist>
40512 </listitem>
40513 <listitem>
40514 <para>
40515 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
40516 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
40517 than non-existence, delivery is deferred.
40518 </para>
40519 </listitem>
40520 <listitem>
40521 <para>
40522 <indexterm role="concept">
40523 <primary>symbolic link</primary>
40524 <secondary>to mailbox</secondary>
40525 </indexterm>
40526 <indexterm role="concept">
40527 <primary>mailbox</primary>
40528 <secondary>symbolic link</secondary>
40529 </indexterm>
40530 If the file does exist and is a symbolic link, delivery is deferred, unless the
40531 <option>allow_symlink</option> option is set, in which case the ownership of the link is
40532 checked, and then <function>stat()</function> is called to find out about the real file, which
40533 is then subjected to the checks below. The check on the top-level link
40534 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
40535 directory, though allowing symbolic links in this case is definitely not a good
40536 idea. If there is a chain of symbolic links, the intermediate ones are not
40537 checked.
40538 </para>
40539 </listitem>
40540 <listitem>
40541 <para>
40542 If the file already exists but is not a regular file, or if the file&#x2019;s owner
40543 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
40544 different from the user and group under which the delivery is running,
40545 delivery is deferred.
40546 </para>
40547 </listitem>
40548 <listitem>
40549 <para>
40550 If the file&#x2019;s permissions are more generous than specified, they are reduced.
40551 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
40552 is set false, in which case the delivery is tried using the existing
40553 permissions.
40554 </para>
40555 </listitem>
40556 <listitem>
40557 <para>
40558 The file&#x2019;s inode number is saved, and the file is then opened for appending.
40559 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
40560 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
40561 </para>
40562 </listitem>
40563 <listitem>
40564 <para>
40565 If the file is opened successfully, check that the inode number hasn&#x2019;t
40566 changed, that it is still a regular file, and that the owner and permissions
40567 have not changed. If anything is wrong, defer delivery and freeze the message.
40568 </para>
40569 </listitem>
40570 <listitem>
40571 <para>
40572 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
40573 option is set. Otherwise, check that the file is being created in a permitted
40574 directory if the <option>create_file</option> option is set (deferring on failure), and then
40575 open for writing as a new file, with the O_EXCL and O_CREAT options,
40576 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
40577 set). In this case, which can happen if the link points to a non-existent file,
40578 the file is opened for writing using O_CREAT but not O_EXCL, because
40579 that prevents link following.
40580 </para>
40581 </listitem>
40582 <listitem>
40583 <para>
40584 <indexterm role="concept">
40585 <primary>loop</primary>
40586 <secondary>while file testing</secondary>
40587 </indexterm>
40588 If opening fails because the file exists, obey the tests given above for
40589 existing files. However, to avoid looping in a situation where the file is
40590 being continuously created and destroyed, the exists/not-exists loop is broken
40591 after 10 repetitions, and the message is then frozen.
40592 </para>
40593 </listitem>
40594 <listitem>
40595 <para>
40596 If opening fails with any other error, defer delivery.
40597 </para>
40598 </listitem>
40599 <listitem>
40600 <para>
40601 <indexterm role="concept">
40602 <primary>file</primary>
40603 <secondary>locking</secondary>
40604 </indexterm>
40605 <indexterm role="concept">
40606 <primary>locking files</primary>
40607 </indexterm>
40608 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
40609 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
40610 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
40611 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
40612 file, and an exclusive lock on the file whose name is
40613 </para>
40614 <literallayout class="monospaced">
40615 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
40616 </literallayout>
40617 <para>
40618 using the device and inode numbers of the open mailbox file, in accordance with
40619 the MBX locking rules. This file is created with a mode that is specified by
40620 the <option>lockfile_mode</option> option.
40621 </para>
40622 <para>
40623 If Exim fails to lock the file, there are two possible courses of action,
40624 depending on the value of the locking timeout. This is obtained from
40625 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
40626 </para>
40627 <para>
40628 If the timeout value is zero, the file is closed, Exim waits for
40629 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
40630 to lock it again. This happens up to <option>lock_retries</option> times, after which the
40631 delivery is deferred.
40632 </para>
40633 <para>
40634 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
40635 <function>flock()</function> are used (with the given timeout), so there has already been some
40636 waiting involved by the time locking fails. Nevertheless, Exim does not give up
40637 immediately. It retries up to
40638 </para>
40639 <literallayout class="monospaced">
40640 (lock_retries * lock_interval) / &lt;timeout&gt;
40641 </literallayout>
40642 <para>
40643 times (rounded up).
40644 </para>
40645 </listitem>
40646 </itemizedlist>
40647 <para>
40648 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
40649 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
40650 </para>
40651 </section>
40652 <section id="SECTopdir">
40653 <title>Operational details for delivery to a new file</title>
40654 <para>
40655 <indexterm role="concept">
40656 <primary>delivery</primary>
40657 <secondary>to single file</secondary>
40658 </indexterm>
40659 <indexterm role="concept">
40660 <primary><quote>From</quote> line</primary>
40661 </indexterm>
40662 When the <option>directory</option> option is set instead of <option>file</option>, each message is
40663 delivered into a newly-created file or set of files. When <command>appendfile</command> is
40664 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
40665 <option>directory</option> is normally set, because the path for delivery is supplied by the
40666 router. (See for example, the <command>address_file</command> transport in the default
40667 configuration.) In this case, delivery is to a new file if either the path name
40668 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
40669 </para>
40670 <para>
40671 No locking is required while writing the message to a new file, so the various
40672 locking options of the transport are ignored. The <quote>From</quote> line that by default
40673 separates messages in a single file is not normally needed, nor is the escaping
40674 of message lines that start with <quote>From</quote>, and there is no need to ensure a
40675 newline at the end of each message. Consequently, the default values for
40676 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
40677 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
40678 </para>
40679 <para>
40680 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
40681 the files in the delivery directory by default. However, you can specify a
40682 different directory by setting <option>quota_directory</option>. Also, for maildir
40683 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
40684 </para>
40685 <para>
40686 <indexterm role="concept">
40687 <primary>maildir format</primary>
40688 </indexterm>
40689 <indexterm role="concept">
40690 <primary>mailstore format</primary>
40691 </indexterm>
40692 There are three different ways in which delivery to individual files can be
40693 done, controlled by the settings of the <option>maildir_format</option> and
40694 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
40695 formats is not included in the binary unless SUPPORT_MAILDIR or
40696 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
40697 </para>
40698 <para>
40699 <indexterm role="concept">
40700 <primary>directory creation</primary>
40701 </indexterm>
40702 In all three cases an attempt is made to create the directory and any necessary
40703 sub-directories if they do not exist, provided that the <option>create_directory</option>
40704 option is set (the default). The location of a created directory can be
40705 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
40706 the <option>directory_mode</option> option. If creation fails, or if the
40707 <option>create_directory</option> option is not set when creation is required, delivery is
40708 deferred.
40709 </para>
40710 </section>
40711 <section id="SECTmaildirdelivery">
40712 <title>Maildir delivery</title>
40713 <para>
40714 <indexterm role="concept">
40715 <primary>maildir format</primary>
40716 <secondary>description of</secondary>
40717 </indexterm>
40718 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
40719 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
40720 directory that is defined by the <option>directory</option> option (the <quote>delivery
40721 directory</quote>). If the delivery is successful, the file is renamed into the
40722 <filename>new</filename> subdirectory.
40723 </para>
40724 <para>
40725 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
40726 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
40727 Exim checks that the time-of-day clock has moved on by at least one microsecond
40728 before terminating the delivery process. This guarantees uniqueness for the
40729 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
40730 opening it. If any response other than ENOENT (does not exist) is given,
40731 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
40732 </para>
40733 <para>
40734 Before Exim carries out a maildir delivery, it ensures that subdirectories
40735 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
40736 do not exist, Exim tries to create them and any superior directories in their
40737 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
40738 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
40739 contains matches the delivery directory, Exim also ensures that a file called
40740 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
40741 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
40742 </para>
40743 <para>
40744 These features make it possible to use Exim to create all the necessary files
40745 and directories in a maildir mailbox, including subdirectories for maildir++
40746 folders. Consider this example:
40747 </para>
40748 <literallayout class="monospaced">
40749 maildir_format = true
40750 directory = /var/mail/$local_part\
40751            ${if eq{$local_part_suffix}{}{}\
40752            {/.${substr_1:$local_part_suffix}}}
40753 maildirfolder_create_regex = /\.[^/]+$
40754 </literallayout>
40755 <para>
40756 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
40757 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
40758 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
40759 not match this name, so Exim will not look for or create the file
40760 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
40761 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
40762 </para>
40763 <para>
40764 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
40765 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
40766 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
40767 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
40768 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
40769 </para>
40770 <para>
40771 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
40772 not inadvertently match the toplevel maildir directory, because a
40773 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
40774 </para>
40775 <para>
40776 <indexterm role="concept">
40777 <primary>quota</primary>
40778 <secondary>in maildir delivery</secondary>
40779 </indexterm>
40780 <indexterm role="concept">
40781 <primary>maildir++</primary>
40782 </indexterm>
40783 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
40784 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
40785 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
40786 Exim assumes the directory is a maildir++ folder directory, which is one level
40787 down from the user&#x2019;s top level mailbox directory. This causes it to start at
40788 the parent directory instead of the current directory when calculating the
40789 amount of space used.
40790 </para>
40791 <para>
40792 One problem with delivering into a multi-file mailbox is that it is
40793 computationally expensive to compute the size of the mailbox for quota
40794 checking. Various approaches have been taken to reduce the amount of work
40795 needed. The next two sections describe two of them. A third alternative is to
40796 use some external process for maintaining the size data, and use the expansion
40797 of the <option>mailbox_size</option> option as a way of importing it into Exim.
40798 </para>
40799 </section>
40800 <section id="SECID135">
40801 <title>Using tags to record message sizes</title>
40802 <para>
40803 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
40804 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
40805 tag is added to its name. However, if adding the tag takes the length of the
40806 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
40807 the tag is dropped and the maildir file is created with no tag.
40808 </para>
40809 <para>
40810 <indexterm role="variable">
40811 <primary><varname>$message_size</varname></primary>
40812 </indexterm>
40813 Tags can be used to encode the size of files in their names; see
40814 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
40815 happens after the message has been written. The value of the <varname>$message_size</varname>
40816 variable is set to the number of bytes actually written. If the expansion is
40817 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
40818 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
40819 Non-printing characters in the string are ignored; if the resulting string is
40820 empty, it is ignored. If it starts with an alphanumeric character, a leading
40821 colon is inserted; this default has not proven to be the path that popular
40822 maildir implementations have chosen (but changing it in Exim would break
40823 backwards compatibility).
40824 </para>
40825 <para>
40826 For one common implementation, you might set:
40827 </para>
40828 <literallayout class="monospaced">
40829 maildir_tag = ,S=${message_size}
40830 </literallayout>
40831 <para>
40832 but you should check the documentation of the other software to be sure.
40833 </para>
40834 <para>
40835 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
40836 as this allows Exim to extract the size from your tag, instead of having to
40837 <function>stat()</function> each message file.
40838 </para>
40839 </section>
40840 <section id="SECID136">
40841 <title>Using a maildirsize file</title>
40842 <para>
40843 <indexterm role="concept">
40844 <primary>quota</primary>
40845 <secondary>in maildir delivery</secondary>
40846 </indexterm>
40847 <indexterm role="concept">
40848 <primary>maildir format</primary>
40849 <secondary><filename>maildirsize</filename> file</secondary>
40850 </indexterm>
40851 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
40852 storing quota and message size information in a file called <filename>maildirsize</filename>
40853 within the toplevel maildir directory. If this file does not exist, Exim
40854 creates it, setting the quota from the <option>quota</option> option of the transport. If
40855 the maildir directory itself does not exist, it is created before any attempt
40856 to write a <filename>maildirsize</filename> file.
40857 </para>
40858 <para>
40859 The <filename>maildirsize</filename> file is used to hold information about the sizes of
40860 messages in the maildir, thus speeding up quota calculations. The quota value
40861 in the file is just a cache; if the quota is changed in the transport, the new
40862 value overrides the cached value when the next message is delivered. The cache
40863 is maintained for the benefit of other programs that access the maildir and
40864 need to know the quota.
40865 </para>
40866 <para>
40867 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
40868 file is maintained (with a zero quota setting), but no quota is imposed.
40869 </para>
40870 <para>
40871 A regular expression is available for controlling which directories in the
40872 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
40873 See the description of the <option>maildir_quota_directory_regex</option> option above for
40874 details.
40875 </para>
40876 </section>
40877 <section id="SECID137">
40878 <title>Mailstore delivery</title>
40879 <para>
40880 <indexterm role="concept">
40881 <primary>mailstore format</primary>
40882 <secondary>description of</secondary>
40883 </indexterm>
40884 If the <option>mailstore_format</option> option is true, each message is written as two
40885 files in the given directory. A unique base name is constructed from the
40886 message id and the current delivery process, and the files that are written use
40887 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
40888 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
40889 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
40890 </para>
40891 <para>
40892 During delivery, the envelope is first written to a file with the suffix
40893 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
40894 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
40895 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
40896 file before accessing either of them. An alternative approach is to wait for
40897 the absence of a <filename>.tmp</filename> file.
40898 </para>
40899 <para>
40900 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
40901 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
40902 the sender address on one line, then all the recipient addresses, one per line.
40903 There can be more than one recipient only if the <option>batch_max</option> option is set
40904 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
40905 appended to the file, followed by a newline if it does not end with one.
40906 </para>
40907 <para>
40908 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
40909 failure, it is ignored. Other expansion errors are treated as serious
40910 configuration errors, and delivery is deferred. The variable
40911 <varname>$mailstore_basename</varname> is available for use during these expansions.
40912 </para>
40913 </section>
40914 <section id="SECID138">
40915 <title>Non-special new file delivery</title>
40916 <para>
40917 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
40918 file is created directly in the named directory. For example, when delivering
40919 messages into files in batched SMTP format for later delivery to some host (see
40920 section <xref linkend="SECTbatchSMTP"/>), a setting such as
40921 </para>
40922 <literallayout class="monospaced">
40923 directory = /var/bsmtp/$host
40924 </literallayout>
40925 <para>
40926 might be used. A message is written to a file with a temporary name, which is
40927 then renamed when the delivery is complete. The final name is obtained by
40928 expanding the contents of the <option>directory_file</option> option.
40929 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
40930 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
40931 </para>
40932 </section>
40933 </chapter>
40934
40935 <chapter id="CHID8">
40936 <title>The autoreply transport</title>
40937 <para>
40938 <indexterm role="concept" id="IIDauttra1" class="startofrange">
40939 <primary>transports</primary>
40940 <secondary><command>autoreply</command></secondary>
40941 </indexterm>
40942 <indexterm role="concept" id="IIDauttra2" class="startofrange">
40943 <primary><command>autoreply</command> transport</primary>
40944 </indexterm>
40945 The <command>autoreply</command> transport is not a true transport in that it does not cause
40946 the message to be transmitted. Instead, it generates a new mail message as an
40947 automatic reply to the incoming message. <emphasis>References:</emphasis> and
40948 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
40949 to the rules in RFCs 2822 and 3834, respectively.
40950 </para>
40951 <para>
40952 If the router that passes the message to this transport does not have the
40953 <option>unseen</option> option set, the original message (for the current recipient) is not
40954 delivered anywhere. However, when the <option>unseen</option> option is set on the router
40955 that passes the message to this transport, routing of the address continues, so
40956 another router can set up a normal message delivery.
40957 </para>
40958 <para>
40959 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
40960 <quote>vacation</quote> message being the standard example. However, it can also be run
40961 directly from a router like any other transport. To reduce the possibility of
40962 message cascades, messages created by the <command>autoreply</command> transport always have
40963 empty envelope sender addresses, like bounce messages.
40964 </para>
40965 <para>
40966 The parameters of the message to be sent can be specified in the configuration
40967 by options described below. However, these are used only when the address
40968 passed to the transport does not contain its own reply information. When the
40969 transport is run as a consequence of a
40970 <option>mail</option>
40971 or <option>vacation</option> command in a filter file, the parameters of the message are
40972 supplied by the filter, and passed with the address. The transport&#x2019;s options
40973 that define the message are then ignored (so they are not usually set in this
40974 case). The message is specified entirely by the filter or by the transport; it
40975 is never built from a mixture of options. However, the <option>file_optional</option>,
40976 <option>mode</option>, and <option>return_message</option> options apply in all cases.
40977 </para>
40978 <para>
40979 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
40980 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
40981 gid of the user, and with appropriate current and home directories (see chapter
40982 <xref linkend="CHAPenvironment"/>).
40983 </para>
40984 <para>
40985 There is a subtle difference between routing a message to a <command>pipe</command> transport
40986 that generates some text to be returned to the sender, and routing it to an
40987 <command>autoreply</command> transport. This difference is noticeable only if more than one
40988 address from the same message is so handled. In the case of a pipe, the
40989 separate outputs from the different addresses are gathered up and returned to
40990 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
40991 message is generated for each address that is passed to it.
40992 </para>
40993 <para>
40994 Non-printing characters are not permitted in the header lines generated for the
40995 message that <command>autoreply</command> creates, with the exception of newlines that are
40996 immediately followed by white space. If any non-printing characters are found,
40997 the transport defers.
40998 Whether characters with the top bit set count as printing characters or not is
40999 controlled by the <option>print_topbitchars</option> global option.
41000 </para>
41001 <para>
41002 If any of the generic options for manipulating headers (for example,
41003 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
41004 of the original message that is included in the generated message when
41005 <option>return_message</option> is set. They do not apply to the generated message itself.
41006 </para>
41007 <para>
41008 <indexterm role="variable">
41009 <primary><varname>$sender_address</varname></primary>
41010 </indexterm>
41011 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
41012 the message, indicating that there were no recipients, it does not treat this
41013 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
41014 is empty (because the incoming message is a bounce message) do not cause
41015 problems. They are just discarded.
41016 </para>
41017 <section id="SECID139">
41018 <title>Private options for autoreply</title>
41019 <para>
41020 <indexterm role="concept">
41021 <primary>options</primary>
41022 <secondary><command>autoreply</command> transport</secondary>
41023 </indexterm>
41024 </para>
41025 <para>
41026 <indexterm role="option">
41027 <primary><option>bcc</option></primary>
41028 </indexterm>
41029 </para>
41030 <informaltable frame="all">
41031 <tgroup cols="4" colsep="0" rowsep="0">
41032 <colspec colwidth="8*" align="left"/>
41033 <colspec colwidth="6*" align="center"/>
41034 <colspec colwidth="6*" align="center"/>
41035 <colspec colwidth="6*" align="right"/>
41036 <tbody>
41037 <row>
41038 <entry><option>bcc</option></entry>
41039 <entry>Use: <emphasis>autoreply</emphasis></entry>
41040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41041 <entry>Default: <emphasis>unset</emphasis></entry>
41042 </row>
41043 </tbody>
41044 </tgroup>
41045 </informaltable>
41046 <para>
41047 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
41048 message when the message is specified by the transport.
41049 </para>
41050 <para>
41051 <indexterm role="option">
41052 <primary><option>cc</option></primary>
41053 </indexterm>
41054 </para>
41055 <informaltable frame="all">
41056 <tgroup cols="4" colsep="0" rowsep="0">
41057 <colspec colwidth="8*" align="left"/>
41058 <colspec colwidth="6*" align="center"/>
41059 <colspec colwidth="6*" align="center"/>
41060 <colspec colwidth="6*" align="right"/>
41061 <tbody>
41062 <row>
41063 <entry><option>cc</option></entry>
41064 <entry>Use: <emphasis>autoreply</emphasis></entry>
41065 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41066 <entry>Default: <emphasis>unset</emphasis></entry>
41067 </row>
41068 </tbody>
41069 </tgroup>
41070 </informaltable>
41071 <para>
41072 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
41073 when the message is specified by the transport.
41074 </para>
41075 <para>
41076 <indexterm role="option">
41077 <primary><option>file</option></primary>
41078 </indexterm>
41079 </para>
41080 <informaltable frame="all">
41081 <tgroup cols="4" colsep="0" rowsep="0">
41082 <colspec colwidth="8*" align="left"/>
41083 <colspec colwidth="6*" align="center"/>
41084 <colspec colwidth="6*" align="center"/>
41085 <colspec colwidth="6*" align="right"/>
41086 <tbody>
41087 <row>
41088 <entry><option>file</option></entry>
41089 <entry>Use: <emphasis>autoreply</emphasis></entry>
41090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41091 <entry>Default: <emphasis>unset</emphasis></entry>
41092 </row>
41093 </tbody>
41094 </tgroup>
41095 </informaltable>
41096 <para>
41097 The contents of the file are sent as the body of the message when the message
41098 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
41099 string comes first.
41100 </para>
41101 <para>
41102 <indexterm role="option">
41103 <primary><option>file_expand</option></primary>
41104 </indexterm>
41105 </para>
41106 <informaltable frame="all">
41107 <tgroup cols="4" colsep="0" rowsep="0">
41108 <colspec colwidth="8*" align="left"/>
41109 <colspec colwidth="6*" align="center"/>
41110 <colspec colwidth="6*" align="center"/>
41111 <colspec colwidth="6*" align="right"/>
41112 <tbody>
41113 <row>
41114 <entry><option>file_expand</option></entry>
41115 <entry>Use: <emphasis>autoreply</emphasis></entry>
41116 <entry>Type: <emphasis>boolean</emphasis></entry>
41117 <entry>Default: <emphasis>false</emphasis></entry>
41118 </row>
41119 </tbody>
41120 </tgroup>
41121 </informaltable>
41122 <para>
41123 If this is set, the contents of the file named by the <option>file</option> option are
41124 subjected to string expansion as they are added to the message.
41125 </para>
41126 <para>
41127 <indexterm role="option">
41128 <primary><option>file_optional</option></primary>
41129 </indexterm>
41130 </para>
41131 <informaltable frame="all">
41132 <tgroup cols="4" colsep="0" rowsep="0">
41133 <colspec colwidth="8*" align="left"/>
41134 <colspec colwidth="6*" align="center"/>
41135 <colspec colwidth="6*" align="center"/>
41136 <colspec colwidth="6*" align="right"/>
41137 <tbody>
41138 <row>
41139 <entry><option>file_optional</option></entry>
41140 <entry>Use: <emphasis>autoreply</emphasis></entry>
41141 <entry>Type: <emphasis>boolean</emphasis></entry>
41142 <entry>Default: <emphasis>false</emphasis></entry>
41143 </row>
41144 </tbody>
41145 </tgroup>
41146 </informaltable>
41147 <para>
41148 If this option is true, no error is generated if the file named by the <option>file</option>
41149 option or passed with the address does not exist or cannot be read.
41150 </para>
41151 <para>
41152 <indexterm role="option">
41153 <primary><option>from</option></primary>
41154 </indexterm>
41155 </para>
41156 <informaltable frame="all">
41157 <tgroup cols="4" colsep="0" rowsep="0">
41158 <colspec colwidth="8*" align="left"/>
41159 <colspec colwidth="6*" align="center"/>
41160 <colspec colwidth="6*" align="center"/>
41161 <colspec colwidth="6*" align="right"/>
41162 <tbody>
41163 <row>
41164 <entry><option>from</option></entry>
41165 <entry>Use: <emphasis>autoreply</emphasis></entry>
41166 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41167 <entry>Default: <emphasis>unset</emphasis></entry>
41168 </row>
41169 </tbody>
41170 </tgroup>
41171 </informaltable>
41172 <para>
41173 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
41174 specified by the transport.
41175 </para>
41176 <para>
41177 <indexterm role="option">
41178 <primary><option>headers</option></primary>
41179 </indexterm>
41180 </para>
41181 <informaltable frame="all">
41182 <tgroup cols="4" colsep="0" rowsep="0">
41183 <colspec colwidth="8*" align="left"/>
41184 <colspec colwidth="6*" align="center"/>
41185 <colspec colwidth="6*" align="center"/>
41186 <colspec colwidth="6*" align="right"/>
41187 <tbody>
41188 <row>
41189 <entry><option>headers</option></entry>
41190 <entry>Use: <emphasis>autoreply</emphasis></entry>
41191 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41192 <entry>Default: <emphasis>unset</emphasis></entry>
41193 </row>
41194 </tbody>
41195 </tgroup>
41196 </informaltable>
41197 <para>
41198 This specifies additional RFC 2822 headers that are to be added to the message
41199 when the message is specified by the transport. Several can be given by using
41200 <quote>\n</quote> to separate them. There is no check on the format.
41201 </para>
41202 <para>
41203 <indexterm role="option">
41204 <primary><option>log</option></primary>
41205 </indexterm>
41206 </para>
41207 <informaltable frame="all">
41208 <tgroup cols="4" colsep="0" rowsep="0">
41209 <colspec colwidth="8*" align="left"/>
41210 <colspec colwidth="6*" align="center"/>
41211 <colspec colwidth="6*" align="center"/>
41212 <colspec colwidth="6*" align="right"/>
41213 <tbody>
41214 <row>
41215 <entry><option>log</option></entry>
41216 <entry>Use: <emphasis>autoreply</emphasis></entry>
41217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41218 <entry>Default: <emphasis>unset</emphasis></entry>
41219 </row>
41220 </tbody>
41221 </tgroup>
41222 </informaltable>
41223 <para>
41224 This option names a file in which a record of every message sent is logged when
41225 the message is specified by the transport.
41226 </para>
41227 <para>
41228 <indexterm role="option">
41229 <primary><option>mode</option></primary>
41230 </indexterm>
41231 </para>
41232 <informaltable frame="all">
41233 <tgroup cols="4" colsep="0" rowsep="0">
41234 <colspec colwidth="8*" align="left"/>
41235 <colspec colwidth="6*" align="center"/>
41236 <colspec colwidth="6*" align="center"/>
41237 <colspec colwidth="6*" align="right"/>
41238 <tbody>
41239 <row>
41240 <entry><option>mode</option></entry>
41241 <entry>Use: <emphasis>autoreply</emphasis></entry>
41242 <entry>Type: <emphasis>octal integer</emphasis></entry>
41243 <entry>Default: <emphasis>0600</emphasis></entry>
41244 </row>
41245 </tbody>
41246 </tgroup>
41247 </informaltable>
41248 <para>
41249 If either the log file or the <quote>once</quote> file has to be created, this mode is
41250 used.
41251 </para>
41252 <para>
41253 <indexterm role="option">
41254 <primary><option>never_mail</option></primary>
41255 </indexterm>
41256 </para>
41257 <informaltable frame="all">
41258 <tgroup cols="4" colsep="0" rowsep="0">
41259 <colspec colwidth="8*" align="left"/>
41260 <colspec colwidth="6*" align="center"/>
41261 <colspec colwidth="6*" align="center"/>
41262 <colspec colwidth="6*" align="right"/>
41263 <tbody>
41264 <row>
41265 <entry><option>never_mail</option></entry>
41266 <entry>Use: <emphasis>autoreply</emphasis></entry>
41267 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
41268 <entry>Default: <emphasis>unset</emphasis></entry>
41269 </row>
41270 </tbody>
41271 </tgroup>
41272 </informaltable>
41273 <para>
41274 If any run of the transport creates a message with a recipient that matches any
41275 item in the list, that recipient is quietly discarded. If all recipients are
41276 discarded, no message is created. This applies both when the recipients are
41277 generated by a filter and when they are specified in the transport.
41278 </para>
41279 <para>
41280 <indexterm role="option">
41281 <primary><option>once</option></primary>
41282 </indexterm>
41283 </para>
41284 <informaltable frame="all">
41285 <tgroup cols="4" colsep="0" rowsep="0">
41286 <colspec colwidth="8*" align="left"/>
41287 <colspec colwidth="6*" align="center"/>
41288 <colspec colwidth="6*" align="center"/>
41289 <colspec colwidth="6*" align="right"/>
41290 <tbody>
41291 <row>
41292 <entry><option>once</option></entry>
41293 <entry>Use: <emphasis>autoreply</emphasis></entry>
41294 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41295 <entry>Default: <emphasis>unset</emphasis></entry>
41296 </row>
41297 </tbody>
41298 </tgroup>
41299 </informaltable>
41300 <para>
41301 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
41302 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
41303 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
41304 </para>
41305 <para>
41306 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
41307 By default, if <option>once</option> is set to a non-empty file name, the message
41308 is not sent if a potential recipient is already listed in the database.
41309 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
41310 message is sent if that much time has elapsed since a message was last sent to
41311 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
41312 prevents a message from being sent a second time &ndash; in this case, zero means
41313 infinity.
41314 </para>
41315 <para>
41316 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
41317 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
41318 greater than zero, it changes the way Exim implements the <option>once</option> option.
41319 Instead of using a DBM file to record every recipient it sends to, it uses a
41320 regular file, whose size will never get larger than the given value.
41321 </para>
41322 <para>
41323 In the file, Exim keeps a linear list of recipient addresses and the times at
41324 which they were sent messages. If the file is full when a new address needs to
41325 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
41326 means that a given recipient may receive multiple messages, but at
41327 unpredictable intervals that depend on the rate of turnover of addresses in the
41328 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
41329 </para>
41330 <para>
41331 <indexterm role="option">
41332 <primary><option>once_file_size</option></primary>
41333 </indexterm>
41334 </para>
41335 <informaltable frame="all">
41336 <tgroup cols="4" colsep="0" rowsep="0">
41337 <colspec colwidth="8*" align="left"/>
41338 <colspec colwidth="6*" align="center"/>
41339 <colspec colwidth="6*" align="center"/>
41340 <colspec colwidth="6*" align="right"/>
41341 <tbody>
41342 <row>
41343 <entry><option>once_file_size</option></entry>
41344 <entry>Use: <emphasis>autoreply</emphasis></entry>
41345 <entry>Type: <emphasis>integer</emphasis></entry>
41346 <entry>Default: <emphasis>0</emphasis></entry>
41347 </row>
41348 </tbody>
41349 </tgroup>
41350 </informaltable>
41351 <para>
41352 See <option>once</option> above.
41353 </para>
41354 <para>
41355 <indexterm role="option">
41356 <primary><option>once_repeat</option></primary>
41357 </indexterm>
41358 </para>
41359 <informaltable frame="all">
41360 <tgroup cols="4" colsep="0" rowsep="0">
41361 <colspec colwidth="8*" align="left"/>
41362 <colspec colwidth="6*" align="center"/>
41363 <colspec colwidth="6*" align="center"/>
41364 <colspec colwidth="6*" align="right"/>
41365 <tbody>
41366 <row>
41367 <entry><option>once_repeat</option></entry>
41368 <entry>Use: <emphasis>autoreply</emphasis></entry>
41369 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
41370 <entry>Default: <emphasis>0s</emphasis></entry>
41371 </row>
41372 </tbody>
41373 </tgroup>
41374 </informaltable>
41375 <para>
41376 See <option>once</option> above.
41377 After expansion, the value of this option must be a valid time value.
41378 </para>
41379 <para>
41380 <indexterm role="option">
41381 <primary><option>reply_to</option></primary>
41382 </indexterm>
41383 </para>
41384 <informaltable frame="all">
41385 <tgroup cols="4" colsep="0" rowsep="0">
41386 <colspec colwidth="8*" align="left"/>
41387 <colspec colwidth="6*" align="center"/>
41388 <colspec colwidth="6*" align="center"/>
41389 <colspec colwidth="6*" align="right"/>
41390 <tbody>
41391 <row>
41392 <entry><option>reply_to</option></entry>
41393 <entry>Use: <emphasis>autoreply</emphasis></entry>
41394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41395 <entry>Default: <emphasis>unset</emphasis></entry>
41396 </row>
41397 </tbody>
41398 </tgroup>
41399 </informaltable>
41400 <para>
41401 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
41402 specified by the transport.
41403 </para>
41404 <para>
41405 <indexterm role="option">
41406 <primary><option>return_message</option></primary>
41407 </indexterm>
41408 </para>
41409 <informaltable frame="all">
41410 <tgroup cols="4" colsep="0" rowsep="0">
41411 <colspec colwidth="8*" align="left"/>
41412 <colspec colwidth="6*" align="center"/>
41413 <colspec colwidth="6*" align="center"/>
41414 <colspec colwidth="6*" align="right"/>
41415 <tbody>
41416 <row>
41417 <entry><option>return_message</option></entry>
41418 <entry>Use: <emphasis>autoreply</emphasis></entry>
41419 <entry>Type: <emphasis>boolean</emphasis></entry>
41420 <entry>Default: <emphasis>false</emphasis></entry>
41421 </row>
41422 </tbody>
41423 </tgroup>
41424 </informaltable>
41425 <para>
41426 If this is set, a copy of the original message is returned with the new
41427 message, subject to the maximum size set in the <option>return_size_limit</option> global
41428 configuration option.
41429 </para>
41430 <para>
41431 <indexterm role="option">
41432 <primary><option>subject</option></primary>
41433 </indexterm>
41434 </para>
41435 <informaltable frame="all">
41436 <tgroup cols="4" colsep="0" rowsep="0">
41437 <colspec colwidth="8*" align="left"/>
41438 <colspec colwidth="6*" align="center"/>
41439 <colspec colwidth="6*" align="center"/>
41440 <colspec colwidth="6*" align="right"/>
41441 <tbody>
41442 <row>
41443 <entry><option>subject</option></entry>
41444 <entry>Use: <emphasis>autoreply</emphasis></entry>
41445 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41446 <entry>Default: <emphasis>unset</emphasis></entry>
41447 </row>
41448 </tbody>
41449 </tgroup>
41450 </informaltable>
41451 <para>
41452 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
41453 specified by the transport. It is tempting to quote the original subject in
41454 automatic responses. For example:
41455 </para>
41456 <literallayout class="monospaced">
41457 subject = Re: $h_subject:
41458 </literallayout>
41459 <para>
41460 There is a danger in doing this, however. It may allow a third party to
41461 subscribe your users to an opt-in mailing list, provided that the list accepts
41462 bounce messages as subscription confirmations. Well-managed lists require a
41463 non-bounce message to confirm a subscription, so the danger is relatively
41464 small.
41465 </para>
41466 <para>
41467 <indexterm role="option">
41468 <primary><option>text</option></primary>
41469 </indexterm>
41470 </para>
41471 <informaltable frame="all">
41472 <tgroup cols="4" colsep="0" rowsep="0">
41473 <colspec colwidth="8*" align="left"/>
41474 <colspec colwidth="6*" align="center"/>
41475 <colspec colwidth="6*" align="center"/>
41476 <colspec colwidth="6*" align="right"/>
41477 <tbody>
41478 <row>
41479 <entry><option>text</option></entry>
41480 <entry>Use: <emphasis>autoreply</emphasis></entry>
41481 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41482 <entry>Default: <emphasis>unset</emphasis></entry>
41483 </row>
41484 </tbody>
41485 </tgroup>
41486 </informaltable>
41487 <para>
41488 This specifies a single string to be used as the body of the message when the
41489 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
41490 the text comes first.
41491 </para>
41492 <para>
41493 <indexterm role="option">
41494 <primary><option>to</option></primary>
41495 </indexterm>
41496 </para>
41497 <informaltable frame="all">
41498 <tgroup cols="4" colsep="0" rowsep="0">
41499 <colspec colwidth="8*" align="left"/>
41500 <colspec colwidth="6*" align="center"/>
41501 <colspec colwidth="6*" align="center"/>
41502 <colspec colwidth="6*" align="right"/>
41503 <tbody>
41504 <row>
41505 <entry><option>to</option></entry>
41506 <entry>Use: <emphasis>autoreply</emphasis></entry>
41507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41508 <entry>Default: <emphasis>unset</emphasis></entry>
41509 </row>
41510 </tbody>
41511 </tgroup>
41512 </informaltable>
41513 <para>
41514 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
41515 when the message is specified by the transport.
41516 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
41517 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
41518 </para>
41519 </section>
41520 </chapter>
41521
41522 <chapter id="CHAPLMTP">
41523 <title>The lmtp transport</title>
41524 <para>
41525 <indexterm role="concept">
41526 <primary>transports</primary>
41527 <secondary><command>lmtp</command></secondary>
41528 </indexterm>
41529 <indexterm role="concept">
41530 <primary><command>lmtp</command> transport</primary>
41531 </indexterm>
41532 <indexterm role="concept">
41533 <primary>LMTP</primary>
41534 <secondary>over a pipe</secondary>
41535 </indexterm>
41536 <indexterm role="concept">
41537 <primary>LMTP</primary>
41538 <secondary>over a socket</secondary>
41539 </indexterm>
41540 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
41541 specified command
41542 or by interacting with a Unix domain socket.
41543 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
41544 transports. Exim also has support for using LMTP over TCP/IP; this is
41545 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
41546 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
41547 has it commented out. You need to ensure that
41548 </para>
41549 <literallayout class="monospaced">
41550 TRANSPORT_LMTP=yes
41551 </literallayout>
41552 <para>
41553 <indexterm role="concept">
41554 <primary>options</primary>
41555 <secondary><command>lmtp</command> transport</secondary>
41556 </indexterm>
41557 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
41558 included in the Exim binary. The private options of the <command>lmtp</command> transport are
41559 as follows:
41560 </para>
41561 <para>
41562 <indexterm role="option">
41563 <primary><option>batch_id</option></primary>
41564 </indexterm>
41565 </para>
41566 <informaltable frame="all">
41567 <tgroup cols="4" colsep="0" rowsep="0">
41568 <colspec colwidth="8*" align="left"/>
41569 <colspec colwidth="6*" align="center"/>
41570 <colspec colwidth="6*" align="center"/>
41571 <colspec colwidth="6*" align="right"/>
41572 <tbody>
41573 <row>
41574 <entry><option>batch_id</option></entry>
41575 <entry>Use: <emphasis>lmtp</emphasis></entry>
41576 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41577 <entry>Default: <emphasis>unset</emphasis></entry>
41578 </row>
41579 </tbody>
41580 </tgroup>
41581 </informaltable>
41582 <para>
41583 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41584 </para>
41585 <para>
41586 <indexterm role="option">
41587 <primary><option>batch_max</option></primary>
41588 </indexterm>
41589 </para>
41590 <informaltable frame="all">
41591 <tgroup cols="4" colsep="0" rowsep="0">
41592 <colspec colwidth="8*" align="left"/>
41593 <colspec colwidth="6*" align="center"/>
41594 <colspec colwidth="6*" align="center"/>
41595 <colspec colwidth="6*" align="right"/>
41596 <tbody>
41597 <row>
41598 <entry><option>batch_max</option></entry>
41599 <entry>Use: <emphasis>lmtp</emphasis></entry>
41600 <entry>Type: <emphasis>integer</emphasis></entry>
41601 <entry>Default: <emphasis>1</emphasis></entry>
41602 </row>
41603 </tbody>
41604 </tgroup>
41605 </informaltable>
41606 <para>
41607 This limits the number of addresses that can be handled in a single delivery.
41608 Most LMTP servers can handle several addresses at once, so it is normally a
41609 good idea to increase this value. See the description of local delivery
41610 batching in chapter <xref linkend="CHAPbatching"/>.
41611 </para>
41612 <para>
41613 <indexterm role="option">
41614 <primary><option>command</option></primary>
41615 </indexterm>
41616 </para>
41617 <informaltable frame="all">
41618 <tgroup cols="4" colsep="0" rowsep="0">
41619 <colspec colwidth="8*" align="left"/>
41620 <colspec colwidth="6*" align="center"/>
41621 <colspec colwidth="6*" align="center"/>
41622 <colspec colwidth="6*" align="right"/>
41623 <tbody>
41624 <row>
41625 <entry><option>command</option></entry>
41626 <entry>Use: <emphasis>lmtp</emphasis></entry>
41627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41628 <entry>Default: <emphasis>unset</emphasis></entry>
41629 </row>
41630 </tbody>
41631 </tgroup>
41632 </informaltable>
41633 <para>
41634 This option must be set if <option>socket</option> is not set. The string is a command which
41635 is run in a separate process. It is split up into a command name and list of
41636 arguments, each of which is separately expanded (so expansion cannot change the
41637 number of arguments). The command is run directly, not via a shell. The message
41638 is passed to the new process using the standard input and output to operate the
41639 LMTP protocol.
41640 </para>
41641 <para>
41642 <indexterm role="option">
41643 <primary><option>ignore_quota</option></primary>
41644 </indexterm>
41645 </para>
41646 <informaltable frame="all">
41647 <tgroup cols="4" colsep="0" rowsep="0">
41648 <colspec colwidth="8*" align="left"/>
41649 <colspec colwidth="6*" align="center"/>
41650 <colspec colwidth="6*" align="center"/>
41651 <colspec colwidth="6*" align="right"/>
41652 <tbody>
41653 <row>
41654 <entry><option>ignore_quota</option></entry>
41655 <entry>Use: <emphasis>lmtp</emphasis></entry>
41656 <entry>Type: <emphasis>boolean</emphasis></entry>
41657 <entry>Default: <emphasis>false</emphasis></entry>
41658 </row>
41659 </tbody>
41660 </tgroup>
41661 </informaltable>
41662 <para>
41663 <indexterm role="concept">
41664 <primary>LMTP</primary>
41665 <secondary>ignoring quota errors</secondary>
41666 </indexterm>
41667 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
41668 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
41669 in its response to the LHLO command.
41670 </para>
41671 <para>
41672 <indexterm role="option">
41673 <primary><option>socket</option></primary>
41674 </indexterm>
41675 </para>
41676 <informaltable frame="all">
41677 <tgroup cols="4" colsep="0" rowsep="0">
41678 <colspec colwidth="8*" align="left"/>
41679 <colspec colwidth="6*" align="center"/>
41680 <colspec colwidth="6*" align="center"/>
41681 <colspec colwidth="6*" align="right"/>
41682 <tbody>
41683 <row>
41684 <entry><option>socket</option></entry>
41685 <entry>Use: <emphasis>lmtp</emphasis></entry>
41686 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41687 <entry>Default: <emphasis>unset</emphasis></entry>
41688 </row>
41689 </tbody>
41690 </tgroup>
41691 </informaltable>
41692 <para>
41693 This option must be set if <option>command</option> is not set. The result of expansion must
41694 be the name of a Unix domain socket. The transport connects to the socket and
41695 delivers the message to it using the LMTP protocol.
41696 </para>
41697 <para>
41698 <indexterm role="option">
41699 <primary><option>timeout</option></primary>
41700 </indexterm>
41701 </para>
41702 <informaltable frame="all">
41703 <tgroup cols="4" colsep="0" rowsep="0">
41704 <colspec colwidth="8*" align="left"/>
41705 <colspec colwidth="6*" align="center"/>
41706 <colspec colwidth="6*" align="center"/>
41707 <colspec colwidth="6*" align="right"/>
41708 <tbody>
41709 <row>
41710 <entry><option>timeout</option></entry>
41711 <entry>Use: <emphasis>lmtp</emphasis></entry>
41712 <entry>Type: <emphasis>time</emphasis></entry>
41713 <entry>Default: <emphasis>5m</emphasis></entry>
41714 </row>
41715 </tbody>
41716 </tgroup>
41717 </informaltable>
41718 <para>
41719 The transport is aborted if the created process or Unix domain socket does not
41720 respond to LMTP commands or message input within this timeout. Delivery
41721 is deferred, and will be tried again later. Here is an example of a typical
41722 LMTP transport:
41723 </para>
41724 <literallayout class="monospaced">
41725 lmtp:
41726   driver = lmtp
41727   command = /some/local/lmtp/delivery/program
41728   batch_max = 20
41729   user = exim
41730 </literallayout>
41731 <para>
41732 This delivers up to 20 addresses at a time, in a mixture of domains if
41733 necessary, running as the user <emphasis>exim</emphasis>.
41734 </para>
41735 </chapter>
41736
41737 <chapter id="CHAPpipetransport">
41738 <title>The pipe transport</title>
41739 <para>
41740 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
41741 <primary>transports</primary>
41742 <secondary><command>pipe</command></secondary>
41743 </indexterm>
41744 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
41745 <primary><command>pipe</command> transport</primary>
41746 </indexterm>
41747 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
41748 running in another process. One example is the use of <command>pipe</command> as a
41749 pseudo-remote transport for passing messages to some other delivery mechanism
41750 (such as UUCP). Another is the use by individual users to automatically process
41751 their incoming messages. The <command>pipe</command> transport can be used in one of the
41752 following ways:
41753 </para>
41754 <itemizedlist>
41755 <listitem>
41756 <para>
41757 <indexterm role="variable">
41758 <primary><varname>$local_part</varname></primary>
41759 </indexterm>
41760 A router routes one address to a transport in the normal way, and the
41761 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
41762 contains the local part of the address (as usual), and the command that is run
41763 is specified by the <option>command</option> option on the transport.
41764 </para>
41765 </listitem>
41766 <listitem>
41767 <para>
41768 <indexterm role="variable">
41769 <primary><varname>$pipe_addresses</varname></primary>
41770 </indexterm>
41771 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
41772 transport can handle more than one address in a single run. In this case, when
41773 more than one address is routed to the transport, <varname>$local_part</varname> is not set
41774 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
41775 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
41776 that are routed to the transport.
41777 </para>
41778 </listitem>
41779 <listitem>
41780 <para>
41781 <indexterm role="variable">
41782 <primary><varname>$address_pipe</varname></primary>
41783 </indexterm>
41784 A router redirects an address directly to a pipe command (for example, from an
41785 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
41786 pipe command, and the <option>command</option> option on the transport is ignored unless
41787 <option>force_command</option> is set. If only one address is being transported
41788 (<option>batch_max</option> is not greater than one, or only one address was redirected to
41789 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
41790 </para>
41791 </listitem>
41792 </itemizedlist>
41793 <para>
41794 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
41795 deliver messages over pipes using the LMTP interactive protocol. This is
41796 implemented by the <command>lmtp</command> transport.
41797 </para>
41798 <para>
41799 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
41800 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
41801 other cases, the uid and gid have to be specified explicitly, either on the
41802 transport or on the router that handles the address. Current and <quote>home</quote>
41803 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
41804 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
41805 for a discussion of local delivery batching.
41806 </para>
41807 <section id="SECID140">
41808 <title>Concurrent delivery</title>
41809 <para>
41810 If two messages arrive at almost the same time, and both are routed to a pipe
41811 delivery, the two pipe transports may be run concurrently. You must ensure that
41812 any pipe commands you set up are robust against this happening. If the commands
41813 write to a file, the <option>exim_lock</option> utility might be of use.
41814 </para>
41815 </section>
41816 <section id="SECID141">
41817 <title>Returned status and data</title>
41818 <para>
41819 <indexterm role="concept">
41820 <primary><command>pipe</command> transport</primary>
41821 <secondary>returned data</secondary>
41822 </indexterm>
41823 If the command exits with a non-zero return code, the delivery is deemed to
41824 have failed, unless either the <option>ignore_status</option> option is set (in which case
41825 the return code is treated as zero), or the return code is one of those listed
41826 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
41827 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
41828 logged, but are not included in the bounce message, which merely contains
41829 <quote>local delivery failed</quote>.
41830 </para>
41831 <para>
41832 If the command exits on a signal and the <option>freeze_signal</option> option is set then
41833 the message will be frozen in the queue. If that option is not set, a bounce
41834 will be sent as normal.
41835 </para>
41836 <para>
41837 If the return code is greater than 128 and the command being run is a shell
41838 script, it normally means that the script was terminated by a signal whose
41839 value is the return code minus 128. The <option>freeze_signal</option> option does not
41840 apply in this case.
41841 </para>
41842 <para>
41843 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
41844 return code is set to 127. This is the value that a shell returns if it is
41845 asked to run a non-existent command. The wording for the log line suggests that
41846 a non-existent command may be the problem.
41847 </para>
41848 <para>
41849 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
41850 set and the command produces any output on its standard output or standard
41851 error streams, the command is considered to have failed, even if it gave a zero
41852 return code or if <option>ignore_status</option> is set. The output from the command is
41853 included as part of the bounce message. The <option>return_fail_output</option> option is
41854 similar, except that output is returned only when the command exits with a
41855 failure return code, that is, a value other than zero or a code that matches
41856 <option>temp_errors</option>.
41857 </para>
41858 </section>
41859 <section id="SECThowcommandrun">
41860 <title>How the command is run</title>
41861 <para>
41862 <indexterm role="concept">
41863 <primary><command>pipe</command> transport</primary>
41864 <secondary>path for command</secondary>
41865 </indexterm>
41866 The command line is (by default) broken down into a command name and arguments
41867 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
41868 <option>restrict_to_path</option> options can be used to restrict the commands that may be
41869 run.
41870 </para>
41871 <para>
41872 <indexterm role="concept">
41873 <primary>quoting</primary>
41874 <secondary>in pipe command</secondary>
41875 </indexterm>
41876 Unquoted arguments are delimited by white space. If an argument appears in
41877 double quotes, backslash is interpreted as an escape character in the usual
41878 way. If an argument appears in single quotes, no escaping is done.
41879 </para>
41880 <para>
41881 String expansion is applied to the command line except when it comes from a
41882 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
41883 expansion is applied to each argument in turn rather than to the whole line.
41884 For this reason, any string expansion item that contains white space must be
41885 quoted so as to be contained within a single argument. A setting such as
41886 </para>
41887 <literallayout class="monospaced">
41888 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
41889 </literallayout>
41890 <para>
41891 will not work, because the expansion item gets split between several
41892 arguments. You have to write
41893 </para>
41894 <literallayout class="monospaced">
41895 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
41896 </literallayout>
41897 <para>
41898 to ensure that it is all in one argument. The expansion is done in this way,
41899 argument by argument, so that the number of arguments cannot be changed as a
41900 result of expansion, and quotes or backslashes in inserted variables do not
41901 interact with external quoting. However, this leads to problems if you want to
41902 generate multiple arguments (or the command name plus arguments) from a single
41903 expansion. In this situation, the simplest solution is to use a shell. For
41904 example:
41905 </para>
41906 <literallayout class="monospaced">
41907 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
41908 </literallayout>
41909 <para>
41910 <indexterm role="concept">
41911 <primary>transport</primary>
41912 <secondary>filter</secondary>
41913 </indexterm>
41914 <indexterm role="concept">
41915 <primary>filter</primary>
41916 <secondary>transport filter</secondary>
41917 </indexterm>
41918 <indexterm role="variable">
41919 <primary><varname>$pipe_addresses</varname></primary>
41920 </indexterm>
41921 Special handling takes place when an argument consists of precisely the text
41922 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
41923 place this string is recognized is when it appears as an argument for a pipe or
41924 transport filter command. It causes each address that is being handled to be
41925 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
41926 avoids any problems with spaces or shell metacharacters, and is of use when a
41927 <command>pipe</command> transport is handling groups of addresses in a batch.
41928 </para>
41929 <para revisionflag="changed">
41930 If <option>force_command</option> is enabled on the transport, Special handling takes place
41931 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
41932 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
41933 argument is inserted in the argument list at that point
41934 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
41935 the only item in the argument; in fact, if it were then <option>force_command</option>
41936 should behave as a no-op.  Rather, it should be used to adjust the command
41937 run while preserving the argument vector separation.
41938 </para>
41939 <para>
41940 After splitting up into arguments and expansion, the resulting command is run
41941 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
41942 message that is being delivered is supplied on the standard input, and the
41943 standard output and standard error are both connected to a single pipe that is
41944 read by Exim. The <option>max_output</option> option controls how much output the command
41945 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
41946 control what is done with it.
41947 </para>
41948 <para>
41949 Not running the command under a shell (by default) lessens the security risks
41950 in cases when a command from a user&#x2019;s filter file is built out of data that was
41951 taken from an incoming message. If a shell is required, it can of course be
41952 explicitly specified as the command to be run. However, there are circumstances
41953 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
41954 under a shell and cannot easily be modified. To allow for these cases, there is
41955 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
41956 works. Instead of breaking up the command line as just described, it expands it
41957 as a single string and passes the result to <filename>/bin/sh</filename>. The
41958 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
41959 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
41960 </para>
41961 </section>
41962 <section id="SECTpipeenv">
41963 <title>Environment variables</title>
41964 <para>
41965 <indexterm role="concept">
41966 <primary><command>pipe</command> transport</primary>
41967 <secondary>environment for command</secondary>
41968 </indexterm>
41969 <indexterm role="concept">
41970 <primary>environment for pipe transport</primary>
41971 </indexterm>
41972 The environment variables listed below are set up when the command is invoked.
41973 This list is a compromise for maximum compatibility with other MTAs. Note that
41974 the <option>environment</option> option can be used to add additional variables to this
41975 environment.
41976 </para>
41977 <literallayout>
41978 <literal>DOMAIN            </literal>   the domain of the address
41979 <literal>HOME              </literal>   the home directory, if set
41980 <literal>HOST              </literal>   the host name when called from a router (see below)
41981 <literal>LOCAL_PART        </literal>   see below
41982 <literal>LOCAL_PART_PREFIX </literal>   see below
41983 <literal>LOCAL_PART_SUFFIX </literal>   see below
41984 <literal>LOGNAME           </literal>   see below
41985 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
41986 <literal>PATH              </literal>   as specified by the <option>path</option> option below
41987 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
41988 <literal>RECIPIENT         </literal>   the complete recipient address
41989 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
41990 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
41991 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
41992 <literal>USER              </literal>   see below
41993 </literallayout>
41994 <para>
41995 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
41996 router, LOCAL_PART is set to the local part of the address. When it is
41997 called as a result of a forward or alias expansion, LOCAL_PART is set to
41998 the local part of the address that was expanded. In both cases, any affixes are
41999 removed from the local part, and made available in LOCAL_PART_PREFIX and
42000 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
42001 same value as LOCAL_PART for compatibility with other MTAs.
42002 </para>
42003 <para>
42004 <indexterm role="concept">
42005 <primary>HOST</primary>
42006 </indexterm>
42007 HOST is set only when a <command>pipe</command> transport is called from a router that
42008 associates hosts with an address, typically when using <command>pipe</command> as a
42009 pseudo-remote transport. HOST is set to the first host name specified by
42010 the router.
42011 </para>
42012 <para>
42013 <indexterm role="concept">
42014 <primary>HOME</primary>
42015 </indexterm>
42016 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
42017 for the HOME environment variable. Otherwise, a home directory may be set
42018 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
42019 user&#x2019;s home directory if <option>check_local_user</option> is set.
42020 </para>
42021 </section>
42022 <section id="SECID142">
42023 <title>Private options for pipe</title>
42024 <para>
42025 <indexterm role="concept">
42026 <primary>options</primary>
42027 <secondary><command>pipe</command> transport</secondary>
42028 </indexterm>
42029 </para>
42030 <para>
42031 <indexterm role="option">
42032 <primary><option>allow_commands</option></primary>
42033 </indexterm>
42034 </para>
42035 <informaltable frame="all">
42036 <tgroup cols="4" colsep="0" rowsep="0">
42037 <colspec colwidth="8*" align="left"/>
42038 <colspec colwidth="6*" align="center"/>
42039 <colspec colwidth="6*" align="center"/>
42040 <colspec colwidth="6*" align="right"/>
42041 <tbody>
42042 <row>
42043 <entry><option>allow_commands</option></entry>
42044 <entry>Use: <emphasis>pipe</emphasis></entry>
42045 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
42046 <entry>Default: <emphasis>unset</emphasis></entry>
42047 </row>
42048 </tbody>
42049 </tgroup>
42050 </informaltable>
42051 <para>
42052 <indexterm role="concept">
42053 <primary><command>pipe</command> transport</primary>
42054 <secondary>permitted commands</secondary>
42055 </indexterm>
42056 The string is expanded, and is then interpreted as a colon-separated list of
42057 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
42058 permitted are those in the <option>allow_commands</option> list. They need not be absolute
42059 paths; the <option>path</option> option is still used for relative paths. If
42060 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
42061 in the <option>allow_commands</option> list, or a name without any slashes that is found on
42062 the path. In other words, if neither <option>allow_commands</option> nor
42063 <option>restrict_to_path</option> is set, there is no restriction on the command, but
42064 otherwise only commands that are permitted by one or the other are allowed. For
42065 example, if
42066 </para>
42067 <literallayout class="monospaced">
42068 allow_commands = /usr/bin/vacation
42069 </literallayout>
42070 <para>
42071 and <option>restrict_to_path</option> is not set, the only permitted command is
42072 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
42073 <option>use_shell</option> is set.
42074 </para>
42075 <para>
42076 <indexterm role="option">
42077 <primary><option>batch_id</option></primary>
42078 </indexterm>
42079 </para>
42080 <informaltable frame="all">
42081 <tgroup cols="4" colsep="0" rowsep="0">
42082 <colspec colwidth="8*" align="left"/>
42083 <colspec colwidth="6*" align="center"/>
42084 <colspec colwidth="6*" align="center"/>
42085 <colspec colwidth="6*" align="right"/>
42086 <tbody>
42087 <row>
42088 <entry><option>batch_id</option></entry>
42089 <entry>Use: <emphasis>pipe</emphasis></entry>
42090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42091 <entry>Default: <emphasis>unset</emphasis></entry>
42092 </row>
42093 </tbody>
42094 </tgroup>
42095 </informaltable>
42096 <para>
42097 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42098 </para>
42099 <para>
42100 <indexterm role="option">
42101 <primary><option>batch_max</option></primary>
42102 </indexterm>
42103 </para>
42104 <informaltable frame="all">
42105 <tgroup cols="4" colsep="0" rowsep="0">
42106 <colspec colwidth="8*" align="left"/>
42107 <colspec colwidth="6*" align="center"/>
42108 <colspec colwidth="6*" align="center"/>
42109 <colspec colwidth="6*" align="right"/>
42110 <tbody>
42111 <row>
42112 <entry><option>batch_max</option></entry>
42113 <entry>Use: <emphasis>pipe</emphasis></entry>
42114 <entry>Type: <emphasis>integer</emphasis></entry>
42115 <entry>Default: <emphasis>1</emphasis></entry>
42116 </row>
42117 </tbody>
42118 </tgroup>
42119 </informaltable>
42120 <para>
42121 This limits the number of addresses that can be handled in a single delivery.
42122 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
42123 </para>
42124 <para>
42125 <indexterm role="option">
42126 <primary><option>check_string</option></primary>
42127 </indexterm>
42128 </para>
42129 <informaltable frame="all">
42130 <tgroup cols="4" colsep="0" rowsep="0">
42131 <colspec colwidth="8*" align="left"/>
42132 <colspec colwidth="6*" align="center"/>
42133 <colspec colwidth="6*" align="center"/>
42134 <colspec colwidth="6*" align="right"/>
42135 <tbody>
42136 <row>
42137 <entry><option>check_string</option></entry>
42138 <entry>Use: <emphasis>pipe</emphasis></entry>
42139 <entry>Type: <emphasis>string</emphasis></entry>
42140 <entry>Default: <emphasis>unset</emphasis></entry>
42141 </row>
42142 </tbody>
42143 </tgroup>
42144 </informaltable>
42145 <para>
42146 As <command>pipe</command> writes the message, the start of each line is tested for matching
42147 <option>check_string</option>, and if it does, the initial matching characters are replaced
42148 by the contents of <option>escape_string</option>, provided both are set. The value of
42149 <option>check_string</option> is a literal string, not a regular expression, and the case of
42150 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
42151 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
42152 the SMTP escaping protocol. Any settings made in the configuration file are
42153 ignored.
42154 </para>
42155 <para>
42156 <indexterm role="option">
42157 <primary><option>command</option></primary>
42158 </indexterm>
42159 </para>
42160 <informaltable frame="all">
42161 <tgroup cols="4" colsep="0" rowsep="0">
42162 <colspec colwidth="8*" align="left"/>
42163 <colspec colwidth="6*" align="center"/>
42164 <colspec colwidth="6*" align="center"/>
42165 <colspec colwidth="6*" align="right"/>
42166 <tbody>
42167 <row>
42168 <entry><option>command</option></entry>
42169 <entry>Use: <emphasis>pipe</emphasis></entry>
42170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42171 <entry>Default: <emphasis>unset</emphasis></entry>
42172 </row>
42173 </tbody>
42174 </tgroup>
42175 </informaltable>
42176 <para>
42177 This option need not be set when <command>pipe</command> is being used to deliver to pipes
42178 obtained directly from address redirections. In other cases, the option must be
42179 set, to provide a command to be run. It need not yield an absolute path (see
42180 the <option>path</option> option below). The command is split up into separate arguments by
42181 Exim, and each argument is separately expanded, as described in section
42182 <xref linkend="SECThowcommandrun"/> above.
42183 </para>
42184 <para>
42185 <indexterm role="option">
42186 <primary><option>environment</option></primary>
42187 </indexterm>
42188 </para>
42189 <informaltable frame="all">
42190 <tgroup cols="4" colsep="0" rowsep="0">
42191 <colspec colwidth="8*" align="left"/>
42192 <colspec colwidth="6*" align="center"/>
42193 <colspec colwidth="6*" align="center"/>
42194 <colspec colwidth="6*" align="right"/>
42195 <tbody>
42196 <row>
42197 <entry><option>environment</option></entry>
42198 <entry>Use: <emphasis>pipe</emphasis></entry>
42199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42200 <entry>Default: <emphasis>unset</emphasis></entry>
42201 </row>
42202 </tbody>
42203 </tgroup>
42204 </informaltable>
42205 <para>
42206 <indexterm role="concept">
42207 <primary><command>pipe</command> transport</primary>
42208 <secondary>environment for command</secondary>
42209 </indexterm>
42210 <indexterm role="concept">
42211 <primary>environment for <command>pipe</command> transport</primary>
42212 </indexterm>
42213 This option is used to add additional variables to the environment in which the
42214 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
42215 a string which is expanded, and then interpreted as a colon-separated list of
42216 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
42217 </para>
42218 <para>
42219 <indexterm role="option">
42220 <primary><option>escape_string</option></primary>
42221 </indexterm>
42222 </para>
42223 <informaltable frame="all">
42224 <tgroup cols="4" colsep="0" rowsep="0">
42225 <colspec colwidth="8*" align="left"/>
42226 <colspec colwidth="6*" align="center"/>
42227 <colspec colwidth="6*" align="center"/>
42228 <colspec colwidth="6*" align="right"/>
42229 <tbody>
42230 <row>
42231 <entry><option>escape_string</option></entry>
42232 <entry>Use: <emphasis>pipe</emphasis></entry>
42233 <entry>Type: <emphasis>string</emphasis></entry>
42234 <entry>Default: <emphasis>unset</emphasis></entry>
42235 </row>
42236 </tbody>
42237 </tgroup>
42238 </informaltable>
42239 <para>
42240 See <option>check_string</option> above.
42241 </para>
42242 <para>
42243 <indexterm role="option">
42244 <primary><option>freeze_exec_fail</option></primary>
42245 </indexterm>
42246 </para>
42247 <informaltable frame="all">
42248 <tgroup cols="4" colsep="0" rowsep="0">
42249 <colspec colwidth="8*" align="left"/>
42250 <colspec colwidth="6*" align="center"/>
42251 <colspec colwidth="6*" align="center"/>
42252 <colspec colwidth="6*" align="right"/>
42253 <tbody>
42254 <row>
42255 <entry><option>freeze_exec_fail</option></entry>
42256 <entry>Use: <emphasis>pipe</emphasis></entry>
42257 <entry>Type: <emphasis>boolean</emphasis></entry>
42258 <entry>Default: <emphasis>false</emphasis></entry>
42259 </row>
42260 </tbody>
42261 </tgroup>
42262 </informaltable>
42263 <para>
42264 <indexterm role="concept">
42265 <primary>exec failure</primary>
42266 </indexterm>
42267 <indexterm role="concept">
42268 <primary>failure of exec</primary>
42269 </indexterm>
42270 <indexterm role="concept">
42271 <primary><command>pipe</command> transport</primary>
42272 <secondary>failure of exec</secondary>
42273 </indexterm>
42274 Failure to exec the command in a pipe transport is by default treated like
42275 any other failure while running the command. However, if <option>freeze_exec_fail</option>
42276 is set, failure to exec is treated specially, and causes the message to be
42277 frozen, whatever the setting of <option>ignore_status</option>.
42278 </para>
42279 <para>
42280 <indexterm role="option">
42281 <primary><option>freeze_signal</option></primary>
42282 </indexterm>
42283 </para>
42284 <informaltable frame="all">
42285 <tgroup cols="4" colsep="0" rowsep="0">
42286 <colspec colwidth="8*" align="left"/>
42287 <colspec colwidth="6*" align="center"/>
42288 <colspec colwidth="6*" align="center"/>
42289 <colspec colwidth="6*" align="right"/>
42290 <tbody>
42291 <row>
42292 <entry><option>freeze_signal</option></entry>
42293 <entry>Use: <emphasis>pipe</emphasis></entry>
42294 <entry>Type: <emphasis>boolean</emphasis></entry>
42295 <entry>Default: <emphasis>false</emphasis></entry>
42296 </row>
42297 </tbody>
42298 </tgroup>
42299 </informaltable>
42300 <para>
42301 <indexterm role="concept">
42302 <primary>signal exit</primary>
42303 </indexterm>
42304 <indexterm role="concept">
42305 <primary><command>pipe</command> transport</primary>
42306 <secondary>,</secondary>
42307 </indexterm>
42308 Normally if the process run by a command in a pipe transport exits on a signal,
42309 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
42310 frozen in Exim&#x2019;s queue instead.
42311 </para>
42312 <para revisionflag="changed">
42313 <indexterm role="option">
42314 <primary><option>force_command</option></primary>
42315 </indexterm>
42316 </para>
42317 <informaltable frame="all" revisionflag="changed">
42318 <tgroup cols="4" colsep="0" rowsep="0">
42319 <colspec colwidth="8*" align="left"/>
42320 <colspec colwidth="6*" align="center"/>
42321 <colspec colwidth="6*" align="center"/>
42322 <colspec colwidth="6*" align="right"/>
42323 <tbody>
42324 <row>
42325 <entry><option>force_command</option></entry>
42326 <entry>Use: <emphasis>pipe</emphasis></entry>
42327 <entry>Type: <emphasis>boolean</emphasis></entry>
42328 <entry>Default: <emphasis>false</emphasis></entry>
42329 </row>
42330 </tbody>
42331 </tgroup>
42332 </informaltable>
42333 <para revisionflag="changed">
42334 <indexterm role="concept">
42335 <primary>force command</primary>
42336 </indexterm>
42337 <indexterm role="concept">
42338 <primary><command>pipe</command> transport</primary>
42339 <secondary>,</secondary>
42340 </indexterm>
42341 Normally when a router redirects an address directly to a pipe command
42342 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
42343 is set, the <option>command</option> option will used. This is especially
42344 useful for forcing a wrapper or additional argument to be added to the
42345 command. For example:
42346 </para>
42347 <literallayout class="monospaced" revisionflag="changed">
42348 command = /usr/bin/remote_exec myhost -- $address_pipe
42349 force_command
42350 </literallayout>
42351 <para revisionflag="changed">
42352 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
42353 <option>force_command</option> is set, expanding out to the original argument vector as
42354 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
42355 </para>
42356 <para>
42357 <indexterm role="option">
42358 <primary><option>ignore_status</option></primary>
42359 </indexterm>
42360 </para>
42361 <informaltable frame="all">
42362 <tgroup cols="4" colsep="0" rowsep="0">
42363 <colspec colwidth="8*" align="left"/>
42364 <colspec colwidth="6*" align="center"/>
42365 <colspec colwidth="6*" align="center"/>
42366 <colspec colwidth="6*" align="right"/>
42367 <tbody>
42368 <row>
42369 <entry><option>ignore_status</option></entry>
42370 <entry>Use: <emphasis>pipe</emphasis></entry>
42371 <entry>Type: <emphasis>boolean</emphasis></entry>
42372 <entry>Default: <emphasis>false</emphasis></entry>
42373 </row>
42374 </tbody>
42375 </tgroup>
42376 </informaltable>
42377 <para>
42378 If this option is true, the status returned by the subprocess that is set up to
42379 run the command is ignored, and Exim behaves as if zero had been returned.
42380 Otherwise, a non-zero status or termination by signal causes an error return
42381 from the transport unless the status value is one of those listed in
42382 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
42383 </para>
42384 <para>
42385 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
42386 See the <option>timeout_defer</option> option for how timeouts are handled.
42387 </para>
42388 <para>
42389 <indexterm role="option">
42390 <primary><option>log_defer_output</option></primary>
42391 </indexterm>
42392 </para>
42393 <informaltable frame="all">
42394 <tgroup cols="4" colsep="0" rowsep="0">
42395 <colspec colwidth="8*" align="left"/>
42396 <colspec colwidth="6*" align="center"/>
42397 <colspec colwidth="6*" align="center"/>
42398 <colspec colwidth="6*" align="right"/>
42399 <tbody>
42400 <row>
42401 <entry><option>log_defer_output</option></entry>
42402 <entry>Use: <emphasis>pipe</emphasis></entry>
42403 <entry>Type: <emphasis>boolean</emphasis></entry>
42404 <entry>Default: <emphasis>false</emphasis></entry>
42405 </row>
42406 </tbody>
42407 </tgroup>
42408 </informaltable>
42409 <para>
42410 <indexterm role="concept">
42411 <primary><command>pipe</command> transport</primary>
42412 <secondary>logging output</secondary>
42413 </indexterm>
42414 If this option is set, and the status returned by the command is
42415 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
42416 and any output was produced, the first line of it is written to the main log.
42417 </para>
42418 <para>
42419 <indexterm role="option">
42420 <primary><option>log_fail_output</option></primary>
42421 </indexterm>
42422 </para>
42423 <informaltable frame="all">
42424 <tgroup cols="4" colsep="0" rowsep="0">
42425 <colspec colwidth="8*" align="left"/>
42426 <colspec colwidth="6*" align="center"/>
42427 <colspec colwidth="6*" align="center"/>
42428 <colspec colwidth="6*" align="right"/>
42429 <tbody>
42430 <row>
42431 <entry><option>log_fail_output</option></entry>
42432 <entry>Use: <emphasis>pipe</emphasis></entry>
42433 <entry>Type: <emphasis>boolean</emphasis></entry>
42434 <entry>Default: <emphasis>false</emphasis></entry>
42435 </row>
42436 </tbody>
42437 </tgroup>
42438 </informaltable>
42439 <para>
42440 If this option is set, and the command returns any output, and also ends with a
42441 return code that is neither zero nor one of the return codes listed in
42442 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
42443 written to the main log. This option and <option>log_output</option> are mutually exclusive.
42444 Only one of them may be set.
42445 </para>
42446 <para>
42447 <indexterm role="option">
42448 <primary><option>log_output</option></primary>
42449 </indexterm>
42450 </para>
42451 <informaltable frame="all">
42452 <tgroup cols="4" colsep="0" rowsep="0">
42453 <colspec colwidth="8*" align="left"/>
42454 <colspec colwidth="6*" align="center"/>
42455 <colspec colwidth="6*" align="center"/>
42456 <colspec colwidth="6*" align="right"/>
42457 <tbody>
42458 <row>
42459 <entry><option>log_output</option></entry>
42460 <entry>Use: <emphasis>pipe</emphasis></entry>
42461 <entry>Type: <emphasis>boolean</emphasis></entry>
42462 <entry>Default: <emphasis>false</emphasis></entry>
42463 </row>
42464 </tbody>
42465 </tgroup>
42466 </informaltable>
42467 <para>
42468 If this option is set and the command returns any output, the first line of
42469 output is written to the main log, whatever the return code. This option and
42470 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
42471 </para>
42472 <para>
42473 <indexterm role="option">
42474 <primary><option>max_output</option></primary>
42475 </indexterm>
42476 </para>
42477 <informaltable frame="all">
42478 <tgroup cols="4" colsep="0" rowsep="0">
42479 <colspec colwidth="8*" align="left"/>
42480 <colspec colwidth="6*" align="center"/>
42481 <colspec colwidth="6*" align="center"/>
42482 <colspec colwidth="6*" align="right"/>
42483 <tbody>
42484 <row>
42485 <entry><option>max_output</option></entry>
42486 <entry>Use: <emphasis>pipe</emphasis></entry>
42487 <entry>Type: <emphasis>integer</emphasis></entry>
42488 <entry>Default: <emphasis>20K</emphasis></entry>
42489 </row>
42490 </tbody>
42491 </tgroup>
42492 </informaltable>
42493 <para>
42494 This specifies the maximum amount of output that the command may produce on its
42495 standard output and standard error file combined. If the limit is exceeded, the
42496 process running the command is killed. This is intended as a safety measure to
42497 catch runaway processes. The limit is applied independently of the settings of
42498 the options that control what is done with such output (for example,
42499 <option>return_output</option>). Because of buffering effects, the amount of output may
42500 exceed the limit by a small amount before Exim notices.
42501 </para>
42502 <para>
42503 <indexterm role="option">
42504 <primary><option>message_prefix</option></primary>
42505 </indexterm>
42506 </para>
42507 <informaltable frame="all">
42508 <tgroup cols="4" colsep="0" rowsep="0">
42509 <colspec colwidth="8*" align="left"/>
42510 <colspec colwidth="6*" align="center"/>
42511 <colspec colwidth="6*" align="center"/>
42512 <colspec colwidth="6*" align="right"/>
42513 <tbody>
42514 <row>
42515 <entry><option>message_prefix</option></entry>
42516 <entry>Use: <emphasis>pipe</emphasis></entry>
42517 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42518 <entry>Default: <emphasis>see below</emphasis></entry>
42519 </row>
42520 </tbody>
42521 </tgroup>
42522 </informaltable>
42523 <para>
42524 The string specified here is expanded and output at the start of every message.
42525 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
42526 </para>
42527 <literallayout class="monospaced">
42528 message_prefix = \
42529   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
42530   ${tod_bsdinbox}\n
42531 </literallayout>
42532 <para>
42533 <indexterm role="concept">
42534 <primary>Cyrus</primary>
42535 </indexterm>
42536 <indexterm role="concept">
42537 <primary><option>tmail</option></primary>
42538 </indexterm>
42539 <indexterm role="concept">
42540 <primary><quote>From</quote> line</primary>
42541 </indexterm>
42542 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
42543 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
42544 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
42545 setting
42546 </para>
42547 <literallayout class="monospaced">
42548 message_prefix =
42549 </literallayout>
42550 <para>
42551 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42552 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
42553 </para>
42554 <para>
42555 <indexterm role="option">
42556 <primary><option>message_suffix</option></primary>
42557 </indexterm>
42558 </para>
42559 <informaltable frame="all">
42560 <tgroup cols="4" colsep="0" rowsep="0">
42561 <colspec colwidth="8*" align="left"/>
42562 <colspec colwidth="6*" align="center"/>
42563 <colspec colwidth="6*" align="center"/>
42564 <colspec colwidth="6*" align="right"/>
42565 <tbody>
42566 <row>
42567 <entry><option>message_suffix</option></entry>
42568 <entry>Use: <emphasis>pipe</emphasis></entry>
42569 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42570 <entry>Default: <emphasis>see below</emphasis></entry>
42571 </row>
42572 </tbody>
42573 </tgroup>
42574 </informaltable>
42575 <para>
42576 The string specified here is expanded and output at the end of every message.
42577 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
42578 The suffix can be suppressed by setting
42579 </para>
42580 <literallayout class="monospaced">
42581 message_suffix =
42582 </literallayout>
42583 <para>
42584 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42585 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
42586 </para>
42587 <para>
42588 <indexterm role="option">
42589 <primary><option>path</option></primary>
42590 </indexterm>
42591 </para>
42592 <informaltable frame="all">
42593 <tgroup cols="4" colsep="0" rowsep="0">
42594 <colspec colwidth="8*" align="left"/>
42595 <colspec colwidth="6*" align="center"/>
42596 <colspec colwidth="6*" align="center"/>
42597 <colspec colwidth="6*" align="right"/>
42598 <tbody>
42599 <row>
42600 <entry><option>path</option></entry>
42601 <entry>Use: <emphasis>pipe</emphasis></entry>
42602 <entry>Type: <emphasis>string</emphasis></entry>
42603 <entry>Default: <emphasis>see below</emphasis></entry>
42604 </row>
42605 </tbody>
42606 </tgroup>
42607 </informaltable>
42608 <para>
42609 This option specifies the string that is set up in the PATH environment
42610 variable of the subprocess. The default is:
42611 </para>
42612 <literallayout class="monospaced">
42613 /bin:/usr/bin
42614 </literallayout>
42615 <para>
42616 If the <option>command</option> option does not yield an absolute path name, the command is
42617 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
42618 apply to a command specified as a transport filter.
42619 </para>
42620 <para>
42621 <indexterm role="option">
42622 <primary><option>permit_coredump</option></primary>
42623 </indexterm>
42624 </para>
42625 <informaltable frame="all">
42626 <tgroup cols="4" colsep="0" rowsep="0">
42627 <colspec colwidth="8*" align="left"/>
42628 <colspec colwidth="6*" align="center"/>
42629 <colspec colwidth="6*" align="center"/>
42630 <colspec colwidth="6*" align="right"/>
42631 <tbody>
42632 <row>
42633 <entry><option>permit_coredump</option></entry>
42634 <entry>Use: <emphasis>pipe</emphasis></entry>
42635 <entry>Type: <emphasis>boolean</emphasis></entry>
42636 <entry>Default: <emphasis>false</emphasis></entry>
42637 </row>
42638 </tbody>
42639 </tgroup>
42640 </informaltable>
42641 <para>
42642 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
42643 a core-dump of a pipe command, enable this command.  This enables core-dumps
42644 during delivery and affects both the Exim binary and the pipe command run.
42645 It is recommended that this option remain off unless and until you have a need
42646 for it and that this only be enabled when needed, as the risk of excessive
42647 resource consumption can be quite high.  Note also that Exim is typically
42648 installed as a setuid binary and most operating systems will inhibit coredumps
42649 of these by default, so further OS-specific action may be required.
42650 </para>
42651 <para>
42652 <indexterm role="option">
42653 <primary><option>pipe_as_creator</option></primary>
42654 </indexterm>
42655 </para>
42656 <informaltable frame="all">
42657 <tgroup cols="4" colsep="0" rowsep="0">
42658 <colspec colwidth="8*" align="left"/>
42659 <colspec colwidth="6*" align="center"/>
42660 <colspec colwidth="6*" align="center"/>
42661 <colspec colwidth="6*" align="right"/>
42662 <tbody>
42663 <row>
42664 <entry><option>pipe_as_creator</option></entry>
42665 <entry>Use: <emphasis>pipe</emphasis></entry>
42666 <entry>Type: <emphasis>boolean</emphasis></entry>
42667 <entry>Default: <emphasis>false</emphasis></entry>
42668 </row>
42669 </tbody>
42670 </tgroup>
42671 </informaltable>
42672 <para>
42673 <indexterm role="concept">
42674 <primary>uid (user id)</primary>
42675 <secondary>local delivery</secondary>
42676 </indexterm>
42677 If the generic <option>user</option> option is not set and this option is true, the delivery
42678 process is run under the uid that was in force when Exim was originally called
42679 to accept the message. If the group id is not otherwise set (via the generic
42680 <option>group</option> option), the gid that was in force when Exim was originally called to
42681 accept the message is used.
42682 </para>
42683 <para>
42684 <indexterm role="option">
42685 <primary><option>restrict_to_path</option></primary>
42686 </indexterm>
42687 </para>
42688 <informaltable frame="all">
42689 <tgroup cols="4" colsep="0" rowsep="0">
42690 <colspec colwidth="8*" align="left"/>
42691 <colspec colwidth="6*" align="center"/>
42692 <colspec colwidth="6*" align="center"/>
42693 <colspec colwidth="6*" align="right"/>
42694 <tbody>
42695 <row>
42696 <entry><option>restrict_to_path</option></entry>
42697 <entry>Use: <emphasis>pipe</emphasis></entry>
42698 <entry>Type: <emphasis>boolean</emphasis></entry>
42699 <entry>Default: <emphasis>false</emphasis></entry>
42700 </row>
42701 </tbody>
42702 </tgroup>
42703 </informaltable>
42704 <para>
42705 When this option is set, any command name not listed in <option>allow_commands</option> must
42706 contain no slashes. The command is searched for only in the directories listed
42707 in the <option>path</option> option. This option is intended for use in the case when a pipe
42708 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
42709 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
42710 </para>
42711 <para>
42712 <indexterm role="option">
42713 <primary><option>return_fail_output</option></primary>
42714 </indexterm>
42715 </para>
42716 <informaltable frame="all">
42717 <tgroup cols="4" colsep="0" rowsep="0">
42718 <colspec colwidth="8*" align="left"/>
42719 <colspec colwidth="6*" align="center"/>
42720 <colspec colwidth="6*" align="center"/>
42721 <colspec colwidth="6*" align="right"/>
42722 <tbody>
42723 <row>
42724 <entry><option>return_fail_output</option></entry>
42725 <entry>Use: <emphasis>pipe</emphasis></entry>
42726 <entry>Type: <emphasis>boolean</emphasis></entry>
42727 <entry>Default: <emphasis>false</emphasis></entry>
42728 </row>
42729 </tbody>
42730 </tgroup>
42731 </informaltable>
42732 <para>
42733 If this option is true, and the command produced any output and ended with a
42734 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
42735 is, the delivery failed), the output is returned in the bounce message.
42736 However, if the message has a null sender (that is, it is itself a bounce
42737 message), output from the command is discarded. This option and
42738 <option>return_output</option> are mutually exclusive. Only one of them may be set.
42739 </para>
42740 <para>
42741 <indexterm role="option">
42742 <primary><option>return_output</option></primary>
42743 </indexterm>
42744 </para>
42745 <informaltable frame="all">
42746 <tgroup cols="4" colsep="0" rowsep="0">
42747 <colspec colwidth="8*" align="left"/>
42748 <colspec colwidth="6*" align="center"/>
42749 <colspec colwidth="6*" align="center"/>
42750 <colspec colwidth="6*" align="right"/>
42751 <tbody>
42752 <row>
42753 <entry><option>return_output</option></entry>
42754 <entry>Use: <emphasis>pipe</emphasis></entry>
42755 <entry>Type: <emphasis>boolean</emphasis></entry>
42756 <entry>Default: <emphasis>false</emphasis></entry>
42757 </row>
42758 </tbody>
42759 </tgroup>
42760 </informaltable>
42761 <para>
42762 If this option is true, and the command produced any output, the delivery is
42763 deemed to have failed whatever the return code from the command, and the output
42764 is returned in the bounce message. Otherwise, the output is just discarded.
42765 However, if the message has a null sender (that is, it is a bounce message),
42766 output from the command is always discarded, whatever the setting of this
42767 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
42768 of them may be set.
42769 </para>
42770 <para>
42771 <indexterm role="option">
42772 <primary><option>temp_errors</option></primary>
42773 </indexterm>
42774 </para>
42775 <informaltable frame="all">
42776 <tgroup cols="4" colsep="0" rowsep="0">
42777 <colspec colwidth="8*" align="left"/>
42778 <colspec colwidth="6*" align="center"/>
42779 <colspec colwidth="6*" align="center"/>
42780 <colspec colwidth="6*" align="right"/>
42781 <tbody>
42782 <row>
42783 <entry><option>temp_errors</option></entry>
42784 <entry>Use: <emphasis>pipe</emphasis></entry>
42785 <entry>Type: <emphasis>string list</emphasis></entry>
42786 <entry>Default: <emphasis>see below</emphasis></entry>
42787 </row>
42788 </tbody>
42789 </tgroup>
42790 </informaltable>
42791 <para>
42792 <indexterm role="concept">
42793 <primary><command>pipe</command> transport</primary>
42794 <secondary>temporary failure</secondary>
42795 </indexterm>
42796 This option contains either a colon-separated list of numbers, or a single
42797 asterisk. If <option>ignore_status</option> is false
42798 and <option>return_output</option> is not set,
42799 and the command exits with a non-zero return code, the failure is treated as
42800 temporary and the delivery is deferred if the return code matches one of the
42801 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
42802 codes are treated as permanent errors. The default setting contains the codes
42803 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
42804 compiled on a system that does not define these macros, it assumes values of 75
42805 and 73, respectively.
42806 </para>
42807 <para>
42808 <indexterm role="option">
42809 <primary><option>timeout</option></primary>
42810 </indexterm>
42811 </para>
42812 <informaltable frame="all">
42813 <tgroup cols="4" colsep="0" rowsep="0">
42814 <colspec colwidth="8*" align="left"/>
42815 <colspec colwidth="6*" align="center"/>
42816 <colspec colwidth="6*" align="center"/>
42817 <colspec colwidth="6*" align="right"/>
42818 <tbody>
42819 <row>
42820 <entry><option>timeout</option></entry>
42821 <entry>Use: <emphasis>pipe</emphasis></entry>
42822 <entry>Type: <emphasis>time</emphasis></entry>
42823 <entry>Default: <emphasis>1h</emphasis></entry>
42824 </row>
42825 </tbody>
42826 </tgroup>
42827 </informaltable>
42828 <para>
42829 If the command fails to complete within this time, it is killed. This normally
42830 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
42831 specifies no timeout. In order to ensure that any subprocesses created by the
42832 command are also killed, Exim makes the initial process a process group leader,
42833 and kills the whole process group on a timeout. However, this can be defeated
42834 if one of the processes starts a new process group.
42835 </para>
42836 <para>
42837 <indexterm role="option">
42838 <primary><option>timeout_defer</option></primary>
42839 </indexterm>
42840 </para>
42841 <informaltable frame="all">
42842 <tgroup cols="4" colsep="0" rowsep="0">
42843 <colspec colwidth="8*" align="left"/>
42844 <colspec colwidth="6*" align="center"/>
42845 <colspec colwidth="6*" align="center"/>
42846 <colspec colwidth="6*" align="right"/>
42847 <tbody>
42848 <row>
42849 <entry><option>timeout_defer</option></entry>
42850 <entry>Use: <emphasis>pipe</emphasis></entry>
42851 <entry>Type: <emphasis>boolean</emphasis></entry>
42852 <entry>Default: <emphasis>false</emphasis></entry>
42853 </row>
42854 </tbody>
42855 </tgroup>
42856 </informaltable>
42857 <para>
42858 A timeout in a <command>pipe</command> transport, either in the command that the transport
42859 runs, or in a transport filter that is associated with it, is by default
42860 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
42861 is set true, both kinds of timeout become temporary errors, causing the
42862 delivery to be deferred.
42863 </para>
42864 <para>
42865 <indexterm role="option">
42866 <primary><option>umask</option></primary>
42867 </indexterm>
42868 </para>
42869 <informaltable frame="all">
42870 <tgroup cols="4" colsep="0" rowsep="0">
42871 <colspec colwidth="8*" align="left"/>
42872 <colspec colwidth="6*" align="center"/>
42873 <colspec colwidth="6*" align="center"/>
42874 <colspec colwidth="6*" align="right"/>
42875 <tbody>
42876 <row>
42877 <entry><option>umask</option></entry>
42878 <entry>Use: <emphasis>pipe</emphasis></entry>
42879 <entry>Type: <emphasis>octal integer</emphasis></entry>
42880 <entry>Default: <emphasis>022</emphasis></entry>
42881 </row>
42882 </tbody>
42883 </tgroup>
42884 </informaltable>
42885 <para>
42886 This specifies the umask setting for the subprocess that runs the command.
42887 </para>
42888 <para>
42889 <indexterm role="option">
42890 <primary><option>use_bsmtp</option></primary>
42891 </indexterm>
42892 </para>
42893 <informaltable frame="all">
42894 <tgroup cols="4" colsep="0" rowsep="0">
42895 <colspec colwidth="8*" align="left"/>
42896 <colspec colwidth="6*" align="center"/>
42897 <colspec colwidth="6*" align="center"/>
42898 <colspec colwidth="6*" align="right"/>
42899 <tbody>
42900 <row>
42901 <entry><option>use_bsmtp</option></entry>
42902 <entry>Use: <emphasis>pipe</emphasis></entry>
42903 <entry>Type: <emphasis>boolean</emphasis></entry>
42904 <entry>Default: <emphasis>false</emphasis></entry>
42905 </row>
42906 </tbody>
42907 </tgroup>
42908 </informaltable>
42909 <para>
42910 <indexterm role="concept">
42911 <primary>envelope sender</primary>
42912 </indexterm>
42913 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
42914 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
42915 commands. If you want to include a leading HELO command with such messages,
42916 you can do so by setting the <option>message_prefix</option> option. See section
42917 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
42918 </para>
42919 <para>
42920 <indexterm role="option">
42921 <primary><option>use_classresources</option></primary>
42922 </indexterm>
42923 </para>
42924 <informaltable frame="all">
42925 <tgroup cols="4" colsep="0" rowsep="0">
42926 <colspec colwidth="8*" align="left"/>
42927 <colspec colwidth="6*" align="center"/>
42928 <colspec colwidth="6*" align="center"/>
42929 <colspec colwidth="6*" align="right"/>
42930 <tbody>
42931 <row>
42932 <entry><option>use_classresources</option></entry>
42933 <entry>Use: <emphasis>pipe</emphasis></entry>
42934 <entry>Type: <emphasis>boolean</emphasis></entry>
42935 <entry>Default: <emphasis>false</emphasis></entry>
42936 </row>
42937 </tbody>
42938 </tgroup>
42939 </informaltable>
42940 <para>
42941 <indexterm role="concept">
42942 <primary>class resources (BSD)</primary>
42943 </indexterm>
42944 This option is available only when Exim is running on FreeBSD, NetBSD, or
42945 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
42946 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
42947 limits for the uid under which the pipe is to run are obtained from the login
42948 class database.
42949 </para>
42950 <para>
42951 <indexterm role="option">
42952 <primary><option>use_crlf</option></primary>
42953 </indexterm>
42954 </para>
42955 <informaltable frame="all">
42956 <tgroup cols="4" colsep="0" rowsep="0">
42957 <colspec colwidth="8*" align="left"/>
42958 <colspec colwidth="6*" align="center"/>
42959 <colspec colwidth="6*" align="center"/>
42960 <colspec colwidth="6*" align="right"/>
42961 <tbody>
42962 <row>
42963 <entry><option>use_crlf</option></entry>
42964 <entry>Use: <emphasis>pipe</emphasis></entry>
42965 <entry>Type: <emphasis>boolean</emphasis></entry>
42966 <entry>Default: <emphasis>false</emphasis></entry>
42967 </row>
42968 </tbody>
42969 </tgroup>
42970 </informaltable>
42971 <para>
42972 <indexterm role="concept">
42973 <primary>carriage return</primary>
42974 </indexterm>
42975 <indexterm role="concept">
42976 <primary>linefeed</primary>
42977 </indexterm>
42978 This option causes lines to be terminated with the two-character CRLF sequence
42979 (carriage return, linefeed) instead of just a linefeed character. In the case
42980 of batched SMTP, the byte sequence written to the pipe is then an exact image
42981 of what would be sent down a real SMTP connection.
42982 </para>
42983 <para>
42984 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
42985 written verbatim, so must contain their own carriage return characters if these
42986 are needed. When <option>use_bsmtp</option> is not set, the default values for both
42987 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
42988 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
42989 </para>
42990 <para>
42991 <indexterm role="option">
42992 <primary><option>use_shell</option></primary>
42993 </indexterm>
42994 </para>
42995 <informaltable frame="all">
42996 <tgroup cols="4" colsep="0" rowsep="0">
42997 <colspec colwidth="8*" align="left"/>
42998 <colspec colwidth="6*" align="center"/>
42999 <colspec colwidth="6*" align="center"/>
43000 <colspec colwidth="6*" align="right"/>
43001 <tbody>
43002 <row>
43003 <entry><option>use_shell</option></entry>
43004 <entry>Use: <emphasis>pipe</emphasis></entry>
43005 <entry>Type: <emphasis>boolean</emphasis></entry>
43006 <entry>Default: <emphasis>false</emphasis></entry>
43007 </row>
43008 </tbody>
43009 </tgroup>
43010 </informaltable>
43011 <para>
43012 <indexterm role="variable">
43013 <primary><varname>$pipe_addresses</varname></primary>
43014 </indexterm>
43015 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
43016 instead of being run directly from the transport, as described in section
43017 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
43018 where the command is expected to be run under a shell and cannot easily be
43019 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
43020 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
43021 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
43022 its <option>-c</option> option.
43023 </para>
43024 </section>
43025 <section id="SECID143">
43026 <title>Using an external local delivery agent</title>
43027 <para>
43028 <indexterm role="concept">
43029 <primary>local delivery</primary>
43030 <secondary>using an external agent</secondary>
43031 </indexterm>
43032 <indexterm role="concept">
43033 <primary><emphasis>procmail</emphasis></primary>
43034 </indexterm>
43035 <indexterm role="concept">
43036 <primary>external local delivery</primary>
43037 </indexterm>
43038 <indexterm role="concept">
43039 <primary>delivery</primary>
43040 <secondary><emphasis>procmail</emphasis></secondary>
43041 </indexterm>
43042 <indexterm role="concept">
43043 <primary>delivery</primary>
43044 <secondary>by external agent</secondary>
43045 </indexterm>
43046 The <command>pipe</command> transport can be used to pass all messages that require local
43047 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
43048 this, care must be taken to ensure that the pipe is run under an appropriate
43049 uid and gid. In some configurations one wants this to be a uid that is trusted
43050 by the delivery agent to supply the correct sender of the message. It may be
43051 necessary to recompile or reconfigure the delivery agent so that it trusts an
43052 appropriate user. The following is an example transport and router
43053 configuration for <option>procmail</option>:
43054 </para>
43055 <literallayout class="monospaced">
43056 # transport
43057 procmail_pipe:
43058   driver = pipe
43059   command = /usr/local/bin/procmail -d $local_part
43060   return_path_add
43061   delivery_date_add
43062   envelope_to_add
43063   check_string = "From "
43064   escape_string = "&gt;From "
43065   umask = 077
43066   user = $local_part
43067   group = mail
43068
43069 # router
43070 procmail:
43071   driver = accept
43072   check_local_user
43073   transport = procmail_pipe
43074 </literallayout>
43075 <para>
43076 In this example, the pipe is run as the local user, but with the group set to
43077 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
43078 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
43079 user to supply a correct sender address. If you do not specify either a
43080 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
43081 home directory is the user&#x2019;s home directory by default.
43082 </para>
43083 <para>
43084 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
43085 </para>
43086 <literallayout class="monospaced">
43087 IFS=" "
43088 </literallayout>
43089 <para>
43090 as shown in some <option>procmail</option> documentation, because Exim does not by default
43091 use a shell to run pipe commands.
43092 </para>
43093 <para>
43094 <indexterm role="concept">
43095 <primary>Cyrus</primary>
43096 </indexterm>
43097 The next example shows a transport and a router for a system where local
43098 deliveries are handled by the Cyrus IMAP server.
43099 </para>
43100 <literallayout class="monospaced">
43101 # transport
43102 local_delivery_cyrus:
43103   driver = pipe
43104   command = /usr/cyrus/bin/deliver \
43105             -m ${substr_1:$local_part_suffix} -- $local_part
43106   user = cyrus
43107   group = mail
43108   return_output
43109   log_output
43110   message_prefix =
43111   message_suffix =
43112
43113 # router
43114 local_user_cyrus:
43115   driver = accept
43116   check_local_user
43117   local_part_suffix = .*
43118   transport = local_delivery_cyrus
43119 </literallayout>
43120 <para>
43121 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
43122 <option>return_output</option> to cause any text written by Cyrus to be returned to the
43123 sender.
43124 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
43125 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
43126 </para>
43127 </section>
43128 </chapter>
43129
43130 <chapter id="CHAPsmtptrans">
43131 <title>The smtp transport</title>
43132 <para>
43133 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
43134 <primary>transports</primary>
43135 <secondary><command>smtp</command></secondary>
43136 </indexterm>
43137 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
43138 <primary><command>smtp</command> transport</primary>
43139 </indexterm>
43140 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
43141 or LMTP protocol. The list of hosts to try can either be taken from the address
43142 that is being processed (having been set up by the router), or specified
43143 explicitly for the transport. Timeout and retry processing (see chapter
43144 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
43145 </para>
43146 <section id="SECID144">
43147 <title>Multiple messages on a single connection</title>
43148 <para>
43149 The sending of multiple messages over a single TCP/IP connection can arise in
43150 two ways:
43151 </para>
43152 <itemizedlist>
43153 <listitem>
43154 <para>
43155 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
43156 routed to the same host, more than one copy of the message has to be sent to
43157 that host. In this situation, multiple copies may be sent in a single run of
43158 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
43159 does when it has too many addresses to send in one message also depends on the
43160 value of the global <option>remote_max_parallel</option> option. Details are given in
43161 section <xref linkend="SECToutSMTPTCP"/>.)
43162 </para>
43163 </listitem>
43164 <listitem>
43165 <para>
43166 <indexterm role="concept">
43167 <primary>hints database</primary>
43168 <secondary>remembering routing</secondary>
43169 </indexterm>
43170 When a message has been successfully delivered over a TCP/IP connection, Exim
43171 looks in its hints database to see if there are any other messages awaiting a
43172 connection to the same host. If there are, a new delivery process is started
43173 for one of them, and the current TCP/IP connection is passed on to it. The new
43174 process may in turn send multiple copies and possibly create yet another
43175 process.
43176 </para>
43177 </listitem>
43178 </itemizedlist>
43179 <para>
43180 For each copy sent over the same TCP/IP connection, a sequence counter is
43181 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
43182 no further messages are sent over that connection.
43183 </para>
43184 </section>
43185 <section id="SECID145">
43186 <title>Use of the $host and $host_address variables</title>
43187 <para>
43188 <indexterm role="variable">
43189 <primary><varname>$host</varname></primary>
43190 </indexterm>
43191 <indexterm role="variable">
43192 <primary><varname>$host_address</varname></primary>
43193 </indexterm>
43194 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
43195 <varname>$host_address</varname> are the name and IP address of the first host on the host list
43196 passed by the router. However, when the transport is about to connect to a
43197 specific host, and while it is connected to that host, <varname>$host</varname> and
43198 <varname>$host_address</varname> are set to the values for that host. These are the values
43199 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
43200 <option>serialize_hosts</option>, and the various TLS options are expanded.
43201 </para>
43202 </section>
43203 <section id="usecippeer">
43204 <title>Use of $tls_cipher and $tls_peerdn</title>
43205 <para>
43206 <indexterm role="variable">
43207 <primary><varname>$tls_bits</varname></primary>
43208 </indexterm>
43209 <indexterm role="variable">
43210 <primary><varname>$tls_cipher</varname></primary>
43211 </indexterm>
43212 <indexterm role="variable">
43213 <primary><varname>$tls_peerdn</varname></primary>
43214 </indexterm>
43215 <indexterm role="variable">
43216 <primary><varname>$tls_sni</varname></primary>
43217 </indexterm>
43218 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
43219 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
43220 are the values that were set when the message was received.
43221 These are the values that are used for options that are expanded before any
43222 SMTP connections are made. Just before each connection is made, these four
43223 variables are emptied. If TLS is subsequently started, they are set to the
43224 appropriate values for the outgoing connection, and these are the values that
43225 are in force when any authenticators are run and when the
43226 <option>authenticated_sender</option> option is expanded.
43227 </para>
43228 <para revisionflag="changed">
43229 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
43230 and will be removed in a future release.
43231 </para>
43232 </section>
43233 <section id="SECID146">
43234 <title>Private options for smtp</title>
43235 <para>
43236 <indexterm role="concept">
43237 <primary>options</primary>
43238 <secondary><command>smtp</command> transport</secondary>
43239 </indexterm>
43240 The private options of the <command>smtp</command> transport are as follows:
43241 </para>
43242 <para>
43243 <indexterm role="option">
43244 <primary><option>address_retry_include_sender</option></primary>
43245 </indexterm>
43246 </para>
43247 <informaltable frame="all">
43248 <tgroup cols="4" colsep="0" rowsep="0">
43249 <colspec colwidth="8*" align="left"/>
43250 <colspec colwidth="6*" align="center"/>
43251 <colspec colwidth="6*" align="center"/>
43252 <colspec colwidth="6*" align="right"/>
43253 <tbody>
43254 <row>
43255 <entry><option>address_retry_include_sender</option></entry>
43256 <entry>Use: <emphasis>smtp</emphasis></entry>
43257 <entry>Type: <emphasis>boolean</emphasis></entry>
43258 <entry>Default: <emphasis>true</emphasis></entry>
43259 </row>
43260 </tbody>
43261 </tgroup>
43262 </informaltable>
43263 <para>
43264 <indexterm role="concept">
43265 <primary>4<emphasis>xx</emphasis> responses</primary>
43266 <secondary>retrying after</secondary>
43267 </indexterm>
43268 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
43269 is the combination of sender and recipient that is delayed in subsequent queue
43270 runs until the retry time is reached. You can delay the recipient without
43271 reference to the sender (which is what earlier versions of Exim did), by
43272 setting <option>address_retry_include_sender</option> false. However, this can lead to
43273 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
43274 </para>
43275 <para>
43276 <indexterm role="option">
43277 <primary><option>allow_localhost</option></primary>
43278 </indexterm>
43279 </para>
43280 <informaltable frame="all">
43281 <tgroup cols="4" colsep="0" rowsep="0">
43282 <colspec colwidth="8*" align="left"/>
43283 <colspec colwidth="6*" align="center"/>
43284 <colspec colwidth="6*" align="center"/>
43285 <colspec colwidth="6*" align="right"/>
43286 <tbody>
43287 <row>
43288 <entry><option>allow_localhost</option></entry>
43289 <entry>Use: <emphasis>smtp</emphasis></entry>
43290 <entry>Type: <emphasis>boolean</emphasis></entry>
43291 <entry>Default: <emphasis>false</emphasis></entry>
43292 </row>
43293 </tbody>
43294 </tgroup>
43295 </informaltable>
43296 <para>
43297 <indexterm role="concept">
43298 <primary>local host</primary>
43299 <secondary>sending to</secondary>
43300 </indexterm>
43301 <indexterm role="concept">
43302 <primary>fallback</primary>
43303 <secondary>hosts specified on transport</secondary>
43304 </indexterm>
43305 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
43306 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
43307 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
43308 the delivery anyway. This should be used only in special cases when the
43309 configuration ensures that no looping will result (for example, a differently
43310 configured Exim is listening on the port to which the message is sent).
43311 </para>
43312 <para>
43313 <indexterm role="option">
43314 <primary><option>authenticated_sender</option></primary>
43315 </indexterm>
43316 </para>
43317 <informaltable frame="all">
43318 <tgroup cols="4" colsep="0" rowsep="0">
43319 <colspec colwidth="8*" align="left"/>
43320 <colspec colwidth="6*" align="center"/>
43321 <colspec colwidth="6*" align="center"/>
43322 <colspec colwidth="6*" align="right"/>
43323 <tbody>
43324 <row>
43325 <entry><option>authenticated_sender</option></entry>
43326 <entry>Use: <emphasis>smtp</emphasis></entry>
43327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43328 <entry>Default: <emphasis>unset</emphasis></entry>
43329 </row>
43330 </tbody>
43331 </tgroup>
43332 </informaltable>
43333 <para>
43334 <indexterm role="concept">
43335 <primary>Cyrus</primary>
43336 </indexterm>
43337 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
43338 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
43339 overriding any existing authenticated sender value. If the string expansion is
43340 forced to fail, the option is ignored. Other expansion failures cause delivery
43341 to be deferred. If the result of expansion is an empty string, that is also
43342 ignored.
43343 </para>
43344 <para>
43345 The expansion happens after the outgoing connection has been made and TLS
43346 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
43347 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
43348 particular connection.
43349 </para>
43350 <para>
43351 If the SMTP session is not authenticated, the expansion of
43352 <option>authenticated_sender</option> still happens (and can cause the delivery to be
43353 deferred if it fails), but no AUTH= item is added to MAIL commands
43354 unless <option>authenticated_sender_force</option> is true.
43355 </para>
43356 <para>
43357 This option allows you to use the <command>smtp</command> transport in LMTP mode to
43358 deliver mail to Cyrus IMAP and provide the proper local part as the
43359 <quote>authenticated sender</quote>, via a setting such as:
43360 </para>
43361 <literallayout class="monospaced">
43362 authenticated_sender = $local_part
43363 </literallayout>
43364 <para>
43365 This removes the need for IMAP subfolders to be assigned special ACLs to
43366 allow direct delivery to those subfolders.
43367 </para>
43368 <para>
43369 Because of expected uses such as that just described for Cyrus (when no
43370 domain is involved), there is no checking on the syntax of the provided
43371 value.
43372 </para>
43373 <para>
43374 <indexterm role="option">
43375 <primary><option>authenticated_sender_force</option></primary>
43376 </indexterm>
43377 </para>
43378 <informaltable frame="all">
43379 <tgroup cols="4" colsep="0" rowsep="0">
43380 <colspec colwidth="8*" align="left"/>
43381 <colspec colwidth="6*" align="center"/>
43382 <colspec colwidth="6*" align="center"/>
43383 <colspec colwidth="6*" align="right"/>
43384 <tbody>
43385 <row>
43386 <entry><option>authenticated_sender_force</option></entry>
43387 <entry>Use: <emphasis>smtp</emphasis></entry>
43388 <entry>Type: <emphasis>boolean</emphasis></entry>
43389 <entry>Default: <emphasis>false</emphasis></entry>
43390 </row>
43391 </tbody>
43392 </tgroup>
43393 </informaltable>
43394 <para>
43395 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
43396 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
43397 authenticated as a client.
43398 </para>
43399 <para>
43400 <indexterm role="option">
43401 <primary><option>command_timeout</option></primary>
43402 </indexterm>
43403 </para>
43404 <informaltable frame="all">
43405 <tgroup cols="4" colsep="0" rowsep="0">
43406 <colspec colwidth="8*" align="left"/>
43407 <colspec colwidth="6*" align="center"/>
43408 <colspec colwidth="6*" align="center"/>
43409 <colspec colwidth="6*" align="right"/>
43410 <tbody>
43411 <row>
43412 <entry><option>command_timeout</option></entry>
43413 <entry>Use: <emphasis>smtp</emphasis></entry>
43414 <entry>Type: <emphasis>time</emphasis></entry>
43415 <entry>Default: <emphasis>5m</emphasis></entry>
43416 </row>
43417 </tbody>
43418 </tgroup>
43419 </informaltable>
43420 <para>
43421 This sets a timeout for receiving a response to an SMTP command that has been
43422 sent out. It is also used when waiting for the initial banner line from the
43423 remote host. Its value must not be zero.
43424 </para>
43425 <para>
43426 <indexterm role="option">
43427 <primary><option>connect_timeout</option></primary>
43428 </indexterm>
43429 </para>
43430 <informaltable frame="all">
43431 <tgroup cols="4" colsep="0" rowsep="0">
43432 <colspec colwidth="8*" align="left"/>
43433 <colspec colwidth="6*" align="center"/>
43434 <colspec colwidth="6*" align="center"/>
43435 <colspec colwidth="6*" align="right"/>
43436 <tbody>
43437 <row>
43438 <entry><option>connect_timeout</option></entry>
43439 <entry>Use: <emphasis>smtp</emphasis></entry>
43440 <entry>Type: <emphasis>time</emphasis></entry>
43441 <entry>Default: <emphasis>5m</emphasis></entry>
43442 </row>
43443 </tbody>
43444 </tgroup>
43445 </informaltable>
43446 <para>
43447 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
43448 to a remote host. A setting of zero allows the system timeout (typically
43449 several minutes) to act. To have any effect, the value of this option must be
43450 less than the system timeout. However, it has been observed that on some
43451 systems there is no system timeout, which is why the default value for this
43452 option is 5 minutes, a value recommended by RFC 1123.
43453 </para>
43454 <para>
43455 <indexterm role="option">
43456 <primary><option>connection_max_messages</option></primary>
43457 </indexterm>
43458 </para>
43459 <informaltable frame="all">
43460 <tgroup cols="4" colsep="0" rowsep="0">
43461 <colspec colwidth="8*" align="left"/>
43462 <colspec colwidth="6*" align="center"/>
43463 <colspec colwidth="6*" align="center"/>
43464 <colspec colwidth="6*" align="right"/>
43465 <tbody>
43466 <row>
43467 <entry><option>connection_max_messages</option></entry>
43468 <entry>Use: <emphasis>smtp</emphasis></entry>
43469 <entry>Type: <emphasis>integer</emphasis></entry>
43470 <entry>Default: <emphasis>500</emphasis></entry>
43471 </row>
43472 </tbody>
43473 </tgroup>
43474 </informaltable>
43475 <para>
43476 <indexterm role="concept">
43477 <primary>SMTP</primary>
43478 <secondary>passed connection</secondary>
43479 </indexterm>
43480 <indexterm role="concept">
43481 <primary>SMTP</primary>
43482 <secondary>multiple deliveries</secondary>
43483 </indexterm>
43484 <indexterm role="concept">
43485 <primary>multiple SMTP deliveries</primary>
43486 </indexterm>
43487 This controls the maximum number of separate message deliveries that are sent
43488 over a single TCP/IP connection. If the value is zero, there is no limit.
43489 For testing purposes, this value can be overridden by the <option>-oB</option> command line
43490 option.
43491 </para>
43492 <para>
43493 <indexterm role="option">
43494 <primary><option>data_timeout</option></primary>
43495 </indexterm>
43496 </para>
43497 <informaltable frame="all">
43498 <tgroup cols="4" colsep="0" rowsep="0">
43499 <colspec colwidth="8*" align="left"/>
43500 <colspec colwidth="6*" align="center"/>
43501 <colspec colwidth="6*" align="center"/>
43502 <colspec colwidth="6*" align="right"/>
43503 <tbody>
43504 <row>
43505 <entry><option>data_timeout</option></entry>
43506 <entry>Use: <emphasis>smtp</emphasis></entry>
43507 <entry>Type: <emphasis>time</emphasis></entry>
43508 <entry>Default: <emphasis>5m</emphasis></entry>
43509 </row>
43510 </tbody>
43511 </tgroup>
43512 </informaltable>
43513 <para>
43514 This sets a timeout for the transmission of each block in the data portion of
43515 the message. As a result, the overall timeout for a message depends on the size
43516 of the message. Its value must not be zero. See also <option>final_timeout</option>.
43517 </para>
43518 <para>
43519 <indexterm role="option">
43520 <primary><option>delay_after_cutoff</option></primary>
43521 </indexterm>
43522 </para>
43523 <informaltable frame="all">
43524 <tgroup cols="4" colsep="0" rowsep="0">
43525 <colspec colwidth="8*" align="left"/>
43526 <colspec colwidth="6*" align="center"/>
43527 <colspec colwidth="6*" align="center"/>
43528 <colspec colwidth="6*" align="right"/>
43529 <tbody>
43530 <row>
43531 <entry><option>delay_after_cutoff</option></entry>
43532 <entry>Use: <emphasis>smtp</emphasis></entry>
43533 <entry>Type: <emphasis>boolean</emphasis></entry>
43534 <entry>Default: <emphasis>true</emphasis></entry>
43535 </row>
43536 </tbody>
43537 </tgroup>
43538 </informaltable>
43539 <para>
43540 This option controls what happens when all remote IP addresses for a given
43541 domain have been inaccessible for so long that they have passed their retry
43542 cutoff times.
43543 </para>
43544 <para>
43545 In the default state, if the next retry time has not been reached for any of
43546 them, the address is bounced without trying any deliveries. In other words,
43547 Exim delays retrying an IP address after the final cutoff time until a new
43548 retry time is reached, and can therefore bounce an address without ever trying
43549 a delivery, when machines have been down for a long time. Some people are
43550 unhappy at this prospect, so...
43551 </para>
43552 <para>
43553 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
43554 addresses are past their final cutoff time, Exim tries to deliver to those
43555 IP addresses that have not been tried since the message arrived. If there are
43556 none, of if they all fail, the address is bounced. In other words, it does not
43557 delay when a new message arrives, but immediately tries those expired IP
43558 addresses that haven&#x2019;t been tried since the message arrived. If there is a
43559 continuous stream of messages for the dead hosts, unsetting
43560 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
43561 to them.
43562 </para>
43563 <para>
43564 <indexterm role="option">
43565 <primary><option>dns_qualify_single</option></primary>
43566 </indexterm>
43567 </para>
43568 <informaltable frame="all">
43569 <tgroup cols="4" colsep="0" rowsep="0">
43570 <colspec colwidth="8*" align="left"/>
43571 <colspec colwidth="6*" align="center"/>
43572 <colspec colwidth="6*" align="center"/>
43573 <colspec colwidth="6*" align="right"/>
43574 <tbody>
43575 <row>
43576 <entry><option>dns_qualify_single</option></entry>
43577 <entry>Use: <emphasis>smtp</emphasis></entry>
43578 <entry>Type: <emphasis>boolean</emphasis></entry>
43579 <entry>Default: <emphasis>true</emphasis></entry>
43580 </row>
43581 </tbody>
43582 </tgroup>
43583 </informaltable>
43584 <para>
43585 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
43586 and the <option>gethostbyname</option> option is false,
43587 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
43588 in chapter <xref linkend="CHAPdnslookup"/> for more details.
43589 </para>
43590 <para>
43591 <indexterm role="option">
43592 <primary><option>dns_search_parents</option></primary>
43593 </indexterm>
43594 </para>
43595 <informaltable frame="all">
43596 <tgroup cols="4" colsep="0" rowsep="0">
43597 <colspec colwidth="8*" align="left"/>
43598 <colspec colwidth="6*" align="center"/>
43599 <colspec colwidth="6*" align="center"/>
43600 <colspec colwidth="6*" align="right"/>
43601 <tbody>
43602 <row>
43603 <entry><option>dns_search_parents</option></entry>
43604 <entry>Use: <emphasis>smtp</emphasis></entry>
43605 <entry>Type: <emphasis>boolean</emphasis></entry>
43606 <entry>Default: <emphasis>false</emphasis></entry>
43607 </row>
43608 </tbody>
43609 </tgroup>
43610 </informaltable>
43611 <para>
43612 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
43613 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
43614 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
43615 details.
43616 </para>
43617 <para revisionflag="changed">
43618 <indexterm role="option">
43619 <primary><option>dscp</option></primary>
43620 </indexterm>
43621 </para>
43622 <informaltable frame="all" revisionflag="changed">
43623 <tgroup cols="4" colsep="0" rowsep="0">
43624 <colspec colwidth="8*" align="left"/>
43625 <colspec colwidth="6*" align="center"/>
43626 <colspec colwidth="6*" align="center"/>
43627 <colspec colwidth="6*" align="right"/>
43628 <tbody>
43629 <row>
43630 <entry><option>dscp</option></entry>
43631 <entry>Use: <emphasis>smtp</emphasis></entry>
43632 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43633 <entry>Default: <emphasis>unset</emphasis></entry>
43634 </row>
43635 </tbody>
43636 </tgroup>
43637 </informaltable>
43638 <para revisionflag="changed">
43639 <indexterm role="concept">
43640 <primary>DCSP</primary>
43641 <secondary>outbound</secondary>
43642 </indexterm>
43643 This option causes the DSCP value associated with a socket to be set to one
43644 of a number of fixed strings or to numeric value.
43645 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
43646 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
43647 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
43648 </para>
43649 <para revisionflag="changed">
43650 The outbound packets from Exim will be marked with this value in the header
43651 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
43652 that these values will have any effect, not be stripped by networking
43653 equipment, or do much of anything without cooperation with your Network
43654 Engineer and those of all network operators between the source and destination.
43655 </para>
43656 <para>
43657 <indexterm role="option">
43658 <primary><option>fallback_hosts</option></primary>
43659 </indexterm>
43660 </para>
43661 <informaltable frame="all">
43662 <tgroup cols="4" colsep="0" rowsep="0">
43663 <colspec colwidth="8*" align="left"/>
43664 <colspec colwidth="6*" align="center"/>
43665 <colspec colwidth="6*" align="center"/>
43666 <colspec colwidth="6*" align="right"/>
43667 <tbody>
43668 <row>
43669 <entry><option>fallback_hosts</option></entry>
43670 <entry>Use: <emphasis>smtp</emphasis></entry>
43671 <entry>Type: <emphasis>string list</emphasis></entry>
43672 <entry>Default: <emphasis>unset</emphasis></entry>
43673 </row>
43674 </tbody>
43675 </tgroup>
43676 </informaltable>
43677 <para>
43678 <indexterm role="concept">
43679 <primary>fallback</primary>
43680 <secondary>hosts specified on transport</secondary>
43681 </indexterm>
43682 String expansion is not applied to this option. The argument must be a
43683 colon-separated list of host names or IP addresses, optionally also including
43684 port numbers, though the separator can be changed, as described in section
43685 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
43686 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
43687 in section <xref linkend="SECTformatonehostitem"/>.
43688 </para>
43689 <para>
43690 Fallback hosts can also be specified on routers, which associate them with the
43691 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
43692 <option>fallback_hosts</option> specified on the transport is used only if the address does
43693 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
43694 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
43695 However, <option>hosts_randomize</option> does apply to fallback host lists.
43696 </para>
43697 <para>
43698 If Exim is unable to deliver to any of the hosts for a particular address, and
43699 the errors are not permanent rejections, the address is put on a separate
43700 transport queue with its host list replaced by the fallback hosts, unless the
43701 address was routed via MX records and the current host was in the original MX
43702 list. In that situation, the fallback host list is not used.
43703 </para>
43704 <para>
43705 Once normal deliveries are complete, the fallback queue is delivered by
43706 re-running the same transports with the new host lists. If several failing
43707 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
43708 copy of the message is sent.
43709 </para>
43710 <para>
43711 The resolution of the host names on the fallback list is controlled by the
43712 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
43713 both to cases when the host list comes with the address and when it is taken
43714 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
43715 fails</quote> facility.
43716 </para>
43717 <para>
43718 <indexterm role="option">
43719 <primary><option>final_timeout</option></primary>
43720 </indexterm>
43721 </para>
43722 <informaltable frame="all">
43723 <tgroup cols="4" colsep="0" rowsep="0">
43724 <colspec colwidth="8*" align="left"/>
43725 <colspec colwidth="6*" align="center"/>
43726 <colspec colwidth="6*" align="center"/>
43727 <colspec colwidth="6*" align="right"/>
43728 <tbody>
43729 <row>
43730 <entry><option>final_timeout</option></entry>
43731 <entry>Use: <emphasis>smtp</emphasis></entry>
43732 <entry>Type: <emphasis>time</emphasis></entry>
43733 <entry>Default: <emphasis>10m</emphasis></entry>
43734 </row>
43735 </tbody>
43736 </tgroup>
43737 </informaltable>
43738 <para>
43739 This is the timeout that applies while waiting for the response to the final
43740 line containing just <quote>.</quote> that terminates a message. Its value must not be
43741 zero.
43742 </para>
43743 <para>
43744 <indexterm role="option">
43745 <primary><option>gethostbyname</option></primary>
43746 </indexterm>
43747 </para>
43748 <informaltable frame="all">
43749 <tgroup cols="4" colsep="0" rowsep="0">
43750 <colspec colwidth="8*" align="left"/>
43751 <colspec colwidth="6*" align="center"/>
43752 <colspec colwidth="6*" align="center"/>
43753 <colspec colwidth="6*" align="right"/>
43754 <tbody>
43755 <row>
43756 <entry><option>gethostbyname</option></entry>
43757 <entry>Use: <emphasis>smtp</emphasis></entry>
43758 <entry>Type: <emphasis>boolean</emphasis></entry>
43759 <entry>Default: <emphasis>false</emphasis></entry>
43760 </row>
43761 </tbody>
43762 </tgroup>
43763 </informaltable>
43764 <para>
43765 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
43766 being used, names are looked up using <function>gethostbyname()</function>
43767 (or <function>getipnodebyname()</function> when available)
43768 instead of using the DNS. Of course, that function may in fact use the DNS, but
43769 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
43770 </para>
43771 <para>
43772 <indexterm role="option">
43773 <primary><option>gnutls_compat_mode</option></primary>
43774 </indexterm>
43775 </para>
43776 <informaltable frame="all">
43777 <tgroup cols="4" colsep="0" rowsep="0">
43778 <colspec colwidth="8*" align="left"/>
43779 <colspec colwidth="6*" align="center"/>
43780 <colspec colwidth="6*" align="center"/>
43781 <colspec colwidth="6*" align="right"/>
43782 <tbody>
43783 <row>
43784 <entry><option>gnutls_compat_mode</option></entry>
43785 <entry>Use: <emphasis>smtp</emphasis></entry>
43786 <entry>Type: <emphasis>boolean</emphasis></entry>
43787 <entry>Default: <emphasis>unset</emphasis></entry>
43788 </row>
43789 </tbody>
43790 </tgroup>
43791 </informaltable>
43792 <para>
43793 This option controls whether GnuTLS is used in compatibility mode in an Exim
43794 server. This reduces security slightly, but improves interworking with older
43795 implementations of TLS.
43796 </para>
43797 <para>
43798 <indexterm role="option">
43799 <primary><option>helo_data</option></primary>
43800 </indexterm>
43801 </para>
43802 <informaltable frame="all">
43803 <tgroup cols="4" colsep="0" rowsep="0">
43804 <colspec colwidth="8*" align="left"/>
43805 <colspec colwidth="6*" align="center"/>
43806 <colspec colwidth="6*" align="center"/>
43807 <colspec colwidth="6*" align="right"/>
43808 <tbody>
43809 <row>
43810 <entry><option>helo_data</option></entry>
43811 <entry>Use: <emphasis>smtp</emphasis></entry>
43812 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43813 <entry>Default: <emphasis>see below</emphasis></entry>
43814 </row>
43815 </tbody>
43816 </tgroup>
43817 </informaltable>
43818 <para>
43819 <indexterm role="concept">
43820 <primary>HELO</primary>
43821 <secondary>argument, setting</secondary>
43822 </indexterm>
43823 <indexterm role="concept">
43824 <primary>EHLO</primary>
43825 <secondary>argument, setting</secondary>
43826 </indexterm>
43827 <indexterm role="concept">
43828 <primary>LHLO argument setting</primary>
43829 </indexterm>
43830 The value of this option is expanded after a connection to a another host has
43831 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
43832 command that starts the outgoing SMTP or LMTP session. The default value of the
43833 option is:
43834 </para>
43835 <literallayout class="monospaced">
43836 $primary_hostname
43837 </literallayout>
43838 <para>
43839 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
43840 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
43841 <varname>$sending_port</varname> are set to the local IP address and port number that are being
43842 used. These variables can be used to generate different values for different
43843 servers or different local IP addresses. For example, if you want the string
43844 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
43845 interface address, you could use this:
43846 </para>
43847 <literallayout class="monospaced">
43848 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
43849   {$primary_hostname}}
43850 </literallayout>
43851 <para>
43852 The use of <option>helo_data</option> applies both to sending messages and when doing
43853 callouts.
43854 </para>
43855 <para>
43856 <indexterm role="option">
43857 <primary><option>hosts</option></primary>
43858 </indexterm>
43859 </para>
43860 <informaltable frame="all">
43861 <tgroup cols="4" colsep="0" rowsep="0">
43862 <colspec colwidth="8*" align="left"/>
43863 <colspec colwidth="6*" align="center"/>
43864 <colspec colwidth="6*" align="center"/>
43865 <colspec colwidth="6*" align="right"/>
43866 <tbody>
43867 <row>
43868 <entry><option>hosts</option></entry>
43869 <entry>Use: <emphasis>smtp</emphasis></entry>
43870 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
43871 <entry>Default: <emphasis>unset</emphasis></entry>
43872 </row>
43873 </tbody>
43874 </tgroup>
43875 </informaltable>
43876 <para>
43877 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
43878 finds the hosts by looking up the address domain in the DNS, or by
43879 <command>manualroute</command>, which has lists of hosts in its configuration. However,
43880 email addresses can be passed to the <command>smtp</command> transport by any router, and not
43881 all of them can provide an associated list of hosts.
43882 </para>
43883 <para>
43884 The <option>hosts</option> option specifies a list of hosts to be used if the address being
43885 processed does not have any hosts associated with it. The hosts specified by
43886 <option>hosts</option> are also used, whether or not the address has its own hosts, if
43887 <option>hosts_override</option> is set.
43888 </para>
43889 <para>
43890 The string is first expanded, before being interpreted as a colon-separated
43891 list of host names or IP addresses, possibly including port numbers. The
43892 separator may be changed to something other than colon, as described in section
43893 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
43894 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
43895 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
43896 of the <command>manualroute</command> router is not available here.
43897 </para>
43898 <para>
43899 If the expansion fails, delivery is deferred. Unless the failure was caused by
43900 the inability to complete a lookup, the error is logged to the panic log as
43901 well as the main log. Host names are looked up either by searching directly for
43902 address records in the DNS or by calling <function>gethostbyname()</function> (or
43903 <function>getipnodebyname()</function> when available), depending on the setting of the
43904 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
43905 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
43906 address are used.
43907 </para>
43908 <para>
43909 During delivery, the hosts are tried in order, subject to their retry status,
43910 unless <option>hosts_randomize</option> is set.
43911 </para>
43912 <para>
43913 <indexterm role="option">
43914 <primary><option>hosts_avoid_esmtp</option></primary>
43915 </indexterm>
43916 </para>
43917 <informaltable frame="all">
43918 <tgroup cols="4" colsep="0" rowsep="0">
43919 <colspec colwidth="8*" align="left"/>
43920 <colspec colwidth="6*" align="center"/>
43921 <colspec colwidth="6*" align="center"/>
43922 <colspec colwidth="6*" align="right"/>
43923 <tbody>
43924 <row>
43925 <entry><option>hosts_avoid_esmtp</option></entry>
43926 <entry>Use: <emphasis>smtp</emphasis></entry>
43927 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43928 <entry>Default: <emphasis>unset</emphasis></entry>
43929 </row>
43930 </tbody>
43931 </tgroup>
43932 </informaltable>
43933 <para>
43934 <indexterm role="concept">
43935 <primary>ESMTP, avoiding use of</primary>
43936 </indexterm>
43937 <indexterm role="concept">
43938 <primary>HELO</primary>
43939 <secondary>forcing use of</secondary>
43940 </indexterm>
43941 <indexterm role="concept">
43942 <primary>EHLO</primary>
43943 <secondary>avoiding use of</secondary>
43944 </indexterm>
43945 <indexterm role="concept">
43946 <primary>PIPELINING</primary>
43947 <secondary>avoiding the use of</secondary>
43948 </indexterm>
43949 This option is for use with broken hosts that announce ESMTP facilities (for
43950 example, PIPELINING) and then fail to implement them properly. When a host
43951 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
43952 start of the SMTP session. This means that it cannot use any of the ESMTP
43953 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
43954 </para>
43955 <para>
43956 <indexterm role="option">
43957 <primary><option>hosts_avoid_pipelining</option></primary>
43958 </indexterm>
43959 </para>
43960 <informaltable frame="all">
43961 <tgroup cols="4" colsep="0" rowsep="0">
43962 <colspec colwidth="8*" align="left"/>
43963 <colspec colwidth="6*" align="center"/>
43964 <colspec colwidth="6*" align="center"/>
43965 <colspec colwidth="6*" align="right"/>
43966 <tbody>
43967 <row>
43968 <entry><option>hosts_avoid_pipelining</option></entry>
43969 <entry>Use: <emphasis>smtp</emphasis></entry>
43970 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
43971 <entry>Default: <emphasis>unset</emphasis></entry>
43972 </row>
43973 </tbody>
43974 </tgroup>
43975 </informaltable>
43976 <para>
43977 <indexterm role="concept">
43978 <primary>PIPELINING</primary>
43979 <secondary>avoiding the use of</secondary>
43980 </indexterm>
43981 Exim will not use the SMTP PIPELINING extension when delivering to any host
43982 that matches this list, even if the server host advertises PIPELINING support.
43983 </para>
43984 <para>
43985 <indexterm role="option">
43986 <primary><option>hosts_avoid_tls</option></primary>
43987 </indexterm>
43988 </para>
43989 <informaltable frame="all">
43990 <tgroup cols="4" colsep="0" rowsep="0">
43991 <colspec colwidth="8*" align="left"/>
43992 <colspec colwidth="6*" align="center"/>
43993 <colspec colwidth="6*" align="center"/>
43994 <colspec colwidth="6*" align="right"/>
43995 <tbody>
43996 <row>
43997 <entry><option>hosts_avoid_tls</option></entry>
43998 <entry>Use: <emphasis>smtp</emphasis></entry>
43999 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44000 <entry>Default: <emphasis>unset</emphasis></entry>
44001 </row>
44002 </tbody>
44003 </tgroup>
44004 </informaltable>
44005 <para>
44006 <indexterm role="concept">
44007 <primary>TLS</primary>
44008 <secondary>avoiding for certain hosts</secondary>
44009 </indexterm>
44010 Exim will not try to start a TLS session when delivering to any host that
44011 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44012 </para>
44013 <para revisionflag="changed">
44014 <indexterm role="option">
44015 <primary><option>hosts_verify_avoid_tls</option></primary>
44016 </indexterm>
44017 </para>
44018 <informaltable frame="all" revisionflag="changed">
44019 <tgroup cols="4" colsep="0" rowsep="0">
44020 <colspec colwidth="8*" align="left"/>
44021 <colspec colwidth="6*" align="center"/>
44022 <colspec colwidth="6*" align="center"/>
44023 <colspec colwidth="6*" align="right"/>
44024 <tbody>
44025 <row>
44026 <entry><option>hosts_verify_avoid_tls</option></entry>
44027 <entry>Use: <emphasis>smtp</emphasis></entry>
44028 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44029 <entry>Default: <emphasis>*</emphasis></entry>
44030 </row>
44031 </tbody>
44032 </tgroup>
44033 </informaltable>
44034 <para revisionflag="changed">
44035 <indexterm role="concept">
44036 <primary>TLS</primary>
44037 <secondary>avoiding for certain hosts</secondary>
44038 </indexterm>
44039 Exim will not try to start a TLS session for a verify callout,
44040 or when delivering in cutthrough mode,
44041 to any host that matches this list.
44042 Note that the default is to not use TLS.
44043 </para>
44044 <para>
44045 <indexterm role="option">
44046 <primary><option>hosts_max_try</option></primary>
44047 </indexterm>
44048 </para>
44049 <informaltable frame="all">
44050 <tgroup cols="4" colsep="0" rowsep="0">
44051 <colspec colwidth="8*" align="left"/>
44052 <colspec colwidth="6*" align="center"/>
44053 <colspec colwidth="6*" align="center"/>
44054 <colspec colwidth="6*" align="right"/>
44055 <tbody>
44056 <row>
44057 <entry><option>hosts_max_try</option></entry>
44058 <entry>Use: <emphasis>smtp</emphasis></entry>
44059 <entry>Type: <emphasis>integer</emphasis></entry>
44060 <entry>Default: <emphasis>5</emphasis></entry>
44061 </row>
44062 </tbody>
44063 </tgroup>
44064 </informaltable>
44065 <para>
44066 <indexterm role="concept">
44067 <primary>host</primary>
44068 <secondary>maximum number to try</secondary>
44069 </indexterm>
44070 <indexterm role="concept">
44071 <primary>limit</primary>
44072 <secondary>number of hosts tried</secondary>
44073 </indexterm>
44074 <indexterm role="concept">
44075 <primary>limit</primary>
44076 <secondary>number of MX tried</secondary>
44077 </indexterm>
44078 <indexterm role="concept">
44079 <primary>MX record</primary>
44080 <secondary>maximum tried</secondary>
44081 </indexterm>
44082 This option limits the number of IP addresses that are tried for any one
44083 delivery in cases where there are temporary delivery errors. Section
44084 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
44085 </para>
44086 <para>
44087 <indexterm role="option">
44088 <primary><option>hosts_max_try_hardlimit</option></primary>
44089 </indexterm>
44090 </para>
44091 <informaltable frame="all">
44092 <tgroup cols="4" colsep="0" rowsep="0">
44093 <colspec colwidth="8*" align="left"/>
44094 <colspec colwidth="6*" align="center"/>
44095 <colspec colwidth="6*" align="center"/>
44096 <colspec colwidth="6*" align="right"/>
44097 <tbody>
44098 <row>
44099 <entry><option>hosts_max_try_hardlimit</option></entry>
44100 <entry>Use: <emphasis>smtp</emphasis></entry>
44101 <entry>Type: <emphasis>integer</emphasis></entry>
44102 <entry>Default: <emphasis>50</emphasis></entry>
44103 </row>
44104 </tbody>
44105 </tgroup>
44106 </informaltable>
44107 <para>
44108 This is an additional check on the maximum number of IP addresses that Exim
44109 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
44110 why it exists.
44111 </para>
44112 <para>
44113 <indexterm role="option">
44114 <primary><option>hosts_nopass_tls</option></primary>
44115 </indexterm>
44116 </para>
44117 <informaltable frame="all">
44118 <tgroup cols="4" colsep="0" rowsep="0">
44119 <colspec colwidth="8*" align="left"/>
44120 <colspec colwidth="6*" align="center"/>
44121 <colspec colwidth="6*" align="center"/>
44122 <colspec colwidth="6*" align="right"/>
44123 <tbody>
44124 <row>
44125 <entry><option>hosts_nopass_tls</option></entry>
44126 <entry>Use: <emphasis>smtp</emphasis></entry>
44127 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44128 <entry>Default: <emphasis>unset</emphasis></entry>
44129 </row>
44130 </tbody>
44131 </tgroup>
44132 </informaltable>
44133 <para>
44134 <indexterm role="concept">
44135 <primary>TLS</primary>
44136 <secondary>passing connection</secondary>
44137 </indexterm>
44138 <indexterm role="concept">
44139 <primary>multiple SMTP deliveries</primary>
44140 </indexterm>
44141 <indexterm role="concept">
44142 <primary>TLS</primary>
44143 <secondary>multiple message deliveries</secondary>
44144 </indexterm>
44145 For any host that matches this list, a connection on which a TLS session has
44146 been started will not be passed to a new delivery process for sending another
44147 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
44148 explanation of when this might be needed.
44149 </para>
44150 <para>
44151 <indexterm role="option">
44152 <primary><option>hosts_override</option></primary>
44153 </indexterm>
44154 </para>
44155 <informaltable frame="all">
44156 <tgroup cols="4" colsep="0" rowsep="0">
44157 <colspec colwidth="8*" align="left"/>
44158 <colspec colwidth="6*" align="center"/>
44159 <colspec colwidth="6*" align="center"/>
44160 <colspec colwidth="6*" align="right"/>
44161 <tbody>
44162 <row>
44163 <entry><option>hosts_override</option></entry>
44164 <entry>Use: <emphasis>smtp</emphasis></entry>
44165 <entry>Type: <emphasis>boolean</emphasis></entry>
44166 <entry>Default: <emphasis>false</emphasis></entry>
44167 </row>
44168 </tbody>
44169 </tgroup>
44170 </informaltable>
44171 <para>
44172 If this option is set and the <option>hosts</option> option is also set, any hosts that are
44173 attached to the address are ignored, and instead the hosts specified by the
44174 <option>hosts</option> option are always used. This option does not apply to
44175 <option>fallback_hosts</option>.
44176 </para>
44177 <para>
44178 <indexterm role="option">
44179 <primary><option>hosts_randomize</option></primary>
44180 </indexterm>
44181 </para>
44182 <informaltable frame="all">
44183 <tgroup cols="4" colsep="0" rowsep="0">
44184 <colspec colwidth="8*" align="left"/>
44185 <colspec colwidth="6*" align="center"/>
44186 <colspec colwidth="6*" align="center"/>
44187 <colspec colwidth="6*" align="right"/>
44188 <tbody>
44189 <row>
44190 <entry><option>hosts_randomize</option></entry>
44191 <entry>Use: <emphasis>smtp</emphasis></entry>
44192 <entry>Type: <emphasis>boolean</emphasis></entry>
44193 <entry>Default: <emphasis>false</emphasis></entry>
44194 </row>
44195 </tbody>
44196 </tgroup>
44197 </informaltable>
44198 <para>
44199 <indexterm role="concept">
44200 <primary>randomized host list</primary>
44201 </indexterm>
44202 <indexterm role="concept">
44203 <primary>host</primary>
44204 <secondary>list of; randomized</secondary>
44205 </indexterm>
44206 <indexterm role="concept">
44207 <primary>fallback</primary>
44208 <secondary>randomized hosts</secondary>
44209 </indexterm>
44210 If this option is set, and either the list of hosts is taken from the
44211 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
44212 were not obtained from MX records (this includes fallback hosts from the
44213 router), and were not randomized by the router, the order of trying the hosts
44214 is randomized each time the transport runs. Randomizing the order of a host
44215 list can be used to do crude load sharing.
44216 </para>
44217 <para>
44218 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
44219 order is separately randomized. This makes it possible to set up MX-like
44220 behaviour. The boundaries between groups are indicated by an item that is just
44221 <literal>+</literal> in the host list. For example:
44222 </para>
44223 <literallayout class="monospaced">
44224 hosts = host1:host2:host3:+:host4:host5
44225 </literallayout>
44226 <para>
44227 The order of the first three hosts and the order of the last two hosts is
44228 randomized for each use, but the first three always end up before the last two.
44229 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
44230 </para>
44231 <para>
44232 <indexterm role="option">
44233 <primary><option>hosts_require_auth</option></primary>
44234 </indexterm>
44235 </para>
44236 <informaltable frame="all">
44237 <tgroup cols="4" colsep="0" rowsep="0">
44238 <colspec colwidth="8*" align="left"/>
44239 <colspec colwidth="6*" align="center"/>
44240 <colspec colwidth="6*" align="center"/>
44241 <colspec colwidth="6*" align="right"/>
44242 <tbody>
44243 <row>
44244 <entry><option>hosts_require_auth</option></entry>
44245 <entry>Use: <emphasis>smtp</emphasis></entry>
44246 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44247 <entry>Default: <emphasis>unset</emphasis></entry>
44248 </row>
44249 </tbody>
44250 </tgroup>
44251 </informaltable>
44252 <para>
44253 <indexterm role="concept">
44254 <primary>authentication</primary>
44255 <secondary>required by client</secondary>
44256 </indexterm>
44257 This option provides a list of servers for which authentication must succeed
44258 before Exim will try to transfer a message. If authentication fails for
44259 servers which are not in this list, Exim tries to send unauthenticated. If
44260 authentication fails for one of these servers, delivery is deferred. This
44261 temporary error is detectable in the retry rules, so it can be turned into a
44262 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
44263 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
44264 </para>
44265 <para>
44266 <indexterm role="option">
44267 <primary><option>hosts_require_tls</option></primary>
44268 </indexterm>
44269 </para>
44270 <informaltable frame="all">
44271 <tgroup cols="4" colsep="0" rowsep="0">
44272 <colspec colwidth="8*" align="left"/>
44273 <colspec colwidth="6*" align="center"/>
44274 <colspec colwidth="6*" align="center"/>
44275 <colspec colwidth="6*" align="right"/>
44276 <tbody>
44277 <row>
44278 <entry><option>hosts_require_tls</option></entry>
44279 <entry>Use: <emphasis>smtp</emphasis></entry>
44280 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44281 <entry>Default: <emphasis>unset</emphasis></entry>
44282 </row>
44283 </tbody>
44284 </tgroup>
44285 </informaltable>
44286 <para>
44287 <indexterm role="concept">
44288 <primary>TLS</primary>
44289 <secondary>requiring for certain servers</secondary>
44290 </indexterm>
44291 Exim will insist on using a TLS session when delivering to any host that
44292 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44293 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
44294 incoming messages, use an appropriate ACL.
44295 </para>
44296 <para>
44297 <indexterm role="option">
44298 <primary><option>hosts_try_auth</option></primary>
44299 </indexterm>
44300 </para>
44301 <informaltable frame="all">
44302 <tgroup cols="4" colsep="0" rowsep="0">
44303 <colspec colwidth="8*" align="left"/>
44304 <colspec colwidth="6*" align="center"/>
44305 <colspec colwidth="6*" align="center"/>
44306 <colspec colwidth="6*" align="right"/>
44307 <tbody>
44308 <row>
44309 <entry><option>hosts_try_auth</option></entry>
44310 <entry>Use: <emphasis>smtp</emphasis></entry>
44311 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44312 <entry>Default: <emphasis>unset</emphasis></entry>
44313 </row>
44314 </tbody>
44315 </tgroup>
44316 </informaltable>
44317 <para>
44318 <indexterm role="concept">
44319 <primary>authentication</primary>
44320 <secondary>optional in client</secondary>
44321 </indexterm>
44322 This option provides a list of servers to which, provided they announce
44323 authentication support, Exim will attempt to authenticate as a client when it
44324 connects. If authentication fails, Exim will try to transfer the message
44325 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
44326 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
44327 </para>
44328 <para>
44329 <indexterm role="option">
44330 <primary><option>interface</option></primary>
44331 </indexterm>
44332 </para>
44333 <informaltable frame="all">
44334 <tgroup cols="4" colsep="0" rowsep="0">
44335 <colspec colwidth="8*" align="left"/>
44336 <colspec colwidth="6*" align="center"/>
44337 <colspec colwidth="6*" align="center"/>
44338 <colspec colwidth="6*" align="right"/>
44339 <tbody>
44340 <row>
44341 <entry><option>interface</option></entry>
44342 <entry>Use: <emphasis>smtp</emphasis></entry>
44343 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44344 <entry>Default: <emphasis>unset</emphasis></entry>
44345 </row>
44346 </tbody>
44347 </tgroup>
44348 </informaltable>
44349 <para>
44350 <indexterm role="concept">
44351 <primary>bind IP address</primary>
44352 </indexterm>
44353 <indexterm role="concept">
44354 <primary>IP address</primary>
44355 <secondary>binding</secondary>
44356 </indexterm>
44357 <indexterm role="variable">
44358 <primary><varname>$host</varname></primary>
44359 </indexterm>
44360 <indexterm role="variable">
44361 <primary><varname>$host_address</varname></primary>
44362 </indexterm>
44363 This option specifies which interface to bind to when making an outgoing SMTP
44364 call. The value is an IP address, not an interface name such as
44365 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
44366 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
44367 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
44368 outgoing interface address. There is no variable that contains an outgoing
44369 interface address because, unless it is set by this option, its value is
44370 unknown.
44371 </para>
44372 <para>
44373 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
44374 <varname>$host_address</varname> refer to the host to which a connection is about to be made
44375 during the expansion of the string. Forced expansion failure, or an empty
44376 string result causes the option to be ignored. Otherwise, after expansion, the
44377 string must be a list of IP addresses, colon-separated by default, but the
44378 separator can be changed in the usual way. For example:
44379 </para>
44380 <literallayout class="monospaced">
44381 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
44382 </literallayout>
44383 <para>
44384 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
44385 connection. If none of them are the correct type, the option is ignored. If
44386 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
44387 interface to use if the host has more than one.
44388 </para>
44389 <para>
44390 <indexterm role="option">
44391 <primary><option>keepalive</option></primary>
44392 </indexterm>
44393 </para>
44394 <informaltable frame="all">
44395 <tgroup cols="4" colsep="0" rowsep="0">
44396 <colspec colwidth="8*" align="left"/>
44397 <colspec colwidth="6*" align="center"/>
44398 <colspec colwidth="6*" align="center"/>
44399 <colspec colwidth="6*" align="right"/>
44400 <tbody>
44401 <row>
44402 <entry><option>keepalive</option></entry>
44403 <entry>Use: <emphasis>smtp</emphasis></entry>
44404 <entry>Type: <emphasis>boolean</emphasis></entry>
44405 <entry>Default: <emphasis>true</emphasis></entry>
44406 </row>
44407 </tbody>
44408 </tgroup>
44409 </informaltable>
44410 <para>
44411 <indexterm role="concept">
44412 <primary>keepalive</primary>
44413 <secondary>on outgoing connection</secondary>
44414 </indexterm>
44415 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
44416 connections. When set, it causes the kernel to probe idle connections
44417 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
44418 of the connection should send a acknowledgment if the connection is still okay
44419 or a reset if the connection has been aborted. The reason for doing this is
44420 that it has the beneficial effect of freeing up certain types of connection
44421 that can get stuck when the remote host is disconnected without tidying up the
44422 TCP/IP call properly. The keepalive mechanism takes several hours to detect
44423 unreachable hosts.
44424 </para>
44425 <para>
44426 <indexterm role="option">
44427 <primary><option>lmtp_ignore_quota</option></primary>
44428 </indexterm>
44429 </para>
44430 <informaltable frame="all">
44431 <tgroup cols="4" colsep="0" rowsep="0">
44432 <colspec colwidth="8*" align="left"/>
44433 <colspec colwidth="6*" align="center"/>
44434 <colspec colwidth="6*" align="center"/>
44435 <colspec colwidth="6*" align="right"/>
44436 <tbody>
44437 <row>
44438 <entry><option>lmtp_ignore_quota</option></entry>
44439 <entry>Use: <emphasis>smtp</emphasis></entry>
44440 <entry>Type: <emphasis>boolean</emphasis></entry>
44441 <entry>Default: <emphasis>false</emphasis></entry>
44442 </row>
44443 </tbody>
44444 </tgroup>
44445 </informaltable>
44446 <para>
44447 <indexterm role="concept">
44448 <primary>LMTP</primary>
44449 <secondary>ignoring quota errors</secondary>
44450 </indexterm>
44451 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
44452 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
44453 has advertised support for IGNOREQUOTA in its response to the LHLO command.
44454 </para>
44455 <para>
44456 <indexterm role="option">
44457 <primary><option>max_rcpt</option></primary>
44458 </indexterm>
44459 </para>
44460 <informaltable frame="all">
44461 <tgroup cols="4" colsep="0" rowsep="0">
44462 <colspec colwidth="8*" align="left"/>
44463 <colspec colwidth="6*" align="center"/>
44464 <colspec colwidth="6*" align="center"/>
44465 <colspec colwidth="6*" align="right"/>
44466 <tbody>
44467 <row>
44468 <entry><option>max_rcpt</option></entry>
44469 <entry>Use: <emphasis>smtp</emphasis></entry>
44470 <entry>Type: <emphasis>integer</emphasis></entry>
44471 <entry>Default: <emphasis>100</emphasis></entry>
44472 </row>
44473 </tbody>
44474 </tgroup>
44475 </informaltable>
44476 <para>
44477 <indexterm role="concept">
44478 <primary>RCPT</primary>
44479 <secondary>maximum number of outgoing</secondary>
44480 </indexterm>
44481 This option limits the number of RCPT commands that are sent in a single
44482 SMTP message transaction. Each set of addresses is treated independently, and
44483 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
44484 permits this.
44485 </para>
44486 <para>
44487 <indexterm role="option">
44488 <primary><option>multi_domain</option></primary>
44489 </indexterm>
44490 </para>
44491 <informaltable frame="all">
44492 <tgroup cols="4" colsep="0" rowsep="0">
44493 <colspec colwidth="8*" align="left"/>
44494 <colspec colwidth="6*" align="center"/>
44495 <colspec colwidth="6*" align="center"/>
44496 <colspec colwidth="6*" align="right"/>
44497 <tbody>
44498 <row>
44499 <entry><option>multi_domain</option></entry>
44500 <entry>Use: <emphasis>smtp</emphasis></entry>
44501 <entry>Type: <emphasis>boolean</emphasis></entry>
44502 <entry>Default: <emphasis>true</emphasis></entry>
44503 </row>
44504 </tbody>
44505 </tgroup>
44506 </informaltable>
44507 <para>
44508 <indexterm role="variable">
44509 <primary><varname>$domain</varname></primary>
44510 </indexterm>
44511 When this option is set, the <command>smtp</command> transport can handle a number of
44512 addresses containing a mixture of different domains provided they all resolve
44513 to the same list of hosts. Turning the option off restricts the transport to
44514 handling only one domain at a time. This is useful if you want to use
44515 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
44516 is a single domain involved in a remote delivery.
44517 </para>
44518 <para>
44519 <indexterm role="option">
44520 <primary><option>port</option></primary>
44521 </indexterm>
44522 </para>
44523 <informaltable frame="all">
44524 <tgroup cols="4" colsep="0" rowsep="0">
44525 <colspec colwidth="8*" align="left"/>
44526 <colspec colwidth="6*" align="center"/>
44527 <colspec colwidth="6*" align="center"/>
44528 <colspec colwidth="6*" align="right"/>
44529 <tbody>
44530 <row>
44531 <entry><option>port</option></entry>
44532 <entry>Use: <emphasis>smtp</emphasis></entry>
44533 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44534 <entry>Default: <emphasis>see below</emphasis></entry>
44535 </row>
44536 </tbody>
44537 </tgroup>
44538 </informaltable>
44539 <para>
44540 <indexterm role="concept">
44541 <primary>port</primary>
44542 <secondary>sending TCP/IP</secondary>
44543 </indexterm>
44544 <indexterm role="concept">
44545 <primary>TCP/IP</primary>
44546 <secondary>setting outgoing port</secondary>
44547 </indexterm>
44548 This option specifies the TCP/IP port on the server to which Exim connects.
44549 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
44550 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
44551 The name was changed to minimize confusion with the outgoing port. There is no
44552 variable that contains an outgoing port.
44553 </para>
44554 <para>
44555 If the value of this option begins with a digit it is taken as a port number;
44556 otherwise it is looked up using <function>getservbyname()</function>. The default value is
44557 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
44558 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
44559 is deferred.
44560 </para>
44561 <para>
44562 <indexterm role="option">
44563 <primary><option>protocol</option></primary>
44564 </indexterm>
44565 </para>
44566 <informaltable frame="all">
44567 <tgroup cols="4" colsep="0" rowsep="0">
44568 <colspec colwidth="8*" align="left"/>
44569 <colspec colwidth="6*" align="center"/>
44570 <colspec colwidth="6*" align="center"/>
44571 <colspec colwidth="6*" align="right"/>
44572 <tbody>
44573 <row>
44574 <entry><option>protocol</option></entry>
44575 <entry>Use: <emphasis>smtp</emphasis></entry>
44576 <entry>Type: <emphasis>string</emphasis></entry>
44577 <entry>Default: <emphasis>smtp</emphasis></entry>
44578 </row>
44579 </tbody>
44580 </tgroup>
44581 </informaltable>
44582 <para>
44583 <indexterm role="concept">
44584 <primary>LMTP</primary>
44585 <secondary>over TCP/IP</secondary>
44586 </indexterm>
44587 <indexterm role="concept">
44588 <primary>ssmtp protocol</primary>
44589 <secondary>outbound</secondary>
44590 </indexterm>
44591 <indexterm role="concept">
44592 <primary>TLS</primary>
44593 <secondary>SSL-on-connect outbound</secondary>
44594 </indexterm>
44595 <indexterm role="variable">
44596 <primary><varname>$port</varname></primary>
44597 </indexterm>
44598 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
44599 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
44600 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
44601 deliveries into closed message stores. Exim also has support for running LMTP
44602 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
44603 </para>
44604 <para>
44605 If this option is set to <quote>smtps</quote>, the default vaule for the <option>port</option> option
44606 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
44607 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
44608 The Internet standards bodies strongly discourage use of this mode.
44609 </para>
44610 <para>
44611 <indexterm role="option">
44612 <primary><option>retry_include_ip_address</option></primary>
44613 </indexterm>
44614 </para>
44615 <informaltable frame="all">
44616 <tgroup cols="4" colsep="0" rowsep="0">
44617 <colspec colwidth="8*" align="left"/>
44618 <colspec colwidth="6*" align="center"/>
44619 <colspec colwidth="6*" align="center"/>
44620 <colspec colwidth="6*" align="right"/>
44621 <tbody>
44622 <row>
44623 <entry><option>retry_include_ip_address</option></entry>
44624 <entry>Use: <emphasis>smtp</emphasis></entry>
44625 <entry>Type: <emphasis>boolean</emphasis></entry>
44626 <entry>Default: <emphasis>true</emphasis></entry>
44627 </row>
44628 </tbody>
44629 </tgroup>
44630 </informaltable>
44631 <para>
44632 Exim normally includes both the host name and the IP address in the key it
44633 constructs for indexing retry data after a temporary delivery failure. This
44634 means that when one of several IP addresses for a host is failing, it gets
44635 tried periodically (controlled by the retry rules), but use of the other IP
44636 addresses is not affected.
44637 </para>
44638 <para>
44639 However, in some dialup environments hosts are assigned a different IP address
44640 each time they connect. In this situation the use of the IP address as part of
44641 the retry key leads to undesirable behaviour. Setting this option false causes
44642 Exim to use only the host name. This should normally be done on a separate
44643 instance of the <command>smtp</command> transport, set up specially to handle the dialup
44644 hosts.
44645 </para>
44646 <para>
44647 <indexterm role="option">
44648 <primary><option>serialize_hosts</option></primary>
44649 </indexterm>
44650 </para>
44651 <informaltable frame="all">
44652 <tgroup cols="4" colsep="0" rowsep="0">
44653 <colspec colwidth="8*" align="left"/>
44654 <colspec colwidth="6*" align="center"/>
44655 <colspec colwidth="6*" align="center"/>
44656 <colspec colwidth="6*" align="right"/>
44657 <tbody>
44658 <row>
44659 <entry><option>serialize_hosts</option></entry>
44660 <entry>Use: <emphasis>smtp</emphasis></entry>
44661 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
44662 <entry>Default: <emphasis>unset</emphasis></entry>
44663 </row>
44664 </tbody>
44665 </tgroup>
44666 </informaltable>
44667 <para>
44668 <indexterm role="concept">
44669 <primary>serializing connections</primary>
44670 </indexterm>
44671 <indexterm role="concept">
44672 <primary>host</primary>
44673 <secondary>serializing connections</secondary>
44674 </indexterm>
44675 Because Exim operates in a distributed manner, if several messages for the same
44676 host arrive at around the same time, more than one simultaneous connection to
44677 the remote host can occur. This is not usually a problem except when there is a
44678 slow link between the hosts. In that situation it may be helpful to restrict
44679 Exim to one connection at a time. This can be done by setting
44680 <option>serialize_hosts</option> to match the relevant hosts.
44681 </para>
44682 <para>
44683 <indexterm role="concept">
44684 <primary>hints database</primary>
44685 <secondary>serializing deliveries to a host</secondary>
44686 </indexterm>
44687 Exim implements serialization by means of a hints database in which a record is
44688 written whenever a process connects to one of the restricted hosts. The record
44689 is deleted when the connection is completed. Obviously there is scope for
44690 records to get left lying around if there is a system or program crash. To
44691 guard against this, Exim ignores any records that are more than six hours old.
44692 </para>
44693 <para>
44694 If you set up this kind of serialization, you should also arrange to delete the
44695 relevant hints database whenever your system reboots. The names of the files
44696 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
44697 may be one or two files, depending on the type of DBM in use. The same files
44698 are used for ETRN serialization.
44699 </para>
44700 <para>
44701 <indexterm role="option">
44702 <primary><option>size_addition</option></primary>
44703 </indexterm>
44704 </para>
44705 <informaltable frame="all">
44706 <tgroup cols="4" colsep="0" rowsep="0">
44707 <colspec colwidth="8*" align="left"/>
44708 <colspec colwidth="6*" align="center"/>
44709 <colspec colwidth="6*" align="center"/>
44710 <colspec colwidth="6*" align="right"/>
44711 <tbody>
44712 <row>
44713 <entry><option>size_addition</option></entry>
44714 <entry>Use: <emphasis>smtp</emphasis></entry>
44715 <entry>Type: <emphasis>integer</emphasis></entry>
44716 <entry>Default: <emphasis>1024</emphasis></entry>
44717 </row>
44718 </tbody>
44719 </tgroup>
44720 </informaltable>
44721 <para>
44722 <indexterm role="concept">
44723 <primary>SMTP</primary>
44724 <secondary>SIZE</secondary>
44725 </indexterm>
44726 <indexterm role="concept">
44727 <primary>message</primary>
44728 <secondary>size issue for transport filter</secondary>
44729 </indexterm>
44730 <indexterm role="concept">
44731 <primary>size</primary>
44732 <secondary>of message</secondary>
44733 </indexterm>
44734 <indexterm role="concept">
44735 <primary>transport</primary>
44736 <secondary>filter</secondary>
44737 </indexterm>
44738 <indexterm role="concept">
44739 <primary>filter</primary>
44740 <secondary>transport filter</secondary>
44741 </indexterm>
44742 If a remote SMTP server indicates that it supports the SIZE option of the
44743 MAIL command, Exim uses this to pass over the message size at the start of
44744 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
44745 sends, to allow for headers and other text that may be added during delivery by
44746 configuration options or in a transport filter. It may be necessary to increase
44747 this if a lot of text is added to messages.
44748 </para>
44749 <para>
44750 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
44751 the use of the SIZE option altogether.
44752 </para>
44753 <para>
44754 <indexterm role="option">
44755 <primary><option>tls_certificate</option></primary>
44756 </indexterm>
44757 </para>
44758 <informaltable frame="all">
44759 <tgroup cols="4" colsep="0" rowsep="0">
44760 <colspec colwidth="8*" align="left"/>
44761 <colspec colwidth="6*" align="center"/>
44762 <colspec colwidth="6*" align="center"/>
44763 <colspec colwidth="6*" align="right"/>
44764 <tbody>
44765 <row>
44766 <entry><option>tls_certificate</option></entry>
44767 <entry>Use: <emphasis>smtp</emphasis></entry>
44768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44769 <entry>Default: <emphasis>unset</emphasis></entry>
44770 </row>
44771 </tbody>
44772 </tgroup>
44773 </informaltable>
44774 <para>
44775 <indexterm role="concept">
44776 <primary>TLS</primary>
44777 <secondary>client certificate, location of</secondary>
44778 </indexterm>
44779 <indexterm role="concept">
44780 <primary>certificate</primary>
44781 <secondary>client, location of</secondary>
44782 </indexterm>
44783 <indexterm role="variable">
44784 <primary><varname>$host</varname></primary>
44785 </indexterm>
44786 <indexterm role="variable">
44787 <primary><varname>$host_address</varname></primary>
44788 </indexterm>
44789 The value of this option must be the absolute path to a file which contains the
44790 client&#x2019;s certificate, for possible use when sending a message over an encrypted
44791 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
44792 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
44793 details of TLS.
44794 </para>
44795 <para>
44796 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
44797 certificate when sending messages as a client. The global option of the same
44798 name specifies the certificate for Exim as a server; it is not automatically
44799 assumed that the same certificate should be used when Exim is operating as a
44800 client.
44801 </para>
44802 <para>
44803 <indexterm role="option">
44804 <primary><option>tls_crl</option></primary>
44805 </indexterm>
44806 </para>
44807 <informaltable frame="all">
44808 <tgroup cols="4" colsep="0" rowsep="0">
44809 <colspec colwidth="8*" align="left"/>
44810 <colspec colwidth="6*" align="center"/>
44811 <colspec colwidth="6*" align="center"/>
44812 <colspec colwidth="6*" align="right"/>
44813 <tbody>
44814 <row>
44815 <entry><option>tls_crl</option></entry>
44816 <entry>Use: <emphasis>smtp</emphasis></entry>
44817 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44818 <entry>Default: <emphasis>unset</emphasis></entry>
44819 </row>
44820 </tbody>
44821 </tgroup>
44822 </informaltable>
44823 <para>
44824 <indexterm role="concept">
44825 <primary>TLS</primary>
44826 <secondary>client certificate revocation list</secondary>
44827 </indexterm>
44828 <indexterm role="concept">
44829 <primary>certificate</primary>
44830 <secondary>revocation list for client</secondary>
44831 </indexterm>
44832 This option specifies a certificate revocation list. The expanded value must
44833 be the name of a file that contains a CRL in PEM format.
44834 </para>
44835 <para revisionflag="changed">
44836 <indexterm role="option">
44837 <primary><option>tls_dh_min_bits</option></primary>
44838 </indexterm>
44839 </para>
44840 <informaltable frame="all" revisionflag="changed">
44841 <tgroup cols="4" colsep="0" rowsep="0">
44842 <colspec colwidth="8*" align="left"/>
44843 <colspec colwidth="6*" align="center"/>
44844 <colspec colwidth="6*" align="center"/>
44845 <colspec colwidth="6*" align="right"/>
44846 <tbody>
44847 <row>
44848 <entry><option>tls_dh_min_bits</option></entry>
44849 <entry>Use: <emphasis>smtp</emphasis></entry>
44850 <entry>Type: <emphasis>integer</emphasis></entry>
44851 <entry>Default: <emphasis>1024</emphasis></entry>
44852 </row>
44853 </tbody>
44854 </tgroup>
44855 </informaltable>
44856 <para revisionflag="changed">
44857 <indexterm role="concept">
44858 <primary>TLS</primary>
44859 <secondary>Diffie-Hellman minimum acceptable size</secondary>
44860 </indexterm>
44861 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
44862 key agreement is negotiated, the server will provide a large prime number
44863 for use.  This option establishes the minimum acceptable size of that number.
44864 If the parameter offered by the server is too small, then the TLS handshake
44865 will fail.
44866 </para>
44867 <para revisionflag="changed">
44868 Only supported when using GnuTLS.
44869 </para>
44870 <para>
44871 <indexterm role="option">
44872 <primary><option>tls_privatekey</option></primary>
44873 </indexterm>
44874 </para>
44875 <informaltable frame="all">
44876 <tgroup cols="4" colsep="0" rowsep="0">
44877 <colspec colwidth="8*" align="left"/>
44878 <colspec colwidth="6*" align="center"/>
44879 <colspec colwidth="6*" align="center"/>
44880 <colspec colwidth="6*" align="right"/>
44881 <tbody>
44882 <row>
44883 <entry><option>tls_privatekey</option></entry>
44884 <entry>Use: <emphasis>smtp</emphasis></entry>
44885 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44886 <entry>Default: <emphasis>unset</emphasis></entry>
44887 </row>
44888 </tbody>
44889 </tgroup>
44890 </informaltable>
44891 <para>
44892 <indexterm role="concept">
44893 <primary>TLS</primary>
44894 <secondary>client private key, location of</secondary>
44895 </indexterm>
44896 <indexterm role="variable">
44897 <primary><varname>$host</varname></primary>
44898 </indexterm>
44899 <indexterm role="variable">
44900 <primary><varname>$host_address</varname></primary>
44901 </indexterm>
44902 The value of this option must be the absolute path to a file which contains the
44903 client&#x2019;s private key. This is used when sending a message over an encrypted
44904 connection using a client certificate. The values of <varname>$host</varname> and
44905 <varname>$host_address</varname> are set to the name and address of the server during the
44906 expansion. If this option is unset, or the expansion is forced to fail, or the
44907 result is an empty string, the private key is assumed to be in the same file as
44908 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
44909 </para>
44910 <para>
44911 <indexterm role="option">
44912 <primary><option>tls_require_ciphers</option></primary>
44913 </indexterm>
44914 </para>
44915 <informaltable frame="all">
44916 <tgroup cols="4" colsep="0" rowsep="0">
44917 <colspec colwidth="8*" align="left"/>
44918 <colspec colwidth="6*" align="center"/>
44919 <colspec colwidth="6*" align="center"/>
44920 <colspec colwidth="6*" align="right"/>
44921 <tbody>
44922 <row>
44923 <entry><option>tls_require_ciphers</option></entry>
44924 <entry>Use: <emphasis>smtp</emphasis></entry>
44925 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44926 <entry>Default: <emphasis>unset</emphasis></entry>
44927 </row>
44928 </tbody>
44929 </tgroup>
44930 </informaltable>
44931 <para>
44932 <indexterm role="concept">
44933 <primary>TLS</primary>
44934 <secondary>requiring specific ciphers</secondary>
44935 </indexterm>
44936 <indexterm role="concept">
44937 <primary>cipher</primary>
44938 <secondary>requiring specific</secondary>
44939 </indexterm>
44940 <indexterm role="variable">
44941 <primary><varname>$host</varname></primary>
44942 </indexterm>
44943 <indexterm role="variable">
44944 <primary><varname>$host_address</varname></primary>
44945 </indexterm>
44946 The value of this option must be a list of permitted cipher suites, for use
44947 when setting up an outgoing encrypted connection. (There is a global option of
44948 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
44949 <varname>$host_address</varname> are set to the name and address of the server during the
44950 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
44951 is used in different ways by OpenSSL and GnuTLS (see sections
44952 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
44953 ciphers is a preference order.
44954 </para>
44955 <para>
44956 <indexterm role="option">
44957 <primary><option>tls_sni</option></primary>
44958 </indexterm>
44959 </para>
44960 <informaltable frame="all">
44961 <tgroup cols="4" colsep="0" rowsep="0">
44962 <colspec colwidth="8*" align="left"/>
44963 <colspec colwidth="6*" align="center"/>
44964 <colspec colwidth="6*" align="center"/>
44965 <colspec colwidth="6*" align="right"/>
44966 <tbody>
44967 <row>
44968 <entry><option>tls_sni</option></entry>
44969 <entry>Use: <emphasis>smtp</emphasis></entry>
44970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44971 <entry>Default: <emphasis>unset</emphasis></entry>
44972 </row>
44973 </tbody>
44974 </tgroup>
44975 </informaltable>
44976 <para>
44977 <indexterm role="concept">
44978 <primary>TLS</primary>
44979 <secondary>Server Name Indication</secondary>
44980 </indexterm>
44981 <indexterm role="variable">
44982 <primary><varname>$tls_sni</varname></primary>
44983 </indexterm>
44984 If this option is set then it sets the $tls_out_sni variable and causes any
44985 TLS session to pass this value as the Server Name Indication extension to
44986 the remote side, which can be used by the remote side to select an appropriate
44987 certificate and private key for the session.
44988 </para>
44989 <para>
44990 See <xref linkend="SECTtlssni"/> for more information.
44991 </para>
44992 <para>
44993 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
44994 TLS extensions.
44995 </para>
44996 <para>
44997 <indexterm role="option">
44998 <primary><option>tls_tempfail_tryclear</option></primary>
44999 </indexterm>
45000 </para>
45001 <informaltable frame="all">
45002 <tgroup cols="4" colsep="0" rowsep="0">
45003 <colspec colwidth="8*" align="left"/>
45004 <colspec colwidth="6*" align="center"/>
45005 <colspec colwidth="6*" align="center"/>
45006 <colspec colwidth="6*" align="right"/>
45007 <tbody>
45008 <row>
45009 <entry><option>tls_tempfail_tryclear</option></entry>
45010 <entry>Use: <emphasis>smtp</emphasis></entry>
45011 <entry>Type: <emphasis>boolean</emphasis></entry>
45012 <entry>Default: <emphasis>true</emphasis></entry>
45013 </row>
45014 </tbody>
45015 </tgroup>
45016 </informaltable>
45017 <para>
45018 <indexterm role="concept">
45019 <primary>4<emphasis>xx</emphasis> responses</primary>
45020 <secondary>to STARTTLS</secondary>
45021 </indexterm>
45022 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
45023 setting up a TLS session, this option determines whether or not Exim should try
45024 to deliver the message unencrypted. If it is set false, delivery to the
45025 current host is deferred; if there are other hosts, they are tried. If this
45026 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
45027 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
45028 TLS negotiation fails, Exim closes the current connection (because it is in an
45029 unknown state), opens a new one to the same host, and then tries the delivery
45030 in clear.
45031 </para>
45032 <para>
45033 <indexterm role="option">
45034 <primary><option>tls_verify_certificates</option></primary>
45035 </indexterm>
45036 </para>
45037 <informaltable frame="all">
45038 <tgroup cols="4" colsep="0" rowsep="0">
45039 <colspec colwidth="8*" align="left"/>
45040 <colspec colwidth="6*" align="center"/>
45041 <colspec colwidth="6*" align="center"/>
45042 <colspec colwidth="6*" align="right"/>
45043 <tbody>
45044 <row>
45045 <entry><option>tls_verify_certificates</option></entry>
45046 <entry>Use: <emphasis>smtp</emphasis></entry>
45047 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45048 <entry>Default: <emphasis>unset</emphasis></entry>
45049 </row>
45050 </tbody>
45051 </tgroup>
45052 </informaltable>
45053 <para>
45054 <indexterm role="concept">
45055 <primary>TLS</primary>
45056 <secondary>server certificate verification</secondary>
45057 </indexterm>
45058 <indexterm role="concept">
45059 <primary>certificate</primary>
45060 <secondary>verification of server</secondary>
45061 </indexterm>
45062 <indexterm role="variable">
45063 <primary><varname>$host</varname></primary>
45064 </indexterm>
45065 <indexterm role="variable">
45066 <primary><varname>$host_address</varname></primary>
45067 </indexterm>
45068 The value of this option must be the absolute path to a file containing
45069 permitted server certificates, for use when setting up an encrypted connection.
45070 Alternatively, if you are using OpenSSL, you can set
45071 <option>tls_verify_certificates</option> to the name of a directory containing certificate
45072 files. This does not work with GnuTLS; the option must be set to the name of a
45073 single file if you are using GnuTLS. The values of <varname>$host</varname> and
45074 <varname>$host_address</varname> are set to the name and address of the server during the
45075 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
45076 </para>
45077 </section>
45078 <section id="SECTvalhosmax">
45079 <title>How the limits for the number of hosts to try are used</title>
45080 <para>
45081 <indexterm role="concept">
45082 <primary>host</primary>
45083 <secondary>maximum number to try</secondary>
45084 </indexterm>
45085 <indexterm role="concept">
45086 <primary>limit</primary>
45087 <secondary>hosts; maximum number tried</secondary>
45088 </indexterm>
45089 There are two options that are concerned with the number of hosts that are
45090 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
45091 <option>hosts_max_try_hardlimit</option>.
45092 </para>
45093 <para>
45094 The <option>hosts_max_try</option> option limits the number of hosts that are tried
45095 for a single delivery. However, despite the term <quote>host</quote> in its name, the
45096 option actually applies to each IP address independently. In other words, a
45097 multihomed host is treated as several independent hosts, just as it is for
45098 retrying.
45099 </para>
45100 <para>
45101 Many of the larger ISPs have multiple MX records which often point to
45102 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
45103 created as a result of routing one of these domains.
45104 </para>
45105 <para>
45106 Trying every single IP address on such a long list does not seem sensible; if
45107 several at the top of the list fail, it is reasonable to assume there is some
45108 problem that is likely to affect all of them. Roughly speaking, the value of
45109 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
45110 delivery. However, the logic cannot be quite that simple.
45111 </para>
45112 <para>
45113 Firstly, IP addresses that are skipped because their retry times have not
45114 arrived do not count, and in addition, addresses that are past their retry
45115 limits are also not counted, even when they are tried. This means that when
45116 some IP addresses are past their retry limits, more than the value of
45117 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
45118 that all IP addresses are considered before timing out an email address (but
45119 see below for an exception).
45120 </para>
45121 <para>
45122 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
45123 list to see if there is a subsequent host with a different (higher valued) MX.
45124 If there is, that host is considered next, and the current IP address is used
45125 but not counted. This behaviour helps in the case of a domain with a retry rule
45126 that hardly ever delays any hosts, as is now explained:
45127 </para>
45128 <para>
45129 Consider the case of a long list of hosts with one MX value, and a few with a
45130 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
45131 hosts at the top of the list are tried at first. With the default retry rule,
45132 which specifies increasing retry times, the higher MX hosts are eventually
45133 tried when those at the top of the list are skipped because they have not
45134 reached their retry times.
45135 </para>
45136 <para>
45137 However, it is common practice to put a fixed short retry time on domains for
45138 large ISPs, on the grounds that their servers are rarely down for very long.
45139 Unfortunately, these are exactly the domains that tend to resolve to long lists
45140 of hosts. The short retry time means that the lowest MX hosts are tried every
45141 time. The attempts may be in a different order because of random sorting, but
45142 without the special MX check, the higher MX hosts would never be tried until
45143 all the lower MX hosts had timed out (which might be several days), because
45144 there are always some lower MX hosts that have reached their retry times. With
45145 the special check, Exim considers at least one IP address from each MX value at
45146 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
45147 reached.
45148 </para>
45149 <para>
45150 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
45151 particular, Exim normally eventually tries all the IP addresses before timing
45152 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
45153 reasonable thing to do. Recently, however, some lunatic DNS configurations have
45154 been set up with hundreds of IP addresses for some domains. It can
45155 take a very long time indeed for an address to time out in these cases.
45156 </para>
45157 <para>
45158 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
45159 Exim never tries more than this number of IP addresses; if it hits this limit
45160 and they are all timed out, the email address is bounced, even though not all
45161 possible IP addresses have been tried.
45162 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
45163 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
45164 </para>
45165 </section>
45166 </chapter>
45167
45168 <chapter id="CHAPrewrite">
45169 <title>Address rewriting</title>
45170 <para>
45171 <indexterm role="concept" id="IIDaddrew" class="startofrange">
45172 <primary>rewriting</primary>
45173 <secondary>addresses</secondary>
45174 </indexterm>
45175 There are some circumstances in which Exim automatically rewrites domains in
45176 addresses. The two most common are when an address is given without a domain
45177 (referred to as an <quote>unqualified address</quote>) or when an address contains an
45178 abbreviated domain that is expanded by DNS lookup.
45179 </para>
45180 <para>
45181 Unqualified envelope addresses are accepted only for locally submitted
45182 messages, or for messages that are received from hosts matching
45183 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
45184 appropriate. Unqualified addresses in header lines are qualified if they are in
45185 locally submitted messages, or messages from hosts that are permitted to send
45186 unqualified envelope addresses. Otherwise, unqualified addresses in header
45187 lines are neither qualified nor rewritten.
45188 </para>
45189 <para>
45190 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
45191 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
45192 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
45193 do this. The new RFCs do not contain this suggestion.
45194 </para>
45195 <section id="SECID147">
45196 <title>Explicitly configured address rewriting</title>
45197 <para>
45198 This chapter describes the rewriting rules that can be used in the
45199 main rewrite section of the configuration file, and also in the generic
45200 <option>headers_rewrite</option> option that can be set on any transport.
45201 </para>
45202 <para>
45203 Some people believe that configured address rewriting is a Mortal Sin.
45204 Others believe that life is not possible without it. Exim provides the
45205 facility; you do not have to use it.
45206 </para>
45207 <para>
45208 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
45209 configuration file are applied to addresses in incoming messages, both envelope
45210 addresses and addresses in header lines. Each rule specifies the types of
45211 address to which it applies.
45212 </para>
45213 <para>
45214 Whether or not addresses in header lines are rewritten depends on the origin of
45215 the headers and the type of rewriting. Global rewriting, that is, rewriting
45216 rules from the rewrite section of the configuration file, is applied only to
45217 those headers that were received with the message. Header lines that are added
45218 by ACLs or by a system filter or by individual routers or transports (which
45219 are specific to individual recipient addresses) are not rewritten by the global
45220 rules.
45221 </para>
45222 <para>
45223 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
45224 applies all headers except those added by routers and transports. That is, as
45225 well as the headers that were received with the message, it also applies to
45226 headers that were added by an ACL or a system filter.
45227 </para>
45228 <para>
45229 In general, rewriting addresses from your own system or domain has some
45230 legitimacy. Rewriting other addresses should be done only with great care and
45231 in special circumstances. The author of Exim believes that rewriting should be
45232 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
45233 Although it can sometimes be used as a routing tool, this is very strongly
45234 discouraged.
45235 </para>
45236 <para>
45237 There are two commonly encountered circumstances where rewriting is used, as
45238 illustrated by these examples:
45239 </para>
45240 <itemizedlist>
45241 <listitem>
45242 <para>
45243 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
45244 exchange mail with each other behind a firewall, but there is only a single
45245 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
45246 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
45247 </para>
45248 </listitem>
45249 <listitem>
45250 <para>
45251 A host rewrites the local parts of its own users so that, for example,
45252 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
45253 </para>
45254 </listitem>
45255 </itemizedlist>
45256 </section>
45257 <section id="SECID148">
45258 <title>When does rewriting happen?</title>
45259 <para>
45260 <indexterm role="concept">
45261 <primary>rewriting</primary>
45262 <secondary>timing of</secondary>
45263 </indexterm>
45264 <indexterm role="concept">
45265 <primary>access control lists (ACLs)</primary>
45266 <secondary>rewriting addresses in</secondary>
45267 </indexterm>
45268 Configured address rewriting can take place at several different stages of a
45269 message&#x2019;s processing.
45270 </para>
45271 <para>
45272 <indexterm role="variable">
45273 <primary><varname>$sender_address</varname></primary>
45274 </indexterm>
45275 At the start of an ACL for MAIL, the sender address may have been rewritten
45276 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
45277 ordinary rewrite rules have yet been applied. If, however, the sender address
45278 is verified in the ACL, it is rewritten before verification, and remains
45279 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
45280 rewritten address. This also applies if sender verification happens in a
45281 RCPT ACL. Otherwise, when the sender address is not verified, it is
45282 rewritten as soon as a message&#x2019;s header lines have been received.
45283 </para>
45284 <para>
45285 <indexterm role="variable">
45286 <primary><varname>$domain</varname></primary>
45287 </indexterm>
45288 <indexterm role="variable">
45289 <primary><varname>$local_part</varname></primary>
45290 </indexterm>
45291 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
45292 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
45293 rewrite rules have yet been applied to it. However, the behaviour is different
45294 from the sender address when a recipient is verified. The address is rewritten
45295 for the verification, but the rewriting is not remembered at this stage. The
45296 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
45297 as they were before (that is, they contain the unrewritten &ndash; except for
45298 SMTP-time rewriting &ndash; address).
45299 </para>
45300 <para>
45301 As soon as a message&#x2019;s header lines have been received, all the envelope
45302 recipient addresses are permanently rewritten, and rewriting is also applied to
45303 the addresses in the header lines (if configured). This happens before adding
45304 any header lines that were specified in MAIL or RCPT ACLs, and
45305 <indexterm role="concept">
45306 <primary><function>local_scan()</function> function</primary>
45307 <secondary>address rewriting; timing of</secondary>
45308 </indexterm>
45309 before the DATA ACL and <function>local_scan()</function> functions are run.
45310 </para>
45311 <para>
45312 When an address is being routed, either for delivery or for verification,
45313 rewriting is applied immediately to child addresses that are generated by
45314 redirection, unless <option>no_rewrite</option> is set on the router.
45315 </para>
45316 <para>
45317 <indexterm role="concept">
45318 <primary>envelope sender</primary>
45319 <secondary>rewriting at transport time</secondary>
45320 </indexterm>
45321 <indexterm role="concept">
45322 <primary>rewriting</primary>
45323 <secondary>at transport time</secondary>
45324 </indexterm>
45325 <indexterm role="concept">
45326 <primary>header lines</primary>
45327 <secondary>rewriting at transport time</secondary>
45328 </indexterm>
45329 At transport time, additional rewriting of addresses in header lines can be
45330 specified by setting the generic <option>headers_rewrite</option> option on a transport.
45331 This option contains rules that are identical in form to those in the rewrite
45332 section of the configuration file. They are applied to the original message
45333 header lines and any that were added by ACLs or a system filter. They are not
45334 applied to header lines that are added by routers or the transport.
45335 </para>
45336 <para>
45337 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
45338 transport option. However, it is not possible to rewrite envelope recipients at
45339 transport time.
45340 </para>
45341 </section>
45342 <section id="SECID149">
45343 <title>Testing the rewriting rules that apply on input</title>
45344 <para>
45345 <indexterm role="concept">
45346 <primary>rewriting</primary>
45347 <secondary>testing</secondary>
45348 </indexterm>
45349 <indexterm role="concept">
45350 <primary>testing</primary>
45351 <secondary>rewriting</secondary>
45352 </indexterm>
45353 Exim&#x2019;s input rewriting configuration appears in a part of the run time
45354 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
45355 <option>-brw</option> command line option. This takes an address (which can be a full RFC
45356 2822 address) as its argument. The output is a list of how the address would be
45357 transformed by the rewriting rules for each of the different places it might
45358 appear in an incoming message, that is, for each different header and for the
45359 envelope sender and recipient fields. For example,
45360 </para>
45361 <literallayout class="monospaced">
45362 exim -brw ph10@exim.workshop.example
45363 </literallayout>
45364 <para>
45365 might produce the output
45366 </para>
45367 <literallayout class="monospaced">
45368 sender: Philip.Hazel@exim.workshop.example
45369 from: Philip.Hazel@exim.workshop.example
45370 to: ph10@exim.workshop.example
45371 cc: ph10@exim.workshop.example
45372 bcc: ph10@exim.workshop.example
45373 reply-to: Philip.Hazel@exim.workshop.example
45374 env-from: Philip.Hazel@exim.workshop.example
45375 env-to: ph10@exim.workshop.example
45376 </literallayout>
45377 <para>
45378 which shows that rewriting has been set up for that address when used in any of
45379 the source fields, but not when it appears as a recipient address. At the
45380 present time, there is no equivalent way of testing rewriting rules that are
45381 set for a particular transport.
45382 </para>
45383 </section>
45384 <section id="SECID150">
45385 <title>Rewriting rules</title>
45386 <para>
45387 <indexterm role="concept">
45388 <primary>rewriting</primary>
45389 <secondary>rules</secondary>
45390 </indexterm>
45391 The rewrite section of the configuration file consists of lines of rewriting
45392 rules in the form
45393 </para>
45394 <literallayout>
45395 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
45396 </literallayout>
45397 <para>
45398 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
45399 transport option are given as a colon-separated list. Each item in the list
45400 takes the same form as a line in the main rewriting configuration (except that
45401 any colons must be doubled, of course).
45402 </para>
45403 <para>
45404 The formats of source patterns and replacement strings are described below.
45405 Each is terminated by white space, unless enclosed in double quotes, in which
45406 case normal quoting conventions apply inside the quotes. The flags are single
45407 characters which may appear in any order. Spaces and tabs between them are
45408 ignored.
45409 </para>
45410 <para>
45411 For each address that could potentially be rewritten, the rules are scanned in
45412 order, and replacements for the address from earlier rules can themselves be
45413 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
45414 </para>
45415 <para>
45416 The order in which addresses are rewritten is undefined, may change between
45417 releases, and must not be relied on, with one exception: when a message is
45418 received, the envelope sender is always rewritten first, before any header
45419 lines are rewritten. For example, the replacement string for a rewrite of an
45420 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
45421 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
45422 that the envelope sender has already been rewritten.
45423 </para>
45424 <para>
45425 <indexterm role="variable">
45426 <primary><varname>$domain</varname></primary>
45427 </indexterm>
45428 <indexterm role="variable">
45429 <primary><varname>$local_part</varname></primary>
45430 </indexterm>
45431 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
45432 string to refer to the address that is being rewritten. Note that lookup-driven
45433 rewriting can be done by a rule of the form
45434 </para>
45435 <literallayout class="monospaced">
45436 *@*   ${lookup ...
45437 </literallayout>
45438 <para>
45439 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
45440 refer to the address that is being rewritten.
45441 </para>
45442 </section>
45443 <section id="SECID151">
45444 <title>Rewriting patterns</title>
45445 <para>
45446 <indexterm role="concept">
45447 <primary>rewriting</primary>
45448 <secondary>patterns</secondary>
45449 </indexterm>
45450 <indexterm role="concept">
45451 <primary>address list</primary>
45452 <secondary>in a rewriting pattern</secondary>
45453 </indexterm>
45454 The source pattern in a rewriting rule is any item which may appear in an
45455 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
45456 single-item address list, which means that it is expanded before being tested
45457 against the address. As always, if you use a regular expression as a pattern,
45458 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
45459 facility to suppress string expansion within the regular expression.
45460 </para>
45461 <para>
45462 Domains in patterns should be given in lower case. Local parts in patterns are
45463 case-sensitive. If you want to do case-insensitive matching of local parts, you
45464 can use a regular expression that starts with <literal>^(?i)</literal>.
45465 </para>
45466 <para>
45467 <indexterm role="concept">
45468 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45469 <secondary>in rewriting rules</secondary>
45470 </indexterm>
45471 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
45472 depending on the type of match which occurred. These can be used in the
45473 replacement string to insert portions of the incoming address. <varname>$0</varname> always
45474 refers to the complete incoming address. When a regular expression is used, the
45475 numerical variables are set from its capturing subexpressions. For other types
45476 of pattern they are set as follows:
45477 </para>
45478 <itemizedlist>
45479 <listitem>
45480 <para>
45481 If a local part or domain starts with an asterisk, the numerical variables
45482 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
45483 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
45484 pattern
45485 </para>
45486 <literallayout class="monospaced">
45487 *queen@*.fict.example
45488 </literallayout>
45489 <para>
45490 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
45491 </para>
45492 <literallayout class="monospaced">
45493 $0 = hearts-queen@wonderland.fict.example
45494 $1 = hearts-
45495 $2 = wonderland
45496 </literallayout>
45497 <para>
45498 Note that if the local part does not start with an asterisk, but the domain
45499 does, it is <varname>$1</varname> that contains the wild part of the domain.
45500 </para>
45501 </listitem>
45502 <listitem>
45503 <para>
45504 If the domain part of the pattern is a partial lookup, the wild and fixed parts
45505 of the domain are placed in the next available numerical variables. Suppose,
45506 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
45507 rewriting rule of the form
45508 </para>
45509 <literallayout>
45510 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
45511 </literallayout>
45512 <para>
45513 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
45514 </para>
45515 <literallayout class="monospaced">
45516 $1 = foo
45517 $2 = bar
45518 $3 = baz.example
45519 </literallayout>
45520 <para>
45521 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
45522 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
45523 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
45524 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
45525 whole domain. For non-partial domain lookups, no numerical variables are set.
45526 </para>
45527 </listitem>
45528 </itemizedlist>
45529 </section>
45530 <section id="SECID152">
45531 <title>Rewriting replacements</title>
45532 <para>
45533 <indexterm role="concept">
45534 <primary>rewriting</primary>
45535 <secondary>replacements</secondary>
45536 </indexterm>
45537 If the replacement string for a rule is a single asterisk, addresses that
45538 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
45539 rewriting rules are scanned. For example,
45540 </para>
45541 <literallayout class="monospaced">
45542 hatta@lookingglass.fict.example  *  f
45543 </literallayout>
45544 <para>
45545 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
45546 <emphasis>From:</emphasis> headers.
45547 </para>
45548 <para>
45549 <indexterm role="variable">
45550 <primary><varname>$domain</varname></primary>
45551 </indexterm>
45552 <indexterm role="variable">
45553 <primary><varname>$local_part</varname></primary>
45554 </indexterm>
45555 If the replacement string is not a single asterisk, it is expanded, and must
45556 yield a fully qualified address. Within the expansion, the variables
45557 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
45558 Any letters they contain retain their original case &ndash; they are not lower
45559 cased. The numerical variables are set up according to the type of pattern that
45560 matched the address, as described above. If the expansion is forced to fail by
45561 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
45562 current rule is abandoned, but subsequent rules may take effect. Any other
45563 expansion failure causes the entire rewriting operation to be abandoned, and an
45564 entry written to the panic log.
45565 </para>
45566 </section>
45567 <section id="SECID153">
45568 <title>Rewriting flags</title>
45569 <para>
45570 There are three different kinds of flag that may appear on rewriting rules:
45571 </para>
45572 <itemizedlist>
45573 <listitem>
45574 <para>
45575 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
45576 c, f, h, r, s, t.
45577 </para>
45578 </listitem>
45579 <listitem>
45580 <para>
45581 A flag that specifies rewriting at SMTP time: S.
45582 </para>
45583 </listitem>
45584 <listitem>
45585 <para>
45586 Flags that control the rewriting process: Q, q, R, w.
45587 </para>
45588 </listitem>
45589 </itemizedlist>
45590 <para>
45591 For rules that are part of the <option>headers_rewrite</option> generic transport option,
45592 E, F, T, and S are not permitted.
45593 </para>
45594 </section>
45595 <section id="SECID154">
45596 <title>Flags specifying which headers and envelope addresses to rewrite</title>
45597 <para>
45598 <indexterm role="concept">
45599 <primary>rewriting</primary>
45600 <secondary>flags</secondary>
45601 </indexterm>
45602 If none of the following flag letters, nor the <quote>S</quote> flag (see section
45603 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
45604 and to both the sender and recipient fields of the envelope, whereas a
45605 transport-time rewriting rule just applies to all headers. Otherwise, the
45606 rewriting rule is skipped unless the relevant addresses are being processed.
45607 </para>
45608 <literallayout>
45609 <literal>E</literal>       rewrite all envelope fields
45610 <literal>F</literal>       rewrite the envelope From field
45611 <literal>T</literal>       rewrite the envelope To field
45612 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
45613 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
45614 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
45615 <literal>h</literal>       rewrite all headers
45616 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
45617 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
45618 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
45619 </literallayout>
45620 <para>
45621 "All headers" means all of the headers listed above that can be selected
45622 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
45623 other headers such as <emphasis>Subject:</emphasis> etc.
45624 </para>
45625 <para>
45626 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
45627 restrict this to special known cases in your own domains.
45628 </para>
45629 </section>
45630 <section id="SECTrewriteS">
45631 <title>The SMTP-time rewriting flag</title>
45632 <para>
45633 <indexterm role="concept">
45634 <primary>SMTP</primary>
45635 <secondary>rewriting malformed addresses</secondary>
45636 </indexterm>
45637 <indexterm role="concept">
45638 <primary>RCPT</primary>
45639 <secondary>rewriting argument of</secondary>
45640 </indexterm>
45641 <indexterm role="concept">
45642 <primary>MAIL</primary>
45643 <secondary>rewriting argument of</secondary>
45644 </indexterm>
45645 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
45646 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
45647 before any other processing; even before syntax checking. The pattern is
45648 required to be a regular expression, and it is matched against the whole of the
45649 data for the command, including any surrounding angle brackets.
45650 </para>
45651 <para>
45652 <indexterm role="variable">
45653 <primary><varname>$domain</varname></primary>
45654 </indexterm>
45655 <indexterm role="variable">
45656 <primary><varname>$local_part</varname></primary>
45657 </indexterm>
45658 This form of rewrite rule allows for the handling of addresses that are not
45659 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
45660 input). Because the input is not required to be a syntactically valid address,
45661 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
45662 expansion of the replacement string. The result of rewriting replaces the
45663 original address in the MAIL or RCPT command.
45664 </para>
45665 </section>
45666 <section id="SECID155">
45667 <title>Flags controlling the rewriting process</title>
45668 <para>
45669 There are four flags which control the way the rewriting process works. These
45670 take effect only when a rule is invoked, that is, when the address is of the
45671 correct type (matches the flags) and matches the pattern:
45672 </para>
45673 <itemizedlist>
45674 <listitem>
45675 <para>
45676 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
45677 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
45678 absence of <quote>Q</quote> the rewritten address must always include a domain.
45679 </para>
45680 </listitem>
45681 <listitem>
45682 <para>
45683 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
45684 even if no rewriting actually takes place because of a <quote>fail</quote> in the
45685 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
45686 (does not match the flags) or does not match the pattern.
45687 </para>
45688 </listitem>
45689 <listitem>
45690 <para>
45691 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
45692 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
45693 rewriting once it fails to match (after at least one successful rewrite).
45694 </para>
45695 </listitem>
45696 <listitem>
45697 <para>
45698 <indexterm role="concept">
45699 <primary>rewriting</primary>
45700 <secondary>whole addresses</secondary>
45701 </indexterm>
45702 When an address in a header is rewritten, the rewriting normally applies only
45703 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
45704 left unchanged. For example, rewriting might change
45705 </para>
45706 <literallayout class="monospaced">
45707 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
45708 </literallayout>
45709 <para>
45710 into
45711 </para>
45712 <literallayout class="monospaced">
45713 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
45714 </literallayout>
45715 <para>
45716 <indexterm role="concept">
45717 <primary>RFC 2047</primary>
45718 </indexterm>
45719 Sometimes there is a need to replace the whole address item, and this can be
45720 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
45721 causes an address in a header line to be rewritten, the entire address is
45722 replaced, not just the working part. The replacement must be a complete RFC
45723 2822 address, including the angle brackets if necessary. If text outside angle
45724 brackets contains a character whose value is greater than 126 or less than 32
45725 (except for tab), the text is encoded according to RFC 2047. The character set
45726 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
45727 </para>
45728 <para>
45729 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
45730 rewritten, all but the working part of the replacement address is discarded.
45731 </para>
45732 </listitem>
45733 </itemizedlist>
45734 </section>
45735 <section id="SECID156">
45736 <title>Rewriting examples</title>
45737 <para>
45738 Here is an example of the two common rewriting paradigms:
45739 </para>
45740 <literallayout class="monospaced">
45741 *@*.hitch.fict.example  $1@hitch.fict.example
45742 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
45743                      {$value}fail}@hitch.fict.example bctfrF
45744 </literallayout>
45745 <para>
45746 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
45747 the string expansion to fail if the lookup does not succeed. In this context it
45748 has the effect of leaving the original address unchanged, but Exim goes on to
45749 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
45750 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
45751 explicitly, which would cause the rewritten address to be the same as before,
45752 at the cost of a small bit of processing. Not supplying either of these is an
45753 error, since the rewritten address would then contain no local part.
45754 </para>
45755 <para>
45756 The first example above replaces the domain with a superior, more general
45757 domain. This may not be desirable for certain local parts. If the rule
45758 </para>
45759 <literallayout class="monospaced">
45760 root@*.hitch.fict.example  *
45761 </literallayout>
45762 <para>
45763 were inserted before the first rule, rewriting would be suppressed for the
45764 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
45765 </para>
45766 <para>
45767 Rewriting can be made conditional on a number of tests, by making use of
45768 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
45769 messages that originate outside the local host:
45770 </para>
45771 <literallayout class="monospaced">
45772 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
45773                          {$1@hitch.fict.example}fail}"
45774 </literallayout>
45775 <para>
45776 The replacement string is quoted in this example because it contains white
45777 space.
45778 </para>
45779 <para>
45780 <indexterm role="concept">
45781 <primary>rewriting</primary>
45782 <secondary>bang paths</secondary>
45783 </indexterm>
45784 <indexterm role="concept">
45785 <primary>bang paths</primary>
45786 <secondary>rewriting</secondary>
45787 </indexterm>
45788 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
45789 an address it treats it as an unqualified local part which it qualifies with
45790 the local qualification domain (if the source of the message is local or if the
45791 remote host is permitted to send unqualified addresses). Rewriting can
45792 sometimes be used to handle simple bang paths with a fixed number of
45793 components. For example, the rule
45794 </para>
45795 <literallayout class="monospaced">
45796 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
45797 </literallayout>
45798 <para>
45799 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
45800 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
45801 a global rewriting rule for envelope addresses. It can provide a backdoor
45802 method for using your system as a relay, because the incoming addresses appear
45803 to be local. If the bang path addresses are received via SMTP, it is safer to
45804 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
45805 can be done on the rewritten addresses.
45806 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
45807 </para>
45808 </section>
45809 </chapter>
45810
45811 <chapter id="CHAPretry">
45812 <title>Retry configuration</title>
45813 <para>
45814 <indexterm role="concept" id="IIDretconf1" class="startofrange">
45815 <primary>retry</primary>
45816 <secondary>configuration, description of</secondary>
45817 </indexterm>
45818 <indexterm role="concept" id="IIDregconf2" class="startofrange">
45819 <primary>configuration file</primary>
45820 <secondary>retry section</secondary>
45821 </indexterm>
45822 The <quote>retry</quote> section of the runtime configuration file contains a list of
45823 retry rules that control how often Exim tries to deliver messages that cannot
45824 be delivered at the first attempt. If there are no retry rules (the section is
45825 empty or not present), there are no retries. In this situation, temporary
45826 errors are treated as permanent. The default configuration contains a single,
45827 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
45828 line option can be used to test which retry rule will be used for a given
45829 address, domain and error.
45830 </para>
45831 <para>
45832 The most common cause of retries is temporary failure to deliver to a remote
45833 host because the host is down, or inaccessible because of a network problem.
45834 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
45835 address) basis, not on a per-message basis. Thus, if one message has recently
45836 been delayed, delivery of a new message to the same host is not immediately
45837 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
45838 log selector is set, the message
45839 <indexterm role="concept">
45840 <primary>retry</primary>
45841 <secondary>time not reached</secondary>
45842 </indexterm>
45843 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
45844 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
45845 the handling of errors during remote deliveries.
45846 </para>
45847 <para>
45848 Retry processing applies to routing as well as to delivering, except as covered
45849 in the next paragraph. The retry rules do not distinguish between these
45850 actions. It is not possible, for example, to specify different behaviour for
45851 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
45852 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
45853 added complication, so did not implement it. However, although they share the
45854 same retry rule, the actual retry times for routing and transporting a given
45855 domain are maintained independently.
45856 </para>
45857 <para>
45858 When a delivery is not part of a queue run (typically an immediate delivery on
45859 receipt of a message), the routers are always run, and local deliveries are
45860 always attempted, even if retry times are set for them. This makes for better
45861 behaviour if one particular message is causing problems (for example, causing
45862 quota overflow, or provoking an error in a filter file). If such a delivery
45863 suffers a temporary failure, the retry data is updated as normal, and
45864 subsequent delivery attempts from queue runs occur only when the retry time for
45865 the local address is reached.
45866 </para>
45867 <section id="SECID157">
45868 <title>Changing retry rules</title>
45869 <para>
45870 If you change the retry rules in your configuration, you should consider
45871 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
45872 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
45873 always safe; that is why they are called <quote>hints</quote>.
45874 </para>
45875 <para>
45876 The hints retry data contains suggested retry times based on the previous
45877 rules. In the case of a long-running problem with a remote host, it might
45878 record the fact that the host has timed out. If your new rules increase the
45879 timeout time for such a host, you should definitely remove the old retry data
45880 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
45881 messages that it should now be retaining.
45882 </para>
45883 </section>
45884 <section id="SECID158">
45885 <title>Format of retry rules</title>
45886 <para>
45887 <indexterm role="concept">
45888 <primary>retry</primary>
45889 <secondary>rules</secondary>
45890 </indexterm>
45891 Each retry rule occupies one line and consists of three or four parts,
45892 separated by white space: a pattern, an error name, an optional list of sender
45893 addresses, and a list of retry parameters. The pattern and sender lists must be
45894 enclosed in double quotes if they contain white space. The rules are searched
45895 in order until one is found where the pattern, error name, and sender list (if
45896 present) match the failing host or address, the error that occurred, and the
45897 message&#x2019;s sender, respectively.
45898 </para>
45899 <para>
45900 The pattern is any single item that may appear in an address list (see section
45901 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
45902 which means that it is expanded before being tested against the address that
45903 has been delayed. A negated address list item is permitted. Address
45904 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
45905 which makes it possible for many retry rules to start with just a domain. For
45906 example,
45907 </para>
45908 <literallayout class="monospaced">
45909 lookingglass.fict.example        *  F,24h,30m;
45910 </literallayout>
45911 <para>
45912 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
45913 whereas
45914 </para>
45915 <literallayout class="monospaced">
45916 alice@lookingglass.fict.example  *  F,24h,30m;
45917 </literallayout>
45918 <para>
45919 applies only to temporary failures involving the local part <option>alice</option>.
45920 In practice, almost all rules start with a domain name pattern without a local
45921 part.
45922 </para>
45923 <para>
45924 <indexterm role="concept">
45925 <primary>regular expressions</primary>
45926 <secondary>in retry rules</secondary>
45927 </indexterm>
45928 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
45929 must match a complete address, not just a domain, because that is how regular
45930 expressions work in address lists.
45931 </para>
45932 <literallayout>
45933 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
45934 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
45935 </literallayout>
45936 </section>
45937 <section id="SECID159">
45938 <title>Choosing which retry rule to use for address errors</title>
45939 <para>
45940 When Exim is looking for a retry rule after a routing attempt has failed (for
45941 example, after a DNS timeout), each line in the retry configuration is tested
45942 against the complete address only if <option>retry_use_local_part</option> is set for the
45943 router. Otherwise, only the domain is used, except when matching against a
45944 regular expression, when the local part of the address is replaced with <quote>*</quote>.
45945 A domain on its own can match a domain pattern, or a pattern that starts with
45946 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
45947 <option>check_local_user</option> is true, and false for other routers.
45948 </para>
45949 <para>
45950 Similarly, when Exim is looking for a retry rule after a local delivery has
45951 failed (for example, after a mailbox full error), each line in the retry
45952 configuration is tested against the complete address only if
45953 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
45954 local transports).
45955 </para>
45956 <para>
45957 <indexterm role="concept">
45958 <primary>4<emphasis>xx</emphasis> responses</primary>
45959 <secondary>retry rules for</secondary>
45960 </indexterm>
45961 However, when Exim is looking for a retry rule after a remote delivery attempt
45962 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
45963 whole address is always used as the key when searching the retry rules. The
45964 rule that is found is used to create a retry time for the combination of the
45965 failing address and the message&#x2019;s sender. It is the combination of sender and
45966 recipient that is delayed in subsequent queue runs until its retry time is
45967 reached. You can delay the recipient without regard to the sender by setting
45968 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
45969 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
45970 commands.
45971 </para>
45972 </section>
45973 <section id="SECID160">
45974 <title>Choosing which retry rule to use for host and message errors</title>
45975 <para>
45976 For a temporary error that is not related to an individual address (for
45977 example, a connection timeout), each line in the retry configuration is checked
45978 twice. First, the name of the remote host is used as a domain name (preceded by
45979 <quote>*@</quote> when matching a regular expression). If this does not match the line,
45980 the domain from the email address is tried in a similar fashion. For example,
45981 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
45982 </para>
45983 <literallayout class="monospaced">
45984 a.b.c.example  MX  5  x.y.z.example
45985                MX  6  p.q.r.example
45986                MX  7  m.n.o.example
45987 </literallayout>
45988 <para>
45989 and the retry rules are
45990 </para>
45991 <literallayout class="monospaced">
45992 p.q.r.example    *      F,24h,30m;
45993 a.b.c.example    *      F,4d,45m;
45994 </literallayout>
45995 <para>
45996 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
45997 first rule matches neither the host nor the domain, so Exim looks at the second
45998 rule. This does not match the host, but it does match the domain, so it is used
45999 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
46000 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
46001 first retry rule is used, because it matches the host.
46002 </para>
46003 <para>
46004 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
46005 first rule to determine retry times, but for all the other hosts for the domain
46006 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
46007 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
46008 </para>
46009 <para>
46010 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
46011 However, if a message is routed directly to an IP address without the use of a
46012 host name, for example, if a <command>manualroute</command> router contains a setting such as:
46013 </para>
46014 <literallayout class="monospaced">
46015 route_list = *.a.example  192.168.34.23
46016 </literallayout>
46017 <para>
46018 then the <quote>host name</quote> that is used when searching for a retry rule is the
46019 textual form of the IP address.
46020 </para>
46021 </section>
46022 <section id="SECID161">
46023 <title>Retry rules for specific errors</title>
46024 <para>
46025 <indexterm role="concept">
46026 <primary>retry</primary>
46027 <secondary>specific errors; specifying</secondary>
46028 </indexterm>
46029 The second field in a retry rule is the name of a particular error, or an
46030 asterisk, which matches any error. The errors that can be tested for are:
46031 </para>
46032 <variablelist>
46033 <varlistentry>
46034 <term><option>auth_failed</option></term>
46035 <listitem>
46036 <para>
46037 Authentication failed when trying to send to a host in the
46038 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
46039 </para>
46040 </listitem></varlistentry>
46041 <varlistentry>
46042 <term><option>data_4xx</option></term>
46043 <listitem>
46044 <para>
46045 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
46046 after the command, or after sending the message&#x2019;s data.
46047 </para>
46048 </listitem></varlistentry>
46049 <varlistentry>
46050 <term><option>mail_4xx</option></term>
46051 <listitem>
46052 <para>
46053 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
46054 </para>
46055 </listitem></varlistentry>
46056 <varlistentry>
46057 <term><option>rcpt_4xx</option></term>
46058 <listitem>
46059 <para>
46060 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
46061 </para>
46062 </listitem></varlistentry>
46063 </variablelist>
46064 <para>
46065 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
46066 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
46067 recognize 452 errors given to RCPT commands for addresses in a certain domain,
46068 and have retries every ten minutes with a one-hour timeout, you could set up a
46069 retry rule of this form:
46070 </para>
46071 <literallayout class="monospaced">
46072 the.domain.name  rcpt_452   F,1h,10m
46073 </literallayout>
46074 <para>
46075 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
46076 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
46077 </para>
46078 <variablelist>
46079 <varlistentry>
46080 <term><option>lost_connection</option></term>
46081 <listitem>
46082 <para>
46083 A server unexpectedly closed the SMTP connection. There may, of course,
46084 legitimate reasons for this (host died, network died), but if it repeats a lot
46085 for the same host, it indicates something odd.
46086 </para>
46087 </listitem></varlistentry>
46088 <varlistentry>
46089 <term><option>refused_MX</option></term>
46090 <listitem>
46091 <para>
46092 A connection to a host obtained from an MX record was refused.
46093 </para>
46094 </listitem></varlistentry>
46095 <varlistentry>
46096 <term><option>refused_A</option></term>
46097 <listitem>
46098 <para>
46099 A connection to a host not obtained from an MX record was refused.
46100 </para>
46101 </listitem></varlistentry>
46102 <varlistentry>
46103 <term><option>refused</option></term>
46104 <listitem>
46105 <para>
46106 A connection was refused.
46107 </para>
46108 </listitem></varlistentry>
46109 <varlistentry>
46110 <term><option>timeout_connect_MX</option></term>
46111 <listitem>
46112 <para>
46113 A connection attempt to a host obtained from an MX record timed out.
46114 </para>
46115 </listitem></varlistentry>
46116 <varlistentry>
46117 <term><option>timeout_connect_A</option></term>
46118 <listitem>
46119 <para>
46120 A connection attempt to a host not obtained from an MX record timed out.
46121 </para>
46122 </listitem></varlistentry>
46123 <varlistentry>
46124 <term><option>timeout_connect</option></term>
46125 <listitem>
46126 <para>
46127 A connection attempt timed out.
46128 </para>
46129 </listitem></varlistentry>
46130 <varlistentry>
46131 <term><option>timeout_MX</option></term>
46132 <listitem>
46133 <para>
46134 There was a timeout while connecting or during an SMTP session with a host
46135 obtained from an MX record.
46136 </para>
46137 </listitem></varlistentry>
46138 <varlistentry>
46139 <term><option>timeout_A</option></term>
46140 <listitem>
46141 <para>
46142 There was a timeout while connecting or during an SMTP session with a host not
46143 obtained from an MX record.
46144 </para>
46145 </listitem></varlistentry>
46146 <varlistentry>
46147 <term><option>timeout</option></term>
46148 <listitem>
46149 <para>
46150 There was a timeout while connecting or during an SMTP session.
46151 </para>
46152 </listitem></varlistentry>
46153 <varlistentry>
46154 <term><option>tls_required</option></term>
46155 <listitem>
46156 <para>
46157 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
46158 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
46159 to STARTTLS, or there was a problem setting up the TLS connection.
46160 </para>
46161 </listitem></varlistentry>
46162 <varlistentry>
46163 <term><option>quota</option></term>
46164 <listitem>
46165 <para>
46166 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
46167 transport.
46168 </para>
46169 </listitem></varlistentry>
46170 <varlistentry>
46171 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
46172 <listitem>
46173 <para>
46174 <indexterm role="concept">
46175 <primary>quota</primary>
46176 <secondary>error testing in retry rule</secondary>
46177 </indexterm>
46178 <indexterm role="concept">
46179 <primary>retry</primary>
46180 <secondary>quota error testing</secondary>
46181 </indexterm>
46182 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
46183 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
46184 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
46185 for four days.
46186 </para>
46187 </listitem></varlistentry>
46188 </variablelist>
46189 <para>
46190 <indexterm role="concept">
46191 <primary>mailbox</primary>
46192 <secondary>time of last read</secondary>
46193 </indexterm>
46194 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
46195 timeouts when the mailbox is full and is not being read by its owner. Ideally,
46196 it should be based on the last time that the user accessed the mailbox.
46197 However, it is not always possible to determine this. Exim uses the following
46198 heuristic rules:
46199 </para>
46200 <itemizedlist>
46201 <listitem>
46202 <para>
46203 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
46204 used. As no new messages are being delivered (because the mailbox is over
46205 quota), Exim does not access the file, so this is the time of last user access.
46206 </para>
46207 </listitem>
46208 <listitem>
46209 <para>
46210 <indexterm role="concept">
46211 <primary>maildir format</primary>
46212 <secondary>time of last read</secondary>
46213 </indexterm>
46214 For a maildir delivery, the time of last modification of the <filename>new</filename>
46215 subdirectory is used. As the mailbox is over quota, no new files are created in
46216 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
46217 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
46218 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
46219 time that is used is therefore the last time that the user read a new message.
46220 </para>
46221 </listitem>
46222 <listitem>
46223 <para>
46224 For other kinds of multi-file mailbox, the time of last access cannot be
46225 obtained, so a retry rule that uses this type of error field is never matched.
46226 </para>
46227 </listitem>
46228 </itemizedlist>
46229 <para>
46230 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
46231 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
46232 when a local delivery is deferred because a partition is full (the ENOSPC
46233 error).
46234 </para>
46235 </section>
46236 <section id="SECID162">
46237 <title>Retry rules for specified senders</title>
46238 <para>
46239 <indexterm role="concept">
46240 <primary>retry</primary>
46241 <secondary>rules; sender-specific</secondary>
46242 </indexterm>
46243 You can specify retry rules that apply only when the failing message has a
46244 specific sender. In particular, this can be used to define retry rules that
46245 apply only to bounce messages. The third item in a retry rule can be of this
46246 form:
46247 </para>
46248 <literallayout>
46249 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
46250 </literallayout>
46251 <para>
46252 The retry timings themselves are then the fourth item. For example:
46253 </para>
46254 <literallayout class="monospaced">
46255 *   rcpt_4xx   senders=:   F,1h,30m
46256 </literallayout>
46257 <para>
46258 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
46259 host. If the address list contains white space, it must be enclosed in quotes.
46260 For example:
46261 </para>
46262 <literallayout class="monospaced">
46263 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
46264 </literallayout>
46265 <para>
46266 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
46267 (which do not depend on the recipient). The reason is that the sender is used
46268 only to match the retry rule. Once the rule has been found for a host error,
46269 its contents are used to set a retry time for the host, and this will apply to
46270 all messages, not just those with specific senders.
46271 </para>
46272 <para>
46273 When testing retry rules using <option>-brt</option>, you can supply a sender using the
46274 <option>-f</option> command line option, like this:
46275 </para>
46276 <literallayout class="monospaced">
46277 exim -f "" -brt user@dom.ain
46278 </literallayout>
46279 <para>
46280 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
46281 list is never matched.
46282 </para>
46283 </section>
46284 <section id="SECID163">
46285 <title>Retry parameters</title>
46286 <para>
46287 <indexterm role="concept">
46288 <primary>retry</primary>
46289 <secondary>parameters in rules</secondary>
46290 </indexterm>
46291 The third (or fourth, if a senders list is present) field in a retry rule is a
46292 sequence of retry parameter sets, separated by semicolons. Each set consists of
46293 </para>
46294 <literallayout>
46295 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
46296 </literallayout>
46297 <para>
46298 The letter identifies the algorithm for computing a new retry time; the cutoff
46299 time is the time beyond which this algorithm no longer applies, and the
46300 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
46301 time that the first failure for the domain (combined with the local part if
46302 relevant) was detected, not from the time the message was received.
46303 </para>
46304 <para>
46305 <indexterm role="concept">
46306 <primary>retry</primary>
46307 <secondary>algorithms</secondary>
46308 </indexterm>
46309 <indexterm role="concept">
46310 <primary>retry</primary>
46311 <secondary>fixed intervals</secondary>
46312 </indexterm>
46313 <indexterm role="concept">
46314 <primary>retry</primary>
46315 <secondary>increasing intervals</secondary>
46316 </indexterm>
46317 <indexterm role="concept">
46318 <primary>retry</primary>
46319 <secondary>random intervals</secondary>
46320 </indexterm>
46321 The available algorithms are:
46322 </para>
46323 <itemizedlist>
46324 <listitem>
46325 <para>
46326 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
46327 the interval.
46328 </para>
46329 </listitem>
46330 <listitem>
46331 <para>
46332 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
46333 specifies a starting value for the interval, and the second a multiplier, which
46334 is used to increase the size of the interval at each retry.
46335 </para>
46336 </listitem>
46337 <listitem>
46338 <para>
46339 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
46340 retry, the previous interval is multiplied by the factor in order to get a
46341 maximum for the next interval. The minimum interval is the first argument of
46342 the parameter, and an actual interval is chosen randomly between them. Such a
46343 rule has been found to be helpful in cluster configurations when all the
46344 members of the cluster restart at once, and may therefore synchronize their
46345 queue processing times.
46346 </para>
46347 </listitem>
46348 </itemizedlist>
46349 <para>
46350 When computing the next retry time, the algorithm definitions are scanned in
46351 order until one whose cutoff time has not yet passed is reached. This is then
46352 used to compute a new retry time that is later than the current time. In the
46353 case of fixed interval retries, this simply means adding the interval to the
46354 current time. For geometrically increasing intervals, retry intervals are
46355 computed from the rule&#x2019;s parameters until one that is greater than the previous
46356 interval is found. The main configuration variable
46357 <indexterm role="concept">
46358 <primary>limit</primary>
46359 <secondary>retry interval</secondary>
46360 </indexterm>
46361 <indexterm role="concept">
46362 <primary>retry</primary>
46363 <secondary>interval, maximum</secondary>
46364 </indexterm>
46365 <indexterm role="option">
46366 <primary><option>retry_interval_max</option></primary>
46367 </indexterm>
46368 <option>retry_interval_max</option> limits the maximum interval between retries. It
46369 cannot be set greater than <literal>24h</literal>, which is its default value.
46370 </para>
46371 <para>
46372 A single remote domain may have a number of hosts associated with it, and each
46373 host may have more than one IP address. Retry algorithms are selected on the
46374 basis of the domain name, but are applied to each IP address independently. If,
46375 for example, a host has two IP addresses and one is unusable, Exim will
46376 generate retry times for it and will not try to use it until its next retry
46377 time comes. Thus the good IP address is likely to be tried first most of the
46378 time.
46379 </para>
46380 <para>
46381 <indexterm role="concept">
46382 <primary>hints database</primary>
46383 <secondary>use for retrying</secondary>
46384 </indexterm>
46385 Retry times are hints rather than promises. Exim does not make any attempt to
46386 run deliveries exactly at the computed times. Instead, a queue runner process
46387 starts delivery processes for delayed messages periodically, and these attempt
46388 new deliveries only for those addresses that have passed their next retry time.
46389 If a new message arrives for a deferred address, an immediate delivery attempt
46390 occurs only if the address has passed its retry time. In the absence of new
46391 messages, the minimum time between retries is the interval between queue runner
46392 processes. There is not much point in setting retry times of five minutes if
46393 your queue runners happen only once an hour, unless there are a significant
46394 number of incoming messages (which might be the case on a system that is
46395 sending everything to a smart host, for example).
46396 </para>
46397 <para>
46398 The data in the retry hints database can be inspected by using the
46399 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
46400 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
46401 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
46402 are for the hosts associated with a particular mail domain, and also for local
46403 deliveries that have been deferred.
46404 </para>
46405 </section>
46406 <section id="SECID164">
46407 <title>Retry rule examples</title>
46408 <para>
46409 Here are some example retry rules:
46410 </para>
46411 <literallayout class="monospaced">
46412 alice@wonderland.fict.example quota_5d  F,7d,3h
46413 wonderland.fict.example       quota_5d
46414 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
46415 lookingglass.fict.example     *         F,24h,30m;
46416 *                 refused_A   F,2h,20m;
46417 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
46418 </literallayout>
46419 <para>
46420 The first rule sets up special handling for mail to
46421 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
46422 mailbox has not been read for at least 5 days. Retries continue every three
46423 hours for 7 days. The second rule handles over-quota errors for all other local
46424 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
46425 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
46426 fail are bounced immediately if the mailbox has not been read for at least 5
46427 days.
46428 </para>
46429 <para>
46430 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
46431 happen every 15 minutes for an hour, then with geometrically increasing
46432 intervals until two days have passed since a delivery first failed. After the
46433 first hour there is a delay of one hour, then two hours, then four hours, and
46434 so on (this is a rather extreme example).
46435 </para>
46436 <para>
46437 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
46438 They happen every 30 minutes for 24 hours only. The remaining two rules handle
46439 all other domains, with special action for connection refusal from hosts that
46440 were not obtained from an MX record.
46441 </para>
46442 <para>
46443 The final rule in a retry configuration should always have asterisks in the
46444 first two fields so as to provide a general catch-all for any addresses that do
46445 not have their own special handling. This example tries every 15 minutes for 2
46446 hours, then with intervals starting at one hour and increasing by a factor of
46447 1.5 up to 16 hours, then every 8 hours up to 5 days.
46448 </para>
46449 </section>
46450 <section id="SECID165">
46451 <title>Timeout of retry data</title>
46452 <para>
46453 <indexterm role="concept">
46454 <primary>timeout</primary>
46455 <secondary>of retry data</secondary>
46456 </indexterm>
46457 <indexterm role="option">
46458 <primary><option>retry_data_expire</option></primary>
46459 </indexterm>
46460 <indexterm role="concept">
46461 <primary>hints database</primary>
46462 <secondary>data expiry</secondary>
46463 </indexterm>
46464 <indexterm role="concept">
46465 <primary>retry</primary>
46466 <secondary>timeout of data</secondary>
46467 </indexterm>
46468 Exim timestamps the data that it writes to its retry hints database. When it
46469 consults the data during a delivery it ignores any that is older than the value
46470 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
46471 been tried for 7 days, Exim will try to deliver to it immediately a message
46472 arrives, and if that fails, it will calculate a retry time as if it were
46473 failing for the first time.
46474 </para>
46475 <para>
46476 This improves the behaviour for messages routed to rarely-used hosts such as MX
46477 backups. If such a host was down at one time, and happens to be down again when
46478 Exim tries a month later, using the old retry data would imply that it had been
46479 down all the time, which is not a justified assumption.
46480 </para>
46481 <para>
46482 If a host really is permanently dead, this behaviour causes a burst of retries
46483 every now and again, but only if messages routed to it are rare. If there is a
46484 message at least once every 7 days the retry data never expires.
46485 </para>
46486 </section>
46487 <section id="SECID166">
46488 <title>Long-term failures</title>
46489 <para>
46490 <indexterm role="concept">
46491 <primary>delivery failure, long-term</primary>
46492 </indexterm>
46493 <indexterm role="concept">
46494 <primary>retry</primary>
46495 <secondary>after long-term failure</secondary>
46496 </indexterm>
46497 Special processing happens when an email address has been failing for so long
46498 that the cutoff time for the last algorithm is reached. For example, using the
46499 default retry rule:
46500 </para>
46501 <literallayout class="monospaced">
46502 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
46503 </literallayout>
46504 <para>
46505 the cutoff time is four days. Reaching the retry cutoff is independent of how
46506 long any specific message has been failing; it is the length of continuous
46507 failure for the recipient address that counts.
46508 </para>
46509 <para>
46510 When the cutoff time is reached for a local delivery, or for all the IP
46511 addresses associated with a remote delivery, a subsequent delivery failure
46512 causes Exim to give up on the address, and a bounce message is generated.
46513 In order to cater for new messages that use the failing address, a next retry
46514 time is still computed from the final algorithm, and is used as follows:
46515 </para>
46516 <para>
46517 For local deliveries, one delivery attempt is always made for any subsequent
46518 messages. If this delivery fails, the address fails immediately. The
46519 post-cutoff retry time is not used.
46520 </para>
46521 <para>
46522 If the delivery is remote, there are two possibilities, controlled by the
46523 <indexterm role="option">
46524 <primary><option>delay_after_cutoff</option></primary>
46525 </indexterm>
46526 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
46527 default. Until the post-cutoff retry time for one of the IP addresses is
46528 reached, the failing email address is bounced immediately, without a delivery
46529 attempt taking place. After that time, one new delivery attempt is made to
46530 those IP addresses that are past their retry times, and if that still fails,
46531 the address is bounced and new retry times are computed.
46532 </para>
46533 <para>
46534 In other words, when all the hosts for a given email address have been failing
46535 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
46536 times is reached. Then it tries once, and bounces if that attempt fails. This
46537 behaviour ensures that few resources are wasted in repeatedly trying to deliver
46538 to a broken destination, but if the host does recover, Exim will eventually
46539 notice.
46540 </para>
46541 <para>
46542 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
46543 addresses are past their final cutoff time, Exim tries to deliver to those IP
46544 addresses that have not been tried since the message arrived. If there are
46545 no suitable IP addresses, or if they all fail, the address is bounced. In other
46546 words, it does not delay when a new message arrives, but tries the expired
46547 addresses immediately, unless they have been tried since the message arrived.
46548 If there is a continuous stream of messages for the failing domains, setting
46549 <option>delay_after_cutoff</option> false means that there will be many more attempts to
46550 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
46551 true.
46552 </para>
46553 </section>
46554 <section id="SECID167">
46555 <title>Deliveries that work intermittently</title>
46556 <para>
46557 <indexterm role="concept">
46558 <primary>retry</primary>
46559 <secondary>intermittently working deliveries</secondary>
46560 </indexterm>
46561 Some additional logic is needed to cope with cases where a host is
46562 intermittently available, or when a message has some attribute that prevents
46563 its delivery when others to the same address get through. In this situation,
46564 because some messages are successfully delivered, the <quote>retry clock</quote> for the
46565 host or address keeps getting reset by the successful deliveries, and so
46566 failing messages remain on the queue for ever because the cutoff time is never
46567 reached.
46568 </para>
46569 <para>
46570 Two exceptional actions are applied to prevent this happening. The first
46571 applies to errors that are related to a message rather than a remote host.
46572 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
46573 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
46574 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
46575 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
46576 is used when scanning the retry rules to decide when to try next and when to
46577 time out the address.
46578 </para>
46579 <para>
46580 The exceptional second action applies in all cases. If a message has been on
46581 the queue for longer than the cutoff time of any applicable retry rule for a
46582 given address, a delivery is attempted for that address, even if it is not yet
46583 time, and if this delivery fails, the address is timed out. A new retry time is
46584 not computed in this case, so that other messages for the same address are
46585 considered immediately.
46586 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
46587 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
46588 </para>
46589 </section>
46590 </chapter>
46591
46592 <chapter id="CHAPSMTPAUTH">
46593 <title>SMTP authentication</title>
46594 <para>
46595 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
46596 <primary>SMTP</primary>
46597 <secondary>authentication configuration</secondary>
46598 </indexterm>
46599 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
46600 <primary>authentication</primary>
46601 </indexterm>
46602 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
46603 with SMTP authentication. This facility is an extension to the SMTP protocol,
46604 described in RFC 2554, which allows a client SMTP host to authenticate itself
46605 to a server. This is a common way for a server to recognize clients that are
46606 permitted to use it as a relay. SMTP authentication is not of relevance to the
46607 transfer of mail between servers that have no managerial connection with each
46608 other.
46609 </para>
46610 <para>
46611 <indexterm role="concept">
46612 <primary>AUTH</primary>
46613 <secondary>description of</secondary>
46614 </indexterm>
46615 Very briefly, the way SMTP authentication works is as follows:
46616 </para>
46617 <itemizedlist>
46618 <listitem>
46619 <para>
46620 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
46621 the client&#x2019;s EHLO command.
46622 </para>
46623 </listitem>
46624 <listitem>
46625 <para>
46626 The client issues an AUTH command, naming a specific mechanism. The command
46627 may, optionally, contain some authentication data.
46628 </para>
46629 </listitem>
46630 <listitem>
46631 <para>
46632 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
46633 appropriate responses. In simple authentication mechanisms, the challenges are
46634 just prompts for user names and passwords. The server does not have to issue
46635 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
46636 with the AUTH command.
46637 </para>
46638 </listitem>
46639 <listitem>
46640 <para>
46641 The server either accepts or denies authentication.
46642 </para>
46643 </listitem>
46644 <listitem>
46645 <para>
46646 If authentication succeeds, the client may optionally make use of the AUTH
46647 option on the MAIL command to pass an authenticated sender in subsequent
46648 mail transactions. Authentication lasts for the remainder of the SMTP
46649 connection.
46650 </para>
46651 </listitem>
46652 <listitem>
46653 <para>
46654 If authentication fails, the client may give up, or it may try a different
46655 authentication mechanism, or it may try transferring mail over the
46656 unauthenticated connection.
46657 </para>
46658 </listitem>
46659 </itemizedlist>
46660 <para>
46661 If you are setting up a client, and want to know which authentication
46662 mechanisms the server supports, you can use Telnet to connect to port 25 (the
46663 SMTP port) on the server, and issue an EHLO command. The response to this
46664 includes the list of supported mechanisms. For example:
46665 </para>
46666 <literallayout>
46667 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
46668 <literal>Trying 192.168.34.25...</literal>
46669 <literal>Connected to server.example.</literal>
46670 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
46671 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
46672 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
46673 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
46674 <literal>250-SIZE 52428800</literal>
46675 <literal>250-PIPELINING</literal>
46676 <literal>250-AUTH PLAIN</literal>
46677 <literal>250 HELP</literal>
46678 </literallayout>
46679 <para>
46680 The second-last line of this example output shows that the server supports
46681 authentication using the PLAIN mechanism. In Exim, the different authentication
46682 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
46683 routers and transports, which authenticators are included in the binary is
46684 controlled by build-time definitions. The following are currently available,
46685 included by setting
46686 </para>
46687 <literallayout class="monospaced">
46688 AUTH_CRAM_MD5=yes
46689 AUTH_CYRUS_SASL=yes
46690 AUTH_DOVECOT=yes
46691 AUTH_GSASL=yes
46692 AUTH_HEIMDAL_GSSAPI=yes
46693 AUTH_PLAINTEXT=yes
46694 AUTH_SPA=yes
46695 </literallayout>
46696 <para>
46697 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
46698 authentication mechanism (RFC 2195), and the second provides an interface to
46699 the Cyrus SASL authentication library.
46700 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
46701 work via a socket interface.
46702 The fourth provides an interface to the GNU SASL authentication library, which
46703 provides mechanisms but typically not data sources.
46704 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
46705 supporting setting a server keytab.
46706 The sixth can be configured to support
46707 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
46708 not formally documented, but used by several MUAs. The seventh authenticator
46709 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
46710 </para>
46711 <para>
46712 The authenticators are configured using the same syntax as other drivers (see
46713 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
46714 authentication section need be present in the configuration file. Each
46715 authenticator can in principle have both server and client functions. When Exim
46716 is receiving SMTP mail, it is acting as a server; when it is sending out
46717 messages over SMTP, it is acting as a client. Authenticator configuration
46718 options are provided for use in both these circumstances.
46719 </para>
46720 <para>
46721 To make it clear which options apply to which situation, the prefixes
46722 <option>server_</option> and <option>client_</option> are used on option names that are specific to
46723 either the server or the client function, respectively. Server and client
46724 functions are disabled if none of their options are set. If an authenticator is
46725 to be used for both server and client functions, a single definition, using
46726 both sets of options, is required. For example:
46727 </para>
46728 <literallayout class="monospaced">
46729 cram:
46730   driver = cram_md5
46731   public_name = CRAM-MD5
46732   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
46733   client_name = ph10
46734   client_secret = secret2
46735 </literallayout>
46736 <para>
46737 The <option>server_</option> option is used when Exim is acting as a server, and the
46738 <option>client_</option> options when it is acting as a client.
46739 </para>
46740 <para>
46741 Descriptions of the individual authenticators are given in subsequent chapters.
46742 The remainder of this chapter covers the generic options for the
46743 authenticators, followed by general discussion of the way authentication works
46744 in Exim.
46745 </para>
46746 <para>
46747 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
46748 per-mechanism basis.  Please read carefully to determine which variables hold
46749 account labels such as usercodes and which hold passwords or other
46750 authenticating data.
46751 </para>
46752 <para>
46753 Note that some mechanisms support two different identifiers for accounts: the
46754 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
46755 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
46756 Conceptually, authentication data such as passwords are tied to the identifier
46757 used to authenticate; servers may have rules to permit one user to act as a
46758 second user, so that after login the session is treated as though that second
46759 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
46760 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
46761 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
46762 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
46763 choose to honour.
46764 </para>
46765 <para>
46766 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
46767 to a client to help it select an account and credentials to use.  In some
46768 mechanisms, the client and server provably agree on the realm, but clients
46769 typically can not treat the realm as secure data to be blindly trusted.
46770 </para>
46771 <section id="SECID168">
46772 <title>Generic options for authenticators</title>
46773 <para>
46774 <indexterm role="concept">
46775 <primary>authentication</primary>
46776 <secondary>generic options</secondary>
46777 </indexterm>
46778 <indexterm role="concept">
46779 <primary>options</primary>
46780 <secondary>generic; for authenticators</secondary>
46781 </indexterm>
46782 </para>
46783 <para>
46784 <indexterm role="option">
46785 <primary><option>client_condition</option></primary>
46786 </indexterm>
46787 </para>
46788 <informaltable frame="all">
46789 <tgroup cols="4" colsep="0" rowsep="0">
46790 <colspec colwidth="8*" align="left"/>
46791 <colspec colwidth="6*" align="center"/>
46792 <colspec colwidth="6*" align="center"/>
46793 <colspec colwidth="6*" align="right"/>
46794 <tbody>
46795 <row>
46796 <entry><option>client_condition</option></entry>
46797 <entry>Use: <emphasis>authenticators</emphasis></entry>
46798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46799 <entry>Default: <emphasis>unset</emphasis></entry>
46800 </row>
46801 </tbody>
46802 </tgroup>
46803 </informaltable>
46804 <para>
46805 When Exim is authenticating as a client, it skips any authenticator whose
46806 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
46807 used, for example, to skip plain text authenticators when the connection is not
46808 encrypted by a setting such as:
46809 </para>
46810 <literallayout class="monospaced">
46811 client_condition = ${if !eq{$tls_out_cipher}{}}
46812 </literallayout>
46813 <para revisionflag="changed">
46814 <indexterm role="option">
46815 <primary><option>client_set_id</option></primary>
46816 </indexterm>
46817 </para>
46818 <informaltable frame="all" revisionflag="changed">
46819 <tgroup cols="4" colsep="0" rowsep="0">
46820 <colspec colwidth="8*" align="left"/>
46821 <colspec colwidth="6*" align="center"/>
46822 <colspec colwidth="6*" align="center"/>
46823 <colspec colwidth="6*" align="right"/>
46824 <tbody>
46825 <row>
46826 <entry><option>client_set_id</option></entry>
46827 <entry>Use: <emphasis>authenticators</emphasis></entry>
46828 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46829 <entry>Default: <emphasis>unset</emphasis></entry>
46830 </row>
46831 </tbody>
46832 </tgroup>
46833 </informaltable>
46834 <para revisionflag="changed">
46835 When client authentication succeeds, this condition is expanded; the
46836 result is used in the log lines for outbound messasges.
46837 Typically it will be the user name used for authentication.
46838 </para>
46839 <para>
46840 <indexterm role="option">
46841 <primary><option>driver</option></primary>
46842 </indexterm>
46843 </para>
46844 <informaltable frame="all">
46845 <tgroup cols="4" colsep="0" rowsep="0">
46846 <colspec colwidth="8*" align="left"/>
46847 <colspec colwidth="6*" align="center"/>
46848 <colspec colwidth="6*" align="center"/>
46849 <colspec colwidth="6*" align="right"/>
46850 <tbody>
46851 <row>
46852 <entry><option>driver</option></entry>
46853 <entry>Use: <emphasis>authenticators</emphasis></entry>
46854 <entry>Type: <emphasis>string</emphasis></entry>
46855 <entry>Default: <emphasis>unset</emphasis></entry>
46856 </row>
46857 </tbody>
46858 </tgroup>
46859 </informaltable>
46860 <para>
46861 This option must always be set. It specifies which of the available
46862 authenticators is to be used.
46863 </para>
46864 <para>
46865 <indexterm role="option">
46866 <primary><option>public_name</option></primary>
46867 </indexterm>
46868 </para>
46869 <informaltable frame="all">
46870 <tgroup cols="4" colsep="0" rowsep="0">
46871 <colspec colwidth="8*" align="left"/>
46872 <colspec colwidth="6*" align="center"/>
46873 <colspec colwidth="6*" align="center"/>
46874 <colspec colwidth="6*" align="right"/>
46875 <tbody>
46876 <row>
46877 <entry><option>public_name</option></entry>
46878 <entry>Use: <emphasis>authenticators</emphasis></entry>
46879 <entry>Type: <emphasis>string</emphasis></entry>
46880 <entry>Default: <emphasis>unset</emphasis></entry>
46881 </row>
46882 </tbody>
46883 </tgroup>
46884 </informaltable>
46885 <para>
46886 This option specifies the name of the authentication mechanism that the driver
46887 implements, and by which it is known to the outside world. These names should
46888 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
46889 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
46890 defaults to the driver&#x2019;s instance name.
46891 </para>
46892 <para>
46893 <indexterm role="option">
46894 <primary><option>server_advertise_condition</option></primary>
46895 </indexterm>
46896 </para>
46897 <informaltable frame="all">
46898 <tgroup cols="4" colsep="0" rowsep="0">
46899 <colspec colwidth="8*" align="left"/>
46900 <colspec colwidth="6*" align="center"/>
46901 <colspec colwidth="6*" align="center"/>
46902 <colspec colwidth="6*" align="right"/>
46903 <tbody>
46904 <row>
46905 <entry><option>server_advertise_condition</option></entry>
46906 <entry>Use: <emphasis>authenticators</emphasis></entry>
46907 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46908 <entry>Default: <emphasis>unset</emphasis></entry>
46909 </row>
46910 </tbody>
46911 </tgroup>
46912 </informaltable>
46913 <para>
46914 When a server is about to advertise an authentication mechanism, the condition
46915 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
46916 mechanism is not advertised.
46917 If the expansion fails, the mechanism is not advertised. If the failure was not
46918 forced, and was not caused by a lookup defer, the incident is logged.
46919 See section <xref linkend="SECTauthexiser"/> below for further discussion.
46920 </para>
46921 <para>
46922 <indexterm role="option">
46923 <primary><option>server_condition</option></primary>
46924 </indexterm>
46925 </para>
46926 <informaltable frame="all">
46927 <tgroup cols="4" colsep="0" rowsep="0">
46928 <colspec colwidth="8*" align="left"/>
46929 <colspec colwidth="6*" align="center"/>
46930 <colspec colwidth="6*" align="center"/>
46931 <colspec colwidth="6*" align="right"/>
46932 <tbody>
46933 <row>
46934 <entry><option>server_condition</option></entry>
46935 <entry>Use: <emphasis>authenticators</emphasis></entry>
46936 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46937 <entry>Default: <emphasis>unset</emphasis></entry>
46938 </row>
46939 </tbody>
46940 </tgroup>
46941 </informaltable>
46942 <para>
46943 This option must be set for a <option>plaintext</option> server authenticator, where it
46944 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
46945 for details.
46946 </para>
46947 <para>
46948 For the <command>gsasl</command> authenticator, this option is required for various
46949 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
46950 </para>
46951 <para>
46952 For the other authenticators, <option>server_condition</option> can be used as an additional
46953 authentication or authorization mechanism that is applied after the other
46954 authenticator conditions succeed. If it is set, it is expanded when the
46955 authenticator would otherwise return a success code. If the expansion is forced
46956 to fail, authentication fails. Any other expansion failure causes a temporary
46957 error code to be returned. If the result of a successful expansion is an empty
46958 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
46959 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
46960 other result, a temporary error code is returned, with the expanded string as
46961 the error text.
46962 </para>
46963 <para>
46964 <indexterm role="option">
46965 <primary><option>server_debug_print</option></primary>
46966 </indexterm>
46967 </para>
46968 <informaltable frame="all">
46969 <tgroup cols="4" colsep="0" rowsep="0">
46970 <colspec colwidth="8*" align="left"/>
46971 <colspec colwidth="6*" align="center"/>
46972 <colspec colwidth="6*" align="center"/>
46973 <colspec colwidth="6*" align="right"/>
46974 <tbody>
46975 <row>
46976 <entry><option>server_debug_print</option></entry>
46977 <entry>Use: <emphasis>authenticators</emphasis></entry>
46978 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46979 <entry>Default: <emphasis>unset</emphasis></entry>
46980 </row>
46981 </tbody>
46982 </tgroup>
46983 </informaltable>
46984 <para>
46985 If this option is set and authentication debugging is enabled (see the <option>-d</option>
46986 command line option), the string is expanded and included in the debugging
46987 output when the authenticator is run as a server. This can help with checking
46988 out the values of variables.
46989 If expansion of the string fails, the error message is written to the debugging
46990 output, and Exim carries on processing.
46991 </para>
46992 <para>
46993 <indexterm role="option">
46994 <primary><option>server_set_id</option></primary>
46995 </indexterm>
46996 </para>
46997 <informaltable frame="all">
46998 <tgroup cols="4" colsep="0" rowsep="0">
46999 <colspec colwidth="8*" align="left"/>
47000 <colspec colwidth="6*" align="center"/>
47001 <colspec colwidth="6*" align="center"/>
47002 <colspec colwidth="6*" align="right"/>
47003 <tbody>
47004 <row>
47005 <entry><option>server_set_id</option></entry>
47006 <entry>Use: <emphasis>authenticators</emphasis></entry>
47007 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47008 <entry>Default: <emphasis>unset</emphasis></entry>
47009 </row>
47010 </tbody>
47011 </tgroup>
47012 </informaltable>
47013 <para>
47014 <indexterm role="variable">
47015 <primary><varname>$authenticated_id</varname></primary>
47016 </indexterm>
47017 When an Exim server successfully authenticates a client, this string is
47018 expanded using data from the authentication, and preserved for any incoming
47019 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
47020 lines for incoming messages. For example, a user/password authenticator
47021 configuration might preserve the user name that was used to authenticate, and
47022 refer to it subsequently during delivery of the message.
47023 If expansion fails, the option is ignored.
47024 </para>
47025 <para>
47026 <indexterm role="option">
47027 <primary><option>server_mail_auth_condition</option></primary>
47028 </indexterm>
47029 </para>
47030 <informaltable frame="all">
47031 <tgroup cols="4" colsep="0" rowsep="0">
47032 <colspec colwidth="8*" align="left"/>
47033 <colspec colwidth="6*" align="center"/>
47034 <colspec colwidth="6*" align="center"/>
47035 <colspec colwidth="6*" align="right"/>
47036 <tbody>
47037 <row>
47038 <entry><option>server_mail_auth_condition</option></entry>
47039 <entry>Use: <emphasis>authenticators</emphasis></entry>
47040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47041 <entry>Default: <emphasis>unset</emphasis></entry>
47042 </row>
47043 </tbody>
47044 </tgroup>
47045 </informaltable>
47046 <para>
47047 This option allows a server to discard authenticated sender addresses supplied
47048 as part of MAIL commands in SMTP connections that are authenticated by the
47049 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
47050 as part of the authentication process; instead its (unexpanded) value is
47051 remembered for later use.
47052 How it is used is described in the following section.
47053 </para>
47054 </section>
47055 <section id="SECTauthparamail">
47056 <title>The AUTH parameter on MAIL commands</title>
47057 <para>
47058 <indexterm role="concept">
47059 <primary>authentication</primary>
47060 <secondary>sender; authenticated</secondary>
47061 </indexterm>
47062 <indexterm role="concept">
47063 <primary>AUTH</primary>
47064 <secondary>on MAIL command</secondary>
47065 </indexterm>
47066 When a client supplied an AUTH= item on a MAIL command, Exim applies
47067 the following checks before accepting it as the authenticated sender of the
47068 message:
47069 </para>
47070 <itemizedlist>
47071 <listitem>
47072 <para>
47073 If the connection is not using extended SMTP (that is, HELO was used rather
47074 than EHLO), the use of AUTH= is a syntax error.
47075 </para>
47076 </listitem>
47077 <listitem>
47078 <para>
47079 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
47080 </para>
47081 </listitem>
47082 <listitem>
47083 <para>
47084 <indexterm role="variable">
47085 <primary><varname>$authenticated_sender</varname></primary>
47086 </indexterm>
47087 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
47088 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
47089 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
47090 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
47091 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
47092 given for the MAIL command.
47093 </para>
47094 </listitem>
47095 <listitem>
47096 <para>
47097 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
47098 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
47099 authenticated.
47100 </para>
47101 </listitem>
47102 <listitem>
47103 <para>
47104 If the AUTH= value was accepted by either of the two previous rules, and
47105 the client has authenticated, and the authenticator has a setting for the
47106 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
47107 valued that was saved from the authenticator is expanded. If the expansion
47108 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
47109 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
47110 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
47111 message.
47112 </para>
47113 </listitem>
47114 </itemizedlist>
47115 <para>
47116 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
47117 hosts to which Exim authenticates as a client. Do not confuse this value with
47118 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
47119 process, and which is not usually a complete email address.
47120 </para>
47121 <para>
47122 <indexterm role="variable">
47123 <primary><varname>$sender_address</varname></primary>
47124 </indexterm>
47125 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
47126 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
47127 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
47128 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
47129 ACL is run.
47130 </para>
47131 </section>
47132 <section id="SECTauthexiser">
47133 <title>Authentication on an Exim server</title>
47134 <para>
47135 <indexterm role="concept">
47136 <primary>authentication</primary>
47137 <secondary>on an Exim server</secondary>
47138 </indexterm>
47139 When Exim receives an EHLO command, it advertises the public names of those
47140 authenticators that are configured as servers, subject to the following
47141 conditions:
47142 </para>
47143 <itemizedlist>
47144 <listitem>
47145 <para>
47146 The client host must match <option>auth_advertise_hosts</option> (default *).
47147 </para>
47148 </listitem>
47149 <listitem>
47150 <para>
47151 It the <option>server_advertise_condition</option> option is set, its expansion must not
47152 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
47153 </para>
47154 </listitem>
47155 </itemizedlist>
47156 <para>
47157 The order in which the authenticators are defined controls the order in which
47158 the mechanisms are advertised.
47159 </para>
47160 <para>
47161 Some mail clients (for example, some versions of Netscape) require the user to
47162 provide a name and password for authentication whenever AUTH is advertised,
47163 even though authentication may not in fact be needed (for example, Exim may be
47164 set up to allow unconditional relaying from the client by an IP address check).
47165 You can make such clients more friendly by not advertising AUTH to them.
47166 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
47167 that runs for RCPT) to relay without authentication, you should set
47168 </para>
47169 <literallayout class="monospaced">
47170 auth_advertise_hosts = ! 10.9.8.0/24
47171 </literallayout>
47172 <para>
47173 so that no authentication mechanisms are advertised to them.
47174 </para>
47175 <para>
47176 The <option>server_advertise_condition</option> controls the advertisement of individual
47177 authentication mechanisms. For example, it can be used to restrict the
47178 advertisement of a particular mechanism to encrypted connections, by a setting
47179 such as:
47180 </para>
47181 <literallayout class="monospaced">
47182 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
47183 </literallayout>
47184 <para>
47185 <indexterm role="variable">
47186 <primary><varname>$tls_in_cipher</varname></primary>
47187 </indexterm>
47188 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
47189 yields <quote>yes</quote>, which allows the advertisement to happen.
47190 </para>
47191 <para>
47192 When an Exim server receives an AUTH command from a client, it rejects it
47193 immediately if AUTH was not advertised in response to an earlier EHLO
47194 command. This is the case if
47195 </para>
47196 <itemizedlist>
47197 <listitem>
47198 <para>
47199 The client host does not match <option>auth_advertise_hosts</option>; or
47200 </para>
47201 </listitem>
47202 <listitem>
47203 <para>
47204 No authenticators are configured with server options; or
47205 </para>
47206 </listitem>
47207 <listitem>
47208 <para>
47209 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
47210 server authenticators.
47211 </para>
47212 </listitem>
47213 </itemizedlist>
47214 <para>
47215 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
47216 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
47217 AUTH is accepted from any client host.
47218 </para>
47219 <para>
47220 If AUTH is not rejected by the ACL, Exim searches its configuration for a
47221 server authentication mechanism that was advertised in response to EHLO and
47222 that matches the one named in the AUTH command. If it finds one, it runs
47223 the appropriate authentication protocol, and authentication either succeeds or
47224 fails. If there is no matching advertised mechanism, the AUTH command is
47225 rejected with a 504 error.
47226 </para>
47227 <para>
47228 <indexterm role="variable">
47229 <primary><varname>$received_protocol</varname></primary>
47230 </indexterm>
47231 <indexterm role="variable">
47232 <primary><varname>$sender_host_authenticated</varname></primary>
47233 </indexterm>
47234 When a message is received from an authenticated host, the value of
47235 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
47236 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
47237 public name) of the authenticator driver that successfully authenticated the
47238 client from which the message was received. This variable is empty if there was
47239 no successful authentication.
47240 </para>
47241 </section>
47242 <section id="SECID169">
47243 <title>Testing server authentication</title>
47244 <para>
47245 <indexterm role="concept">
47246 <primary>authentication</primary>
47247 <secondary>testing a server</secondary>
47248 </indexterm>
47249 <indexterm role="concept">
47250 <primary>AUTH</primary>
47251 <secondary>testing a server</secondary>
47252 </indexterm>
47253 <indexterm role="concept">
47254 <primary>base64 encoding</primary>
47255 <secondary>creating authentication test data</secondary>
47256 </indexterm>
47257 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
47258 configurations. The data for the AUTH command has to be sent using base64
47259 encoding. A quick way to produce such data for testing is the following Perl
47260 script:
47261 </para>
47262 <literallayout class="monospaced">
47263 use MIME::Base64;
47264 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
47265 </literallayout>
47266 <para>
47267 <indexterm role="concept">
47268 <primary>binary zero</primary>
47269 <secondary>in authentication data</secondary>
47270 </indexterm>
47271 This interprets its argument as a Perl string, and then encodes it. The
47272 interpretation as a Perl string allows binary zeros, which are required for
47273 some kinds of authentication, to be included in the data. For example, a
47274 command line to run this script on such data might be
47275 </para>
47276 <literallayout class="monospaced">
47277 encode '\0user\0password'
47278 </literallayout>
47279 <para>
47280 Note the use of single quotes to prevent the shell interpreting the
47281 backslashes, so that they can be interpreted by Perl to specify characters
47282 whose code value is zero.
47283 </para>
47284 <para>
47285 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
47286 digit, you must use three zeros instead of one after the leading backslash. If
47287 you do not, the octal digit that starts your string will be incorrectly
47288 interpreted as part of the code for the first character.
47289 </para>
47290 <para>
47291 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
47292 specially, you must use a Perl escape to prevent them being misinterpreted. For
47293 example, a command such as
47294 </para>
47295 <literallayout class="monospaced">
47296 encode '\0user@domain.com\0pas$$word'
47297 </literallayout>
47298 <para>
47299 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
47300 </para>
47301 <para>
47302 If you have the <option>mimencode</option> command installed, another way to do produce
47303 base64-encoded strings is to run the command
47304 </para>
47305 <literallayout class="monospaced">
47306 echo -e -n `\0user\0password' | mimencode
47307 </literallayout>
47308 <para>
47309 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
47310 in the argument, and the <option>-n</option> option specifies no newline at the end of its
47311 output. However, not all versions of <option>echo</option> recognize these options, so you
47312 should check your version before relying on this suggestion.
47313 </para>
47314 </section>
47315 <section id="SECID170">
47316 <title>Authentication by an Exim client</title>
47317 <para>
47318 <indexterm role="concept">
47319 <primary>authentication</primary>
47320 <secondary>on an Exim client</secondary>
47321 </indexterm>
47322 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
47323 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
47324 announces support for authentication, and the host matches an entry in either
47325 of these options, Exim (as a client) tries to authenticate as follows:
47326 </para>
47327 <itemizedlist>
47328 <listitem>
47329 <para>
47330 For each authenticator that is configured as a client, in the order in which
47331 they are defined in the configuration, it searches the authentication
47332 mechanisms announced by the server for one whose name matches the public name
47333 of the authenticator.
47334 </para>
47335 </listitem>
47336 <listitem>
47337 <para>
47338 <indexterm role="variable">
47339 <primary><varname>$host</varname></primary>
47340 </indexterm>
47341 <indexterm role="variable">
47342 <primary><varname>$host_address</varname></primary>
47343 </indexterm>
47344 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
47345 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
47346 that the client might do. They are set to the server&#x2019;s name and IP address. If
47347 any expansion is forced to fail, the authentication attempt is abandoned, and
47348 Exim moves on to the next authenticator. Otherwise an expansion failure causes
47349 delivery to be deferred.
47350 </para>
47351 </listitem>
47352 <listitem>
47353 <para>
47354 If the result of the authentication attempt is a temporary error or a timeout,
47355 Exim abandons trying to send the message to the host for the moment. It will
47356 try again later. If there are any backup hosts available, they are tried in the
47357 usual way.
47358 </para>
47359 </listitem>
47360 <listitem>
47361 <para>
47362 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
47363 carries on searching the list of authenticators and tries another one if
47364 possible. If all authentication attempts give permanent errors, or if there are
47365 no attempts because no mechanisms match (or option expansions force failure),
47366 what happens depends on whether the host matches <option>hosts_require_auth</option> or
47367 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
47368 delivery is deferred. The error can be detected in the retry rules, and thereby
47369 turned into a permanent error if you wish. In the second case, Exim tries to
47370 deliver the message unauthenticated.
47371 </para>
47372 </listitem>
47373 </itemizedlist>
47374 <para>
47375 <indexterm role="concept">
47376 <primary>AUTH</primary>
47377 <secondary>on MAIL command</secondary>
47378 </indexterm>
47379 When Exim has authenticated itself to a remote server, it adds the AUTH
47380 parameter to the MAIL commands it sends, if it has an authenticated sender for
47381 the message. If the message came from a remote host, the authenticated sender
47382 is the one that was receiving on an incoming MAIL command, provided that the
47383 incoming connection was authenticated and the <option>server_mail_auth</option> condition
47384 allowed the authenticated sender to be retained. If a local process calls Exim
47385 to send a message, the sender address that is built from the login name and
47386 <option>qualify_domain</option> is treated as authenticated. However, if the
47387 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
47388 the authenticated sender that was received with the message.
47389 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
47390 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
47391 </para>
47392 </section>
47393 </chapter>
47394
47395 <chapter id="CHAPplaintext">
47396 <title>The plaintext authenticator</title>
47397 <para>
47398 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
47399 <primary><command>plaintext</command> authenticator</primary>
47400 </indexterm>
47401 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
47402 <primary>authenticators</primary>
47403 <secondary><command>plaintext</command></secondary>
47404 </indexterm>
47405 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
47406 LOGIN authentication mechanisms, both of which transfer authentication data as
47407 plain (unencrypted) text (though base64 encoded). The use of plain text is a
47408 security risk; you are strongly advised to insist on the use of SMTP encryption
47409 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
47410 use unencrypted plain text, you should not use the same passwords for SMTP
47411 connections as you do for login accounts.
47412 </para>
47413 <section id="SECID171">
47414 <title>Plaintext options</title>
47415 <para>
47416 <indexterm role="concept">
47417 <primary>options</primary>
47418 <secondary><command>plaintext</command> authenticator (server)</secondary>
47419 </indexterm>
47420 When configured as a server, <command>plaintext</command> uses the following options:
47421 </para>
47422 <para>
47423 <indexterm role="option">
47424 <primary><option>server_condition</option></primary>
47425 </indexterm>
47426 </para>
47427 <informaltable frame="all">
47428 <tgroup cols="4" colsep="0" rowsep="0">
47429 <colspec colwidth="8*" align="left"/>
47430 <colspec colwidth="6*" align="center"/>
47431 <colspec colwidth="6*" align="center"/>
47432 <colspec colwidth="6*" align="right"/>
47433 <tbody>
47434 <row>
47435 <entry><option>server_condition</option></entry>
47436 <entry>Use: <emphasis>authenticators</emphasis></entry>
47437 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47438 <entry>Default: <emphasis>unset</emphasis></entry>
47439 </row>
47440 </tbody>
47441 </tgroup>
47442 </informaltable>
47443 <para>
47444 This is actually a global authentication option, but it must be set in order to
47445 configure the <command>plaintext</command> driver as a server. Its use is described below.
47446 </para>
47447 <para>
47448 <indexterm role="option">
47449 <primary><option>server_prompts</option></primary>
47450 </indexterm>
47451 </para>
47452 <informaltable frame="all">
47453 <tgroup cols="4" colsep="0" rowsep="0">
47454 <colspec colwidth="8*" align="left"/>
47455 <colspec colwidth="6*" align="center"/>
47456 <colspec colwidth="6*" align="center"/>
47457 <colspec colwidth="6*" align="right"/>
47458 <tbody>
47459 <row>
47460 <entry><option>server_prompts</option></entry>
47461 <entry>Use: <emphasis>plaintext</emphasis></entry>
47462 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47463 <entry>Default: <emphasis>unset</emphasis></entry>
47464 </row>
47465 </tbody>
47466 </tgroup>
47467 </informaltable>
47468 <para>
47469 The contents of this option, after expansion, must be a colon-separated list of
47470 prompt strings. If expansion fails, a temporary authentication rejection is
47471 given.
47472 </para>
47473 </section>
47474 <section id="SECTplainserver">
47475 <title>Using plaintext in a server</title>
47476 <para>
47477 <indexterm role="concept">
47478 <primary>AUTH</primary>
47479 <secondary>in <command>plaintext</command> authenticator</secondary>
47480 </indexterm>
47481 <indexterm role="concept">
47482 <primary>binary zero</primary>
47483 <secondary>in <command>plaintext</command> authenticator</secondary>
47484 </indexterm>
47485 <indexterm role="concept">
47486 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47487 <secondary>in <command>plaintext</command> authenticator</secondary>
47488 </indexterm>
47489 <indexterm role="variable">
47490 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
47491 </indexterm>
47492 <indexterm role="concept">
47493 <primary>base64 encoding</primary>
47494 <secondary>in <command>plaintext</command> authenticator</secondary>
47495 </indexterm>
47496 </para>
47497 <para>
47498 When running as a server, <command>plaintext</command> performs the authentication test by
47499 expanding a string. The data sent by the client with the AUTH command, or in
47500 response to subsequent prompts, is base64 encoded, and so may contain any byte
47501 values when decoded. If any data is supplied with the command, it is treated as
47502 a list of strings, separated by NULs (binary zeros), the first three of which
47503 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
47504 (neither LOGIN nor PLAIN uses more than three strings).
47505 </para>
47506 <para>
47507 For compatibility with previous releases of Exim, the values are also placed in
47508 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
47509 variables for this purpose is now deprecated, as it can lead to confusion in
47510 string expansions that also use them for other things.
47511 </para>
47512 <para>
47513 If there are more strings in <option>server_prompts</option> than the number of strings
47514 supplied with the AUTH command, the remaining prompts are used to obtain more
47515 data. Each response from the client may be a list of NUL-separated strings.
47516 </para>
47517 <para>
47518 <indexterm role="variable">
47519 <primary><varname>$authenticated_id</varname></primary>
47520 </indexterm>
47521 Once a sufficient number of data strings have been received,
47522 <option>server_condition</option> is expanded. If the expansion is forced to fail,
47523 authentication fails. Any other expansion failure causes a temporary error code
47524 to be returned. If the result of a successful expansion is an empty string,
47525 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
47526 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
47527 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
47528 For any other result, a temporary error code is returned, with the expanded
47529 string as the error text
47530 <phrase revisionflag="changed">, and the failed id saved in <varname>$authenticated_fail_id</varname>.</phrase>
47531 </para>
47532 <para>
47533 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
47534 password, be sure to make the authentication fail if the user is unknown.
47535 There are good and bad examples at the end of the next section.
47536 </para>
47537 </section>
47538 <section id="SECID172">
47539 <title>The PLAIN authentication mechanism</title>
47540 <para>
47541 <indexterm role="concept">
47542 <primary>PLAIN authentication mechanism</primary>
47543 </indexterm>
47544 <indexterm role="concept">
47545 <primary>authentication</primary>
47546 <secondary>PLAIN mechanism</secondary>
47547 </indexterm>
47548 <indexterm role="concept">
47549 <primary>binary zero</primary>
47550 <secondary>in <command>plaintext</command> authenticator</secondary>
47551 </indexterm>
47552 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
47553 sent as one item of data (that is, one combined string containing two NUL
47554 separators). The data is sent either as part of the AUTH command, or
47555 subsequently in response to an empty prompt from the server.
47556 </para>
47557 <para>
47558 The second and third strings are a user name and a corresponding password.
47559 Using a single fixed user name and password as an example, this could be
47560 configured as follows:
47561 </para>
47562 <literallayout class="monospaced">
47563 fixed_plain:
47564   driver = plaintext
47565   public_name = PLAIN
47566   server_prompts = :
47567   server_condition = \
47568     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
47569   server_set_id = $auth2
47570 </literallayout>
47571 <para>
47572 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
47573 are exactly what we want here, so they need not be specified. Obviously, if the
47574 password contains expansion-significant characters such as dollar, backslash,
47575 or closing brace, they have to be escaped.
47576 </para>
47577 <para>
47578 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
47579 the end of a string list are ignored). If all the data comes as part of the
47580 AUTH command, as is commonly the case, the prompt is not used. This
47581 authenticator is advertised in the response to EHLO as
47582 </para>
47583 <literallayout class="monospaced">
47584 250-AUTH PLAIN
47585 </literallayout>
47586 <para>
47587 and a client host can authenticate itself by sending the command
47588 </para>
47589 <literallayout class="monospaced">
47590 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
47591 </literallayout>
47592 <para>
47593 As this contains three strings (more than the number of prompts), no further
47594 data is required from the client. Alternatively, the client may just send
47595 </para>
47596 <literallayout class="monospaced">
47597 AUTH PLAIN
47598 </literallayout>
47599 <para>
47600 to initiate authentication, in which case the server replies with an empty
47601 prompt. The client must respond with the combined data string.
47602 </para>
47603 <para>
47604 The data string is base64 encoded, as required by the RFC. This example,
47605 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;
47606 represents a zero byte. This is split up into three strings, the first of which
47607 is empty. The <option>server_condition</option> option in the authenticator checks that the
47608 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
47609 </para>
47610 <para>
47611 Having just one fixed user name and password, as in this example, is not very
47612 realistic, though for a small organization with only a handful of
47613 authenticating clients it could make sense.
47614 </para>
47615 <para>
47616 A more sophisticated instance of this authenticator could use the user name in
47617 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
47618 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
47619 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
47620 This is an incorrect example:
47621 </para>
47622 <literallayout class="monospaced">
47623 server_condition = \
47624   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
47625 </literallayout>
47626 <para>
47627 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
47628 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
47629 incorrect? It works fine for existing users, but consider what happens if a
47630 non-existent user name is given. The lookup fails, but as no success/failure
47631 strings are given for the lookup, it yields an empty string. Thus, to defeat
47632 the authentication, all a client has to do is to supply a non-existent user
47633 name and an empty password. The correct way of writing this test is:
47634 </para>
47635 <literallayout class="monospaced">
47636 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
47637   {${if eq{$value}{$auth3}}} {false}}
47638 </literallayout>
47639 <para>
47640 In this case, if the lookup succeeds, the result is checked; if the lookup
47641 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
47642 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
47643 always fails if its second argument is empty. However, the second way of
47644 writing the test makes the logic clearer.
47645 </para>
47646 </section>
47647 <section id="SECID173">
47648 <title>The LOGIN authentication mechanism</title>
47649 <para>
47650 <indexterm role="concept">
47651 <primary>LOGIN authentication mechanism</primary>
47652 </indexterm>
47653 <indexterm role="concept">
47654 <primary>authentication</primary>
47655 <secondary>LOGIN mechanism</secondary>
47656 </indexterm>
47657 The LOGIN authentication mechanism is not documented in any RFC, but is in use
47658 in a number of programs. No data is sent with the AUTH command. Instead, a
47659 user name and password are supplied separately, in response to prompts. The
47660 plaintext authenticator can be configured to support this as in this example:
47661 </para>
47662 <literallayout class="monospaced">
47663 fixed_login:
47664   driver = plaintext
47665   public_name = LOGIN
47666   server_prompts = User Name : Password
47667   server_condition = \
47668     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
47669   server_set_id = $auth1
47670 </literallayout>
47671 <para>
47672 Because of the way plaintext operates, this authenticator accepts data supplied
47673 with the AUTH command (in contravention of the specification of LOGIN), but
47674 if the client does not supply it (as is the case for LOGIN clients), the prompt
47675 strings are used to obtain two data items.
47676 </para>
47677 <para>
47678 Some clients are very particular about the precise text of the prompts. For
47679 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
47680 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
47681 strings. It uses the <option>ldapauth</option> expansion condition to check the user
47682 name and password by binding to an LDAP server:
47683 </para>
47684 <literallayout class="monospaced">
47685 login:
47686   driver = plaintext
47687   public_name = LOGIN
47688   server_prompts = Username:: : Password::
47689   server_condition = ${if and{{ \
47690     !eq{}{$auth1} }{ \
47691     ldapauth{\
47692       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
47693       pass=${quote:$auth2} \
47694       ldap://ldap.example.org/} }} }
47695   server_set_id = uid=$auth1,ou=people,o=example.org
47696 </literallayout>
47697 <para>
47698 We have to check that the username is not empty before using it, because LDAP
47699 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
47700 operator to correctly quote the DN for authentication. However, the basic
47701 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
47702 correct one to use for the password, because quoting is needed only to make
47703 the password conform to the Exim syntax. At the LDAP level, the password is an
47704 uninterpreted string.
47705 </para>
47706 </section>
47707 <section id="SECID174">
47708 <title>Support for different kinds of authentication</title>
47709 <para>
47710 A number of string expansion features are provided for the purpose of
47711 interfacing to different ways of user authentication. These include checking
47712 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
47713 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
47714 <xref linkend="SECTexpcond"/>.
47715 </para>
47716 </section>
47717 <section id="SECID175">
47718 <title>Using plaintext in a client</title>
47719 <para>
47720 <indexterm role="concept">
47721 <primary>options</primary>
47722 <secondary><command>plaintext</command> authenticator (client)</secondary>
47723 </indexterm>
47724 The <command>plaintext</command> authenticator has two client options:
47725 </para>
47726 <para>
47727 <indexterm role="option">
47728 <primary><option>client_ignore_invalid_base64</option></primary>
47729 </indexterm>
47730 </para>
47731 <informaltable frame="all">
47732 <tgroup cols="4" colsep="0" rowsep="0">
47733 <colspec colwidth="8*" align="left"/>
47734 <colspec colwidth="6*" align="center"/>
47735 <colspec colwidth="6*" align="center"/>
47736 <colspec colwidth="6*" align="right"/>
47737 <tbody>
47738 <row>
47739 <entry><option>client_ignore_invalid_base64</option></entry>
47740 <entry>Use: <emphasis>plaintext</emphasis></entry>
47741 <entry>Type: <emphasis>boolean</emphasis></entry>
47742 <entry>Default: <emphasis>false</emphasis></entry>
47743 </row>
47744 </tbody>
47745 </tgroup>
47746 </informaltable>
47747 <para>
47748 If the client receives a server prompt that is not a valid base64 string,
47749 authentication is abandoned by default. However, if this option is set true,
47750 the error in the challenge is ignored and the client sends the response as
47751 usual.
47752 </para>
47753 <para>
47754 <indexterm role="option">
47755 <primary><option>client_send</option></primary>
47756 </indexterm>
47757 </para>
47758 <informaltable frame="all">
47759 <tgroup cols="4" colsep="0" rowsep="0">
47760 <colspec colwidth="8*" align="left"/>
47761 <colspec colwidth="6*" align="center"/>
47762 <colspec colwidth="6*" align="center"/>
47763 <colspec colwidth="6*" align="right"/>
47764 <tbody>
47765 <row>
47766 <entry><option>client_send</option></entry>
47767 <entry>Use: <emphasis>plaintext</emphasis></entry>
47768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47769 <entry>Default: <emphasis>unset</emphasis></entry>
47770 </row>
47771 </tbody>
47772 </tgroup>
47773 </informaltable>
47774 <para>
47775 The string is a colon-separated list of authentication data strings. Each
47776 string is independently expanded before being sent to the server. The first
47777 string is sent with the AUTH command; any more strings are sent in response
47778 to prompts from the server. Before each string is expanded, the value of the
47779 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
47780 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
47781 way. Thus, the prompt that is received in response to sending the first string
47782 (with the AUTH command) can be used in the expansion of the second string, and
47783 so on. If an invalid base64 string is received when
47784 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
47785 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
47786 </para>
47787 <para>
47788 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
47789 splitting takes priority and happens first.
47790 </para>
47791 <para>
47792 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
47793 the data, further processing is applied to each string before it is sent. If
47794 there are any single circumflex characters in the string, they are converted to
47795 NULs. Should an actual circumflex be required as data, it must be doubled in
47796 the string.
47797 </para>
47798 <para>
47799 This is an example of a client configuration that implements the PLAIN
47800 authentication mechanism with a fixed user name and password:
47801 </para>
47802 <literallayout class="monospaced">
47803 fixed_plain:
47804   driver = plaintext
47805   public_name = PLAIN
47806   client_send = ^username^mysecret
47807 </literallayout>
47808 <para>
47809 The lack of colons means that the entire text is sent with the AUTH
47810 command, with the circumflex characters converted to NULs. A similar example
47811 that uses the LOGIN mechanism is:
47812 </para>
47813 <literallayout class="monospaced">
47814 fixed_login:
47815   driver = plaintext
47816   public_name = LOGIN
47817   client_send = : username : mysecret
47818 </literallayout>
47819 <para>
47820 The initial colon means that the first string is empty, so no data is sent with
47821 the AUTH command itself. The remaining strings are sent in response to
47822 prompts.
47823 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
47824 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
47825 </para>
47826 </section>
47827 </chapter>
47828
47829 <chapter id="CHID9">
47830 <title>The cram_md5 authenticator</title>
47831 <para>
47832 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
47833 <primary><command>cram_md5</command> authenticator</primary>
47834 </indexterm>
47835 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
47836 <primary>authenticators</primary>
47837 <secondary><command>cram_md5</command></secondary>
47838 </indexterm>
47839 <indexterm role="concept">
47840 <primary>CRAM-MD5 authentication mechanism</primary>
47841 </indexterm>
47842 <indexterm role="concept">
47843 <primary>authentication</primary>
47844 <secondary>CRAM-MD5 mechanism</secondary>
47845 </indexterm>
47846 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
47847 sends a challenge string to the client, and the response consists of a user
47848 name and the CRAM-MD5 digest of the challenge string combined with a secret
47849 string (password) which is known to both server and client. Thus, the secret
47850 is not sent over the network as plain text, which makes this authenticator more
47851 secure than <command>plaintext</command>. However, the downside is that the secret has to be
47852 available in plain text at either end.
47853 </para>
47854 <section id="SECID176">
47855 <title>Using cram_md5 as a server</title>
47856 <para>
47857 <indexterm role="concept">
47858 <primary>options</primary>
47859 <secondary><command>cram_md5</command> authenticator (server)</secondary>
47860 </indexterm>
47861 This authenticator has one server option, which must be set to configure the
47862 authenticator as a server:
47863 </para>
47864 <para>
47865 <indexterm role="option">
47866 <primary><option>server_secret</option></primary>
47867 </indexterm>
47868 </para>
47869 <informaltable frame="all">
47870 <tgroup cols="4" colsep="0" rowsep="0">
47871 <colspec colwidth="8*" align="left"/>
47872 <colspec colwidth="6*" align="center"/>
47873 <colspec colwidth="6*" align="center"/>
47874 <colspec colwidth="6*" align="right"/>
47875 <tbody>
47876 <row>
47877 <entry><option>server_secret</option></entry>
47878 <entry>Use: <emphasis>cram_md5</emphasis></entry>
47879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47880 <entry>Default: <emphasis>unset</emphasis></entry>
47881 </row>
47882 </tbody>
47883 </tgroup>
47884 </informaltable>
47885 <para>
47886 <indexterm role="concept">
47887 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
47888 <secondary>in <command>cram_md5</command> authenticator</secondary>
47889 </indexterm>
47890 When the server receives the client&#x2019;s response, the user name is placed in
47891 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
47892 obtain the password for that user. The server then computes the CRAM-MD5 digest
47893 that the client should have sent, and checks that it received the correct
47894 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
47895 fails. If the expansion fails for some other reason, a temporary error code is
47896 returned to the client.
47897 </para>
47898 <para>
47899 For compatibility with previous releases of Exim, the user name is also placed
47900 in <varname>$1</varname>. However, the use of this variables for this purpose is now
47901 deprecated, as it can lead to confusion in string expansions that also use
47902 numeric variables for other things.
47903 </para>
47904 <para>
47905 For example, the following authenticator checks that the user name given by the
47906 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
47907 user name, authentication fails.
47908 </para>
47909 <literallayout class="monospaced">
47910 fixed_cram:
47911   driver = cram_md5
47912   public_name = CRAM-MD5
47913   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
47914   server_set_id = $auth1
47915 </literallayout>
47916 <para>
47917 <indexterm role="variable">
47918 <primary><varname>$authenticated_id</varname></primary>
47919 </indexterm>
47920 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
47921 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
47922 secret string in a file, using the user name as the key. For example:
47923 </para>
47924 <literallayout class="monospaced">
47925 lookup_cram:
47926   driver = cram_md5
47927   public_name = CRAM-MD5
47928   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
47929                   {$value}fail}
47930   server_set_id = $auth1
47931 </literallayout>
47932 <para>
47933 Note that this expansion explicitly forces failure if the lookup fails
47934 because <varname>$auth1</varname> contains an unknown user name.
47935 </para>
47936 <para>
47937 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
47938 using the relevant libraries, you need to know the realm to specify in the
47939 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
47940 realm, with:
47941 </para>
47942 <literallayout class="monospaced">
47943 cyrusless_crammd5:
47944   driver = cram_md5
47945   public_name = CRAM-MD5
47946   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
47947                   dbmjz{/etc/sasldb2}}
47948   server_set_id = $auth1
47949 </literallayout>
47950 </section>
47951 <section id="SECID177">
47952 <title>Using cram_md5 as a client</title>
47953 <para>
47954 <indexterm role="concept">
47955 <primary>options</primary>
47956 <secondary><command>cram_md5</command> authenticator (client)</secondary>
47957 </indexterm>
47958 When used as a client, the <command>cram_md5</command> authenticator has two options:
47959 </para>
47960 <para>
47961 <indexterm role="option">
47962 <primary><option>client_name</option></primary>
47963 </indexterm>
47964 </para>
47965 <informaltable frame="all">
47966 <tgroup cols="4" colsep="0" rowsep="0">
47967 <colspec colwidth="8*" align="left"/>
47968 <colspec colwidth="6*" align="center"/>
47969 <colspec colwidth="6*" align="center"/>
47970 <colspec colwidth="6*" align="right"/>
47971 <tbody>
47972 <row>
47973 <entry><option>client_name</option></entry>
47974 <entry>Use: <emphasis>cram_md5</emphasis></entry>
47975 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47976 <entry>Default: <emphasis>the primary host name</emphasis></entry>
47977 </row>
47978 </tbody>
47979 </tgroup>
47980 </informaltable>
47981 <para>
47982 This string is expanded, and the result used as the user name data when
47983 computing the response to the server&#x2019;s challenge.
47984 </para>
47985 <para>
47986 <indexterm role="option">
47987 <primary><option>client_secret</option></primary>
47988 </indexterm>
47989 </para>
47990 <informaltable frame="all">
47991 <tgroup cols="4" colsep="0" rowsep="0">
47992 <colspec colwidth="8*" align="left"/>
47993 <colspec colwidth="6*" align="center"/>
47994 <colspec colwidth="6*" align="center"/>
47995 <colspec colwidth="6*" align="right"/>
47996 <tbody>
47997 <row>
47998 <entry><option>client_secret</option></entry>
47999 <entry>Use: <emphasis>cram_md5</emphasis></entry>
48000 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48001 <entry>Default: <emphasis>unset</emphasis></entry>
48002 </row>
48003 </tbody>
48004 </tgroup>
48005 </informaltable>
48006 <para>
48007 This option must be set for the authenticator to work as a client. Its value is
48008 expanded and the result used as the secret string when computing the response.
48009 </para>
48010 <para>
48011 <indexterm role="variable">
48012 <primary><varname>$host</varname></primary>
48013 </indexterm>
48014 <indexterm role="variable">
48015 <primary><varname>$host_address</varname></primary>
48016 </indexterm>
48017 Different user names and secrets can be used for different servers by referring
48018 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
48019 expansion string is treated as an indication that this authenticator is not
48020 prepared to handle this case. Exim moves on to the next configured client
48021 authenticator. Any other expansion failure causes Exim to give up trying to
48022 send the message to the current server.
48023 </para>
48024 <para>
48025 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
48026 strings, is:
48027 </para>
48028 <literallayout class="monospaced">
48029 fixed_cram:
48030   driver = cram_md5
48031   public_name = CRAM-MD5
48032   client_name = ph10
48033   client_secret = secret
48034 </literallayout>
48035 <para>
48036 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
48037 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
48038 </para>
48039 </section>
48040 </chapter>
48041
48042 <chapter id="CHID10">
48043 <title>The cyrus_sasl authenticator</title>
48044 <para>
48045 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
48046 <primary><command>cyrus_sasl</command> authenticator</primary>
48047 </indexterm>
48048 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
48049 <primary>authenticators</primary>
48050 <secondary><command>cyrus_sasl</command></secondary>
48051 </indexterm>
48052 <indexterm role="concept">
48053 <primary>Cyrus</primary>
48054 <secondary>SASL library</secondary>
48055 </indexterm>
48056 <indexterm role="concept">
48057 <primary>Kerberos</primary>
48058 </indexterm>
48059 The code for this authenticator was provided by Matthew Byng-Maddick of A L
48060 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
48061 </para>
48062 <para>
48063 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
48064 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
48065 Layer</quote>). This library supports a number of authentication mechanisms,
48066 including PLAIN and LOGIN, but also several others that Exim does not support
48067 directly. In particular, there is support for Kerberos authentication.
48068 </para>
48069 <para>
48070 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
48071 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
48072 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
48073 name of the driver to determine which mechanism to support.
48074 </para>
48075 <para>
48076 Where access to some kind of secret file is required, for example in GSSAPI
48077 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
48078 user, and that the Cyrus SASL library has no way of escalating privileges
48079 by default. You may also find you need to set environment variables,
48080 depending on the driver you are using.
48081 </para>
48082 <para>
48083 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
48084 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
48085 Kerberos, note that because of limitations in the GSSAPI interface,
48086 changing the server keytab might need to be communicated down to the Kerberos
48087 layer independently. The mechanism for doing so is dependent upon the Kerberos
48088 implementation.
48089 </para>
48090 <para>
48091 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
48092 may be set to point to an alternative keytab file. Exim will pass this
48093 variable through from its own inherited environment when started as root or the
48094 Exim user. The keytab file needs to be readable by the Exim user.
48095 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
48096 environment variable.  In practice, for those releases, the Cyrus authenticator
48097 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
48098 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
48099 </para>
48100 <section id="SECID178">
48101 <title>Using cyrus_sasl as a server</title>
48102 <para>
48103 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
48104 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
48105 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
48106 use of this variable for this purpose is now deprecated, as it can lead to
48107 confusion in string expansions that also use numeric variables for other
48108 things.
48109 </para>
48110 <para>
48111 <indexterm role="option">
48112 <primary><option>server_hostname</option></primary>
48113 </indexterm>
48114 </para>
48115 <informaltable frame="all">
48116 <tgroup cols="4" colsep="0" rowsep="0">
48117 <colspec colwidth="8*" align="left"/>
48118 <colspec colwidth="6*" align="center"/>
48119 <colspec colwidth="6*" align="center"/>
48120 <colspec colwidth="6*" align="right"/>
48121 <tbody>
48122 <row>
48123 <entry><option>server_hostname</option></entry>
48124 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48126 <entry>Default: <emphasis>see below</emphasis></entry>
48127 </row>
48128 </tbody>
48129 </tgroup>
48130 </informaltable>
48131 <para>
48132 This option selects the hostname that is used when communicating with the
48133 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
48134 SASL plug-in what it does with this data.
48135 </para>
48136 <para>
48137 <indexterm role="option">
48138 <primary><option>server_mech</option></primary>
48139 </indexterm>
48140 </para>
48141 <informaltable frame="all">
48142 <tgroup cols="4" colsep="0" rowsep="0">
48143 <colspec colwidth="8*" align="left"/>
48144 <colspec colwidth="6*" align="center"/>
48145 <colspec colwidth="6*" align="center"/>
48146 <colspec colwidth="6*" align="right"/>
48147 <tbody>
48148 <row>
48149 <entry><option>server_mech</option></entry>
48150 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48151 <entry>Type: <emphasis>string</emphasis></entry>
48152 <entry>Default: <emphasis>see below</emphasis></entry>
48153 </row>
48154 </tbody>
48155 </tgroup>
48156 </informaltable>
48157 <para>
48158 This option selects the authentication mechanism this driver should use. The
48159 default is the value of the generic <option>public_name</option> option. This option allows
48160 you to use a different underlying mechanism from the advertised name. For
48161 example:
48162 </para>
48163 <literallayout class="monospaced">
48164 sasl:
48165   driver = cyrus_sasl
48166   public_name = X-ANYTHING
48167   server_mech = CRAM-MD5
48168   server_set_id = $auth1
48169 </literallayout>
48170 <para>
48171 <indexterm role="option">
48172 <primary><option>server_realm</option></primary>
48173 </indexterm>
48174 </para>
48175 <informaltable frame="all">
48176 <tgroup cols="4" colsep="0" rowsep="0">
48177 <colspec colwidth="8*" align="left"/>
48178 <colspec colwidth="6*" align="center"/>
48179 <colspec colwidth="6*" align="center"/>
48180 <colspec colwidth="6*" align="right"/>
48181 <tbody>
48182 <row>
48183 <entry><option>server_realm</option></entry>
48184 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48185 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48186 <entry>Default: <emphasis>unset</emphasis></entry>
48187 </row>
48188 </tbody>
48189 </tgroup>
48190 </informaltable>
48191 <para>
48192 This specifies the SASL realm that the server claims to be in.
48193 </para>
48194 <para>
48195 <indexterm role="option">
48196 <primary><option>server_service</option></primary>
48197 </indexterm>
48198 </para>
48199 <informaltable frame="all">
48200 <tgroup cols="4" colsep="0" rowsep="0">
48201 <colspec colwidth="8*" align="left"/>
48202 <colspec colwidth="6*" align="center"/>
48203 <colspec colwidth="6*" align="center"/>
48204 <colspec colwidth="6*" align="right"/>
48205 <tbody>
48206 <row>
48207 <entry><option>server_service</option></entry>
48208 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
48209 <entry>Type: <emphasis>string</emphasis></entry>
48210 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
48211 </row>
48212 </tbody>
48213 </tgroup>
48214 </informaltable>
48215 <para>
48216 This is the SASL service that the server claims to implement.
48217 </para>
48218 <para>
48219 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
48220 private options. All you need to do is to specify an appropriate mechanism as
48221 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
48222 PLAIN, you could have two authenticators as follows:
48223 </para>
48224 <literallayout class="monospaced">
48225 sasl_cram_md5:
48226   driver = cyrus_sasl
48227   public_name = CRAM-MD5
48228   server_set_id = $auth1
48229
48230 sasl_plain:
48231   driver = cyrus_sasl
48232   public_name = PLAIN
48233   server_set_id = $auth2
48234 </literallayout>
48235 <para>
48236 Cyrus SASL does implement the LOGIN authentication method, even though it is
48237 not a standard method. It is disabled by default in the source distribution,
48238 but it is present in many binary distributions.
48239 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
48240 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
48241 </para>
48242 </section>
48243 </chapter>
48244
48245 <chapter id="CHAPdovecot">
48246 <title>The dovecot authenticator</title>
48247 <para>
48248 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
48249 <primary><command>dovecot</command> authenticator</primary>
48250 </indexterm>
48251 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
48252 <primary>authenticators</primary>
48253 <secondary><command>dovecot</command></secondary>
48254 </indexterm>
48255 This authenticator is an interface to the authentication facility of the
48256 Dovecot POP/IMAP server, which can support a number of authentication methods.
48257 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
48258 to use the same mechanisms for SMTP authentication. This is a server
48259 authenticator only. There is only one option:
48260 </para>
48261 <para>
48262 <indexterm role="option">
48263 <primary><option>server_socket</option></primary>
48264 </indexterm>
48265 </para>
48266 <informaltable frame="all">
48267 <tgroup cols="4" colsep="0" rowsep="0">
48268 <colspec colwidth="8*" align="left"/>
48269 <colspec colwidth="6*" align="center"/>
48270 <colspec colwidth="6*" align="center"/>
48271 <colspec colwidth="6*" align="right"/>
48272 <tbody>
48273 <row>
48274 <entry><option>server_socket</option></entry>
48275 <entry>Use: <emphasis>dovecot</emphasis></entry>
48276 <entry>Type: <emphasis>string</emphasis></entry>
48277 <entry>Default: <emphasis>unset</emphasis></entry>
48278 </row>
48279 </tbody>
48280 </tgroup>
48281 </informaltable>
48282 <para>
48283 This option must specify the socket that is the interface to Dovecot
48284 authentication. The <option>public_name</option> option must specify an authentication
48285 mechanism that Dovecot is configured to support. You can have several
48286 authenticators for different mechanisms. For example:
48287 </para>
48288 <literallayout class="monospaced">
48289 dovecot_plain:
48290   driver = dovecot
48291   public_name = PLAIN
48292   server_socket = /var/run/dovecot/auth-client
48293   server_set_id = $auth2
48294
48295 dovecot_ntlm:
48296   driver = dovecot
48297   public_name = NTLM
48298   server_socket = /var/run/dovecot/auth-client
48299   server_set_id = $auth1
48300 </literallayout>
48301 <para>
48302 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
48303 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
48304 option is passed in the Dovecot authentication command. If, for a TLS
48305 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
48306 option is passed. When authentication succeeds, the identity of the user
48307 who authenticated is placed in <varname>$auth1</varname>.
48308 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
48309 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
48310 </para>
48311 </chapter>
48312
48313 <chapter id="CHAPgsasl">
48314 <title>The gsasl authenticator</title>
48315 <para>
48316 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
48317 <primary><command>gsasl</command> authenticator</primary>
48318 </indexterm>
48319 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
48320 <primary>authenticators</primary>
48321 <secondary><command>gsasl</command></secondary>
48322 </indexterm>
48323 <indexterm role="concept">
48324 <primary>authentication</primary>
48325 <secondary>GNU SASL</secondary>
48326 </indexterm>
48327 <indexterm role="concept">
48328 <primary>authentication</primary>
48329 <secondary>SASL</secondary>
48330 </indexterm>
48331 <indexterm role="concept">
48332 <primary>authentication</primary>
48333 <secondary>EXTERNAL</secondary>
48334 </indexterm>
48335 <indexterm role="concept">
48336 <primary>authentication</primary>
48337 <secondary>ANONYMOUS</secondary>
48338 </indexterm>
48339 <indexterm role="concept">
48340 <primary>authentication</primary>
48341 <secondary>PLAIN</secondary>
48342 </indexterm>
48343 <indexterm role="concept">
48344 <primary>authentication</primary>
48345 <secondary>LOGIN</secondary>
48346 </indexterm>
48347 <indexterm role="concept">
48348 <primary>authentication</primary>
48349 <secondary>DIGEST-MD5</secondary>
48350 </indexterm>
48351 <indexterm role="concept">
48352 <primary>authentication</primary>
48353 <secondary>CRAM-MD5</secondary>
48354 </indexterm>
48355 <indexterm role="concept">
48356 <primary>authentication</primary>
48357 <secondary>SCRAM-SHA-1</secondary>
48358 </indexterm>
48359 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
48360 library and the mechanisms it provides.  This is new as of the 4.80 release
48361 and there are a few areas where the library does not let Exim smoothly
48362 scale to handle future authentication mechanisms, so no guarantee can be
48363 made that any particular new authentication mechanism will be supported
48364 without code changes in Exim.
48365 </para>
48366 <para>
48367 <indexterm role="option">
48368 <primary><option>server_channelbinding</option></primary>
48369 </indexterm>
48370 </para>
48371 <informaltable frame="all">
48372 <tgroup cols="4" colsep="0" rowsep="0">
48373 <colspec colwidth="8*" align="left"/>
48374 <colspec colwidth="6*" align="center"/>
48375 <colspec colwidth="6*" align="center"/>
48376 <colspec colwidth="6*" align="right"/>
48377 <tbody>
48378 <row>
48379 <entry><option>server_channelbinding</option></entry>
48380 <entry>Use: <emphasis>gsasl</emphasis></entry>
48381 <entry>Type: <emphasis>boolean</emphasis></entry>
48382 <entry>Default: <emphasis>false</emphasis></entry>
48383 </row>
48384 </tbody>
48385 </tgroup>
48386 </informaltable>
48387 <para>
48388 Some authentication mechanisms are able to use external context at both ends
48389 of the session to bind the authentication to that context, and fail the
48390 authentication process if that context differs.  Specifically, some TLS
48391 ciphersuites can provide identifying information about the cryptographic
48392 context.
48393 </para>
48394 <para>
48395 This means that certificate identity and verification becomes a non-issue,
48396 as a man-in-the-middle attack will cause the correct client and server to
48397 see different identifiers and authentication will fail.
48398 </para>
48399 <para>
48400 This is currently only supported when using the GnuTLS library.  This is
48401 only usable by mechanisms which support "channel binding"; at time of
48402 writing, that&#x2019;s the SCRAM family.
48403 </para>
48404 <para>
48405 This defaults off to ensure smooth upgrade across Exim releases, in case
48406 this option causes some clients to start failing.  Some future release
48407 of Exim may switch the default to be true.
48408 </para>
48409 <para>
48410 <indexterm role="option">
48411 <primary><option>server_hostname</option></primary>
48412 </indexterm>
48413 </para>
48414 <informaltable frame="all">
48415 <tgroup cols="4" colsep="0" rowsep="0">
48416 <colspec colwidth="8*" align="left"/>
48417 <colspec colwidth="6*" align="center"/>
48418 <colspec colwidth="6*" align="center"/>
48419 <colspec colwidth="6*" align="right"/>
48420 <tbody>
48421 <row>
48422 <entry><option>server_hostname</option></entry>
48423 <entry>Use: <emphasis>gsasl</emphasis></entry>
48424 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48425 <entry>Default: <emphasis>see below</emphasis></entry>
48426 </row>
48427 </tbody>
48428 </tgroup>
48429 </informaltable>
48430 <para>
48431 This option selects the hostname that is used when communicating with the
48432 library. The default value is <literal>$primary_hostname</literal>.
48433 Some mechanisms will use this data.
48434 </para>
48435 <para>
48436 <indexterm role="option">
48437 <primary><option>server_mech</option></primary>
48438 </indexterm>
48439 </para>
48440 <informaltable frame="all">
48441 <tgroup cols="4" colsep="0" rowsep="0">
48442 <colspec colwidth="8*" align="left"/>
48443 <colspec colwidth="6*" align="center"/>
48444 <colspec colwidth="6*" align="center"/>
48445 <colspec colwidth="6*" align="right"/>
48446 <tbody>
48447 <row>
48448 <entry><option>server_mech</option></entry>
48449 <entry>Use: <emphasis>gsasl</emphasis></entry>
48450 <entry>Type: <emphasis>string</emphasis></entry>
48451 <entry>Default: <emphasis>see below</emphasis></entry>
48452 </row>
48453 </tbody>
48454 </tgroup>
48455 </informaltable>
48456 <para>
48457 This option selects the authentication mechanism this driver should use. The
48458 default is the value of the generic <option>public_name</option> option. This option allows
48459 you to use a different underlying mechanism from the advertised name. For
48460 example:
48461 </para>
48462 <literallayout class="monospaced">
48463 sasl:
48464   driver = gsasl
48465   public_name = X-ANYTHING
48466   server_mech = CRAM-MD5
48467   server_set_id = $auth1
48468 </literallayout>
48469 <para>
48470 <indexterm role="option">
48471 <primary><option>server_password</option></primary>
48472 </indexterm>
48473 </para>
48474 <informaltable frame="all">
48475 <tgroup cols="4" colsep="0" rowsep="0">
48476 <colspec colwidth="8*" align="left"/>
48477 <colspec colwidth="6*" align="center"/>
48478 <colspec colwidth="6*" align="center"/>
48479 <colspec colwidth="6*" align="right"/>
48480 <tbody>
48481 <row>
48482 <entry><option>server_password</option></entry>
48483 <entry>Use: <emphasis>gsasl</emphasis></entry>
48484 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48485 <entry>Default: <emphasis>unset</emphasis></entry>
48486 </row>
48487 </tbody>
48488 </tgroup>
48489 </informaltable>
48490 <para>
48491 Various mechanisms need access to the cleartext password on the server, so
48492 that proof-of-possession can be demonstrated on the wire, without sending
48493 the password itself.
48494 </para>
48495 <para>
48496 The data available for lookup varies per mechanism.
48497 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
48498 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
48499 if available, else the empty string.
48500 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
48501 else the empty string.
48502 </para>
48503 <para>
48504 A forced failure will cause authentication to defer.
48505 </para>
48506 <para>
48507 If using this option, it may make sense to set the <option>server_condition</option>
48508 option to be simply "true".
48509 </para>
48510 <para>
48511 <indexterm role="option">
48512 <primary><option>server_realm</option></primary>
48513 </indexterm>
48514 </para>
48515 <informaltable frame="all">
48516 <tgroup cols="4" colsep="0" rowsep="0">
48517 <colspec colwidth="8*" align="left"/>
48518 <colspec colwidth="6*" align="center"/>
48519 <colspec colwidth="6*" align="center"/>
48520 <colspec colwidth="6*" align="right"/>
48521 <tbody>
48522 <row>
48523 <entry><option>server_realm</option></entry>
48524 <entry>Use: <emphasis>gsasl</emphasis></entry>
48525 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48526 <entry>Default: <emphasis>unset</emphasis></entry>
48527 </row>
48528 </tbody>
48529 </tgroup>
48530 </informaltable>
48531 <para>
48532 This specifies the SASL realm that the server claims to be in.
48533 Some mechanisms will use this data.
48534 </para>
48535 <para>
48536 <indexterm role="option">
48537 <primary><option>server_scram_iter</option></primary>
48538 </indexterm>
48539 </para>
48540 <informaltable frame="all">
48541 <tgroup cols="4" colsep="0" rowsep="0">
48542 <colspec colwidth="8*" align="left"/>
48543 <colspec colwidth="6*" align="center"/>
48544 <colspec colwidth="6*" align="center"/>
48545 <colspec colwidth="6*" align="right"/>
48546 <tbody>
48547 <row>
48548 <entry><option>server_scram_iter</option></entry>
48549 <entry>Use: <emphasis>gsasl</emphasis></entry>
48550 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48551 <entry>Default: <emphasis>unset</emphasis></entry>
48552 </row>
48553 </tbody>
48554 </tgroup>
48555 </informaltable>
48556 <para>
48557 This option provides data for the SCRAM family of mechanisms.
48558 <varname>$auth1</varname> is not available at evaluation time.
48559 (This may change, as we receive feedback on use)
48560 </para>
48561 <para>
48562 <indexterm role="option">
48563 <primary><option>server_scram_salt</option></primary>
48564 </indexterm>
48565 </para>
48566 <informaltable frame="all">
48567 <tgroup cols="4" colsep="0" rowsep="0">
48568 <colspec colwidth="8*" align="left"/>
48569 <colspec colwidth="6*" align="center"/>
48570 <colspec colwidth="6*" align="center"/>
48571 <colspec colwidth="6*" align="right"/>
48572 <tbody>
48573 <row>
48574 <entry><option>server_scram_salt</option></entry>
48575 <entry>Use: <emphasis>gsasl</emphasis></entry>
48576 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48577 <entry>Default: <emphasis>unset</emphasis></entry>
48578 </row>
48579 </tbody>
48580 </tgroup>
48581 </informaltable>
48582 <para>
48583 This option provides data for the SCRAM family of mechanisms.
48584 <varname>$auth1</varname> is not available at evaluation time.
48585 (This may change, as we receive feedback on use)
48586 </para>
48587 <para>
48588 <indexterm role="option">
48589 <primary><option>server_service</option></primary>
48590 </indexterm>
48591 </para>
48592 <informaltable frame="all">
48593 <tgroup cols="4" colsep="0" rowsep="0">
48594 <colspec colwidth="8*" align="left"/>
48595 <colspec colwidth="6*" align="center"/>
48596 <colspec colwidth="6*" align="center"/>
48597 <colspec colwidth="6*" align="right"/>
48598 <tbody>
48599 <row>
48600 <entry><option>server_service</option></entry>
48601 <entry>Use: <emphasis>gsasl</emphasis></entry>
48602 <entry>Type: <emphasis>string</emphasis></entry>
48603 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
48604 </row>
48605 </tbody>
48606 </tgroup>
48607 </informaltable>
48608 <para>
48609 This is the SASL service that the server claims to implement.
48610 Some mechanisms will use this data.
48611 </para>
48612 <section id="SECTgsaslauthvar">
48613 <title><command>gsasl</command> auth variables</title>
48614 <para>
48615 <indexterm role="variable">
48616 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48617 </indexterm>
48618 These may be set when evaluating specific options, as detailed above.
48619 They will also be set when evaluating <option>server_condition</option>.
48620 </para>
48621 <para>
48622 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
48623 meanings for these variables:
48624 </para>
48625 <itemizedlist>
48626 <listitem>
48627 <para>
48628 <indexterm role="variable">
48629 <primary><varname>$auth1</varname></primary>
48630 </indexterm>
48631 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
48632 </para>
48633 </listitem>
48634 <listitem>
48635 <para>
48636 <indexterm role="variable">
48637 <primary><varname>$auth2</varname></primary>
48638 </indexterm>
48639 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
48640 </para>
48641 </listitem>
48642 <listitem>
48643 <para>
48644 <indexterm role="variable">
48645 <primary><varname>$auth3</varname></primary>
48646 </indexterm>
48647 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
48648 </para>
48649 </listitem>
48650 </itemizedlist>
48651 <para>
48652 On a per-mechanism basis:
48653 </para>
48654 <itemizedlist>
48655 <listitem>
48656 <para>
48657 <indexterm role="concept">
48658 <primary>authentication</primary>
48659 <secondary>EXTERNAL</secondary>
48660 </indexterm>
48661 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
48662 the <option>server_condition</option> option must be present.
48663 </para>
48664 </listitem>
48665 <listitem>
48666 <para>
48667 <indexterm role="concept">
48668 <primary>authentication</primary>
48669 <secondary>ANONYMOUS</secondary>
48670 </indexterm>
48671 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
48672 the <option>server_condition</option> option must be present.
48673 </para>
48674 </listitem>
48675 <listitem>
48676 <para>
48677 <indexterm role="concept">
48678 <primary>authentication</primary>
48679 <secondary>GSSAPI</secondary>
48680 </indexterm>
48681 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
48682 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
48683 the <option>server_condition</option> option must be present.
48684 </para>
48685 </listitem>
48686 </itemizedlist>
48687 <para>
48688 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
48689 identifier; this is analogous to FTP anonymous authentication passing an
48690 email address, or software-identifier@, as the "password".
48691 </para>
48692 <para>
48693 An example showing the password having the realm specified in the callback
48694 and demonstrating a Cyrus SASL to GSASL migration approach is:
48695 </para>
48696 <literallayout class="monospaced">
48697 gsasl_cyrusless_crammd5:
48698   driver = gsasl
48699   public_name = CRAM-MD5
48700   server_realm = imap.example.org
48701   server_password = ${lookup{$auth1:$auth3:userPassword}\
48702                     dbmjz{/etc/sasldb2}{$value}fail}
48703   server_set_id = ${quote:$auth1}
48704   server_condition = yes
48705 </literallayout>
48706 </section>
48707 </chapter>
48708
48709 <chapter id="CHAPheimdalgss">
48710 <title>The heimdal_gssapi authenticator</title>
48711 <para>
48712 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
48713 <primary><command>heimdal_gssapi</command> authenticator</primary>
48714 </indexterm>
48715 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
48716 <primary>authenticators</primary>
48717 <secondary><command>heimdal_gssapi</command></secondary>
48718 </indexterm>
48719 <indexterm role="concept">
48720 <primary>authentication</primary>
48721 <secondary>GSSAPI</secondary>
48722 </indexterm>
48723 <indexterm role="concept">
48724 <primary>authentication</primary>
48725 <secondary>Kerberos</secondary>
48726 </indexterm>
48727 The <command>heimdal_gssapi</command> authenticator provides server integration for the
48728 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
48729 reliably.
48730 </para>
48731 <para>
48732 <indexterm role="option">
48733 <primary><option>server_hostname</option></primary>
48734 </indexterm>
48735 </para>
48736 <informaltable frame="all">
48737 <tgroup cols="4" colsep="0" rowsep="0">
48738 <colspec colwidth="8*" align="left"/>
48739 <colspec colwidth="6*" align="center"/>
48740 <colspec colwidth="6*" align="center"/>
48741 <colspec colwidth="6*" align="right"/>
48742 <tbody>
48743 <row>
48744 <entry><option>server_hostname</option></entry>
48745 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
48746 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48747 <entry>Default: <emphasis>see below</emphasis></entry>
48748 </row>
48749 </tbody>
48750 </tgroup>
48751 </informaltable>
48752 <para>
48753 This option selects the hostname that is used, with <option>server_service</option>,
48754 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
48755 identifier.  The default value is <literal>$primary_hostname</literal>.
48756 </para>
48757 <para>
48758 <indexterm role="option">
48759 <primary><option>server_keytab</option></primary>
48760 </indexterm>
48761 </para>
48762 <informaltable frame="all">
48763 <tgroup cols="4" colsep="0" rowsep="0">
48764 <colspec colwidth="8*" align="left"/>
48765 <colspec colwidth="6*" align="center"/>
48766 <colspec colwidth="6*" align="center"/>
48767 <colspec colwidth="6*" align="right"/>
48768 <tbody>
48769 <row>
48770 <entry><option>server_keytab</option></entry>
48771 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
48772 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48773 <entry>Default: <emphasis>unset</emphasis></entry>
48774 </row>
48775 </tbody>
48776 </tgroup>
48777 </informaltable>
48778 <para>
48779 If set, then Heimdal will not use the system default keytab (typically
48780 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
48781 The value should be a pathname, with no <quote>file:</quote> prefix.
48782 </para>
48783 <para>
48784 <indexterm role="option">
48785 <primary><option>server_service</option></primary>
48786 </indexterm>
48787 </para>
48788 <informaltable frame="all">
48789 <tgroup cols="4" colsep="0" rowsep="0">
48790 <colspec colwidth="8*" align="left"/>
48791 <colspec colwidth="6*" align="center"/>
48792 <colspec colwidth="6*" align="center"/>
48793 <colspec colwidth="6*" align="right"/>
48794 <tbody>
48795 <row>
48796 <entry><option>server_service</option></entry>
48797 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
48798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48799 <entry>Default: <emphasis>smtp</emphasis></entry>
48800 </row>
48801 </tbody>
48802 </tgroup>
48803 </informaltable>
48804 <para>
48805 This option specifies the service identifier used, in conjunction with
48806 <option>server_hostname</option>, for building the identifer for finding credentials
48807 from the keytab.
48808 </para>
48809 <section id="SECTheimdalgssauthvar">
48810 <title><command>heimdal_gssapi</command> auth variables</title>
48811 <para>
48812 Beware that these variables will typically include a realm, thus will appear
48813 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
48814 not verified, so a malicious client can set it to anything.
48815 </para>
48816 <para>
48817 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
48818 Distribution Center.  Note that these are not quite email addresses.
48819 Each identifier is for a role, and so the left-hand-side may include a
48820 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
48821 </para>
48822 <para>
48823 <indexterm role="variable">
48824 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
48825 </indexterm>
48826 </para>
48827 <itemizedlist>
48828 <listitem>
48829 <para>
48830 <indexterm role="variable">
48831 <primary><varname>$auth1</varname></primary>
48832 </indexterm>
48833 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
48834 </para>
48835 </listitem>
48836 <listitem>
48837 <para>
48838 <indexterm role="variable">
48839 <primary><varname>$auth2</varname></primary>
48840 </indexterm>
48841 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
48842 authentication.  If that was empty, this will also be set to the
48843 GSS Display Name.
48844 </para>
48845 </listitem>
48846 </itemizedlist>
48847 </section>
48848 </chapter>
48849
48850 <chapter id="CHAPspa">
48851 <title>The spa authenticator</title>
48852 <para>
48853 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
48854 <primary><command>spa</command> authenticator</primary>
48855 </indexterm>
48856 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
48857 <primary>authenticators</primary>
48858 <secondary><command>spa</command></secondary>
48859 </indexterm>
48860 <indexterm role="concept">
48861 <primary>authentication</primary>
48862 <secondary>Microsoft Secure Password</secondary>
48863 </indexterm>
48864 <indexterm role="concept">
48865 <primary>authentication</primary>
48866 <secondary>NTLM</secondary>
48867 </indexterm>
48868 <indexterm role="concept">
48869 <primary>Microsoft Secure Password Authentication</primary>
48870 </indexterm>
48871 <indexterm role="concept">
48872 <primary>NTLM authentication</primary>
48873 </indexterm>
48874 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
48875 Password Authentication</emphasis> mechanism,
48876 which is also sometimes known as NTLM (NT LanMan). The code for client side of
48877 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
48878 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
48879 server side was subsequently contributed by Tom Kistner. The mechanism works as
48880 follows:
48881 </para>
48882 <itemizedlist>
48883 <listitem>
48884 <para>
48885 After the AUTH command has been accepted, the client sends an SPA
48886 authentication request based on the user name and optional domain.
48887 </para>
48888 </listitem>
48889 <listitem>
48890 <para>
48891 The server sends back a challenge.
48892 </para>
48893 </listitem>
48894 <listitem>
48895 <para>
48896 The client builds a challenge response which makes use of the user&#x2019;s password
48897 and sends it to the server, which then accepts or rejects it.
48898 </para>
48899 </listitem>
48900 </itemizedlist>
48901 <para>
48902 Encryption is used to protect the password in transit.
48903 </para>
48904 <section id="SECID179">
48905 <title>Using spa as a server</title>
48906 <para>
48907 <indexterm role="concept">
48908 <primary>options</primary>
48909 <secondary><command>spa</command> authenticator (server)</secondary>
48910 </indexterm>
48911 The <command>spa</command> authenticator has just one server option:
48912 </para>
48913 <para>
48914 <indexterm role="option">
48915 <primary><option>server_password</option></primary>
48916 </indexterm>
48917 </para>
48918 <informaltable frame="all">
48919 <tgroup cols="4" colsep="0" rowsep="0">
48920 <colspec colwidth="8*" align="left"/>
48921 <colspec colwidth="6*" align="center"/>
48922 <colspec colwidth="6*" align="center"/>
48923 <colspec colwidth="6*" align="right"/>
48924 <tbody>
48925 <row>
48926 <entry><option>server_password</option></entry>
48927 <entry>Use: <emphasis>spa</emphasis></entry>
48928 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48929 <entry>Default: <emphasis>unset</emphasis></entry>
48930 </row>
48931 </tbody>
48932 </tgroup>
48933 </informaltable>
48934 <para>
48935 <indexterm role="concept">
48936 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48937 <secondary>in <command>spa</command> authenticator</secondary>
48938 </indexterm>
48939 This option is expanded, and the result must be the cleartext password for the
48940 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
48941 compatibility with previous releases of Exim, the user name is also placed in
48942 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
48943 it can lead to confusion in string expansions that also use numeric variables
48944 for other things. For example:
48945 </para>
48946 <literallayout class="monospaced">
48947 spa:
48948   driver = spa
48949   public_name = NTLM
48950   server_password = \
48951     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
48952 </literallayout>
48953 <para>
48954 If the expansion is forced to fail, authentication fails. Any other expansion
48955 failure causes a temporary error code to be returned.
48956 </para>
48957 </section>
48958 <section id="SECID180">
48959 <title>Using spa as a client</title>
48960 <para>
48961 <indexterm role="concept">
48962 <primary>options</primary>
48963 <secondary><command>spa</command> authenticator (client)</secondary>
48964 </indexterm>
48965 The <command>spa</command> authenticator has the following client options:
48966 </para>
48967 <para>
48968 <indexterm role="option">
48969 <primary><option>client_domain</option></primary>
48970 </indexterm>
48971 </para>
48972 <informaltable frame="all">
48973 <tgroup cols="4" colsep="0" rowsep="0">
48974 <colspec colwidth="8*" align="left"/>
48975 <colspec colwidth="6*" align="center"/>
48976 <colspec colwidth="6*" align="center"/>
48977 <colspec colwidth="6*" align="right"/>
48978 <tbody>
48979 <row>
48980 <entry><option>client_domain</option></entry>
48981 <entry>Use: <emphasis>spa</emphasis></entry>
48982 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48983 <entry>Default: <emphasis>unset</emphasis></entry>
48984 </row>
48985 </tbody>
48986 </tgroup>
48987 </informaltable>
48988 <para>
48989 This option specifies an optional domain for the authentication.
48990 </para>
48991 <para>
48992 <indexterm role="option">
48993 <primary><option>client_password</option></primary>
48994 </indexterm>
48995 </para>
48996 <informaltable frame="all">
48997 <tgroup cols="4" colsep="0" rowsep="0">
48998 <colspec colwidth="8*" align="left"/>
48999 <colspec colwidth="6*" align="center"/>
49000 <colspec colwidth="6*" align="center"/>
49001 <colspec colwidth="6*" align="right"/>
49002 <tbody>
49003 <row>
49004 <entry><option>client_password</option></entry>
49005 <entry>Use: <emphasis>spa</emphasis></entry>
49006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49007 <entry>Default: <emphasis>unset</emphasis></entry>
49008 </row>
49009 </tbody>
49010 </tgroup>
49011 </informaltable>
49012 <para>
49013 This option specifies the user&#x2019;s password, and must be set.
49014 </para>
49015 <para>
49016 <indexterm role="option">
49017 <primary><option>client_username</option></primary>
49018 </indexterm>
49019 </para>
49020 <informaltable frame="all">
49021 <tgroup cols="4" colsep="0" rowsep="0">
49022 <colspec colwidth="8*" align="left"/>
49023 <colspec colwidth="6*" align="center"/>
49024 <colspec colwidth="6*" align="center"/>
49025 <colspec colwidth="6*" align="right"/>
49026 <tbody>
49027 <row>
49028 <entry><option>client_username</option></entry>
49029 <entry>Use: <emphasis>spa</emphasis></entry>
49030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49031 <entry>Default: <emphasis>unset</emphasis></entry>
49032 </row>
49033 </tbody>
49034 </tgroup>
49035 </informaltable>
49036 <para>
49037 This option specifies the user name, and must be set. Here is an example of a
49038 configuration of this authenticator for use with the mail servers at
49039 <emphasis>msn.com</emphasis>:
49040 </para>
49041 <literallayout class="monospaced">
49042 msn:
49043   driver = spa
49044   public_name = MSN
49045   client_username = msn/msn_username
49046   client_password = msn_plaintext_password
49047   client_domain = DOMAIN_OR_UNSET
49048 </literallayout>
49049 <para>
49050 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
49051 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
49052 </para>
49053 </section>
49054 </chapter>
49055
49056 <chapter id="CHAPTLS">
49057 <title>Encrypted SMTP connections using TLS/SSL</title>
49058 <titleabbrev>Encrypted SMTP connections</titleabbrev>
49059 <para>
49060 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
49061 <primary>encryption</primary>
49062 <secondary>on SMTP connection</secondary>
49063 </indexterm>
49064 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
49065 <primary>SMTP</primary>
49066 <secondary>encryption</secondary>
49067 </indexterm>
49068 <indexterm role="concept">
49069 <primary>TLS</primary>
49070 <secondary>on SMTP connection</secondary>
49071 </indexterm>
49072 <indexterm role="concept">
49073 <primary>OpenSSL</primary>
49074 </indexterm>
49075 <indexterm role="concept">
49076 <primary>GnuTLS</primary>
49077 </indexterm>
49078 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
49079 Sockets Layer), is implemented by making use of the OpenSSL library or the
49080 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
49081 cryptographic code in the Exim distribution itself for implementing TLS. In
49082 order to use this feature you must install OpenSSL or GnuTLS, and then build a
49083 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
49084 You also need to understand the basic concepts of encryption at a managerial
49085 level, and in particular, the way that public keys, private keys, and
49086 certificates are used.
49087 </para>
49088 <para>
49089 RFC 3207 defines how SMTP connections can make use of encryption. Once a
49090 connection is established, the client issues a STARTTLS command. If the
49091 server accepts this, the client and the server negotiate an encryption
49092 mechanism. If the negotiation succeeds, the data that subsequently passes
49093 between them is encrypted.
49094 </para>
49095 <para>
49096 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
49097 and if so, what cipher suite is in use, whether the client supplied a
49098 certificate, and whether or not that certificate was verified. This makes it
49099 possible for an Exim server to deny or accept certain commands based on the
49100 encryption state.
49101 </para>
49102 <para>
49103 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
49104 disrupt TLS connections. You need to turn off SMTP scanning for these products
49105 in order to get TLS to work.
49106 </para>
49107 <section id="SECID284">
49108 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
49109 <para>
49110 <indexterm role="concept">
49111 <primary>ssmtp protocol</primary>
49112 </indexterm>
49113 <indexterm role="concept">
49114 <primary>smtps protocol</primary>
49115 </indexterm>
49116 <indexterm role="concept">
49117 <primary>SMTP</primary>
49118 <secondary>ssmtp protocol</secondary>
49119 </indexterm>
49120 <indexterm role="concept">
49121 <primary>SMTP</primary>
49122 <secondary>smtps protocol</secondary>
49123 </indexterm>
49124 Early implementations of encrypted SMTP used a different TCP port from normal
49125 SMTP, and expected an encryption negotiation to start immediately, instead of
49126 waiting for a STARTTLS command from the client using the standard SMTP
49127 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
49128 allocated for this purpose.
49129 </para>
49130 <para>
49131 This approach was abandoned when encrypted SMTP was standardized, but there are
49132 still some legacy clients that use it. Exim supports these clients by means of
49133 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
49134 numbers; the most common use is expected to be:
49135 </para>
49136 <literallayout class="monospaced">
49137 tls_on_connect_ports = 465
49138 </literallayout>
49139 <para>
49140 The port numbers specified by this option apply to all SMTP connections, both
49141 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
49142 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
49143 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
49144 an extra port &ndash; rather, it specifies different behaviour on a port that is
49145 defined elsewhere.
49146 </para>
49147 <para>
49148 There is also a <option>-tls-on-connect</option> command line option. This overrides
49149 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
49150 </para>
49151 </section>
49152 <section id="SECTopenvsgnu">
49153 <title>OpenSSL vs GnuTLS</title>
49154 <para>
49155 <indexterm role="concept">
49156 <primary>TLS</primary>
49157 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
49158 </indexterm>
49159 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
49160 followed later, when the first versions of GnuTLS were released. To build Exim
49161 to use GnuTLS, you need to set
49162 </para>
49163 <literallayout class="monospaced">
49164 USE_GNUTLS=yes
49165 </literallayout>
49166 <para>
49167 in Local/Makefile, in addition to
49168 </para>
49169 <literallayout class="monospaced">
49170 SUPPORT_TLS=yes
49171 </literallayout>
49172 <para>
49173 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
49174 include files and libraries for GnuTLS can be found.
49175 </para>
49176 <para>
49177 There are some differences in usage when using GnuTLS instead of OpenSSL:
49178 </para>
49179 <itemizedlist>
49180 <listitem>
49181 <para>
49182 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
49183 name of a directory (for OpenSSL it can be either).
49184 </para>
49185 </listitem>
49186 <listitem>
49187 <para>
49188 The default value for <option>tls_dhparam</option> differs for historical reasons.
49189 </para>
49190 </listitem>
49191 <listitem>
49192 <para>
49193 <indexterm role="variable">
49194 <primary><varname>$tls_in_peerdn</varname></primary>
49195 </indexterm>
49196 <indexterm role="variable">
49197 <primary><varname>$tls_out_peerdn</varname></primary>
49198 </indexterm>
49199 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
49200 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
49201 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
49202 </para>
49203 </listitem>
49204 <listitem>
49205 <para>
49206 OpenSSL identifies cipher suites using hyphens as separators, for example:
49207 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
49208 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
49209 in a cipher list. To make life simpler, Exim changes underscores to hyphens
49210 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
49211 to handle its own older variants) when processing lists of cipher suites in the
49212 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
49213 option).
49214 </para>
49215 </listitem>
49216 <listitem>
49217 <para>
49218 The <option>tls_require_ciphers</option> options operate differently, as described in the
49219 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
49220 </para>
49221 </listitem>
49222 <listitem>
49223 <para revisionflag="changed">
49224 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
49225 When using OpenSSL, this option is ignored.
49226 (If an API is found to let OpenSSL be configured in this way,
49227 let the Exim Maintainers know and we&#x2019;ll likely use it).
49228 </para>
49229 </listitem>
49230 <listitem>
49231 <para>
49232 Some other recently added features may only be available in one or the other.
49233 This should be documented with the feature.  If the documentation does not
49234 explicitly state that the feature is infeasible in the other TLS
49235 implementation, then patches are welcome.
49236 </para>
49237 </listitem>
49238 </itemizedlist>
49239 </section>
49240 <section id="SECTgnutlsparam">
49241 <title>GnuTLS parameter computation</title>
49242 <para>
49243 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
49244 an explicit path; if the latter, then the text about generation still applies,
49245 but not the chosen filename.
49246 By default, as of Exim 4.80 a hard-coded D-H prime is used.
49247 See the documentation of <option>tls_dhparam</option> for more information.
49248 </para>
49249 <para>
49250 GnuTLS uses D-H parameters that may take a substantial amount of time
49251 to compute. It is unreasonable to re-compute them for every TLS session.
49252 Therefore, Exim keeps this data in a file in its spool directory, called
49253 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
49254 of bits requested.
49255 The file is owned by the Exim user and is readable only by
49256 its owner. Every Exim process that start up GnuTLS reads the D-H
49257 parameters from this file. If the file does not exist, the first Exim process
49258 that needs it computes the data and writes it to a temporary file which is
49259 renamed once it is complete. It does not matter if several Exim processes do
49260 this simultaneously (apart from wasting a few resources). Once a file is in
49261 place, new Exim processes immediately start using it.
49262 </para>
49263 <para>
49264 For maximum security, the parameters that are stored in this file should be
49265 recalculated periodically, the frequency depending on your paranoia level.
49266 If you are avoiding using the fixed D-H primes published in RFCs, then you
49267 are concerned about some advanced attacks and will wish to do this; if you do
49268 not regenerate then you might as well stick to the standard primes.
49269 </para>
49270 <para>
49271 Arranging this is easy in principle; just delete the file when you want new
49272 values to be computed. However, there may be a problem. The calculation of new
49273 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
49274 If the system is not very active, <filename>/dev/random</filename> may delay returning data
49275 until enough randomness (entropy) is available. This may cause Exim to hang for
49276 a substantial amount of time, causing timeouts on incoming connections.
49277 </para>
49278 <para>
49279 The solution is to generate the parameters externally to Exim. They are stored
49280 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
49281 generated externally using the <command>certtool</command> command that is part of GnuTLS.
49282 </para>
49283 <para>
49284 To replace the parameters with new ones, instead of deleting the file
49285 and letting Exim re-create it, you can generate new parameters using
49286 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
49287 renaming. The relevant commands are something like this:
49288 </para>
49289 <literallayout class="monospaced">
49290 # ls
49291 [ look for file; assume gnutls-params-2236 is the most recent ]
49292 # rm -f new-params
49293 # touch new-params
49294 # chown exim:exim new-params
49295 # chmod 0600 new-params
49296 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
49297 # openssl dhparam -noout -text -in new-params | head
49298 [ check the first line, make sure it's not more than 2236;
49299   if it is, then go back to the start ("rm") and repeat
49300   until the size generated is at most the size requested ]
49301 # chmod 0400 new-params
49302 # mv new-params gnutls-params-2236
49303 </literallayout>
49304 <para>
49305 If Exim never has to generate the parameters itself, the possibility of
49306 stalling is removed.
49307 </para>
49308 <para>
49309 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
49310 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
49311 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
49312 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
49313 and Exim does so.  This attempt to remove Exim from TLS policy decisions
49314 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
49315 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
49316 which applies to all D-H usage, client or server.  If the value returned by
49317 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
49318 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
49319 limit, which is still much higher than Exim historically used.
49320 </para>
49321 <para>
49322 The filename and bits used will change as the GnuTLS maintainers change the
49323 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
49324 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
49325 2432 bits, while NSS is limited to 2236 bits.
49326 </para>
49327 <para>
49328 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
49329 increase the chance of the generated prime actually being within acceptable
49330 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
49331 procedure above.  There is no sane procedure available to Exim to double-check
49332 the size of the generated prime, so it might still be too large.
49333 </para>
49334 </section>
49335 <section id="SECTreqciphssl">
49336 <title>Requiring specific ciphers in OpenSSL</title>
49337 <para>
49338 <indexterm role="concept">
49339 <primary>TLS</primary>
49340 <secondary>requiring specific ciphers (OpenSSL)</secondary>
49341 </indexterm>
49342 <indexterm role="option">
49343 <primary><option>tls_require_ciphers</option></primary>
49344 <secondary>OpenSSL</secondary>
49345 </indexterm>
49346 There is a function in the OpenSSL library that can be passed a list of cipher
49347 suites before the cipher negotiation takes place. This specifies which ciphers
49348 are acceptable. The list is colon separated and may contain names like
49349 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
49350 directly to this function call.
49351 Many systems will install the OpenSSL manual-pages, so you may have
49352 <emphasis>ciphers(1)</emphasis> available to you.
49353 The following quotation from the OpenSSL
49354 documentation specifies what forms of item are allowed in the cipher string:
49355 </para>
49356 <itemizedlist>
49357 <listitem>
49358 <para>
49359 It can consist of a single cipher suite such as RC4-SHA.
49360 </para>
49361 </listitem>
49362 <listitem>
49363 <para>
49364 It can represent a list of cipher suites containing a certain algorithm,
49365 or cipher suites of a certain type. For example SHA1 represents all
49366 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
49367 SSL v3 algorithms.
49368 </para>
49369 </listitem>
49370 <listitem>
49371 <para>
49372 Lists of cipher suites can be combined in a single cipher string using
49373 the + character. This is used as a logical and operation. For example
49374 SHA1+DES represents all cipher suites containing the SHA1 and the DES
49375 algorithms.
49376 </para>
49377 </listitem>
49378 </itemizedlist>
49379 <para>
49380 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
49381 <literal>-</literal> or <literal>+</literal>.
49382 </para>
49383 <itemizedlist>
49384 <listitem>
49385 <para>
49386 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
49387 ciphers deleted can never reappear in the list even if they are explicitly
49388 stated.
49389 </para>
49390 </listitem>
49391 <listitem>
49392 <para>
49393 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
49394 of the ciphers can be added again by later options.
49395 </para>
49396 </listitem>
49397 <listitem>
49398 <para>
49399 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
49400 option does not add any new ciphers; it just moves matching existing ones.
49401 </para>
49402 </listitem>
49403 </itemizedlist>
49404 <para>
49405 If none of these characters is present, the string is interpreted as
49406 a list of ciphers to be appended to the current preference list. If the list
49407 includes any ciphers already present they will be ignored: that is, they will
49408 not be moved to the end of the list.
49409 </para>
49410 <para>
49411 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
49412 string:
49413 </para>
49414 <literallayout class="monospaced">
49415 # note single-quotes to get ! past any shell history expansion
49416 $ openssl ciphers 'HIGH:!MD5:!SHA1'
49417 </literallayout>
49418 <para>
49419 This example will let the library defaults be permitted on the MX port, where
49420 there&#x2019;s probably no identity verification anyway, but ups the ante on the
49421 submission ports where the administrator might have some influence on the
49422 choice of clients used:
49423 </para>
49424 <literallayout class="monospaced">
49425 # OpenSSL variant; see man ciphers(1)
49426 tls_require_ciphers = ${if =={$received_port}{25}\
49427                            {DEFAULT}\
49428                            {HIGH:!MD5:!SHA1}}
49429 </literallayout>
49430 </section>
49431 <section id="SECTreqciphgnu">
49432 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
49433 <para>
49434 <indexterm role="concept">
49435 <primary>GnuTLS</primary>
49436 <secondary>specifying parameters for</secondary>
49437 </indexterm>
49438 <indexterm role="concept">
49439 <primary>TLS</primary>
49440 <secondary>specifying ciphers (GnuTLS)</secondary>
49441 </indexterm>
49442 <indexterm role="concept">
49443 <primary>TLS</primary>
49444 <secondary>specifying key exchange methods (GnuTLS)</secondary>
49445 </indexterm>
49446 <indexterm role="concept">
49447 <primary>TLS</primary>
49448 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
49449 </indexterm>
49450 <indexterm role="concept">
49451 <primary>TLS</primary>
49452 <secondary>specifying protocols (GnuTLS)</secondary>
49453 </indexterm>
49454 <indexterm role="concept">
49455 <primary>TLS</primary>
49456 <secondary>specifying priority string (GnuTLS)</secondary>
49457 </indexterm>
49458 <indexterm role="option">
49459 <primary><option>tls_require_ciphers</option></primary>
49460 <secondary>GnuTLS</secondary>
49461 </indexterm>
49462 The GnuTLS library allows the caller to provide a "priority string", documented
49463 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
49464 ciphersuite specification in OpenSSL.
49465 </para>
49466 <para>
49467 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string.
49468 </para>
49469 <para>
49470 The <option>tls_require_ciphers</option> option is available both as an global option,
49471 controlling how Exim behaves as a server, and also as an option of the
49472 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
49473 the value is string expanded.  The resulting string is not an Exim list and
49474 the string is given to the GnuTLS library, so that Exim does not need to be
49475 aware of future feature enhancements of GnuTLS.
49476 </para>
49477 <para>
49478 Documentation of the strings accepted may be found in the GnuTLS manual, under
49479 "Priority strings".  This is online as
49480 <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>,
49481 but beware that this relates to GnuTLS 3, which may be newer than the version
49482 installed on your system.  If you are using GnuTLS 3,
49483 <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>
49484 on that site can be used to test a given string.
49485 </para>
49486 <para>
49487 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
49488 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
49489 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
49490 </para>
49491 <para>
49492 This example will let the library defaults be permitted on the MX port, where
49493 there&#x2019;s probably no identity verification anyway, and lowers security further
49494 by increasing compatibility; but this ups the ante on the submission ports
49495 where the administrator might have some influence on the choice of clients
49496 used:
49497 </para>
49498 <literallayout class="monospaced">
49499 # GnuTLS variant
49500 tls_require_ciphers = ${if =={$received_port}{25}\
49501                            {NORMAL:%COMPAT}\
49502                            {SECURE128}}
49503 </literallayout>
49504 </section>
49505 <section id="SECID182">
49506 <title>Configuring an Exim server to use TLS</title>
49507 <para>
49508 <indexterm role="concept">
49509 <primary>TLS</primary>
49510 <secondary>configuring an Exim server</secondary>
49511 </indexterm>
49512 When Exim has been built with TLS support, it advertises the availability of
49513 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
49514 but not to any others. The default value of this option is unset, which means
49515 that STARTTLS is not advertised at all. This default is chosen because you
49516 need to set some other options in order to make TLS available, and also it is
49517 sensible for systems that want to use TLS only as a client.
49518 </para>
49519 <para>
49520 If a client issues a STARTTLS command and there is some configuration
49521 problem in the server, the command is rejected with a 454 error. If the client
49522 persists in trying to issue SMTP commands, all except QUIT are rejected
49523 with the error
49524 </para>
49525 <literallayout class="monospaced">
49526 554 Security failure
49527 </literallayout>
49528 <para>
49529 If a STARTTLS command is issued within an existing TLS session, it is
49530 rejected with a 554 error code.
49531 </para>
49532 <para>
49533 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
49534 match some hosts. You can, of course, set it to * to match all hosts.
49535 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
49536 without some further configuration at the server end.
49537 </para>
49538 <para>
49539 It is rumoured that all existing clients that support TLS/SSL use RSA
49540 encryption. To make this work you need to set, in the server,
49541 </para>
49542 <literallayout class="monospaced">
49543 tls_certificate = /some/file/name
49544 tls_privatekey = /some/file/name
49545 </literallayout>
49546 <para>
49547 These options are, in fact, expanded strings, so you can make them depend on
49548 the identity of the client that is connected if you wish. The first file
49549 contains the server&#x2019;s X509 certificate, and the second contains the private key
49550 that goes with it. These files need to be readable by the Exim user, and must
49551 always be given as full path names. They can be the same file if both the
49552 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
49553 set, or if its expansion is forced to fail or results in an empty string, this
49554 is assumed to be the case. The certificate file may also contain intermediate
49555 certificates that need to be sent to the client to enable it to authenticate
49556 the server&#x2019;s certificate.
49557 </para>
49558 <para>
49559 If you do not understand about certificates and keys, please try to find a
49560 source of this background information, which is not Exim-specific. (There are a
49561 few comments below in section <xref linkend="SECTcerandall"/>.)
49562 </para>
49563 <para>
49564 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
49565 they apply only in the case of a server. If you need to use a certificate in an
49566 Exim client, you must set the options of the same names in an <command>smtp</command>
49567 transport.
49568 </para>
49569 <para>
49570 With just these options, an Exim server will be able to use TLS. It does not
49571 require the client to have a certificate (but see below for how to insist on
49572 this). There is one other option that may be needed in other situations. If
49573 </para>
49574 <literallayout class="monospaced">
49575 tls_dhparam = /some/file/name
49576 </literallayout>
49577 <para>
49578 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
49579 with the parameters contained in the file.
49580 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
49581 available:
49582 </para>
49583 <literallayout class="monospaced">
49584 tls_dhparam = none
49585 </literallayout>
49586 <para>
49587 This may also be set to a string identifying a standard prime to be used for
49588 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
49589 used is <literal>ike23</literal>.  There are a few standard primes available, see the
49590 documentation for <option>tls_dhparam</option> for the complete list.
49591 </para>
49592 <para>
49593 See the command
49594 </para>
49595 <literallayout class="monospaced">
49596 openssl dhparam
49597 </literallayout>
49598 <para>
49599 for a way of generating file data.
49600 </para>
49601 <para>
49602 The strings supplied for these three options are expanded every time a client
49603 host connects. It is therefore possible to use different certificates and keys
49604 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
49605 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
49606 forced to fail, Exim behaves as if the option is not set.
49607 </para>
49608 <para>
49609 <indexterm role="concept">
49610 <primary>cipher</primary>
49611 <secondary>logging</secondary>
49612 </indexterm>
49613 <indexterm role="concept">
49614 <primary>log</primary>
49615 <secondary>TLS cipher</secondary>
49616 </indexterm>
49617 <indexterm role="variable">
49618 <primary><varname>$tls_in_cipher</varname></primary>
49619 </indexterm>
49620 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
49621 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
49622 incoming message (by default &ndash; you can, of course, change this), and it is
49623 also included in the log line that records a message&#x2019;s arrival, keyed by
49624 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
49625 condition can be used to test for specific cipher suites in ACLs.
49626 </para>
49627 <para>
49628 Once TLS has been established, the ACLs that run for subsequent SMTP commands
49629 can check the name of the cipher suite and vary their actions accordingly. The
49630 cipher suite names vary, depending on which TLS library is being used. For
49631 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
49632 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
49633 documentation for more details.
49634 </para>
49635 <para revisionflag="changed">
49636 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
49637 (again depending on the <option>tls_cipher</option> log selector).
49638 </para>
49639 </section>
49640 <section id="SECID183">
49641 <title>Requesting and verifying client certificates</title>
49642 <para>
49643 <indexterm role="concept">
49644 <primary>certificate</primary>
49645 <secondary>verification of client</secondary>
49646 </indexterm>
49647 <indexterm role="concept">
49648 <primary>TLS</primary>
49649 <secondary>client certificate verification</secondary>
49650 </indexterm>
49651 If you want an Exim server to request a certificate when negotiating a TLS
49652 session with a client, you must set either <option>tls_verify_hosts</option> or
49653 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
49654 apply to all TLS connections. For any host that matches one of these options,
49655 Exim requests a certificate as part of the setup of the TLS session. The
49656 contents of the certificate are verified by comparing it with a list of
49657 expected certificates. These must be available in a file or,
49658 for OpenSSL only (not GnuTLS), a directory, identified by
49659 <option>tls_verify_certificates</option>.
49660 </para>
49661 <para>
49662 A file can contain multiple certificates, concatenated end to end. If a
49663 directory is used
49664 (OpenSSL only),
49665 each certificate must be in a separate file, with a name (or a symbolic link)
49666 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
49667 certificate. You can compute the relevant hash by running the command
49668 </para>
49669 <literallayout class="monospaced">
49670 openssl x509 -hash -noout -in /cert/file
49671 </literallayout>
49672 <para>
49673 where <filename>/cert/file</filename> contains a single certificate.
49674 </para>
49675 <para>
49676 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
49677 what happens if the client does not supply a certificate, or if the certificate
49678 does not match any of the certificates in the collection named by
49679 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
49680 attempt to set up a TLS session is aborted, and the incoming connection is
49681 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
49682 session continues. ACLs that run for subsequent SMTP commands can detect the
49683 fact that no certificate was verified, and vary their actions accordingly. For
49684 example, you can insist on a certificate before accepting a message for
49685 relaying, but not when the message is destined for local delivery.
49686 </para>
49687 <para>
49688 <indexterm role="variable">
49689 <primary><varname>$tls_in_peerdn</varname></primary>
49690 </indexterm>
49691 When a client supplies a certificate (whether it verifies or not), the value of
49692 the Distinguished Name of the certificate is made available in the variable
49693 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
49694 </para>
49695 <para>
49696 <indexterm role="concept">
49697 <primary>log</primary>
49698 <secondary>distinguished name</secondary>
49699 </indexterm>
49700 Because it is often a long text string, it is not included in the log line or
49701 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
49702 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
49703 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
49704 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
49705 </para>
49706 </section>
49707 <section id="SECID184">
49708 <title>Revoked certificates</title>
49709 <para>
49710 <indexterm role="concept">
49711 <primary>TLS</primary>
49712 <secondary>revoked certificates</secondary>
49713 </indexterm>
49714 <indexterm role="concept">
49715 <primary>revocation list</primary>
49716 </indexterm>
49717 <indexterm role="concept">
49718 <primary>certificate</primary>
49719 <secondary>revocation list</secondary>
49720 </indexterm>
49721 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
49722 certificates are revoked. If you have such a list, you can pass it to an Exim
49723 server using the global option called <option>tls_crl</option> and to an Exim client using
49724 an identically named option for the <command>smtp</command> transport. In each case, the value
49725 of the option is expanded and must then be the name of a file that contains a
49726 CRL in PEM format.
49727 </para>
49728 </section>
49729 <section id="SECID185">
49730 <title>Configuring an Exim client to use TLS</title>
49731 <para>
49732 <indexterm role="concept">
49733 <primary>cipher</primary>
49734 <secondary>logging</secondary>
49735 </indexterm>
49736 <indexterm role="concept">
49737 <primary>log</primary>
49738 <secondary>TLS cipher</secondary>
49739 </indexterm>
49740 <indexterm role="concept">
49741 <primary>log</primary>
49742 <secondary>distinguished name</secondary>
49743 </indexterm>
49744 <indexterm role="concept">
49745 <primary>TLS</primary>
49746 <secondary>configuring an Exim client</secondary>
49747 </indexterm>
49748 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
49749 deliveries as well as to incoming, the latter one causing logging of the
49750 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
49751 within the <command>smtp</command> transport.
49752 </para>
49753 <para>
49754 It is not necessary to set any options to have TLS work in the <command>smtp</command>
49755 transport. If Exim is built with TLS support, and TLS is advertised by a
49756 server, the <command>smtp</command> transport always tries to start a TLS session. However,
49757 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
49758 transport) to a list of server hosts for which TLS should not be used.
49759 </para>
49760 <para>
49761 If you do not want Exim to attempt to send messages unencrypted when an attempt
49762 to set up an encrypted connection fails in any way, you can set
49763 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
49764 those hosts, delivery is always deferred if an encrypted connection cannot be
49765 set up. If there are any other hosts for the address, they are tried in the
49766 usual way.
49767 </para>
49768 <para>
49769 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
49770 the message unencrypted. It always does this if the response to STARTTLS is
49771 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
49772 session after a success response code, what happens is controlled by the
49773 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
49774 delivery to this host is deferred, and other hosts (if available) are tried. If
49775 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
49776 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
49777 negotiation fails, Exim closes the current connection (because it is in an
49778 unknown state), opens a new one to the same host, and then tries the delivery
49779 unencrypted.
49780 </para>
49781 <para>
49782 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
49783 transport provide the client with a certificate, which is passed to the server
49784 if it requests it. If the server is Exim, it will request a certificate only if
49785 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
49786 </para>
49787 <para>
49788 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
49789 must name a file or,
49790 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
49791 expected server certificates. The client verifies the server&#x2019;s certificate
49792 against this collection, taking into account any revoked certificates that are
49793 in the list defined by <option>tls_crl</option>.
49794 </para>
49795 <para>
49796 If
49797 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
49798 list of permitted cipher suites. If either of these checks fails, delivery to
49799 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
49800 alternative hosts, if any.
49801 </para>
49802 <para>
49803  <emphasis role="bold">Note</emphasis>:
49804 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
49805 is operating as a client. Exim does not assume that a server certificate (set
49806 by the global options of the same name) should also be used when operating as a
49807 client.
49808 </para>
49809 <para>
49810 <indexterm role="variable">
49811 <primary><varname>$host</varname></primary>
49812 </indexterm>
49813 <indexterm role="variable">
49814 <primary><varname>$host_address</varname></primary>
49815 </indexterm>
49816 All the TLS options in the <command>smtp</command> transport are expanded before use, with
49817 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
49818 which the client is connected. Forced failure of an expansion causes Exim to
49819 behave as if the relevant option were unset.
49820 </para>
49821 <para>
49822 <indexterm role="variable">
49823 <primary><varname>$tls_out_bits</varname></primary>
49824 </indexterm>
49825 <indexterm role="variable">
49826 <primary><varname>$tls_out_cipher</varname></primary>
49827 </indexterm>
49828 <indexterm role="variable">
49829 <primary><varname>$tls_out_peerdn</varname></primary>
49830 </indexterm>
49831 <indexterm role="variable">
49832 <primary><varname>$tls_out_sni</varname></primary>
49833 </indexterm>
49834 Before an SMTP connection is established, the
49835 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
49836 variables are emptied. (Until the first connection, they contain the values
49837 that were set when the message was received.) If STARTTLS is subsequently
49838 successfully obeyed, these variables are set to the relevant values for the
49839 outgoing connection.
49840 </para>
49841 </section>
49842 <section id="SECTtlssni">
49843 <title>Use of TLS Server Name Indication</title>
49844 <para>
49845 <indexterm role="concept">
49846 <primary>TLS</primary>
49847 <secondary>Server Name Indication</secondary>
49848 </indexterm>
49849 <indexterm role="variable">
49850 <primary><varname>$tls_in_sni</varname></primary>
49851 </indexterm>
49852 <indexterm role="option">
49853 <primary><option>tls_in_sni</option></primary>
49854 </indexterm>
49855 With TLS1.0 or above, there is an extension mechanism by which extra
49856 information can be included at various points in the protocol.  One of these
49857 extensions, documented in RFC 6066 (and before that RFC 4366) is
49858 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
49859 client in the initial handshake, so that the server can examine the servername
49860 within and possibly choose to use different certificates and keys (and more)
49861 for this session.
49862 </para>
49863 <para>
49864 This is analagous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
49865 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
49866 address.
49867 </para>
49868 <para>
49869 With SMTP to MX, there are the same problems here as in choosing the identity
49870 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
49871 provide the identity which you then cryptographically verify.  So this will
49872 be of limited use in that environment.
49873 </para>
49874 <para>
49875 With SMTP to Submission, there is a well-defined hostname which clients are
49876 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
49877 choose to include this information in the TLS negotiation.  If this becomes
49878 wide-spread, then hosters can choose to present different certificates to
49879 different clients.  Or even negotiate different cipher suites.
49880 </para>
49881 <para>
49882 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
49883 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
49884 nothing more to it.  Choosing a sensible value not derived insecurely is the
49885 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
49886 for the lifetime of the client connection (including during authentication).
49887 </para>
49888 <para>
49889 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
49890 received from a client.
49891 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
49892 </para>
49893 <para>
49894 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
49895 option (prior to expansion) then the following options will be re-expanded
49896 during TLS session handshake, to permit alternative values to be chosen:
49897 </para>
49898 <itemizedlist>
49899 <listitem>
49900 <para>
49901 <indexterm role="variable">
49902 <primary><option>tls_certificate</option></primary>
49903 </indexterm>
49904 <option>tls_certificate</option>
49905 </para>
49906 </listitem>
49907 <listitem>
49908 <para>
49909 <indexterm role="variable">
49910 <primary><option>tls_crl</option></primary>
49911 </indexterm>
49912 <option>tls_crl</option>
49913 </para>
49914 </listitem>
49915 <listitem>
49916 <para>
49917 <indexterm role="variable">
49918 <primary><option>tls_privatekey</option></primary>
49919 </indexterm>
49920 <option>tls_privatekey</option>
49921 </para>
49922 </listitem>
49923 <listitem>
49924 <para>
49925 <indexterm role="variable">
49926 <primary><option>tls_verify_certificates</option></primary>
49927 </indexterm>
49928 <option>tls_verify_certificates</option>
49929 </para>
49930 </listitem>
49931 </itemizedlist>
49932 <para>
49933 Great care should be taken to deal with matters of case, various injection
49934 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
49935 can always be referenced; it is important to remember that <varname>$tls_sni</varname> is
49936 arbitrary unverified data provided prior to authentication.
49937 </para>
49938 <para>
49939 The Exim developers are proceeding cautiously and so far no other TLS options
49940 are re-expanded.
49941 </para>
49942 <para>
49943 When Exim is built againt OpenSSL, OpenSSL must have been built with support
49944 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
49945 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
49946 see <literal>-servername</literal> in the output, then OpenSSL has support.
49947 </para>
49948 <para>
49949 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
49950 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
49951 built, then you have SNI support).
49952 </para>
49953 </section>
49954 <section id="SECTmulmessam">
49955 <title>Multiple messages on the same encrypted TCP/IP connection</title>
49956 <para>
49957 <indexterm role="concept">
49958 <primary>multiple SMTP deliveries with TLS</primary>
49959 </indexterm>
49960 <indexterm role="concept">
49961 <primary>TLS</primary>
49962 <secondary>multiple message deliveries</secondary>
49963 </indexterm>
49964 Exim sends multiple messages down the same TCP/IP connection by starting up
49965 an entirely new delivery process for each message, passing the socket from
49966 one process to the next. This implementation does not fit well with the use
49967 of TLS, because there is quite a lot of state information associated with a TLS
49968 connection, not just a socket identification. Passing all the state information
49969 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
49970 session before passing the socket to a new process. The new process may then
49971 try to start a new TLS session, and if successful, may try to re-authenticate
49972 if AUTH is in use, before sending the next message.
49973 </para>
49974 <para>
49975 The RFC is not clear as to whether or not an SMTP session continues in clear
49976 after TLS has been shut down, or whether TLS may be restarted again later, as
49977 just described. However, if the server is Exim, this shutdown and
49978 reinitialization works. It is not known which (if any) other servers operate
49979 successfully if the client closes a TLS session and continues with unencrypted
49980 SMTP, but there are certainly some that do not work. For such servers, Exim
49981 should not pass the socket to another process, because the failure of the
49982 subsequent attempt to use it would cause Exim to record a temporary host error,
49983 and delay other deliveries to that host.
49984 </para>
49985 <para>
49986 To test for this case, Exim sends an EHLO command to the server after
49987 closing down the TLS session. If this fails in any way, the connection is
49988 closed instead of being passed to a new delivery process, but no retry
49989 information is recorded.
49990 </para>
49991 <para>
49992 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
49993 <command>smtp</command> transport to match those hosts for which Exim should not pass
49994 connections to new processes if TLS has been used.
49995 </para>
49996 </section>
49997 <section id="SECTcerandall">
49998 <title>Certificates and all that</title>
49999 <para>
50000 <indexterm role="concept">
50001 <primary>certificate</primary>
50002 <secondary>references to discussion</secondary>
50003 </indexterm>
50004 In order to understand fully how TLS works, you need to know about
50005 certificates, certificate signing, and certificate authorities. This is not the
50006 place to give a tutorial, especially as I do not know very much about it
50007 myself. Some helpful introduction can be found in the FAQ for the SSL addition
50008 to Apache, currently at
50009 </para>
50010 <literallayout>
50011 <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>
50012 </literallayout>
50013 <para>
50014 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
50015 links to further files.
50016 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
50017 0-201-61598-3), contains both introductory and more in-depth descriptions.
50018 Some sample programs taken from the book are available from
50019 </para>
50020 <literallayout>
50021 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
50022 </literallayout>
50023 </section>
50024 <section id="SECID186">
50025 <title>Certificate chains</title>
50026 <para>
50027 The file named by <option>tls_certificate</option> may contain more than one
50028 certificate. This is useful in the case where the certificate that is being
50029 sent is validated by an intermediate certificate which the other end does
50030 not have. Multiple certificates must be in the correct order in the file.
50031 First the host&#x2019;s certificate itself, then the first intermediate
50032 certificate to validate the issuer of the host certificate, then the next
50033 intermediate certificate to validate the issuer of the first intermediate
50034 certificate, and so on, until finally (optionally) the root certificate.
50035 The root certificate must already be trusted by the recipient for
50036 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
50037 root certificate along with the rest makes it available for the user to
50038 install if the receiving end is a client MUA that can interact with a user.
50039 </para>
50040 </section>
50041 <section id="SECID187">
50042 <title>Self-signed certificates</title>
50043 <para>
50044 <indexterm role="concept">
50045 <primary>certificate</primary>
50046 <secondary>self-signed</secondary>
50047 </indexterm>
50048 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
50049 with OpenSSL, like this:
50050 </para>
50051 <literallayout class="monospaced">
50052 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
50053             -days 9999 -nodes
50054 </literallayout>
50055 <para>
50056 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
50057 delimited and so can be identified independently. The <option>-days</option> option
50058 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
50059 important: if you do not set it, the key is encrypted with a passphrase
50060 that you are prompted for, and any use that is made of the key causes more
50061 prompting for the passphrase. This is not helpful if you are going to use
50062 this certificate and key in an MTA, where prompting is not possible.
50063 </para>
50064 <para revisionflag="changed">
50065 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
50066 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
50067 the above command might produce a date in the past.  Think carefully about
50068 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
50069 of the certificate or reconsider your platform deployment.  (At time of
50070 writing, reducing the duration is the most likely choice, but the inexorable
50071 progression of time takes us steadily towards an era where this will not
50072 be a sensible resolution).
50073 </para>
50074 <para>
50075 A self-signed certificate made in this way is sufficient for testing, and
50076 may be adequate for all your requirements if you are mainly interested in
50077 encrypting transfers, and not in secure identification.
50078 </para>
50079 <para>
50080 However, many clients require that the certificate presented by the server be a
50081 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
50082 certificate. In this situation, the self-signed certificate described above
50083 must be installed on the client host as a trusted root <emphasis>certification
50084 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
50085 signed with that self-signed certificate.
50086 </para>
50087 <para>
50088 For information on creating self-signed CA certificates and using them to sign
50089 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
50090 Open-source PKI book, available online at
50091 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
50092 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
50093 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
50094 </para>
50095 </section>
50096 </chapter>
50097
50098 <chapter id="CHAPACL">
50099 <title>Access control lists</title>
50100 <para>
50101 <indexterm role="concept" id="IIDacl" class="startofrange">
50102 <primary>access control lists (ACLs)</primary>
50103 <secondary>description</secondary>
50104 </indexterm>
50105 <indexterm role="concept">
50106 <primary>control of incoming mail</primary>
50107 </indexterm>
50108 <indexterm role="concept">
50109 <primary>message</primary>
50110 <secondary>controlling incoming</secondary>
50111 </indexterm>
50112 <indexterm role="concept">
50113 <primary>policy control</primary>
50114 <secondary>access control lists</secondary>
50115 </indexterm>
50116 Access Control Lists (ACLs) are defined in a separate section of the run time
50117 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
50118 name, terminated by a colon. Here is a complete ACL section that contains just
50119 one very small ACL:
50120 </para>
50121 <literallayout class="monospaced">
50122 begin acl
50123 small_acl:
50124   accept   hosts = one.host.only
50125 </literallayout>
50126 <para>
50127 You can have as many lists as you like in the ACL section, and the order in
50128 which they appear does not matter. The lists are self-terminating.
50129 </para>
50130 <para>
50131 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
50132 certain SMTP commands. This applies both to incoming TCP/IP connections, and
50133 when a local process submits a message using SMTP by specifying the <option>-bs</option>
50134 option. The most common use is for controlling which recipients are accepted
50135 in incoming messages. In addition, you can define an ACL that is used to check
50136 local non-SMTP messages. The default configuration file contains an example of
50137 a realistic ACL for checking RCPT commands. This is discussed in chapter
50138 <xref linkend="CHAPdefconfil"/>.
50139 </para>
50140 <section id="SECID188">
50141 <title>Testing ACLs</title>
50142 <para>
50143 The <option>-bh</option> command line option provides a way of testing your ACL
50144 configuration locally by running a fake SMTP session with which you interact.
50145 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
50146 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
50147 </para>
50148 </section>
50149 <section id="SECID189">
50150 <title>Specifying when ACLs are used</title>
50151 <para>
50152 <indexterm role="concept">
50153 <primary>access control lists (ACLs)</primary>
50154 <secondary>options for specifying</secondary>
50155 </indexterm>
50156 In order to cause an ACL to be used, you have to name it in one of the relevant
50157 options in the main part of the configuration. These options are:
50158 <indexterm role="concept">
50159 <primary>AUTH</primary>
50160 <secondary>ACL for</secondary>
50161 </indexterm>
50162 <indexterm role="concept">
50163 <primary>DATA</primary>
50164 <secondary>ACLs for</secondary>
50165 </indexterm>
50166 <indexterm role="concept">
50167 <primary>ETRN</primary>
50168 <secondary>ACL for</secondary>
50169 </indexterm>
50170 <indexterm role="concept">
50171 <primary>EXPN</primary>
50172 <secondary>ACL for</secondary>
50173 </indexterm>
50174 <indexterm role="concept">
50175 <primary>HELO</primary>
50176 <secondary>ACL for</secondary>
50177 </indexterm>
50178 <indexterm role="concept">
50179 <primary>EHLO</primary>
50180 <secondary>ACL for</secondary>
50181 </indexterm>
50182 <indexterm role="concept">
50183 <primary>MAIL</primary>
50184 <secondary>ACL for</secondary>
50185 </indexterm>
50186 <indexterm role="concept">
50187 <primary>QUIT, ACL for</primary>
50188 </indexterm>
50189 <indexterm role="concept">
50190 <primary>RCPT</primary>
50191 <secondary>ACL for</secondary>
50192 </indexterm>
50193 <indexterm role="concept">
50194 <primary>STARTTLS, ACL for</primary>
50195 </indexterm>
50196 <indexterm role="concept">
50197 <primary>VRFY</primary>
50198 <secondary>ACL for</secondary>
50199 </indexterm>
50200 <indexterm role="concept">
50201 <primary>SMTP</primary>
50202 <secondary>connection, ACL for</secondary>
50203 </indexterm>
50204 <indexterm role="concept">
50205 <primary>non-SMTP messages</primary>
50206 <secondary>ACLs for</secondary>
50207 </indexterm>
50208 <indexterm role="concept">
50209 <primary>MIME content scanning</primary>
50210 <secondary>ACL for</secondary>
50211 </indexterm>
50212 </para>
50213 <informaltable frame="none">
50214 <tgroup cols="2" colsep="0" rowsep="0">
50215 <colspec colwidth="140pt" align="left"/>
50216 <colspec colwidth="254pt" align="left"/>
50217 <tbody>
50218 <row>
50219 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
50220 <entry>ACL for non-SMTP messages</entry>
50221 </row>
50222 <row>
50223 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
50224 <entry>ACL for non-SMTP MIME parts</entry>
50225 </row>
50226 <row>
50227 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
50228 <entry>ACL at start of non-SMTP message</entry>
50229 </row>
50230 <row>
50231 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
50232 <entry>ACL for AUTH</entry>
50233 </row>
50234 <row>
50235 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
50236 <entry>ACL for start of SMTP connection</entry>
50237 </row>
50238 <row>
50239 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
50240 <entry>ACL after DATA is complete</entry>
50241 </row>
50242 <row>
50243 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
50244 <entry>ACL for ETRN</entry>
50245 </row>
50246 <row>
50247 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
50248 <entry>ACL for EXPN</entry>
50249 </row>
50250 <row>
50251 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
50252 <entry>ACL for HELO or EHLO</entry>
50253 </row>
50254 <row>
50255 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
50256 <entry>ACL for MAIL</entry>
50257 </row>
50258 <row>
50259 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
50260 <entry>ACL for the AUTH parameter of MAIL</entry>
50261 </row>
50262 <row>
50263 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
50264 <entry>ACL for content-scanning MIME parts</entry>
50265 </row>
50266 <row>
50267 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
50268 <entry>ACL for non-QUIT terminations</entry>
50269 </row>
50270 <row>
50271 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
50272 <entry>ACL at start of DATA command</entry>
50273 </row>
50274 <row>
50275 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
50276 <entry>ACL for QUIT</entry>
50277 </row>
50278 <row>
50279 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
50280 <entry>ACL for RCPT</entry>
50281 </row>
50282 <row>
50283 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
50284 <entry>ACL for STARTTLS</entry>
50285 </row>
50286 <row>
50287 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
50288 <entry>ACL for VRFY</entry>
50289 </row>
50290 </tbody>
50291 </tgroup>
50292 </informaltable>
50293 <para>
50294 For example, if you set
50295 </para>
50296 <literallayout class="monospaced">
50297 acl_smtp_rcpt = small_acl
50298 </literallayout>
50299 <para>
50300 the little ACL defined above is used whenever Exim receives a RCPT command
50301 in an SMTP dialogue. The majority of policy tests on incoming messages can be
50302 done when RCPT commands arrive. A rejection of RCPT should cause the
50303 sending MTA to give up on the recipient address contained in the RCPT
50304 command, whereas rejection at other times may cause the client MTA to keep on
50305 trying to deliver the message. It is therefore recommended that you do as much
50306 testing as possible at RCPT time.
50307 </para>
50308 </section>
50309 <section id="SECID190">
50310 <title>The non-SMTP ACLs</title>
50311 <para>
50312 <indexterm role="concept">
50313 <primary>non-SMTP messages</primary>
50314 <secondary>ACLs for</secondary>
50315 </indexterm>
50316 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
50317 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
50318 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
50319 the state of the SMTP connection such as encryption and authentication) are not
50320 relevant and are forbidden in these ACLs. However, the sender and recipients
50321 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
50322 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
50323 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
50324 in any of these ACLs.
50325 </para>
50326 <para>
50327 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
50328 non-SMTP message, before any of the message has been read. (This is the
50329 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
50330 batched SMTP input, it runs after the DATA command has been reached. The
50331 result of this ACL is ignored; it cannot be used to reject a message. If you
50332 really need to, you could set a value in an ACL variable here and reject based
50333 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
50334 controls, and in particular, it can be used to set
50335 </para>
50336 <literallayout class="monospaced">
50337 control = suppress_local_fixups
50338 </literallayout>
50339 <para>
50340 This cannot be used in the other non-SMTP ACLs because by the time they are
50341 run, it is too late.
50342 </para>
50343 <para>
50344 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
50345 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
50346 </para>
50347 <para>
50348 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
50349 kind of rejection is treated as permanent, because there is no way of sending a
50350 temporary error for these kinds of message.
50351 </para>
50352 </section>
50353 <section id="SECID191">
50354 <title>The SMTP connect ACL</title>
50355 <para>
50356 <indexterm role="concept">
50357 <primary>SMTP</primary>
50358 <secondary>connection, ACL for</secondary>
50359 </indexterm>
50360 <indexterm role="option">
50361 <primary><option>smtp_banner</option></primary>
50362 </indexterm>
50363 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
50364 session, after the test specified by <option>host_reject_connection</option> (which is now
50365 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
50366 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
50367 the message override the banner message that is otherwise specified by the
50368 <option>smtp_banner</option> option.
50369 </para>
50370 </section>
50371 <section id="SECID192">
50372 <title>The EHLO/HELO ACL</title>
50373 <para>
50374 <indexterm role="concept">
50375 <primary>EHLO</primary>
50376 <secondary>ACL for</secondary>
50377 </indexterm>
50378 <indexterm role="concept">
50379 <primary>HELO</primary>
50380 <secondary>ACL for</secondary>
50381 </indexterm>
50382 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
50383 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
50384 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
50385 Note that a client may issue more than one EHLO or HELO command in an SMTP
50386 session, and indeed is required to issue a new EHLO or HELO after successfully
50387 setting up encryption following a STARTTLS command.
50388 </para>
50389 <para>
50390 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
50391 modifier, the message may not contain more than one line (it will be truncated
50392 at the first newline and a panic logged if it does). Such a message cannot
50393 affect the EHLO options that are listed on the second and subsequent lines of
50394 an EHLO response.
50395 </para>
50396 </section>
50397 <section id="SECID193">
50398 <title>The DATA ACLs</title>
50399 <para>
50400 <indexterm role="concept">
50401 <primary>DATA</primary>
50402 <secondary>ACLs for</secondary>
50403 </indexterm>
50404 Two ACLs are associated with the DATA command, because it is two-stage
50405 command, with two responses being sent to the client.
50406 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
50407 is obeyed. This gives you control after all the RCPT commands, but before
50408 the message itself is received. It offers the opportunity to give a negative
50409 response to the DATA command before the data is transmitted. Header lines
50410 added by MAIL or RCPT ACLs are not visible at this time, but any that
50411 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
50412 </para>
50413 <para>
50414 You cannot test the contents of the message, for example, to verify addresses
50415 in the headers, at RCPT time or when the DATA command is received. Such
50416 tests have to appear in the ACL that is run after the message itself has been
50417 received, before the final response to the DATA command is sent. This is
50418 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
50419 associated with the DATA command.
50420 </para>
50421 <para>
50422 For both of these ACLs, it is not possible to reject individual recipients. An
50423 error response rejects the entire message. Unfortunately, it is known that some
50424 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
50425 before or after the data) correctly &ndash; they keep the message on their queues
50426 and try again later, but that is their problem, though it does waste some of
50427 your resources.
50428 </para>
50429 <para revisionflag="changed">
50430 The <option>acl_smtp_data</option> ACL is run after both the <option>acl_smtp_dkim</option> and
50431 the <option>acl_smtp_mime</option> ACLs.
50432 </para>
50433 </section>
50434 <section id="SECTDKIMACL">
50435 <title>The SMTP DKIM ACL</title>
50436 <para>
50437 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
50438 enabled (which is the default).
50439 </para>
50440 <para>
50441 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
50442 received, and is executed for each DKIM signature found in a message.  If not
50443 otherwise specified, the default action is to accept.
50444 </para>
50445 <para revisionflag="changed">
50446 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
50447 </para>
50448 <para revisionflag="changed">
50449 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
50450 </para>
50451 </section>
50452 <section id="SECID194">
50453 <title>The SMTP MIME ACL</title>
50454 <para>
50455 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
50456 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
50457 </para>
50458 <para>
50459 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
50460 </para>
50461 </section>
50462 <section id="SECTQUITACL">
50463 <title>The QUIT ACL</title>
50464 <para>
50465 <indexterm role="concept">
50466 <primary>QUIT, ACL for</primary>
50467 </indexterm>
50468 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
50469 does not affect the response code to QUIT, which is always 221. Thus, the ACL
50470 does not in fact control any access. For this reason, the only verbs that are
50471 permitted are <option>accept</option> and <option>warn</option>.
50472 </para>
50473 <para>
50474 This ACL can be used for tasks such as custom logging at the end of an SMTP
50475 session. For example, you can use ACL variables in other ACLs to count
50476 messages, recipients, etc., and log the totals at QUIT time using one or
50477 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
50478 </para>
50479 <para>
50480 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
50481 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
50482 </para>
50483 <para>
50484 You do not need to have a final <option>accept</option>, but if you do, you can use a
50485 <option>message</option> modifier to specify custom text that is sent as part of the 221
50486 response to QUIT.
50487 </para>
50488 <para>
50489 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
50490 failure (for example, failure to open a log file, or when Exim is bombing out
50491 because it has detected an unrecoverable error), all SMTP commands from the
50492 client are given temporary error responses until QUIT is received or the
50493 connection is closed. In these special cases, the QUIT ACL does not run.
50494 </para>
50495 </section>
50496 <section id="SECTNOTQUITACL">
50497 <title>The not-QUIT ACL</title>
50498 <para>
50499 <indexterm role="variable">
50500 <primary><varname>$acl_smtp_notquit</varname></primary>
50501 </indexterm>
50502 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
50503 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
50504 trouble, such as being unable to write to its log files, this ACL is not run,
50505 because it might try to do things (such as write to log files) that make the
50506 situation even worse.
50507 </para>
50508 <para>
50509 Like the QUIT ACL, this ACL is provided to make it possible to do customized
50510 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
50511 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
50512 and <option>warn</option>.
50513 </para>
50514 <para>
50515 <indexterm role="variable">
50516 <primary><varname>$smtp_notquit_reason</varname></primary>
50517 </indexterm>
50518 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
50519 to a string that indicates the reason for the termination of the SMTP
50520 connection. The possible values are:
50521 </para>
50522 <informaltable frame="none">
50523 <tgroup cols="2" colsep="0" rowsep="0">
50524 <colspec colwidth="196pt" align="left"/>
50525 <colspec colwidth="254pt" align="left"/>
50526 <tbody>
50527 <row>
50528 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
50529 <entry>Another ACL issued a <option>drop</option> command</entry>
50530 </row>
50531 <row>
50532 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
50533 <entry>Too many unknown or non-mail commands</entry>
50534 </row>
50535 <row>
50536 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
50537 <entry>Timeout while reading SMTP commands</entry>
50538 </row>
50539 <row>
50540 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
50541 <entry>The SMTP connection has been lost</entry>
50542 </row>
50543 <row>
50544 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
50545 <entry>Timeout while reading message data</entry>
50546 </row>
50547 <row>
50548 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
50549 <entry>The <function>local_scan()</function> function crashed</entry>
50550 </row>
50551 <row>
50552 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
50553 <entry>The <function>local_scan()</function> function timed out</entry>
50554 </row>
50555 <row>
50556 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
50557 <entry>SIGTERM or SIGINT</entry>
50558 </row>
50559 <row>
50560 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
50561 <entry>SMTP synchronization error</entry>
50562 </row>
50563 <row>
50564 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
50565 <entry>TLS failed to start</entry>
50566 </row>
50567 </tbody>
50568 </tgroup>
50569 </informaltable>
50570 <para>
50571 In most cases when an SMTP connection is closed without having received QUIT,
50572 Exim sends an SMTP response message before actually closing the connection.
50573 With the exception of the <literal>acl-drop</literal> case, the default message can be
50574 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
50575 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
50576 used.
50577 </para>
50578 </section>
50579 <section id="SECID195">
50580 <title>Finding an ACL to use</title>
50581 <para>
50582 <indexterm role="concept">
50583 <primary>access control lists (ACLs)</primary>
50584 <secondary>finding which to use</secondary>
50585 </indexterm>
50586 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
50587 you can use different ACLs in different circumstances. For example,
50588 </para>
50589 <literallayout class="monospaced">
50590 acl_smtp_rcpt = ${if ={25}{$interface_port} \
50591                      {acl_check_rcpt} {acl_check_rcpt_submit} }
50592 </literallayout>
50593 <para>
50594 In the default configuration file there are some example settings for
50595 providing an RFC 4409 message submission service on port 587 and a
50596 non-standard <quote>smtps</quote> service on port 465. You can use a string
50597 expansion like this to choose an ACL for MUAs on these ports which is
50598 more appropriate for this purpose than the default ACL on port 25.
50599 </para>
50600 <para>
50601 The expanded string does not have to be the name of an ACL in the
50602 configuration file; there are other possibilities. Having expanded the
50603 string, Exim searches for an ACL as follows:
50604 </para>
50605 <itemizedlist>
50606 <listitem>
50607 <para>
50608 If the string begins with a slash, Exim uses it as a file name, and reads its
50609 contents as an ACL. The lines are processed in the same way as lines in the
50610 Exim configuration file. In particular, continuation lines are supported, blank
50611 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
50612 If the file does not exist or cannot be read, an error occurs (typically
50613 causing a temporary failure of whatever caused the ACL to be run). For example:
50614 </para>
50615 <literallayout class="monospaced">
50616 acl_smtp_data = /etc/acls/\
50617   ${lookup{$sender_host_address}lsearch\
50618   {/etc/acllist}{$value}{default}}
50619 </literallayout>
50620 <para>
50621 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
50622 back to a default if the lookup fails. If an ACL is successfully read from a
50623 file, it is retained in memory for the duration of the Exim process, so that it
50624 can be re-used without having to re-read the file.
50625 </para>
50626 </listitem>
50627 <listitem>
50628 <para>
50629 If the string does not start with a slash, and does not contain any spaces,
50630 Exim searches the ACL section of the configuration for an ACL whose name
50631 matches the string.
50632 </para>
50633 </listitem>
50634 <listitem>
50635 <para>
50636 If no named ACL is found, or if the string contains spaces, Exim parses
50637 the string as an inline ACL. This can save typing in cases where you just
50638 want to have something like
50639 </para>
50640 <literallayout class="monospaced">
50641 acl_smtp_vrfy = accept
50642 </literallayout>
50643 <para>
50644 in order to allow free use of the VRFY command. Such a string may contain
50645 newlines; it is processed in the same way as an ACL that is read from a file.
50646 </para>
50647 </listitem>
50648 </itemizedlist>
50649 </section>
50650 <section id="SECID196">
50651 <title>ACL return codes</title>
50652 <para>
50653 <indexterm role="concept">
50654 <primary>access control lists (ACLs)</primary>
50655 <secondary>return codes</secondary>
50656 </indexterm>
50657 Except for the QUIT ACL, which does not affect the SMTP return code (see
50658 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
50659 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
50660 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
50661 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
50662 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
50663 This also causes a 4<emphasis>xx</emphasis> return code.
50664 </para>
50665 <para>
50666 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
50667 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
50668 submitters of non-SMTP messages.
50669 </para>
50670 <para>
50671 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
50672 has the effect of <quote>accept</quote>, but causes either the entire message or an
50673 individual recipient address to be discarded. In other words, it is a
50674 blackholing facility. Use it with care.
50675 </para>
50676 <para>
50677 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
50678 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
50679 RCPT ACL is to discard just the one recipient address. If there are no
50680 recipients left when the message&#x2019;s data is received, the DATA ACL is not
50681 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
50682 remaining recipients. The <quote>discard</quote> return is not permitted for the
50683 <option>acl_smtp_predata</option> ACL.
50684 </para>
50685 <para>
50686 <indexterm role="concept">
50687 <primary><function>local_scan()</function> function</primary>
50688 <secondary>when all recipients discarded</secondary>
50689 </indexterm>
50690 The <function>local_scan()</function> function is always run, even if there are no remaining
50691 recipients; it may create new recipients.
50692 </para>
50693 </section>
50694 <section id="SECID197">
50695 <title>Unset ACL options</title>
50696 <para>
50697 <indexterm role="concept">
50698 <primary>access control lists (ACLs)</primary>
50699 <secondary>unset options</secondary>
50700 </indexterm>
50701 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
50702 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
50703 not defined at all. For any defined ACL, the default action when control
50704 reaches the end of the ACL statements is <quote>deny</quote>.
50705 </para>
50706 <para>
50707 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
50708 these two are ACLs that are used only for their side effects. They cannot be
50709 used to accept or reject anything.
50710 </para>
50711 <para>
50712 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
50713 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
50714 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
50715 when the ACL is not defined is <quote>accept</quote>.
50716 </para>
50717 <para>
50718 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
50719 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
50720 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
50721 messages over an SMTP connection. For an example, see the ACL in the default
50722 configuration file.
50723 </para>
50724 </section>
50725 <section id="SECID198">
50726 <title>Data for message ACLs</title>
50727 <para>
50728 <indexterm role="concept">
50729 <primary>access control lists (ACLs)</primary>
50730 <secondary>data for message ACL</secondary>
50731 </indexterm>
50732 <indexterm role="variable">
50733 <primary><varname>$domain</varname></primary>
50734 </indexterm>
50735 <indexterm role="variable">
50736 <primary><varname>$local_part</varname></primary>
50737 </indexterm>
50738 <indexterm role="variable">
50739 <primary><varname>$sender_address</varname></primary>
50740 </indexterm>
50741 <indexterm role="variable">
50742 <primary><varname>$sender_host_address</varname></primary>
50743 </indexterm>
50744 <indexterm role="variable">
50745 <primary><varname>$smtp_command</varname></primary>
50746 </indexterm>
50747 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
50748 that contain information about the host and the message&#x2019;s sender (for example,
50749 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
50750 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
50751 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
50752 is available in <varname>$smtp_command</varname>.
50753 </para>
50754 <para>
50755 When an ACL for the AUTH parameter of MAIL is running, the variables that
50756 contain information about the host are set, but <varname>$sender_address</varname> is not yet
50757 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
50758 how it is used.
50759 </para>
50760 <para>
50761 <indexterm role="variable">
50762 <primary><varname>$message_size</varname></primary>
50763 </indexterm>
50764 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
50765 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
50766 that parameter is not given. The value is updated to the true message size by
50767 the time the final DATA ACL is run (after the message data has been
50768 received).
50769 </para>
50770 <para>
50771 <indexterm role="variable">
50772 <primary><varname>$rcpt_count</varname></primary>
50773 </indexterm>
50774 <indexterm role="variable">
50775 <primary><varname>$recipients_count</varname></primary>
50776 </indexterm>
50777 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
50778 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
50779 accepted, so while an ACL for RCPT is being processed, it contains the number
50780 of previously accepted recipients. At DATA time (for both the DATA ACLs),
50781 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
50782 <varname>$recipients_count</varname> contains the total number of accepted recipients.
50783 </para>
50784 </section>
50785 <section id="SECTdatfornon">
50786 <title>Data for non-message ACLs</title>
50787 <para>
50788 <indexterm role="concept">
50789 <primary>access control lists (ACLs)</primary>
50790 <secondary>data for non-message ACL</secondary>
50791 </indexterm>
50792 <indexterm role="variable">
50793 <primary><varname>$smtp_command_argument</varname></primary>
50794 </indexterm>
50795 <indexterm role="variable">
50796 <primary><varname>$smtp_command</varname></primary>
50797 </indexterm>
50798 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
50799 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
50800 and the entire SMTP command is available in <varname>$smtp_command</varname>.
50801 These variables can be tested using a <option>condition</option> condition. For example,
50802 here is an ACL for use with AUTH, which insists that either the session is
50803 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
50804 does not permit authentication methods that use cleartext passwords on
50805 unencrypted connections.
50806 </para>
50807 <literallayout class="monospaced">
50808 acl_check_auth:
50809   accept encrypted = *
50810   accept condition = ${if eq{${uc:$smtp_command_argument}}\
50811                      {CRAM-MD5}}
50812   deny   message   = TLS encryption or CRAM-MD5 required
50813 </literallayout>
50814 <para>
50815 (Another way of applying this restriction is to arrange for the authenticators
50816 that use cleartext passwords not to be advertised when the connection is not
50817 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
50818 option to do this.)
50819 </para>
50820 </section>
50821 <section id="SECID199">
50822 <title>Format of an ACL</title>
50823 <para>
50824 <indexterm role="concept">
50825 <primary>access control lists (ACLs)</primary>
50826 <secondary>format of</secondary>
50827 </indexterm>
50828 <indexterm role="concept">
50829 <primary>access control lists (ACLs)</primary>
50830 <secondary>verbs, definition of</secondary>
50831 </indexterm>
50832 An individual ACL consists of a number of statements. Each statement starts
50833 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
50834 Modifiers can change the way the verb operates, define error and log messages,
50835 set variables, insert delays, and vary the processing of accepted messages.
50836 </para>
50837 <para>
50838 If all the conditions are met, the verb is obeyed. The same condition may be
50839 used (with different arguments) more than once in the same statement. This
50840 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
50841 example:
50842 </para>
50843 <literallayout class="monospaced">
50844 deny  dnslists = list1.example
50845 dnslists = list2.example
50846 </literallayout>
50847 <para>
50848 If there are no conditions, the verb is always obeyed. Exim stops evaluating
50849 the conditions and modifiers when it reaches a condition that fails. What
50850 happens then depends on the verb (and in one case, on a special modifier). Not
50851 all the conditions make sense at every testing point. For example, you cannot
50852 test a sender address in the ACL that is run for a VRFY command.
50853 </para>
50854 </section>
50855 <section id="SECID200">
50856 <title>ACL verbs</title>
50857 <para>
50858 The ACL verbs are as follows:
50859 </para>
50860 <itemizedlist>
50861 <listitem>
50862 <para>
50863 <indexterm role="concept">
50864 <primary><option>accept</option> ACL verb</primary>
50865 </indexterm>
50866 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
50867 of the conditions are not met, what happens depends on whether <option>endpass</option>
50868 appears among the conditions (for syntax see below). If the failing condition
50869 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
50870 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
50871 check a RCPT command:
50872 </para>
50873 <literallayout class="monospaced">
50874 accept domains = +local_domains
50875 endpass
50876 verify = recipient
50877 </literallayout>
50878 <para>
50879 If the recipient domain does not match the <option>domains</option> condition, control
50880 passes to the next statement. If it does match, the recipient is verified, and
50881 the command is accepted if verification succeeds. However, if verification
50882 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
50883 <option>endpass</option>.
50884 </para>
50885 <para>
50886 The <option>endpass</option> feature has turned out to be confusing to many people, so its
50887 use is not recommended nowadays. It is always possible to rewrite an ACL so
50888 that <option>endpass</option> is not needed, and it is no longer used in the default
50889 configuration.
50890 </para>
50891 <para>
50892 <indexterm role="concept">
50893 <primary><option>message</option> ACL modifier</primary>
50894 <secondary>with <option>accept</option></secondary>
50895 </indexterm>
50896 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
50897 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
50898 (when an <option>accept</option> verb either accepts or passes control to the next
50899 statement), <option>message</option> can be used to vary the message that is sent when an
50900 SMTP command is accepted. For example, in a RCPT ACL you could have:
50901 </para>
50902 <literallayout>
50903 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
50904 <literal>        message = OK, I will allow you through today</literal>
50905 </literallayout>
50906 <para>
50907 You can specify an SMTP response code, optionally followed by an <quote>extended
50908 response code</quote> at the start of the message, but the first digit must be the
50909 same as would be sent by default, which is 2 for an <option>accept</option> verb.
50910 </para>
50911 <para>
50912 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
50913 an error message that is used when access is denied. This behaviour is retained
50914 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
50915 of <option>endpass</option>.
50916 </para>
50917 </listitem>
50918 <listitem>
50919 <para>
50920 <indexterm role="concept">
50921 <primary><option>defer</option> ACL verb</primary>
50922 </indexterm>
50923 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
50924 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
50925 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
50926 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
50927 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
50928 be used in any ACL, and even for a recipient it might be a simpler approach.
50929 </para>
50930 </listitem>
50931 <listitem>
50932 <para>
50933 <indexterm role="concept">
50934 <primary><option>deny</option> ACL verb</primary>
50935 </indexterm>
50936 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
50937 the conditions are not met, control is passed to the next ACL statement. For
50938 example,
50939 </para>
50940 <literallayout class="monospaced">
50941 deny dnslists = blackholes.mail-abuse.org
50942 </literallayout>
50943 <para>
50944 rejects commands from hosts that are on a DNS black list.
50945 </para>
50946 </listitem>
50947 <listitem>
50948 <para>
50949 <indexterm role="concept">
50950 <primary><option>discard</option> ACL verb</primary>
50951 </indexterm>
50952 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
50953 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
50954 that are concerned with receiving messages. When all the conditions are true,
50955 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
50956 recipients to be discarded. If it is used in an ACL for RCPT, just the one
50957 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
50958 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
50959 do not appear in the log line when the <option>received_recipients</option> log selector is set.
50960 </para>
50961 <para>
50962 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
50963 its contents are added to the line that is automatically written to the log.
50964 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
50965 </para>
50966 </listitem>
50967 <listitem>
50968 <para>
50969 <indexterm role="concept">
50970 <primary><option>drop</option> ACL verb</primary>
50971 </indexterm>
50972 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
50973 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
50974 </para>
50975 <literallayout class="monospaced">
50976 drop   message   = I don't take more than 20 RCPTs
50977        condition = ${if &gt; {$rcpt_count}{20}}
50978 </literallayout>
50979 <para>
50980 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
50981 The connection is always dropped after sending a 550 response.
50982 </para>
50983 </listitem>
50984 <listitem>
50985 <para>
50986 <indexterm role="concept">
50987 <primary><option>require</option> ACL verb</primary>
50988 </indexterm>
50989 <option>require</option>: If all the conditions are met, control is passed to the next ACL
50990 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
50991 example, when checking a RCPT command,
50992 </para>
50993 <literallayout class="monospaced">
50994 require message = Sender did not verify
50995         verify  = sender
50996 </literallayout>
50997 <para>
50998 passes control to subsequent statements only if the message&#x2019;s sender can be
50999 verified. Otherwise, it rejects the command. Note the positioning of the
51000 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
51001 discussed in section <xref linkend="SECTcondmodproc"/>.
51002 </para>
51003 </listitem>
51004 <listitem>
51005 <para>
51006 <indexterm role="concept">
51007 <primary><option>warn</option> ACL verb</primary>
51008 </indexterm>
51009 <option>warn</option>: If all the conditions are true, a line specified by the
51010 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
51011 to the next ACL statement. If any condition is false, the log line is not
51012 written. If an identical log line is requested several times in the same
51013 message, only one copy is actually written to the log. If you want to force
51014 duplicates to be written, use the <option>logwrite</option> modifier instead.
51015 </para>
51016 <para>
51017 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
51018 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
51019 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
51020 first failing condition. There is more about adding header lines in section
51021 <xref linkend="SECTaddheadacl"/>.
51022 </para>
51023 <para>
51024 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
51025 some sort of defer), the log line specified by <option>log_message</option> is not written.
51026 This does not include the case of a forced failure from a lookup, which
51027 is considered to be a successful completion. After a defer, no further
51028 conditions or modifiers in the <option>warn</option> statement are processed. The incident
51029 is logged, and the ACL continues to be processed, from the next statement
51030 onwards.
51031 </para>
51032 <para>
51033 <indexterm role="variable">
51034 <primary><varname>$acl_verify_message</varname></primary>
51035 </indexterm>
51036 When one of the <option>warn</option> conditions is an address verification that fails, the
51037 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
51038 want this logged, you must set it up explicitly. For example:
51039 </para>
51040 <literallayout class="monospaced">
51041 warn   !verify = sender
51042        log_message = sender verify failed: $acl_verify_message
51043 </literallayout>
51044 </listitem>
51045 </itemizedlist>
51046 <para>
51047 At the end of each ACL there is an implicit unconditional <option>deny</option>.
51048 </para>
51049 <para>
51050 As you can see from the examples above, the conditions and modifiers are
51051 written one to a line, with the first one on the same line as the verb, and
51052 subsequent ones on following lines. If you have a very long condition, you can
51053 continue it onto several physical lines by the usual backslash continuation
51054 mechanism. It is conventional to align the conditions vertically.
51055 </para>
51056 </section>
51057 <section id="SECTaclvariables">
51058 <title>ACL variables</title>
51059 <para>
51060 <indexterm role="concept">
51061 <primary>access control lists (ACLs)</primary>
51062 <secondary>variables</secondary>
51063 </indexterm>
51064 There are some special variables that can be set during ACL processing. They
51065 can be used to pass information between different ACLs, different invocations
51066 of the same ACL in the same SMTP connection, and between ACLs and the routers,
51067 transports, and filters that are used to deliver a message. The names of these
51068 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
51069 an underscore, but the remainder of the name can be any sequence of
51070 alphanumeric characters and underscores that you choose. There is no limit on
51071 the number of ACL variables. The two sets act as follows:
51072 </para>
51073 <itemizedlist>
51074 <listitem>
51075 <para>
51076 The values of those variables whose names begin with <varname>$acl_c</varname> persist
51077 throughout an SMTP connection. They are never reset. Thus, a value that is set
51078 while receiving one message is still available when receiving the next message
51079 on the same SMTP connection.
51080 </para>
51081 </listitem>
51082 <listitem>
51083 <para>
51084 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
51085 while a message is being received. They are reset afterwards. They are also
51086 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
51087 </para>
51088 </listitem>
51089 </itemizedlist>
51090 <para>
51091 When a message is accepted, the current values of all the ACL variables are
51092 preserved with the message and are subsequently made available at delivery
51093 time. The ACL variables are set by a modifier called <option>set</option>. For example:
51094 </para>
51095 <literallayout class="monospaced">
51096 accept hosts = whatever
51097        set acl_m4 = some value
51098 accept authenticated = *
51099        set acl_c_auth = yes
51100 </literallayout>
51101 <para>
51102 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
51103 be set. If you want to set a variable without taking any action, you can use a
51104 <option>warn</option> verb without any other modifiers or conditions.
51105 </para>
51106 <para>
51107 <indexterm role="option">
51108 <primary><option>strict_acl_vars</option></primary>
51109 </indexterm>
51110 What happens if a syntactically valid but undefined ACL variable is
51111 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
51112 false (the default), an empty string is substituted; if it is true, an
51113 error is generated.
51114 </para>
51115 <para>
51116 Versions of Exim before 4.64 have a limited set of numbered variables, but
51117 their names are compatible, so there is no problem with upgrading.
51118 </para>
51119 </section>
51120 <section id="SECTcondmodproc">
51121 <title>Condition and modifier processing</title>
51122 <para>
51123 <indexterm role="concept">
51124 <primary>access control lists (ACLs)</primary>
51125 <secondary>conditions; processing</secondary>
51126 </indexterm>
51127 <indexterm role="concept">
51128 <primary>access control lists (ACLs)</primary>
51129 <secondary>modifiers; processing</secondary>
51130 </indexterm>
51131 An exclamation mark preceding a condition negates its result. For example:
51132 </para>
51133 <literallayout class="monospaced">
51134 deny   domains = *.dom.example
51135       !verify  = recipient
51136 </literallayout>
51137 <para>
51138 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
51139 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
51140 negation can be used on the right-hand side of a condition. For example, these
51141 two statements are equivalent:
51142 </para>
51143 <literallayout class="monospaced">
51144 deny  hosts = !192.168.3.4
51145 deny !hosts =  192.168.3.4
51146 </literallayout>
51147 <para>
51148 However, for many conditions (<option>verify</option> being a good example), only left-hand
51149 side negation of the whole condition is possible.
51150 </para>
51151 <para>
51152 The arguments of conditions and modifiers are expanded. A forced failure
51153 of an expansion causes a condition to be ignored, that is, it behaves as if the
51154 condition is true. Consider these two statements:
51155 </para>
51156 <literallayout class="monospaced">
51157 accept  senders = ${lookup{$host_name}lsearch\
51158                   {/some/file}{$value}fail}
51159 accept  senders = ${lookup{$host_name}lsearch\
51160                   {/some/file}{$value}{}}
51161 </literallayout>
51162 <para>
51163 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
51164 the returned list is searched, but if the lookup fails the behaviour is
51165 different in the two cases. The <option>fail</option> in the first statement causes the
51166 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
51167 therefore succeeds. The second statement, however, generates an empty list when
51168 the lookup fails. No sender can match an empty list, so the condition fails,
51169 and therefore the <option>accept</option> also fails.
51170 </para>
51171 <para>
51172 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
51173 specify actions that are taken as the conditions for a statement are checked;
51174 others specify text for messages that are used when access is denied or a
51175 warning is generated. The <option>control</option> modifier affects the way an incoming
51176 message is handled.
51177 </para>
51178 <para>
51179 The positioning of the modifiers in an ACL statement is important, because the
51180 processing of a verb ceases as soon as its outcome is known. Only those
51181 modifiers that have already been encountered will take effect. For example,
51182 consider this use of the <option>message</option> modifier:
51183 </para>
51184 <literallayout class="monospaced">
51185 require message = Can't verify sender
51186         verify  = sender
51187         message = Can't verify recipient
51188         verify  = recipient
51189         message = This message cannot be used
51190 </literallayout>
51191 <para>
51192 If sender verification fails, Exim knows that the result of the statement is
51193 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
51194 so its text is used as the error message. If sender verification succeeds, but
51195 recipient verification fails, the second message is used. If recipient
51196 verification succeeds, the third message becomes <quote>current</quote>, but is never used
51197 because there are no more conditions to cause failure.
51198 </para>
51199 <para>
51200 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
51201 modifier that is used, because all the conditions must be true for rejection to
51202 happen. Specifying more than one <option>message</option> modifier does not make sense, and
51203 the message can even be specified after all the conditions. For example:
51204 </para>
51205 <literallayout class="monospaced">
51206 deny   hosts = ...
51207       !senders = *@my.domain.example
51208        message = Invalid sender from client host
51209 </literallayout>
51210 <para>
51211 The <quote>deny</quote> result does not happen until the end of the statement is reached,
51212 by which time Exim has set up the message.
51213 </para>
51214 </section>
51215 <section id="SECTACLmodi">
51216 <title>ACL modifiers</title>
51217 <para>
51218 <indexterm role="concept">
51219 <primary>access control lists (ACLs)</primary>
51220 <secondary>modifiers; list of</secondary>
51221 </indexterm>
51222 The ACL modifiers are as follows:
51223 </para>
51224 <variablelist>
51225 <varlistentry>
51226 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51227 <listitem>
51228 <para>
51229 This modifier specifies one or more header lines that are to be added to an
51230 incoming message, assuming, of course, that the message is ultimately
51231 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
51232 </para>
51233 </listitem></varlistentry>
51234 <varlistentry>
51235 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51236 <listitem>
51237 <para>
51238 <indexterm role="concept">
51239 <primary><option>continue</option> ACL modifier</primary>
51240 </indexterm>
51241 <indexterm role="concept">
51242 <primary>database</primary>
51243 <secondary>updating in ACL</secondary>
51244 </indexterm>
51245 This modifier does nothing of itself, and processing of the ACL always
51246 continues with the next condition or modifier. The value of <option>continue</option> is in
51247 the side effects of expanding its argument. Typically this could be used to
51248 update a database. It is really just a syntactic tidiness, to avoid having to
51249 write rather ugly lines like this:
51250 </para>
51251 <literallayout>
51252 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
51253 </literallayout>
51254 <para>
51255 Instead, all you need is
51256 </para>
51257 <literallayout>
51258 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
51259 </literallayout>
51260 </listitem></varlistentry>
51261 <varlistentry>
51262 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51263 <listitem>
51264 <para>
51265 <indexterm role="concept">
51266 <primary><option>control</option> ACL modifier</primary>
51267 </indexterm>
51268 This modifier affects the subsequent processing of the SMTP connection or of an
51269 incoming message that is accepted. The effect of the first type of control
51270 lasts for the duration of the connection, whereas the effect of the second type
51271 lasts only until the current message has been received. The message-specific
51272 controls always apply to the whole message, not to individual recipients,
51273 even if the <option>control</option> modifier appears in a RCPT ACL.
51274 </para>
51275 <para>
51276 As there are now quite a few controls that can be applied, they are described
51277 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
51278 in several different ways. For example:
51279 </para>
51280 <itemizedlist>
51281 <listitem>
51282 <para>
51283 It can be at the end of an <option>accept</option> statement:
51284 </para>
51285 <literallayout class="monospaced">
51286     accept  ...some conditions
51287             control = queue_only
51288 </literallayout>
51289 <para>
51290 In this case, the control is applied when this statement yields <quote>accept</quote>, in
51291 other words, when the conditions are all true.
51292 </para>
51293 </listitem>
51294 <listitem>
51295 <para>
51296 It can be in the middle of an <option>accept</option> statement:
51297 </para>
51298 <literallayout class="monospaced">
51299     accept  ...some conditions...
51300             control = queue_only
51301             ...some more conditions...
51302 </literallayout>
51303 <para>
51304 If the first set of conditions are true, the control is applied, even if the
51305 statement does not accept because one of the second set of conditions is false.
51306 In this case, some subsequent statement must yield <quote>accept</quote> for the control
51307 to be relevant.
51308 </para>
51309 </listitem>
51310 <listitem>
51311 <para>
51312 It can be used with <option>warn</option> to apply the control, leaving the
51313 decision about accepting or denying to a subsequent verb. For
51314 example:
51315 </para>
51316 <literallayout class="monospaced">
51317     warn    ...some conditions...
51318             control = freeze
51319     accept  ...
51320 </literallayout>
51321 <para>
51322 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
51323 <option>logwrite</option>, so it does not add anything to the message and does not write a
51324 log entry.
51325 </para>
51326 </listitem>
51327 <listitem>
51328 <para>
51329 If you want to apply a control unconditionally, you can use it with a
51330 <option>require</option> verb. For example:
51331 </para>
51332 <literallayout class="monospaced">
51333     require  control = no_multiline_responses
51334 </literallayout>
51335 </listitem>
51336 </itemizedlist>
51337 </listitem></varlistentry>
51338 <varlistentry>
51339 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
51340 <listitem>
51341 <para>
51342 <indexterm role="concept">
51343 <primary><option>delay</option> ACL modifier</primary>
51344 </indexterm>
51345 <indexterm role="option">
51346 <primary><option>-bh</option></primary>
51347 </indexterm>
51348 This modifier may appear in any ACL except notquit. It causes Exim to wait for
51349 the time interval before proceeding. However, when testing Exim using the
51350 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
51351 output instead). The time is given in the usual Exim notation, and the delay
51352 happens as soon as the modifier is processed. In an SMTP session, pending
51353 output is flushed before the delay is imposed.
51354 </para>
51355 <para>
51356 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
51357 example:
51358 </para>
51359 <literallayout class="monospaced">
51360 deny    ...some conditions...
51361         delay = 30s
51362 </literallayout>
51363 <para>
51364 The delay happens if all the conditions are true, before the statement returns
51365 <quote>deny</quote>. Compare this with:
51366 </para>
51367 <literallayout class="monospaced">
51368 deny    delay = 30s
51369         ...some conditions...
51370 </literallayout>
51371 <para>
51372 which waits for 30s before processing the conditions. The <option>delay</option> modifier
51373 can also be used with <option>warn</option> and together with <option>control</option>:
51374 </para>
51375 <literallayout class="monospaced">
51376 warn    ...some conditions...
51377         delay = 2m
51378         control = freeze
51379 accept  ...
51380 </literallayout>
51381 <para>
51382 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
51383 responses to several commands are no longer buffered and sent in one packet (as
51384 they would normally be) because all output is flushed before imposing the
51385 delay. This optimization is disabled so that a number of small delays do not
51386 appear to the client as one large aggregated delay that might provoke an
51387 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
51388 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
51389 </para>
51390 </listitem></varlistentry>
51391 <varlistentry>
51392 <term><emphasis role="bold">endpass</emphasis></term>
51393 <listitem>
51394 <para>
51395 <indexterm role="concept">
51396 <primary><option>endpass</option> ACL modifier</primary>
51397 </indexterm>
51398 This modifier, which has no argument, is recognized only in <option>accept</option> and
51399 <option>discard</option> statements. It marks the boundary between the conditions whose
51400 failure causes control to pass to the next statement, and the conditions whose
51401 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
51402 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
51403 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
51404 </para>
51405 </listitem></varlistentry>
51406 <varlistentry>
51407 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51408 <listitem>
51409 <para>
51410 <indexterm role="concept">
51411 <primary><option>log_message</option> ACL modifier</primary>
51412 </indexterm>
51413 This modifier sets up a message that is used as part of the log message if the
51414 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
51415 </para>
51416 <literallayout class="monospaced">
51417 require log_message = wrong cipher suite $tls_in_cipher
51418         encrypted   = DES-CBC3-SHA
51419 </literallayout>
51420 <para>
51421 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
51422 example:
51423 </para>
51424 <literallayout>
51425 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
51426 <literal>        log_message = Discarded $local_part@$domain because...</literal>
51427 </literallayout>
51428 <para>
51429 When access is denied, <option>log_message</option> adds to any underlying error message
51430 that may exist because of a condition failure. For example, while verifying a
51431 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
51432 message.
51433 </para>
51434 <para>
51435 The message may be defined before the conditions to which it applies, because
51436 the string expansion does not happen until Exim decides that access is to be
51437 denied. This means that any variables that are set by the condition are
51438 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
51439 variables are set after a DNS black list lookup succeeds. If the expansion of
51440 <option>log_message</option> fails, or if the result is an empty string, the modifier is
51441 ignored.
51442 </para>
51443 <para>
51444 <indexterm role="variable">
51445 <primary><varname>$acl_verify_message</varname></primary>
51446 </indexterm>
51447 If you want to use a <option>warn</option> statement to log the result of an address
51448 verification, you can use <varname>$acl_verify_message</varname> to include the verification
51449 error message.
51450 </para>
51451 <para>
51452 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
51453 the start of the logged message. If the same warning log message is requested
51454 more than once while receiving  a single email message, only one copy is
51455 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
51456 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
51457 is logged for a successful <option>warn</option> statement.
51458 </para>
51459 <para>
51460 If <option>log_message</option> is not present and there is no underlying error message (for
51461 example, from the failure of address verification), but <option>message</option> is present,
51462 the <option>message</option> text is used for logging rejections. However, if any text for
51463 logging contains newlines, only the first line is logged. In the absence of
51464 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
51465 logging rejections.
51466 </para>
51467 </listitem></varlistentry>
51468 <varlistentry>
51469 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
51470 <listitem>
51471 <para>
51472 <indexterm role="concept">
51473 <primary><option>log_reject_target</option> ACL modifier</primary>
51474 </indexterm>
51475 <indexterm role="concept">
51476 <primary>logging in ACL</primary>
51477 <secondary>specifying which log</secondary>
51478 </indexterm>
51479 This modifier makes it possible to specify which logs are used for messages
51480 about ACL rejections. Its argument is a colon-separated list of words that can
51481 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
51482 may be empty, in which case a rejection is not logged at all. For example, this
51483 ACL fragment writes no logging information when access is denied:
51484 </para>
51485 <literallayout>
51486 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
51487 <literal>     log_reject_target =</literal>
51488 </literallayout>
51489 <para>
51490 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
51491 permanent and temporary rejections. Its effect lasts for the rest of the
51492 current ACL.
51493 </para>
51494 </listitem></varlistentry>
51495 <varlistentry>
51496 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51497 <listitem>
51498 <para>
51499 <indexterm role="concept">
51500 <primary><option>logwrite</option> ACL modifier</primary>
51501 </indexterm>
51502 <indexterm role="concept">
51503 <primary>logging in ACL</primary>
51504 <secondary>immediate</secondary>
51505 </indexterm>
51506 This modifier writes a message to a log file as soon as it is encountered when
51507 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
51508 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
51509 access.) The <option>logwrite</option> modifier can be used to log special incidents in
51510 ACLs. For example:
51511 </para>
51512 <literallayout>
51513 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
51514 <literal>       control  = freeze</literal>
51515 <literal>       logwrite = froze message because ...</literal>
51516 </literallayout>
51517 <para>
51518 By default, the message is written to the main log. However, it may begin
51519 with a colon, followed by a comma-separated list of log names, and then
51520 another colon, to specify exactly which logs are to be written. For
51521 example:
51522 </para>
51523 <literallayout class="monospaced">
51524 logwrite = :main,reject: text for main and reject logs
51525 logwrite = :panic: text for panic log only
51526 </literallayout>
51527 </listitem></varlistentry>
51528 <varlistentry>
51529 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51530 <listitem>
51531 <para>
51532 <indexterm role="concept">
51533 <primary><option>message</option> ACL modifier</primary>
51534 </indexterm>
51535 This modifier sets up a text string that is expanded and used as a response
51536 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
51537 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
51538 there is some complication if <option>endpass</option> is involved; see the description of
51539 <option>accept</option> for details.)
51540 </para>
51541 <para>
51542 The expansion of the message happens at the time Exim decides that the ACL is
51543 to end, not at the time it processes <option>message</option>. If the expansion fails, or
51544 generates an empty string, the modifier is ignored. Here is an example where
51545 <option>message</option> must be specified first, because the ACL ends with a rejection if
51546 the <option>hosts</option> condition fails:
51547 </para>
51548 <literallayout class="monospaced">
51549 require  message = Host not recognized
51550          hosts = 10.0.0.0/8
51551 </literallayout>
51552 <para>
51553 (Once a condition has failed, no further conditions or modifiers are
51554 processed.)
51555 </para>
51556 <para>
51557 <indexterm role="concept">
51558 <primary>SMTP</primary>
51559 <secondary>error codes</secondary>
51560 </indexterm>
51561 <indexterm role="option">
51562 <primary><option>smtp_banner</option></primary>
51563 </indexterm>
51564 For ACLs that are triggered by SMTP commands, the message is returned as part
51565 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
51566 is meaningful only for SMTP, as no message is returned when a non-SMTP message
51567 is accepted. In the case of the connect ACL, accepting with a message modifier
51568 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
51569 accept message may not contain more than one line (otherwise it will be
51570 truncated at the first newline and a panic logged), and it cannot affect the
51571 EHLO options.
51572 </para>
51573 <para>
51574 When SMTP is involved, the message may begin with an overriding response code,
51575 consisting of three digits optionally followed by an <quote>extended response code</quote>
51576 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
51577 </para>
51578 <literallayout class="monospaced">
51579 deny  message = 599 1.2.3 Host not welcome
51580       hosts = 192.168.34.0/24
51581 </literallayout>
51582 <para>
51583 The first digit of the supplied response code must be the same as would be sent
51584 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
51585 access, but for the predata ACL, note that the default success code is 354, not
51586 2<emphasis>xx</emphasis>.
51587 </para>
51588 <para>
51589 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
51590 the message modifier cannot override the 221 response code.
51591 </para>
51592 <para>
51593 The text in a <option>message</option> modifier is literal; any quotes are taken as
51594 literals, but because the string is expanded, backslash escapes are processed
51595 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
51596 response.
51597 </para>
51598 <para>
51599 <indexterm role="variable">
51600 <primary><varname>$acl_verify_message</varname></primary>
51601 </indexterm>
51602 If <option>message</option> is used on a statement that verifies an address, the message
51603 specified overrides any message that is generated by the verification process.
51604 However, the original message is available in the variable
51605 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
51606 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
51607 routers to be passed back as part of the SMTP response, you should either not
51608 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
51609 </para>
51610 <para>
51611 For compatibility with previous releases of Exim, a <option>message</option> modifier that
51612 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
51613 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
51614 all the conditions are true, wherever it appears in an ACL command, whereas
51615 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
51616 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
51617 effect.
51618 </para>
51619 </listitem></varlistentry>
51620 <varlistentry revisionflag="changed">
51621 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
51622 <listitem>
51623 <para revisionflag="changed">
51624 This modifier specifies one or more header names in a colon-separated list
51625  that are to be removed from an incoming message, assuming, of course, that
51626 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
51627 </para>
51628 </listitem></varlistentry>
51629 <varlistentry>
51630 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
51631 <listitem>
51632 <para>
51633 <indexterm role="concept">
51634 <primary><option>set</option> ACL modifier</primary>
51635 </indexterm>
51636 This modifier puts a value into one of the ACL variables (see section
51637 <xref linkend="SECTaclvariables"/>).
51638 </para>
51639 </listitem></varlistentry>
51640 <varlistentry revisionflag="changed">
51641 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
51642 <listitem>
51643 <para revisionflag="changed">
51644 This modifier sends a UDP packet, for purposes such as statistics
51645 collection or behaviour monitoring. The parameters are expanded, and
51646 the result of the expansion must be a colon-separated list consisting
51647 of a destination server, port number, and the packet contents. The
51648 server can be specified as a host name or IPv4 or IPv6 address. The
51649 separator can be changed with the usual angle bracket syntax. For
51650 example, you might want to collect information on which hosts connect
51651 when:
51652 </para>
51653 <literallayout class="monospaced" revisionflag="changed">
51654 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
51655              $tod_zulu $sender_host_address
51656 </literallayout>
51657 </listitem></varlistentry>
51658 </variablelist>
51659 </section>
51660 <section id="SECTcontrols">
51661 <title>Use of the control modifier</title>
51662 <para>
51663 <indexterm role="concept">
51664 <primary><option>control</option> ACL modifier</primary>
51665 </indexterm>
51666 The <option>control</option> modifier supports the following settings:
51667 </para>
51668 <variablelist>
51669 <varlistentry>
51670 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
51671 <listitem>
51672 <para>
51673 This modifier allows a client host to use the SMTP AUTH command even when it
51674 has not been advertised in response to EHLO. Furthermore, because there are
51675 apparently some really broken clients that do this, Exim will accept AUTH after
51676 HELO (rather than EHLO) when this control is set. It should be used only if you
51677 really need it, and you should limit its use to those broken clients that do
51678 not work without it. For example:
51679 </para>
51680 <literallayout class="monospaced">
51681 warn hosts   = 192.168.34.25
51682      control = allow_auth_unadvertised
51683 </literallayout>
51684 <para>
51685 Normally, when an Exim server receives an AUTH command, it checks the name of
51686 the authentication mechanism that is given in the command to ensure that it
51687 matches an advertised mechanism. When this control is set, the check that a
51688 mechanism has been advertised is bypassed. Any configured mechanism can be used
51689 by the client. This control is permitted only in the connection and HELO ACLs.
51690 </para>
51691 </listitem></varlistentry>
51692 <varlistentry>
51693 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
51694 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
51695 <listitem>
51696 <para>
51697 <indexterm role="concept">
51698 <primary>access control lists (ACLs)</primary>
51699 <secondary>case of local part in</secondary>
51700 </indexterm>
51701 <indexterm role="concept">
51702 <primary>case of local parts</primary>
51703 </indexterm>
51704 <indexterm role="variable">
51705 <primary><varname>$local_part</varname></primary>
51706 </indexterm>
51707 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
51708 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
51709 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
51710 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
51711 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
51712 is encountered.
51713 </para>
51714 <para>
51715 These controls affect only the current recipient. Moreover, they apply only to
51716 local part handling that takes place directly in the ACL (for example, as a key
51717 in lookups). If a test to verify the recipient is obeyed, the case-related
51718 handling of the local part during the verification is controlled by the router
51719 configuration (see the <option>caseful_local_part</option> generic router option).
51720 </para>
51721 <para>
51722 This facility could be used, for example, to add a spam score to local parts
51723 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
51724 spam score:
51725 </para>
51726 <literallayout class="monospaced">
51727 warn  control = caseful_local_part
51728       set acl_m4 = ${eval:\
51729                      $acl_m4 + \
51730                      ${if match{$local_part}{[A-Z]}{1}{0}}\
51731                     }
51732       control = caselower_local_part
51733 </literallayout>
51734 <para>
51735 Notice that we put back the lower cased version afterwards, assuming that
51736 is what is wanted for subsequent tests.
51737 </para>
51738 </listitem></varlistentry>
51739 <varlistentry revisionflag="changed">
51740 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery</emphasis></term>
51741 <listitem>
51742 <para revisionflag="changed">
51743 <indexterm role="concept">
51744 <primary>access control lists (ACLs)</primary>
51745 <secondary>cutthrough routing</secondary>
51746 </indexterm>
51747 <indexterm role="concept">
51748 <primary>cutthrough</primary>
51749 <secondary>requesting</secondary>
51750 </indexterm>
51751 This option requests delivery be attempted while the item is being received.
51752 It is usable in the RCPT ACL and valid only for single-recipient mails forwarded
51753 from one SMTP connection to another.  If a recipient-verify callout connection is
51754 requested in the same ACL it is held open and used for the data, otherwise one is made
51755 after the ACL completes.
51756 <phrase revisionflag="changed">Note that routers are used in verify mode.</phrase>
51757 </para>
51758 <para revisionflag="changed">
51759 Should the ultimate destination system positively accept or reject the mail,
51760 a corresponding indication is given to the source system and nothing is queued.
51761 If there is a temporary error the item is queued for later delivery in the
51762 usual fashion. If the item is successfully delivered in cutthrough mode the log line
51763 is tagged with "&gt;&gt;" rather than "=&gt;" and appears before the acceptance "&lt;="
51764 line.
51765 </para>
51766 <para revisionflag="changed">
51767 Delivery in this mode avoids the generation of a bounce mail to a (possibly faked)
51768 sender when the destination system is doing content-scan based rejection.
51769 </para>
51770 </listitem></varlistentry>
51771 <varlistentry revisionflag="changed">
51772 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
51773 <listitem>
51774 <para revisionflag="changed">
51775 <indexterm role="concept">
51776 <primary>access control lists (ACLs)</primary>
51777 <secondary>enabling debug logging</secondary>
51778 </indexterm>
51779 <indexterm role="concept">
51780 <primary>debugging</primary>
51781 <secondary>enabling from an ACL</secondary>
51782 </indexterm>
51783 This control turns on debug logging, almost as though Exim had been invoked
51784 with <literal>-d</literal>, with the output going to a new logfile, by default called
51785 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
51786 may access any variables already defined.  The logging may be adjusted with
51787 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
51788 option.  Some examples (which depend on variables that don&#x2019;t exist in all
51789 contexts):
51790 </para>
51791 <literallayout class="monospaced" revisionflag="changed">
51792       control = debug
51793       control = debug/tag=.$sender_host_address
51794       control = debug/opts=+expand+acl
51795       control = debug/tag=.$message_exim_id/opts=+expand
51796 </literallayout>
51797 </listitem></varlistentry>
51798 <varlistentry>
51799 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
51800 <listitem>
51801 <para>
51802 <indexterm role="concept">
51803 <primary>disable DKIM verify</primary>
51804 </indexterm>
51805 <indexterm role="concept">
51806 <primary>DKIM</primary>
51807 <secondary>disable verify</secondary>
51808 </indexterm>
51809 This control turns off DKIM verification processing entirely.  For details on
51810 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
51811 </para>
51812 </listitem></varlistentry>
51813 <varlistentry revisionflag="changed">
51814 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
51815 <listitem>
51816 <para revisionflag="changed">
51817 <indexterm role="concept">
51818 <primary>access control lists (ACLs)</primary>
51819 <secondary>setting DSCP value</secondary>
51820 </indexterm>
51821 <indexterm role="concept">
51822 <primary>DSCP</primary>
51823 <secondary>inbound</secondary>
51824 </indexterm>
51825 This option causes the DSCP value associated with the socket for the inbound
51826 connection to be adjusted to a given value, given as one of a number of fixed
51827 strings or to numeric value.
51828 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
51829 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
51830 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
51831 </para>
51832 <para revisionflag="changed">
51833 The outbound packets from Exim will be marked with this value in the header
51834 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
51835 that these values will have any effect, not be stripped by networking
51836 equipment, or do much of anything without cooperation with your Network
51837 Engineer and those of all network operators between the source and destination.
51838 </para>
51839 </listitem></varlistentry>
51840 <varlistentry>
51841 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
51842 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
51843 <listitem>
51844 <para>
51845 <indexterm role="concept">
51846 <primary>SMTP</primary>
51847 <secondary>synchronization checking</secondary>
51848 </indexterm>
51849 <indexterm role="concept">
51850 <primary>synchronization checking in SMTP</primary>
51851 </indexterm>
51852 These controls make it possible to be selective about when SMTP synchronization
51853 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
51854 state of the switch (it is true by default). See the description of this option
51855 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
51856 </para>
51857 <para>
51858 The effect of these two controls lasts for the remainder of the SMTP
51859 connection. They can appear in any ACL except the one for the non-SMTP
51860 messages. The most straightforward place to put them is in the ACL defined by
51861 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
51862 before the first synchronization check. The expected use is to turn off the
51863 synchronization checks for badly-behaved hosts that you nevertheless need to
51864 work with.
51865 </para>
51866 </listitem></varlistentry>
51867 <varlistentry>
51868 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
51869 <listitem>
51870 <para>
51871 <indexterm role="concept">
51872 <primary>fake defer</primary>
51873 </indexterm>
51874 <indexterm role="concept">
51875 <primary>defer, fake</primary>
51876 </indexterm>
51877 This control works in exactly the same way as <option>fakereject</option> (described below)
51878 except that it causes an SMTP 450 response after the message data instead of a
51879 550 response. You must take care when using <option>fakedefer</option> because it causes the
51880 messages to be duplicated when the sender retries. Therefore, you should not
51881 use <option>fakedefer</option> if the message is to be delivered normally.
51882 </para>
51883 </listitem></varlistentry>
51884 <varlistentry>
51885 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
51886 <listitem>
51887 <para>
51888 <indexterm role="concept">
51889 <primary>fake rejection</primary>
51890 </indexterm>
51891 <indexterm role="concept">
51892 <primary>rejection, fake</primary>
51893 </indexterm>
51894 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
51895 words, only when an SMTP message is being received. If Exim accepts the
51896 message, instead the final 250 response, a 550 rejection message is sent.
51897 However, Exim proceeds to deliver the message as normal. The control applies
51898 only to the current message, not to any subsequent ones that may be received in
51899 the same SMTP connection.
51900 </para>
51901 <para>
51902 The text for the 550 response is taken from the <option>control</option> modifier. If no
51903 message is supplied, the following is used:
51904 </para>
51905 <literallayout class="monospaced">
51906 550-Your message has been rejected but is being
51907 550-kept for evaluation.
51908 550-If it was a legitimate message, it may still be
51909 550 delivered to the target recipient(s).
51910 </literallayout>
51911 <para>
51912 This facility should be used with extreme caution.
51913 </para>
51914 </listitem></varlistentry>
51915 <varlistentry>
51916 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
51917 <listitem>
51918 <para>
51919 <indexterm role="concept">
51920 <primary>frozen messages</primary>
51921 <secondary>forcing in ACL</secondary>
51922 </indexterm>
51923 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
51924 other words, only when a message is being received. If the message is accepted,
51925 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
51926 current message, not to any subsequent ones that may be received in the same
51927 SMTP connection.
51928 </para>
51929 <para>
51930 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
51931 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
51932 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
51933 are obeyed for the current message have the <literal>/no_tell</literal> option.
51934 </para>
51935 </listitem></varlistentry>
51936 <varlistentry>
51937 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
51938 <listitem>
51939 <para>
51940 <indexterm role="concept">
51941 <primary>SMTP</primary>
51942 <secondary>output flushing, disabling for delay</secondary>
51943 </indexterm>
51944 Exim normally flushes SMTP output before implementing a delay in an ACL, to
51945 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
51946 use. This control, as long as it is encountered before the <option>delay</option> modifier,
51947 disables such output flushing.
51948 </para>
51949 </listitem></varlistentry>
51950 <varlistentry>
51951 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
51952 <listitem>
51953 <para>
51954 <indexterm role="concept">
51955 <primary>SMTP</primary>
51956 <secondary>output flushing, disabling for callout</secondary>
51957 </indexterm>
51958 Exim normally flushes SMTP output before performing a callout in an ACL, to
51959 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
51960 use. This control, as long as it is encountered before the <option>verify</option> condition
51961 that causes the callout, disables such output flushing.
51962 </para>
51963 </listitem></varlistentry>
51964 <varlistentry>
51965 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
51966 <listitem>
51967 <para>
51968 This control is available when Exim is compiled with the content scanning
51969 extension. Content scanning may require a copy of the current message, or parts
51970 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
51971 or spam scanner. Normally, such copies are deleted when they are no longer
51972 needed. If this control is set, the copies are not deleted. The control applies
51973 only to the current message, not to any subsequent ones that may be received in
51974 the same SMTP connection. It is provided for debugging purposes and is unlikely
51975 to be useful in production.
51976 </para>
51977 </listitem></varlistentry>
51978 <varlistentry>
51979 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
51980 <listitem>
51981 <para>
51982 <indexterm role="concept">
51983 <primary>multiline responses, suppressing</primary>
51984 </indexterm>
51985 This control is permitted for any ACL except the one for non-SMTP messages.
51986 It seems that there are broken clients in use that cannot handle multiline
51987 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
51988 </para>
51989 <para>
51990 If this control is set, multiline SMTP responses from ACL rejections are
51991 suppressed. One way of doing this would have been to put out these responses as
51992 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
51993 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
51994 responses might get close to that. So this facility, which is after all only a
51995 sop to broken clients, is implemented by doing two very easy things:
51996 </para>
51997 <itemizedlist>
51998 <listitem>
51999 <para>
52000 Extra information that is normally output as part of a rejection caused by
52001 sender verification failure is omitted. Only the final line (typically <quote>sender
52002 verification failed</quote>) is sent.
52003 </para>
52004 </listitem>
52005 <listitem>
52006 <para>
52007 If a <option>message</option> modifier supplies a multiline response, only the first
52008 line is output.
52009 </para>
52010 </listitem>
52011 </itemizedlist>
52012 <para>
52013 The setting of the switch can, of course, be made conditional on the
52014 calling host. Its effect lasts until the end of the SMTP connection.
52015 </para>
52016 </listitem></varlistentry>
52017 <varlistentry>
52018 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
52019 <listitem>
52020 <para>
52021 <indexterm role="concept">
52022 <primary>PIPELINING</primary>
52023 <secondary>suppressing advertising</secondary>
52024 </indexterm>
52025 This control turns off the advertising of the PIPELINING extension to SMTP in
52026 the current session. To be useful, it must be obeyed before Exim sends its
52027 response to an EHLO command. Therefore, it should normally appear in an ACL
52028 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
52029 <option>pipelining_advertise_hosts</option>.
52030 </para>
52031 </listitem></varlistentry>
52032 <varlistentry>
52033 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
52034 <listitem>
52035 <para>
52036 <indexterm role="option">
52037 <primary><option>queue_only</option></primary>
52038 </indexterm>
52039 <indexterm role="concept">
52040 <primary>queueing incoming messages</primary>
52041 </indexterm>
52042 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
52043 other words, only when a message is being received. If the message is accepted,
52044 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
52045 runner. No immediate delivery process is started. In other words, it has the
52046 effect as the <option>queue_only</option> global option. However, the control applies only
52047 to the current message, not to any subsequent ones that may be received in the
52048 same SMTP connection.
52049 </para>
52050 </listitem></varlistentry>
52051 <varlistentry>
52052 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
52053 <listitem>
52054 <para>
52055 <indexterm role="concept">
52056 <primary>message</primary>
52057 <secondary>submission</secondary>
52058 </indexterm>
52059 <indexterm role="concept">
52060 <primary>submission mode</primary>
52061 </indexterm>
52062 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
52063 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
52064 the current message is a submission from a local MUA. In this case, Exim
52065 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
52066 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
52067 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
52068 late (the message has already been created).
52069 </para>
52070 <para>
52071 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
52072 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
52073 submission mode; the available options for this control are described there.
52074 The control applies only to the current message, not to any subsequent ones
52075 that may be received in the same SMTP connection.
52076 </para>
52077 </listitem></varlistentry>
52078 <varlistentry>
52079 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
52080 <listitem>
52081 <para>
52082 <indexterm role="concept">
52083 <primary>submission fixups, suppressing</primary>
52084 </indexterm>
52085 This control applies to locally submitted (non TCP/IP) messages, and is the
52086 complement of <literal>control = submission</literal>. It disables the fixups that are
52087 normally applied to locally-submitted messages. Specifically:
52088 </para>
52089 <itemizedlist>
52090 <listitem>
52091 <para>
52092 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
52093 dynamic version of <option>local_sender_retain</option>).
52094 </para>
52095 </listitem>
52096 <listitem>
52097 <para>
52098 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
52099 </para>
52100 </listitem>
52101 <listitem>
52102 <para>
52103 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
52104 </para>
52105 </listitem>
52106 </itemizedlist>
52107 <para>
52108 This control may be useful when a remotely-originated message is accepted,
52109 passed to some scanning program, and then re-submitted for delivery. It can be
52110 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
52111 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
52112 data is read.
52113 </para>
52114 <para>
52115 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
52116 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
52117 </para>
52118 </listitem></varlistentry>
52119 </variablelist>
52120 </section>
52121 <section id="SECTsummesfix">
52122 <title>Summary of message fixup control</title>
52123 <para>
52124 All four possibilities for message fixups can be specified:
52125 </para>
52126 <itemizedlist>
52127 <listitem>
52128 <para>
52129 Locally submitted, fixups applied: the default.
52130 </para>
52131 </listitem>
52132 <listitem>
52133 <para>
52134 Locally submitted, no fixups applied: use
52135 <literal>control = suppress_local_fixups</literal>.
52136 </para>
52137 </listitem>
52138 <listitem>
52139 <para>
52140 Remotely submitted, no fixups applied: the default.
52141 </para>
52142 </listitem>
52143 <listitem>
52144 <para>
52145 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
52146 </para>
52147 </listitem>
52148 </itemizedlist>
52149 </section>
52150 <section id="SECTaddheadacl">
52151 <title>Adding header lines in ACLs</title>
52152 <para>
52153 <indexterm role="concept">
52154 <primary>header lines</primary>
52155 <secondary>adding in an ACL</secondary>
52156 </indexterm>
52157 <indexterm role="concept">
52158 <primary>header lines</primary>
52159 <secondary>position of added lines</secondary>
52160 </indexterm>
52161 <indexterm role="concept">
52162 <primary><option>add_header</option> ACL modifier</primary>
52163 </indexterm>
52164 The <option>add_header</option> modifier can be used to add one or more extra header lines
52165 to an incoming message, as in this example:
52166 </para>
52167 <literallayout class="monospaced">
52168 warn dnslists = sbl.spamhaus.org : \
52169                 dialup.mail-abuse.org
52170      add_header = X-blacklisted-at: $dnslist_domain
52171 </literallayout>
52172 <para>
52173 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
52174 MIME, and non-SMTP ACLs (in other words, those that are concerned with
52175 receiving a message). The message must ultimately be accepted for
52176 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
52177 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
52178 RCPT ACL).
52179 </para>
52180 <para>
52181 Leading and trailing newlines are removed from
52182 the data for the <option>add_header</option> modifier; if it then
52183 contains one or more newlines that
52184 are not followed by a space or a tab, it is assumed to contain multiple header
52185 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
52186 front of any line that is not a valid header line.
52187 </para>
52188 <para>
52189 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
52190 They are added to the message before processing the DATA and MIME ACLs.
52191 However, if an identical header line is requested more than once, only one copy
52192 is actually added to the message. Further header lines may be accumulated
52193 during the DATA and MIME ACLs, after which they are added to the message, again
52194 with duplicates suppressed. Thus, it is possible to add two identical header
52195 lines to an SMTP message, but only if one is added before DATA and one after.
52196 In the case of non-SMTP messages, new headers are accumulated during the
52197 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
52198 message is rejected after DATA or by the non-SMTP ACL, all added header lines
52199 are included in the entry that is written to the reject log.
52200 </para>
52201 <para>
52202 <indexterm role="concept">
52203 <primary>header lines</primary>
52204 <secondary>added; visibility of</secondary>
52205 </indexterm>
52206 Header lines are not visible in string expansions
52207 of message headers
52208 until they are added to the
52209 message. It follows that header lines defined in the MAIL, RCPT, and predata
52210 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
52211 header lines that are added by the DATA or MIME ACLs are not visible in those
52212 ACLs. Because of this restriction, you cannot use header lines as a way of
52213 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
52214 this, you can use ACL variables, as described in section
52215 <xref linkend="SECTaclvariables"/>.
52216 </para>
52217 <para revisionflag="changed">
52218 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
52219 </para>
52220 <para>
52221 The <option>add_header</option> modifier acts immediately as it is encountered during the
52222 processing of an ACL. Notice the difference between these two cases:
52223 </para>
52224 <literallayout>
52225 <literal>accept add_header = ADDED: some text</literal>
52226 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
52227
52228 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
52229 <literal>       add_header = ADDED: some text</literal>
52230 </literallayout>
52231 <para>
52232 In the first case, the header line is always added, whether or not the
52233 condition is true. In the second case, the header line is added only if the
52234 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
52235 ACL statement. All those that are encountered before a condition fails are
52236 honoured.
52237 </para>
52238 <para>
52239 <indexterm role="concept">
52240 <primary><option>warn</option> ACL verb</primary>
52241 </indexterm>
52242 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
52243 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
52244 effect only if all the conditions are true, even if it appears before some of
52245 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
52246 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
52247 are present on a <option>warn</option> verb, both are processed according to their
52248 specifications.
52249 </para>
52250 <para>
52251 By default, new header lines are added to a message at the end of the existing
52252 header lines. However, you can specify that any particular header line should
52253 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
52254 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
52255 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
52256 </para>
52257 <para>
52258 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
52259 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
52260 header line, respectively. (Header text cannot start with a colon, as there has
52261 to be a header name first.) For example:
52262 </para>
52263 <literallayout class="monospaced">
52264 warn add_header = \
52265        :after_received:X-My-Header: something or other...
52266 </literallayout>
52267 <para>
52268 If more than one header line is supplied in a single <option>add_header</option> modifier,
52269 each one is treated independently and can therefore be placed differently. If
52270 you add more than one line at the start, or after the Received: block, they end
52271 up in reverse order.
52272 </para>
52273 <para>
52274 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
52275 added in an ACL. It does NOT work for header lines that are added in a
52276 system filter or in a router or transport.
52277 </para>
52278 </section>
52279 <section id="SECTremoveheadacl" revisionflag="changed">
52280 <title>Removing header lines in ACLs</title>
52281 <para revisionflag="changed">
52282 <indexterm role="concept">
52283 <primary>header lines</primary>
52284 <secondary>removing in an ACL</secondary>
52285 </indexterm>
52286 <indexterm role="concept">
52287 <primary>header lines</primary>
52288 <secondary>position of removed lines</secondary>
52289 </indexterm>
52290 <indexterm role="concept">
52291 <primary><option>remove_header</option> ACL modifier</primary>
52292 </indexterm>
52293 The <option>remove_header</option> modifier can be used to remove one or more header lines
52294 from an incoming message, as in this example:
52295 </para>
52296 <literallayout class="monospaced" revisionflag="changed">
52297 warn   message        = Remove internal headers
52298        remove_header  = x-route-mail1 : x-route-mail2
52299 </literallayout>
52300 <para revisionflag="changed">
52301 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
52302 MIME, and non-SMTP ACLs (in other words, those that are concerned with
52303 receiving a message). The message must ultimately be accepted for
52304 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
52305 with any ACL verb, including <option>deny</option>, though this is really not useful for
52306 any verb that doesn&#x2019;t result in a delivered message.
52307 </para>
52308 <para revisionflag="changed">
52309 More than one header can be removed at the same time by using a colon separated
52310 list of header names. The header matching is case insensitive. Wildcards are
52311 not permitted, nor is list expansion performed, so you cannot use hostlists to
52312 create a list of headers, however both connection and message variable expansion
52313 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
52314 </para>
52315 <literallayout class="monospaced" revisionflag="changed">
52316 warn   hosts           = +internal_hosts
52317        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
52318 warn   message         = Remove internal headers
52319        remove_header   = $acl_c_ihdrs
52320 </literallayout>
52321 <para revisionflag="changed">
52322 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
52323 They are removed from the message before processing the DATA and MIME ACLs.
52324 There is no harm in attempting to remove the same header twice nor is removing
52325 a non-existent header. Further header lines to be removed may be accumulated
52326 during the DATA and MIME ACLs, after which they are removed from the message,
52327 if present. In the case of non-SMTP messages, headers to be removed are
52328 accumulated during the non-SMTP ACLs, and are removed from the message after
52329 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
52330 ACL, there really is no effect because there is no logging of what headers
52331 would have been removed.
52332 </para>
52333 <para revisionflag="changed">
52334 <indexterm role="concept">
52335 <primary>header lines</primary>
52336 <secondary>removed; visibility of</secondary>
52337 </indexterm>
52338 Header lines are not visible in string expansions until the DATA phase when it
52339 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
52340 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
52341 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
52342 this restriction, you cannot use header lines as a way of controlling data
52343 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
52344 you should instead use ACL variables, as described in section
52345 <xref linkend="SECTaclvariables"/>.
52346 </para>
52347 <para revisionflag="changed">
52348 The <option>remove_header</option> modifier acts immediately as it is encountered during the
52349 processing of an ACL. Notice the difference between these two cases:
52350 </para>
52351 <literallayout revisionflag="changed">
52352 <literal>accept remove_header = X-Internal</literal>
52353 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
52354
52355 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
52356 <literal>       remove_header = X-Internal</literal>
52357 </literallayout>
52358 <para revisionflag="changed">
52359 In the first case, the header line is always removed, whether or not the
52360 condition is true. In the second case, the header line is removed only if the
52361 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
52362 same ACL statement. All those that are encountered before a condition fails
52363 are honoured.
52364 </para>
52365 <para revisionflag="changed">
52366 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
52367 present during ACL processing. It does NOT remove header lines that are added
52368 in a system filter or in a router or transport.
52369 </para>
52370 </section>
52371 <section id="SECTaclconditions">
52372 <title>ACL conditions</title>
52373 <para>
52374 <indexterm role="concept">
52375 <primary>access control lists (ACLs)</primary>
52376 <secondary>conditions; list of</secondary>
52377 </indexterm>
52378 Some of the conditions listed in this section are available only when Exim is
52379 compiled with the content-scanning extension. They are included here briefly
52380 for completeness. More detailed descriptions can be found in the discussion on
52381 content scanning in chapter <xref linkend="CHAPexiscan"/>.
52382 </para>
52383 <para>
52384 Not all conditions are relevant in all circumstances. For example, testing
52385 senders and recipients does not make sense in an ACL that is being run as the
52386 result of the arrival of an ETRN command, and checks on message headers can be
52387 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
52388 can use the same condition (with different parameters) more than once in the
52389 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
52390 The conditions are as follows:
52391 </para>
52392 <variablelist>
52393 <varlistentry>
52394 <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>
52395 <listitem>
52396 <para>
52397 <indexterm role="concept">
52398 <primary>access control lists (ACLs)</primary>
52399 <secondary>nested</secondary>
52400 </indexterm>
52401 <indexterm role="concept">
52402 <primary>access control lists (ACLs)</primary>
52403 <secondary>indirect</secondary>
52404 </indexterm>
52405 <indexterm role="concept">
52406 <primary>access control lists (ACLs)</primary>
52407 <secondary>arguments</secondary>
52408 </indexterm>
52409 <indexterm role="concept">
52410 <primary><option>acl</option> ACL condition</primary>
52411 </indexterm>
52412 The possible values of the argument are the same as for the
52413 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
52414 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
52415 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
52416 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
52417 condition false. This means that further processing of the <option>warn</option> verb
52418 ceases, but processing of the ACL continues.
52419 </para>
52420 <para revisionflag="changed">
52421 If the argument is a named ACL, up to nine space-separated optional values
52422 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
52423 and $acl_narg is set to the count of values.
52424 Previous values of these variables are restored after the call returns.
52425 The name and values are expanded separately.
52426 </para>
52427 <para>
52428 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
52429 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
52430 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
52431 conditions are tested.
52432 </para>
52433 <para>
52434 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
52435 loops. This condition allows you to use different ACLs in different
52436 circumstances. For example, different ACLs can be used to handle RCPT commands
52437 for different local users or different local domains.
52438 </para>
52439 </listitem></varlistentry>
52440 <varlistentry>
52441 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
52442 <listitem>
52443 <para>
52444 <indexterm role="concept">
52445 <primary><option>authenticated</option> ACL condition</primary>
52446 </indexterm>
52447 <indexterm role="concept">
52448 <primary>authentication</primary>
52449 <secondary>ACL checking</secondary>
52450 </indexterm>
52451 <indexterm role="concept">
52452 <primary>access control lists (ACLs)</primary>
52453 <secondary>testing for authentication</secondary>
52454 </indexterm>
52455 If the SMTP connection is not authenticated, the condition is false. Otherwise,
52456 the name of the authenticator is tested against the list. To test for
52457 authentication by any authenticator, you can set
52458 </para>
52459 <literallayout class="monospaced">
52460 authenticated = *
52461 </literallayout>
52462 </listitem></varlistentry>
52463 <varlistentry>
52464 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
52465 <listitem>
52466 <para>
52467 <indexterm role="concept">
52468 <primary><option>condition</option> ACL condition</primary>
52469 </indexterm>
52470 <indexterm role="concept">
52471 <primary>customizing</primary>
52472 <secondary>ACL condition</secondary>
52473 </indexterm>
52474 <indexterm role="concept">
52475 <primary>access control lists (ACLs)</primary>
52476 <secondary>customized test</secondary>
52477 </indexterm>
52478 <indexterm role="concept">
52479 <primary>access control lists (ACLs)</primary>
52480 <secondary>testing, customized</secondary>
52481 </indexterm>
52482 This feature allows you to make up custom conditions. If the result of
52483 expanding the string is an empty string, the number zero, or one of the strings
52484 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
52485 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
52486 any other value, some error is assumed to have occurred, and the ACL returns
52487 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
52488 ignored. The effect is to treat it as true, whether it is positive or
52489 negative.
52490 </para>
52491 </listitem></varlistentry>
52492 <varlistentry>
52493 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
52494 <listitem>
52495 <para>
52496 <indexterm role="concept">
52497 <primary><option>decode</option> ACL condition</primary>
52498 </indexterm>
52499 This condition is available only when Exim is compiled with the
52500 content-scanning extension, and it is allowed only in the ACL defined by
52501 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
52502 If all goes well, the condition is true. It is false only if there are
52503 problems such as a syntax error or a memory shortage. For more details, see
52504 chapter <xref linkend="CHAPexiscan"/>.
52505 </para>
52506 </listitem></varlistentry>
52507 <varlistentry>
52508 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
52509 <listitem>
52510 <para>
52511 <indexterm role="concept">
52512 <primary><option>demime</option> ACL condition</primary>
52513 </indexterm>
52514 This condition is available only when Exim is compiled with the
52515 content-scanning extension. Its use is described in section
52516 <xref linkend="SECTdemimecond"/>.
52517 </para>
52518 </listitem></varlistentry>
52519 <varlistentry>
52520 <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>
52521 <listitem>
52522 <para>
52523 <indexterm role="concept">
52524 <primary><option>dnslists</option> ACL condition</primary>
52525 </indexterm>
52526 <indexterm role="concept">
52527 <primary>DNS list</primary>
52528 <secondary>in ACL</secondary>
52529 </indexterm>
52530 <indexterm role="concept">
52531 <primary>black list (DNS)</primary>
52532 </indexterm>
52533 <indexterm role="concept">
52534 <primary>access control lists (ACLs)</primary>
52535 <secondary>testing a DNS list</secondary>
52536 </indexterm>
52537 This condition checks for entries in DNS black lists. These are also known as
52538 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
52539 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
52540 different variants of this condition to describe briefly here. See sections
52541 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
52542 </para>
52543 </listitem></varlistentry>
52544 <varlistentry>
52545 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
52546 <listitem>
52547 <para>
52548 <indexterm role="concept">
52549 <primary><option>domains</option> ACL condition</primary>
52550 </indexterm>
52551 <indexterm role="concept">
52552 <primary>domain</primary>
52553 <secondary>ACL checking</secondary>
52554 </indexterm>
52555 <indexterm role="concept">
52556 <primary>access control lists (ACLs)</primary>
52557 <secondary>testing a recipient domain</secondary>
52558 </indexterm>
52559 <indexterm role="variable">
52560 <primary><varname>$domain_data</varname></primary>
52561 </indexterm>
52562 This condition is relevant only after a RCPT command. It checks that the domain
52563 of the recipient address is in the domain list. If percent-hack processing is
52564 enabled, it is done before this test is done. If the check succeeds with a
52565 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
52566 <option>domains</option> test.
52567 </para>
52568 <para>
52569 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
52570 use <option>domains</option> in a DATA ACL.
52571 </para>
52572 </listitem></varlistentry>
52573 <varlistentry>
52574 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
52575 <listitem>
52576 <para>
52577 <indexterm role="concept">
52578 <primary><option>encrypted</option> ACL condition</primary>
52579 </indexterm>
52580 <indexterm role="concept">
52581 <primary>encryption</primary>
52582 <secondary>checking in an ACL</secondary>
52583 </indexterm>
52584 <indexterm role="concept">
52585 <primary>access control lists (ACLs)</primary>
52586 <secondary>testing for encryption</secondary>
52587 </indexterm>
52588 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
52589 name of the cipher suite in use is tested against the list. To test for
52590 encryption without testing for any specific cipher suite(s), set
52591 </para>
52592 <literallayout class="monospaced">
52593 encrypted = *
52594 </literallayout>
52595 </listitem></varlistentry>
52596 <varlistentry>
52597 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
52598 <listitem>
52599 <para>
52600 <indexterm role="concept">
52601 <primary><option>hosts</option> ACL condition</primary>
52602 </indexterm>
52603 <indexterm role="concept">
52604 <primary>host</primary>
52605 <secondary>ACL checking</secondary>
52606 </indexterm>
52607 <indexterm role="concept">
52608 <primary>access control lists (ACLs)</primary>
52609 <secondary>testing the client host</secondary>
52610 </indexterm>
52611 This condition tests that the calling host matches the host list. If you have
52612 name lookups or wildcarded host names and IP addresses in the same host list,
52613 you should normally put the IP addresses first. For example, you could have:
52614 </para>
52615 <literallayout class="monospaced">
52616 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
52617 </literallayout>
52618 <para>
52619 The lookup in this example uses the host name for its key. This is implied by
52620 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
52621 and it wouldn&#x2019;t matter which way round you had these two items.)
52622 </para>
52623 <para>
52624 The reason for the problem with host names lies in the left-to-right way that
52625 Exim processes lists. It can test IP addresses without doing any DNS lookups,
52626 but when it reaches an item that requires a host name, it fails if it cannot
52627 find a host name to compare with the pattern. If the above list is given in the
52628 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
52629 found, even if its IP address is 10.9.8.7.
52630 </para>
52631 <para>
52632 If you really do want to do the name check first, and still recognize the IP
52633 address even if the name lookup fails, you can rewrite the ACL like this:
52634 </para>
52635 <literallayout class="monospaced">
52636 accept hosts = dbm;/etc/friendly/hosts
52637 accept hosts = 10.9.8.7
52638 </literallayout>
52639 <para>
52640 The default action on failing to find the host name is to assume that the host
52641 is not in the list, so the first <option>accept</option> statement fails. The second
52642 statement can then check the IP address.
52643 </para>
52644 <para>
52645 <indexterm role="variable">
52646 <primary><varname>$host_data</varname></primary>
52647 </indexterm>
52648 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
52649 of the lookup is made available in the <varname>$host_data</varname> variable. This
52650 allows you, for example, to set up a statement like this:
52651 </para>
52652 <literallayout class="monospaced">
52653 deny  hosts = net-lsearch;/some/file
52654 message = $host_data
52655 </literallayout>
52656 <para>
52657 which gives a custom error message for each denied host.
52658 </para>
52659 </listitem></varlistentry>
52660 <varlistentry>
52661 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
52662 <listitem>
52663 <para>
52664 <indexterm role="concept">
52665 <primary><option>local_parts</option> ACL condition</primary>
52666 </indexterm>
52667 <indexterm role="concept">
52668 <primary>local part</primary>
52669 <secondary>ACL checking</secondary>
52670 </indexterm>
52671 <indexterm role="concept">
52672 <primary>access control lists (ACLs)</primary>
52673 <secondary>testing a local part</secondary>
52674 </indexterm>
52675 <indexterm role="variable">
52676 <primary><varname>$local_part_data</varname></primary>
52677 </indexterm>
52678 This condition is relevant only after a RCPT command. It checks that the local
52679 part of the recipient address is in the list. If percent-hack processing is
52680 enabled, it is done before this test. If the check succeeds with a lookup, the
52681 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
52682 the next <option>local_parts</option> test.
52683 </para>
52684 </listitem></varlistentry>
52685 <varlistentry>
52686 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
52687 <listitem>
52688 <para>
52689 <indexterm role="concept">
52690 <primary><option>malware</option> ACL condition</primary>
52691 </indexterm>
52692 <indexterm role="concept">
52693 <primary>access control lists (ACLs)</primary>
52694 <secondary>virus scanning</secondary>
52695 </indexterm>
52696 <indexterm role="concept">
52697 <primary>access control lists (ACLs)</primary>
52698 <secondary>scanning for viruses</secondary>
52699 </indexterm>
52700 This condition is available only when Exim is compiled with the
52701 content-scanning extension. It causes the incoming message to be scanned for
52702 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
52703 </para>
52704 </listitem></varlistentry>
52705 <varlistentry>
52706 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
52707 <listitem>
52708 <para>
52709 <indexterm role="concept">
52710 <primary><option>mime_regex</option> ACL condition</primary>
52711 </indexterm>
52712 <indexterm role="concept">
52713 <primary>access control lists (ACLs)</primary>
52714 <secondary>testing by regex matching</secondary>
52715 </indexterm>
52716 This condition is available only when Exim is compiled with the
52717 content-scanning extension, and it is allowed only in the ACL defined by
52718 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
52719 with any of the regular expressions. For details, see chapter
52720 <xref linkend="CHAPexiscan"/>.
52721 </para>
52722 </listitem></varlistentry>
52723 <varlistentry>
52724 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
52725 <listitem>
52726 <para>
52727 <indexterm role="concept">
52728 <primary>rate limiting</primary>
52729 </indexterm>
52730 This condition can be used to limit the rate at which a user or host submits
52731 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
52732 </para>
52733 </listitem></varlistentry>
52734 <varlistentry>
52735 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
52736 <listitem>
52737 <para>
52738 <indexterm role="concept">
52739 <primary><option>recipients</option> ACL condition</primary>
52740 </indexterm>
52741 <indexterm role="concept">
52742 <primary>recipient</primary>
52743 <secondary>ACL checking</secondary>
52744 </indexterm>
52745 <indexterm role="concept">
52746 <primary>access control lists (ACLs)</primary>
52747 <secondary>testing a recipient</secondary>
52748 </indexterm>
52749 This condition is relevant only after a RCPT command. It checks the entire
52750 recipient address against a list of recipients.
52751 </para>
52752 </listitem></varlistentry>
52753 <varlistentry>
52754 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
52755 <listitem>
52756 <para>
52757 <indexterm role="concept">
52758 <primary><option>regex</option> ACL condition</primary>
52759 </indexterm>
52760 <indexterm role="concept">
52761 <primary>access control lists (ACLs)</primary>
52762 <secondary>testing by regex matching</secondary>
52763 </indexterm>
52764 This condition is available only when Exim is compiled with the
52765 content-scanning extension, and is available only in the DATA, MIME, and
52766 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
52767 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
52768 </para>
52769 </listitem></varlistentry>
52770 <varlistentry>
52771 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
52772 <listitem>
52773 <para>
52774 <indexterm role="concept">
52775 <primary><option>sender_domains</option> ACL condition</primary>
52776 </indexterm>
52777 <indexterm role="concept">
52778 <primary>sender</primary>
52779 <secondary>ACL checking</secondary>
52780 </indexterm>
52781 <indexterm role="concept">
52782 <primary>access control lists (ACLs)</primary>
52783 <secondary>testing a sender domain</secondary>
52784 </indexterm>
52785 <indexterm role="variable">
52786 <primary><varname>$domain</varname></primary>
52787 </indexterm>
52788 <indexterm role="variable">
52789 <primary><varname>$sender_address_domain</varname></primary>
52790 </indexterm>
52791 This condition tests the domain of the sender of the message against the given
52792 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
52793 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
52794 of this condition. This is an exception to the general rule for testing domain
52795 lists. It is done this way so that, if this condition is used in an ACL for a
52796 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
52797 influence the sender checking.
52798 </para>
52799 <para>
52800 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
52801 relaying, because sender addresses are easily, and commonly, forged.
52802 </para>
52803 </listitem></varlistentry>
52804 <varlistentry>
52805 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
52806 <listitem>
52807 <para>
52808 <indexterm role="concept">
52809 <primary><option>senders</option> ACL condition</primary>
52810 </indexterm>
52811 <indexterm role="concept">
52812 <primary>sender</primary>
52813 <secondary>ACL checking</secondary>
52814 </indexterm>
52815 <indexterm role="concept">
52816 <primary>access control lists (ACLs)</primary>
52817 <secondary>testing a sender</secondary>
52818 </indexterm>
52819 This condition tests the sender of the message against the given list. To test
52820 for a bounce message, which has an empty sender, set
52821 </para>
52822 <literallayout class="monospaced">
52823 senders = :
52824 </literallayout>
52825 <para>
52826 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
52827 relaying, because sender addresses are easily, and commonly, forged.
52828 </para>
52829 </listitem></varlistentry>
52830 <varlistentry>
52831 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
52832 <listitem>
52833 <para>
52834 <indexterm role="concept">
52835 <primary><option>spam</option> ACL condition</primary>
52836 </indexterm>
52837 <indexterm role="concept">
52838 <primary>access control lists (ACLs)</primary>
52839 <secondary>scanning for spam</secondary>
52840 </indexterm>
52841 This condition is available only when Exim is compiled with the
52842 content-scanning extension. It causes the incoming message to be scanned by
52843 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
52844 </para>
52845 </listitem></varlistentry>
52846 <varlistentry>
52847 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
52848 <listitem>
52849 <para>
52850 <indexterm role="concept">
52851 <primary><option>verify</option> ACL condition</primary>
52852 </indexterm>
52853 <indexterm role="concept">
52854 <primary>TLS</primary>
52855 <secondary>client certificate verification</secondary>
52856 </indexterm>
52857 <indexterm role="concept">
52858 <primary>certificate</primary>
52859 <secondary>verification of client</secondary>
52860 </indexterm>
52861 <indexterm role="concept">
52862 <primary>access control lists (ACLs)</primary>
52863 <secondary>certificate verification</secondary>
52864 </indexterm>
52865 <indexterm role="concept">
52866 <primary>access control lists (ACLs)</primary>
52867 <secondary>testing a TLS certificate</secondary>
52868 </indexterm>
52869 This condition is true in an SMTP session if the session is encrypted, and a
52870 certificate was received from the client, and the certificate was verified. The
52871 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
52872 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
52873 </para>
52874 </listitem></varlistentry>
52875 <varlistentry>
52876 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
52877 <listitem>
52878 <para>
52879 <indexterm role="concept">
52880 <primary>CSA verification</primary>
52881 </indexterm>
52882 This condition checks whether the sending host (the client) is authorized to
52883 send email. Details of how this works are given in section
52884 <xref linkend="SECTverifyCSA"/>.
52885 </para>
52886 </listitem></varlistentry>
52887 <varlistentry>
52888 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
52889 <listitem>
52890 <para>
52891 <indexterm role="concept">
52892 <primary><option>verify</option> ACL condition</primary>
52893 </indexterm>
52894 <indexterm role="concept">
52895 <primary>access control lists (ACLs)</primary>
52896 <secondary>verifying sender in the header</secondary>
52897 </indexterm>
52898 <indexterm role="concept">
52899 <primary>header lines</primary>
52900 <secondary>verifying the sender in</secondary>
52901 </indexterm>
52902 <indexterm role="concept">
52903 <primary>sender</primary>
52904 <secondary>verifying in header</secondary>
52905 </indexterm>
52906 <indexterm role="concept">
52907 <primary>verifying</primary>
52908 <secondary>sender in header</secondary>
52909 </indexterm>
52910 This condition is relevant only in an ACL that is run after a message has been
52911 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
52912 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
52913 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
52914 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
52915 However, an address that appears in one of these headers need not be an address
52916 that accepts bounce messages; only sender addresses in envelopes are required
52917 to accept bounces. Therefore, if you use the callout option on this check, you
52918 might want to arrange for a non-empty address in the MAIL command.
52919 </para>
52920 <para>
52921 Details of address verification and the options are given later, starting at
52922 section <xref linkend="SECTaddressverification"/> (callouts are described in section
52923 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
52924 condition to restrict it to bounce messages only:
52925 </para>
52926 <literallayout class="monospaced">
52927 deny    senders = :
52928         message = A valid sender header is required for bounces
52929        !verify  = header_sender
52930 </literallayout>
52931 </listitem></varlistentry>
52932 <varlistentry>
52933 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
52934 <listitem>
52935 <para>
52936 <indexterm role="concept">
52937 <primary><option>verify</option> ACL condition</primary>
52938 </indexterm>
52939 <indexterm role="concept">
52940 <primary>access control lists (ACLs)</primary>
52941 <secondary>verifying header syntax</secondary>
52942 </indexterm>
52943 <indexterm role="concept">
52944 <primary>header lines</primary>
52945 <secondary>verifying syntax</secondary>
52946 </indexterm>
52947 <indexterm role="concept">
52948 <primary>verifying</primary>
52949 <secondary>header syntax</secondary>
52950 </indexterm>
52951 This condition is relevant only in an ACL that is run after a message has been
52952 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
52953 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
52954 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
52955 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
52956 permitted only in locally generated messages and from hosts that match
52957 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
52958 appropriate.
52959 </para>
52960 <para>
52961 Note that this condition is a syntax check only. However, a common spamming
52962 ploy used to be to send syntactically invalid headers such as
52963 </para>
52964 <literallayout class="monospaced">
52965 To: @
52966 </literallayout>
52967 <para>
52968 and this condition can be used to reject such messages, though they are not as
52969 common as they used to be.
52970 </para>
52971 </listitem></varlistentry>
52972 <varlistentry>
52973 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
52974 <listitem>
52975 <para>
52976 <indexterm role="concept">
52977 <primary><option>verify</option> ACL condition</primary>
52978 </indexterm>
52979 <indexterm role="concept">
52980 <primary>access control lists (ACLs)</primary>
52981 <secondary>verifying HELO/EHLO</secondary>
52982 </indexterm>
52983 <indexterm role="concept">
52984 <primary>HELO</primary>
52985 <secondary>verifying</secondary>
52986 </indexterm>
52987 <indexterm role="concept">
52988 <primary>EHLO</primary>
52989 <secondary>verifying</secondary>
52990 </indexterm>
52991 <indexterm role="concept">
52992 <primary>verifying</primary>
52993 <secondary>EHLO</secondary>
52994 </indexterm>
52995 <indexterm role="concept">
52996 <primary>verifying</primary>
52997 <secondary>HELO</secondary>
52998 </indexterm>
52999 This condition is true if a HELO or EHLO command has been received from the
53000 client host, and its contents have been verified. If there has been no previous
53001 attempt to verify the HELO/EHLO contents, it is carried out when this
53002 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
53003 <option>helo_try_verify_hosts</option> options for details of how to request verification
53004 independently of this condition.
53005 </para>
53006 <para>
53007 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
53008 option), this condition is always true.
53009 </para>
53010 </listitem></varlistentry>
53011 <varlistentry>
53012 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
53013 <listitem>
53014 <para>
53015 <indexterm role="concept">
53016 <primary>verifying</primary>
53017 <secondary>not blind</secondary>
53018 </indexterm>
53019 <indexterm role="concept">
53020 <primary>bcc recipients, verifying none</primary>
53021 </indexterm>
53022 This condition checks that there are no blind (bcc) recipients in the message.
53023 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
53024 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
53025 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
53026 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
53027 used only in a DATA or non-SMTP ACL.
53028 </para>
53029 <para>
53030 There are, of course, many legitimate messages that make use of blind (bcc)
53031 recipients. This check should not be used on its own for blocking messages.
53032 </para>
53033 </listitem></varlistentry>
53034 <varlistentry>
53035 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53036 <listitem>
53037 <para>
53038 <indexterm role="concept">
53039 <primary><option>verify</option> ACL condition</primary>
53040 </indexterm>
53041 <indexterm role="concept">
53042 <primary>access control lists (ACLs)</primary>
53043 <secondary>verifying recipient</secondary>
53044 </indexterm>
53045 <indexterm role="concept">
53046 <primary>recipient</primary>
53047 <secondary>verifying</secondary>
53048 </indexterm>
53049 <indexterm role="concept">
53050 <primary>verifying</primary>
53051 <secondary>recipient</secondary>
53052 </indexterm>
53053 <indexterm role="variable">
53054 <primary><varname>$address_data</varname></primary>
53055 </indexterm>
53056 This condition is relevant only after a RCPT command. It verifies the current
53057 recipient. Details of address verification are given later, starting at section
53058 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
53059 of <varname>$address_data</varname> is the last value that was set while routing the address.
53060 This applies even if the verification fails. When an address that is being
53061 verified is redirected to a single address, verification continues with the new
53062 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
53063 value for the child address.
53064 </para>
53065 </listitem></varlistentry>
53066 <varlistentry>
53067 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
53068 <listitem>
53069 <para>
53070 <indexterm role="concept">
53071 <primary><option>verify</option> ACL condition</primary>
53072 </indexterm>
53073 <indexterm role="concept">
53074 <primary>access control lists (ACLs)</primary>
53075 <secondary>verifying host reverse lookup</secondary>
53076 </indexterm>
53077 <indexterm role="concept">
53078 <primary>host</primary>
53079 <secondary>verifying reverse lookup</secondary>
53080 </indexterm>
53081 This condition ensures that a verified host name has been looked up from the IP
53082 address of the client host. (This may have happened already if the host name
53083 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
53084 Verification ensures that the host name obtained from a reverse DNS lookup, or
53085 one of its aliases, does, when it is itself looked up in the DNS, yield the
53086 original IP address.
53087 </para>
53088 <para>
53089 If this condition is used for a locally generated message (that is, when there
53090 is no client host involved), it always succeeds.
53091 </para>
53092 </listitem></varlistentry>
53093 <varlistentry>
53094 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53095 <listitem>
53096 <para>
53097 <indexterm role="concept">
53098 <primary><option>verify</option> ACL condition</primary>
53099 </indexterm>
53100 <indexterm role="concept">
53101 <primary>access control lists (ACLs)</primary>
53102 <secondary>verifying sender</secondary>
53103 </indexterm>
53104 <indexterm role="concept">
53105 <primary>sender</primary>
53106 <secondary>verifying</secondary>
53107 </indexterm>
53108 <indexterm role="concept">
53109 <primary>verifying</primary>
53110 <secondary>sender</secondary>
53111 </indexterm>
53112 This condition is relevant only after a MAIL or RCPT command, or after a
53113 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
53114 the message&#x2019;s sender is empty (that is, this is a bounce message), the
53115 condition is true. Otherwise, the sender address is verified.
53116 </para>
53117 <para>
53118 <indexterm role="variable">
53119 <primary><varname>$address_data</varname></primary>
53120 </indexterm>
53121 <indexterm role="variable">
53122 <primary><varname>$sender_address_data</varname></primary>
53123 </indexterm>
53124 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
53125 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
53126 value can be used in subsequent conditions and modifiers in the same ACL
53127 statement. It does not persist after the end of the current statement. If you
53128 want to preserve the value for longer, you can save it in an ACL variable.
53129 </para>
53130 <para>
53131 Details of verification are given later, starting at section
53132 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
53133 to avoid doing it more than once per message.
53134 </para>
53135 </listitem></varlistentry>
53136 <varlistentry>
53137 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
53138 <listitem>
53139 <para>
53140 <indexterm role="concept">
53141 <primary><option>verify</option> ACL condition</primary>
53142 </indexterm>
53143 This is a variation of the previous option, in which a modified address is
53144 verified as a sender.
53145 </para>
53146 </listitem></varlistentry>
53147 </variablelist>
53148 </section>
53149 <section id="SECTmorednslists">
53150 <title>Using DNS lists</title>
53151 <para>
53152 <indexterm role="concept">
53153 <primary>DNS list</primary>
53154 <secondary>in ACL</secondary>
53155 </indexterm>
53156 <indexterm role="concept">
53157 <primary>black list (DNS)</primary>
53158 </indexterm>
53159 <indexterm role="concept">
53160 <primary>access control lists (ACLs)</primary>
53161 <secondary>testing a DNS list</secondary>
53162 </indexterm>
53163 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
53164 is on at least one of a number of DNS lists by looking up the inverted IP
53165 address in one or more DNS domains. (Note that DNS list domains are not mail
53166 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
53167 special options instead.) For example, if the calling host&#x2019;s IP
53168 address is 192.168.62.43, and the ACL statement is
53169 </para>
53170 <literallayout class="monospaced">
53171 deny dnslists = blackholes.mail-abuse.org : \
53172                 dialups.mail-abuse.org
53173 </literallayout>
53174 <para>
53175 the following records are looked up:
53176 </para>
53177 <literallayout class="monospaced">
53178 43.62.168.192.blackholes.mail-abuse.org
53179 43.62.168.192.dialups.mail-abuse.org
53180 </literallayout>
53181 <para>
53182 As soon as Exim finds an existing DNS record, processing of the list stops.
53183 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
53184 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
53185 use two separate conditions:
53186 </para>
53187 <literallayout class="monospaced">
53188 deny dnslists = blackholes.mail-abuse.org
53189      dnslists = dialups.mail-abuse.org
53190 </literallayout>
53191 <para>
53192 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
53193 behaves as if the host does not match the list item, that is, as if the DNS
53194 record does not exist. If there are further items in the DNS list, they are
53195 processed.
53196 </para>
53197 <para>
53198 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
53199 (which is the most common usage), because it prevents a DNS failure from
53200 blocking mail. However, you can change this behaviour by putting one of the
53201 following special items in the list:
53202 </para>
53203 <literallayout>
53204 <literal>+include_unknown </literal>   behave as if the item is on the list
53205 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
53206 <literal>+defer_unknown   </literal>   give a temporary error
53207 </literallayout>
53208 <para>
53209 <indexterm role="concept">
53210 <primary><literal>+include_unknown</literal></primary>
53211 </indexterm>
53212 <indexterm role="concept">
53213 <primary><literal>+exclude_unknown</literal></primary>
53214 </indexterm>
53215 <indexterm role="concept">
53216 <primary><literal>+defer_unknown</literal></primary>
53217 </indexterm>
53218 Each of these applies to any subsequent items on the list. For example:
53219 </para>
53220 <literallayout class="monospaced">
53221 deny dnslists = +defer_unknown : foo.bar.example
53222 </literallayout>
53223 <para>
53224 Testing the list of domains stops as soon as a match is found. If you want to
53225 warn for one list and block for another, you can use two different statements:
53226 </para>
53227 <literallayout class="monospaced">
53228 deny  dnslists = blackholes.mail-abuse.org
53229 warn  message  = X-Warn: sending host is on dialups list
53230       dnslists = dialups.mail-abuse.org
53231 </literallayout>
53232 <para>
53233 DNS list lookups are cached by Exim for the duration of the SMTP session,
53234 so a lookup based on the IP address is done at most once for any incoming
53235 connection. Exim does not share information between multiple incoming
53236 connections (but your local name server cache should be active).
53237 </para>
53238 </section>
53239 <section id="SECID201">
53240 <title>Specifying the IP address for a DNS list lookup</title>
53241 <para>
53242 <indexterm role="concept">
53243 <primary>DNS list</primary>
53244 <secondary>keyed by explicit IP address</secondary>
53245 </indexterm>
53246 By default, the IP address that is used in a DNS list lookup is the IP address
53247 of the calling host. However, you can specify another IP address by listing it
53248 after the domain name, introduced by a slash. For example:
53249 </para>
53250 <literallayout class="monospaced">
53251 deny dnslists = black.list.tld/192.168.1.2
53252 </literallayout>
53253 <para>
53254 This feature is not very helpful with explicit IP addresses; it is intended for
53255 use with IP addresses that are looked up, for example, the IP addresses of the
53256 MX hosts or nameservers of an email sender address. For an example, see section
53257 <xref linkend="SECTmulkeyfor"/> below.
53258 </para>
53259 </section>
53260 <section id="SECID202">
53261 <title>DNS lists keyed on domain names</title>
53262 <para>
53263 <indexterm role="concept">
53264 <primary>DNS list</primary>
53265 <secondary>keyed by domain name</secondary>
53266 </indexterm>
53267 There are some lists that are keyed on domain names rather than inverted IP
53268 addresses (see for example the <emphasis>domain based zones</emphasis> link at
53269 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
53270 with these lists. You can change the name that is looked up in a DNS list by
53271 listing it after the domain name, introduced by a slash. For example,
53272 </para>
53273 <literallayout class="monospaced">
53274 deny  message  = Sender's domain is listed at $dnslist_domain
53275       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
53276 </literallayout>
53277 <para>
53278 This particular example is useful only in ACLs that are obeyed after the
53279 RCPT or DATA commands, when a sender address is available. If (for
53280 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
53281 up by this example is
53282 </para>
53283 <literallayout class="monospaced">
53284 tld.example.dsn.rfc-ignorant.org
53285 </literallayout>
53286 <para>
53287 A single <option>dnslists</option> condition can contain entries for both names and IP
53288 addresses. For example:
53289 </para>
53290 <literallayout class="monospaced">
53291 deny dnslists = sbl.spamhaus.org : \
53292                 dsn.rfc-ignorant.org/$sender_address_domain
53293 </literallayout>
53294 <para>
53295 The first item checks the sending host&#x2019;s IP address; the second checks a domain
53296 name. The whole condition is true if either of the DNS lookups succeeds.
53297 </para>
53298 </section>
53299 <section id="SECTmulkeyfor">
53300 <title>Multiple explicit keys for a DNS list</title>
53301 <para>
53302 <indexterm role="concept">
53303 <primary>DNS list</primary>
53304 <secondary>multiple keys for</secondary>
53305 </indexterm>
53306 The syntax described above for looking up explicitly-defined values (either
53307 names or IP addresses) in a DNS blacklist is a simplification. After the domain
53308 name for the DNS list, what follows the slash can in fact be a list of items.
53309 As with all lists in Exim, the default separator is a colon. However, because
53310 this is a sublist within the list of DNS blacklist domains, it is necessary
53311 either to double the separators like this:
53312 </para>
53313 <literallayout class="monospaced">
53314 dnslists = black.list.tld/name.1::name.2
53315 </literallayout>
53316 <para>
53317 or to change the separator character, like this:
53318 </para>
53319 <literallayout class="monospaced">
53320 dnslists = black.list.tld/&lt;;name.1;name.2
53321 </literallayout>
53322 <para>
53323 If an item in the list is an IP address, it is inverted before the DNS
53324 blacklist domain is appended. If it is not an IP address, no inversion
53325 occurs. Consider this condition:
53326 </para>
53327 <literallayout class="monospaced">
53328 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
53329 </literallayout>
53330 <para>
53331 The DNS lookups that occur are:
53332 </para>
53333 <literallayout class="monospaced">
53334 2.1.168.192.black.list.tld
53335 a.domain.black.list.tld
53336 </literallayout>
53337 <para>
53338 Once a DNS record has been found (that matches a specific IP return
53339 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
53340 are done. If there is a temporary DNS error, the rest of the sublist of domains
53341 or IP addresses is tried. A temporary error for the whole dnslists item occurs
53342 only if no other DNS lookup in this sublist succeeds. In other words, a
53343 successful lookup for any of the items in the sublist overrides a temporary
53344 error for a previous item.
53345 </para>
53346 <para>
53347 The ability to supply a list of items after the slash is in some sense just a
53348 syntactic convenience. These two examples have the same effect:
53349 </para>
53350 <literallayout class="monospaced">
53351 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
53352 dnslists = black.list.tld/a.domain::b.domain
53353 </literallayout>
53354 <para>
53355 However, when the data for the list is obtained from a lookup, the second form
53356 is usually much more convenient. Consider this example:
53357 </para>
53358 <literallayout class="monospaced">
53359 deny message  = The mail servers for the domain \
53360                 $sender_address_domain \
53361                 are listed at $dnslist_domain ($dnslist_value); \
53362                 see $dnslist_text.
53363      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
53364                                    ${lookup dnsdb {&gt;|mxh=\
53365                                    $sender_address_domain} }} }
53366 </literallayout>
53367 <para>
53368 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
53369 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
53370 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
53371 of expanding the condition might be something like this:
53372 </para>
53373 <literallayout class="monospaced">
53374 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
53375 </literallayout>
53376 <para>
53377 Thus, this example checks whether or not the IP addresses of the sender
53378 domain&#x2019;s mail servers are on the Spamhaus black list.
53379 </para>
53380 <para>
53381 The key that was used for a successful DNS list lookup is put into the variable
53382 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
53383 </para>
53384 </section>
53385 <section id="SECID203">
53386 <title>Data returned by DNS lists</title>
53387 <para>
53388 <indexterm role="concept">
53389 <primary>DNS list</primary>
53390 <secondary>data returned from</secondary>
53391 </indexterm>
53392 DNS lists are constructed using address records in the DNS. The original RBL
53393 just used the address 127.0.0.1 on the right hand side of each record, but the
53394 RBL+ list and some other lists use a number of values with different meanings.
53395 The values used on the RBL+ list are:
53396 </para>
53397 <literallayout>
53398 127.1.0.1  RBL
53399 127.1.0.2  DUL
53400 127.1.0.3  DUL and RBL
53401 127.1.0.4  RSS
53402 127.1.0.5  RSS and RBL
53403 127.1.0.6  RSS and DUL
53404 127.1.0.7  RSS and DUL and RBL
53405 </literallayout>
53406 <para>
53407 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
53408 different values. Some DNS lists may return more than one address record;
53409 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
53410 </para>
53411 </section>
53412 <section id="SECID204">
53413 <title>Variables set from DNS lists</title>
53414 <para>
53415 <indexterm role="concept">
53416 <primary>expansion</primary>
53417 <secondary>variables, set from DNS list</secondary>
53418 </indexterm>
53419 <indexterm role="concept">
53420 <primary>DNS list</primary>
53421 <secondary>variables set from</secondary>
53422 </indexterm>
53423 <indexterm role="variable">
53424 <primary><varname>$dnslist_domain</varname></primary>
53425 </indexterm>
53426 <indexterm role="variable">
53427 <primary><varname>$dnslist_matched</varname></primary>
53428 </indexterm>
53429 <indexterm role="variable">
53430 <primary><varname>$dnslist_text</varname></primary>
53431 </indexterm>
53432 <indexterm role="variable">
53433 <primary><varname>$dnslist_value</varname></primary>
53434 </indexterm>
53435 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
53436 the name of the overall domain that matched (for example,
53437 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
53438 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
53439 the DNS record. When the key is an IP address, it is not reversed in
53440 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
53441 cases, for example:
53442 </para>
53443 <literallayout class="monospaced">
53444 deny dnslists = spamhaus.example
53445 </literallayout>
53446 <para>
53447 the key is also available in another variable (in this case,
53448 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
53449 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
53450 might generate a dnslists lookup like this:
53451 </para>
53452 <literallayout class="monospaced">
53453 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
53454 </literallayout>
53455 <para>
53456 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
53457 <literal>192.168.6.7</literal> (for example).
53458 </para>
53459 <para>
53460 If more than one address record is returned by the DNS lookup, all the IP
53461 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
53462 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
53463 record. For lists such as RBL+ the TXT record for a merged entry is often not
53464 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
53465 information.
53466 </para>
53467 <para>
53468 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
53469 &ndash; although these appear before the condition in the ACL, they are not
53470 expanded until after it has failed. For example:
53471 </para>
53472 <literallayout class="monospaced">
53473 deny    hosts = !+local_networks
53474         message = $sender_host_address is listed \
53475                   at $dnslist_domain
53476         dnslists = rbl-plus.mail-abuse.example
53477 </literallayout>
53478 </section>
53479 <section id="SECTaddmatcon">
53480 <title>Additional matching conditions for DNS lists</title>
53481 <para>
53482 <indexterm role="concept">
53483 <primary>DNS list</primary>
53484 <secondary>matching specific returned data</secondary>
53485 </indexterm>
53486 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
53487 in order to restrict its action to DNS records with a matching right hand side.
53488 For example,
53489 </para>
53490 <literallayout class="monospaced">
53491 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
53492 </literallayout>
53493 <para>
53494 rejects only those hosts that yield 127.0.0.2. Without this additional data,
53495 any address record is considered to be a match. For the moment, we assume
53496 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
53497 describes how multiple records are handled.
53498 </para>
53499 <para>
53500 More than one IP address may be given for checking, using a comma as a
53501 separator. These are alternatives &ndash; if any one of them matches, the
53502 <option>dnslists</option> condition is true. For example:
53503 </para>
53504 <literallayout class="monospaced">
53505 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
53506 </literallayout>
53507 <para>
53508 If you want to specify a constraining address list and also specify names or IP
53509 addresses to be looked up, the constraining address list must be specified
53510 first. For example:
53511 </para>
53512 <literallayout class="monospaced">
53513 deny dnslists = dsn.rfc-ignorant.org\
53514                 =127.0.0.2/$sender_address_domain
53515 </literallayout>
53516 <para>
53517 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
53518 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
53519 In other words, the listed addresses are used as bit masks. The comparison is
53520 true if all the bits in the mask are present in the address that is being
53521 tested. For example:
53522 </para>
53523 <literallayout class="monospaced">
53524 dnslists = a.b.c&amp;0.0.0.3
53525 </literallayout>
53526 <para>
53527 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
53528 want to test whether one bit or another bit is present (as opposed to both
53529 being present), you must use multiple values. For example:
53530 </para>
53531 <literallayout class="monospaced">
53532 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
53533 </literallayout>
53534 <para>
53535 matches if the final component of the address is an odd number or two times
53536 an odd number.
53537 </para>
53538 </section>
53539 <section id="SECID205">
53540 <title>Negated DNS matching conditions</title>
53541 <para>
53542 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
53543 condition. Whereas
53544 </para>
53545 <literallayout class="monospaced">
53546 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
53547 </literallayout>
53548 <para>
53549 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
53550 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
53551 </para>
53552 <literallayout class="monospaced">
53553 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
53554 </literallayout>
53555 <para>
53556 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
53557 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
53558 words, the result of the test is inverted if an exclamation mark appears before
53559 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
53560 </para>
53561 <para>
53562 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
53563 host, or address list (which is why the syntax is different).
53564 </para>
53565 <para>
53566 If you are using just one list, the negation syntax does not gain you much. The
53567 previous example is precisely equivalent to
53568 </para>
53569 <literallayout class="monospaced">
53570 deny  dnslists = a.b.c
53571      !dnslists = a.b.c=127.0.0.2,127.0.0.3
53572 </literallayout>
53573 <para>
53574 However, if you are using multiple lists, the negation syntax is clearer.
53575 Consider this example:
53576 </para>
53577 <literallayout class="monospaced">
53578 deny  dnslists = sbl.spamhaus.org : \
53579                  list.dsbl.org : \
53580                  dnsbl.njabl.org!=127.0.0.3 : \
53581                  relays.ordb.org
53582 </literallayout>
53583 <para>
53584 Using only positive lists, this would have to be:
53585 </para>
53586 <literallayout class="monospaced">
53587 deny  dnslists = sbl.spamhaus.org : \
53588                  list.dsbl.org
53589 deny  dnslists = dnsbl.njabl.org
53590      !dnslists = dnsbl.njabl.org=127.0.0.3
53591 deny  dnslists = relays.ordb.org
53592 </literallayout>
53593 <para>
53594 which is less clear, and harder to maintain.
53595 </para>
53596 </section>
53597 <section id="SECThanmuldnsrec">
53598 <title>Handling multiple DNS records from a DNS list</title>
53599 <para>
53600 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
53601 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
53602 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
53603 the match to specific results from the DNS lookup, there are two ways in which
53604 the checking can be handled. For example, consider the condition:
53605 </para>
53606 <literallayout class="monospaced">
53607 dnslists = a.b.c=127.0.0.1
53608 </literallayout>
53609 <para>
53610 What happens if the DNS lookup for the incoming IP address yields both
53611 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
53612 condition true because at least one given value was found, or is it false
53613 because at least one of the found values was not listed? And how does this
53614 affect negated conditions? Both possibilities are provided for with the help of
53615 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
53616 </para>
53617 <itemizedlist>
53618 <listitem>
53619 <para>
53620 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
53621 IP addresses matches one of the listed addresses. For the example above, the
53622 condition is true because 127.0.0.1 matches.
53623 </para>
53624 </listitem>
53625 <listitem>
53626 <para>
53627 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
53628 looked up IP addresses matches one of the listed addresses. If the condition is
53629 changed to:
53630 </para>
53631 <literallayout class="monospaced">
53632 dnslists = a.b.c==127.0.0.1
53633 </literallayout>
53634 <para>
53635 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
53636 false because 127.0.0.2 is not listed. You would need to have:
53637 </para>
53638 <literallayout class="monospaced">
53639 dnslists = a.b.c==127.0.0.1,127.0.0.2
53640 </literallayout>
53641 <para>
53642 for the condition to be true.
53643 </para>
53644 </listitem>
53645 </itemizedlist>
53646 <para>
53647 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
53648 the precise opposite of the behaviour above. Thus:
53649 </para>
53650 <itemizedlist>
53651 <listitem>
53652 <para>
53653 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
53654 addresses matches one of the listed addresses. Consider:
53655 </para>
53656 <literallayout class="monospaced">
53657 dnslists = a.b.c!&amp;0.0.0.1
53658 </literallayout>
53659 <para>
53660 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
53661 false because 127.0.0.1 matches.
53662 </para>
53663 </listitem>
53664 <listitem>
53665 <para>
53666 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
53667 looked up IP address that does not match. Consider:
53668 </para>
53669 <literallayout class="monospaced">
53670 dnslists = a.b.c!=&amp;0.0.0.1
53671 </literallayout>
53672 <para>
53673 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
53674 true, because 127.0.0.2 does not match. You would need to have:
53675 </para>
53676 <literallayout class="monospaced">
53677 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
53678 </literallayout>
53679 <para>
53680 for the condition to be false.
53681 </para>
53682 </listitem>
53683 </itemizedlist>
53684 <para>
53685 When the DNS lookup yields only a single IP address, there is no difference
53686 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
53687 </para>
53688 </section>
53689 <section id="SECTmordetinf">
53690 <title>Detailed information from merged DNS lists</title>
53691 <para>
53692 <indexterm role="concept">
53693 <primary>DNS list</primary>
53694 <secondary>information from merged</secondary>
53695 </indexterm>
53696 When the facility for restricting the matching IP values in a DNS list is used,
53697 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
53698 the true reason for rejection. This happens when lists are merged and the IP
53699 address in the A record is used to distinguish them; unfortunately there is
53700 only one TXT record. One way round this is not to use merged lists, but that
53701 can be inefficient because it requires multiple DNS lookups where one would do
53702 in the vast majority of cases when the host of interest is not on any of the
53703 lists.
53704 </para>
53705 <para>
53706 A less inefficient way of solving this problem is available. If
53707 two domain names, comma-separated, are given, the second is used first to
53708 do an initial check, making use of any IP value restrictions that are set.
53709 If there is a match, the first domain is used, without any IP value
53710 restrictions, to get the TXT record. As a byproduct of this, there is also
53711 a check that the IP being tested is indeed on the first list. The first
53712 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
53713 </para>
53714 <literallayout class="monospaced">
53715 reject message  = \
53716          rejected because $sender_host_address is blacklisted \
53717          at $dnslist_domain\n$dnslist_text
53718        dnslists = \
53719          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
53720          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
53721 </literallayout>
53722 <para>
53723 For the first blacklist item, this starts by doing a lookup in
53724 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
53725 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
53726 value, and as long as something is found, it looks for the corresponding TXT
53727 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
53728 The second blacklist item is processed similarly.
53729 </para>
53730 <para>
53731 If you are interested in more than one merged list, the same list must be
53732 given several times, but because the results of the DNS lookups are cached,
53733 the DNS calls themselves are not repeated. For example:
53734 </para>
53735 <literallayout class="monospaced">
53736 reject dnslists = \
53737          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
53738          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
53739          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
53740          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
53741 </literallayout>
53742 <para>
53743 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
53744 values matches (or if no record is found), this is the only lookup that is
53745 done. Only if there is a match is one of the more specific lists consulted.
53746 </para>
53747 </section>
53748 <section id="SECTmorednslistslast">
53749 <title>DNS lists and IPv6</title>
53750 <para>
53751 <indexterm role="concept">
53752 <primary>IPv6</primary>
53753 <secondary>DNS black lists</secondary>
53754 </indexterm>
53755 <indexterm role="concept">
53756 <primary>DNS list</primary>
53757 <secondary>IPv6 usage</secondary>
53758 </indexterm>
53759 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
53760 nibble by nibble. For example, if the calling host&#x2019;s IP address is
53761 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
53762 </para>
53763 <literallayout class="monospaced">
53764 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
53765   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
53766 </literallayout>
53767 <para>
53768 (split over two lines here to fit on the page). Unfortunately, some of the DNS
53769 lists contain wildcard records, intended for IPv4, that interact badly with
53770 IPv6. For example, the DNS entry
53771 </para>
53772 <literallayout class="monospaced">
53773 *.3.some.list.example.    A    127.0.0.1
53774 </literallayout>
53775 <para>
53776 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
53777 Unfortunately, it also matches the entire 3::/4 IPv6 network.
53778 </para>
53779 <para>
53780 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
53781 <option>condition</option> condition, as in this example:
53782 </para>
53783 <literallayout class="monospaced">
53784 deny   condition = ${if isip4{$sender_host_address}}
53785        dnslists  = some.list.example
53786 </literallayout>
53787 </section>
53788 <section id="SECTratelimiting">
53789 <title>Rate limiting incoming messages</title>
53790 <para>
53791 <indexterm role="concept">
53792 <primary>rate limiting</primary>
53793 <secondary>client sending</secondary>
53794 </indexterm>
53795 <indexterm role="concept">
53796 <primary>limiting client sending rates</primary>
53797 </indexterm>
53798 <indexterm role="option">
53799 <primary><option>smtp_ratelimit_*</option></primary>
53800 </indexterm>
53801 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
53802 which clients can send email. This is more powerful than the
53803 <option>smtp_ratelimit_*</option> options, because those options control the rate of
53804 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
53805 works across all connections (concurrent and sequential) from the same client
53806 host. The syntax of the <option>ratelimit</option> condition is:
53807 </para>
53808 <literallayout>
53809 <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;
53810 </literallayout>
53811 <para>
53812 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
53813 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
53814 </para>
53815 <para>
53816 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
53817 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
53818 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
53819 of <emphasis>p</emphasis>.
53820 </para>
53821 <para>
53822 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
53823 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
53824 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
53825 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
53826 send in each time interval. It also specifies the number of messages permitted
53827 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
53828 constant, you can allow a client to send more messages in a burst without
53829 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
53830 both small, messages must be sent at an even rate.
53831 </para>
53832 <para>
53833 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
53834 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
53835 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
53836 instructions when it is run with no arguments.
53837 </para>
53838 <para>
53839 The key is used to look up the data for calculating the client&#x2019;s average
53840 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
53841 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
53842 which means Exim computes the sending rate of each client host IP address.
53843 By changing the key you can change how Exim identifies clients for the purpose
53844 of ratelimiting. For example, to limit the sending rate of each authenticated
53845 user, independent of the computer they are sending from, set the key to
53846 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
53847 example, <varname>$authenticated_id</varname> is only meaningful if the client has
53848 authenticated (which you can check with the <option>authenticated</option> ACL condition).
53849 </para>
53850 <para>
53851 The lookup key does not have to identify clients: If you want to limit the
53852 rate at which a recipient receives messages, you can use the key
53853 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
53854 ACL.
53855 </para>
53856 <para>
53857 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
53858 specifies what Exim measures the rate of, for example messages or recipients
53859 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
53860 <option>count=</option> options. You can also control when Exim updates the recorded rate
53861 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
53862 separated by a slash, like the other parameters. They may appear in any order.
53863 </para>
53864 <para>
53865 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
53866 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
53867 stored, so you can alter the configured maximum rate and Exim will still
53868 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
53869 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
53870 behaviour. The lookup key is not affected by changes to the update mode and
53871 the <option>count=</option> option.
53872 </para>
53873 </section>
53874 <section id="ratoptmea">
53875 <title>Ratelimit options for what is being measured</title>
53876 <para>
53877 <indexterm role="concept">
53878 <primary>rate limiting</primary>
53879 <secondary>per_* options</secondary>
53880 </indexterm>
53881 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
53882 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
53883 <option>acl_not_smtp_start</option> ACLs.
53884 </para>
53885 <para>
53886 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
53887 the default if none of the <option>per_*</option> options is specified. It can be used in
53888 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
53889 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
53890 </para>
53891 <para>
53892 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
53893 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
53894 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
53895 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
53896 in its MAIL command, which may be inaccurate or completely missing. You can
53897 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
53898 in kilobytes, megabytes, or gigabytes, respectively.
53899 </para>
53900 <para>
53901 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
53902 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
53903 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
53904 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
53905 ACLs the rate is updated with the total recipient count in one go. Note that
53906 in either case the rate limiting engine will see a message with many
53907 recipients as a large high-speed burst.
53908 </para>
53909 <para>
53910 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
53911 number of different recipients that the client has sent messages to in the
53912 last time period. That is, if the client repeatedly sends messages to the same
53913 recipient, its measured rate is not increased. This option can only be used in
53914 <option>acl_smtp_rcpt</option>.
53915 </para>
53916 <para>
53917 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
53918 condition is processed. This can be used to limit the rate of any SMTP
53919 command. If it is used in multiple ACLs it can limit the aggregate rate of
53920 multiple different commands.
53921 </para>
53922 <para>
53923 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
53924 measured rate. For example, the <option>per_byte</option> option is equivalent to
53925 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
53926 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
53927 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
53928 </para>
53929 <para>
53930 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
53931 </para>
53932 </section>
53933 <section id="ratoptupd">
53934 <title>Ratelimit update modes</title>
53935 <para>
53936 <indexterm role="concept">
53937 <primary>rate limiting</primary>
53938 <secondary>reading data without updating</secondary>
53939 </indexterm>
53940 You can specify one of three options with the <option>ratelimit</option> condition to
53941 control when its database is updated. This section describes the <option>readonly</option>
53942 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
53943 </para>
53944 <para>
53945 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
53946 previously-computed rate to check against the limit.
53947 </para>
53948 <para>
53949 For example, you can test the client&#x2019;s sending rate and deny it access (when
53950 it is too fast) in the connect ACL. If the client passes this check then it
53951 can go on to send a message, in which case its recorded rate will be updated
53952 in the MAIL ACL. Subsequent connections from the same client will check this
53953 new rate.
53954 </para>
53955 <literallayout class="monospaced">
53956 acl_check_connect:
53957  deny ratelimit = 100 / 5m / readonly
53958     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
53959                   (max $sender_rate_limit)
53960 # ...
53961 acl_check_mail:
53962  warn ratelimit = 100 / 5m / strict
53963     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
53964                   (max $sender_rate_limit)
53965 </literallayout>
53966 <para>
53967 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
53968 processing a message then it may increase the client&#x2019;s measured rate more than
53969 it should. For example, this will happen if you check the <option>per_rcpt</option> option
53970 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
53971 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
53972 multiple update problems by using the <option>readonly</option> option on later ratelimit
53973 checks.
53974 </para>
53975 <para>
53976 The <option>per_*</option> options described above do not make sense in some ACLs. If you
53977 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
53978 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
53979 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
53980 next section) so you must specify the <option>readonly</option> option explicitly.
53981 </para>
53982 </section>
53983 <section id="ratoptfast">
53984 <title>Ratelimit options for handling fast clients</title>
53985 <para>
53986 <indexterm role="concept">
53987 <primary>rate limiting</primary>
53988 <secondary>strict and leaky modes</secondary>
53989 </indexterm>
53990 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
53991 engine can react in two possible ways, depending on the presence of the
53992 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
53993 counter-measures (such as rejecting the message) that may be specified by the
53994 rest of the ACL.
53995 </para>
53996 <para>
53997 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
53998 updated if it is above the limit. The effect of this is that Exim measures the
53999 client&#x2019;s average rate of successfully sent email, which cannot be greater than
54000 the maximum allowed. If the client is over the limit it may suffer some
54001 counter-measures (as specified in the ACL), but it will still be able to send
54002 email at the configured maximum rate, whatever the rate of its attempts. This
54003 is generally the better choice if you have clients that retry automatically.
54004 For example, it does not prevent a sender with an over-aggressive retry rate
54005 from getting any email through.
54006 </para>
54007 <para>
54008 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
54009 updated. The effect of this is that Exim measures the client&#x2019;s average rate
54010 of attempts to send email, which can be much higher than the maximum it is
54011 actually allowed. If the client is over the limit it may be subjected to
54012 counter-measures by the ACL. It must slow down and allow sufficient time to
54013 pass that its computed rate falls below the maximum before it can send email
54014 again. The time (the number of smoothing periods) it must wait and not
54015 attempt to send mail can be calculated with this formula:
54016 </para>
54017 <literallayout class="monospaced">
54018         ln(peakrate/maxrate)
54019 </literallayout>
54020 </section>
54021 <section id="ratoptuniq">
54022 <title>Limiting the rate of different events</title>
54023 <para>
54024 <indexterm role="concept">
54025 <primary>rate limiting</primary>
54026 <secondary>counting unique events</secondary>
54027 </indexterm>
54028 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
54029 rate of different events. For example, the <option>per_addr</option> option uses this
54030 mechanism to count the number of different recipients that the client has
54031 sent messages to in the last time period; it is equivalent to
54032 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
54033 measure the rate that a client uses different sender addresses with the
54034 options <literal>per_mail/unique=$sender_address</literal>.
54035 </para>
54036 <para>
54037 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
54038 has seen for that key. The whole set is thrown away when it is older than the
54039 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
54040 per period. In the <option>leaky</option> update mode, an event that causes the client to
54041 go over the limit is not added to the set, in the same way that the client&#x2019;s
54042 recorded rate is not updated in the same situation.
54043 </para>
54044 <para>
54045 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
54046 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
54047 rate.
54048 </para>
54049 <para>
54050 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
54051 other <option>ratelimit</option> options in order to store the event set. The number of
54052 unique values is potentially as large as the rate limit, so the extra space
54053 required increases with larger limits.
54054 </para>
54055 <para>
54056 The uniqueification is not perfect: there is a small probability that Exim
54057 will think a new event has happened before. If the sender&#x2019;s rate is less than
54058 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
54059 the measured rate can go above the limit, in which case Exim may under-count
54060 events by a significant margin. Fortunately, if the rate is high enough (2.7
54061 times the limit) that the false positive rate goes above 9%, then Exim will
54062 throw away the over-full event set before the measured rate falls below the
54063 limit. Therefore the only harm should be that exceptionally high sending rates
54064 are logged incorrectly; any countermeasures you configure will be as effective
54065 as intended.
54066 </para>
54067 </section>
54068 <section id="useratlim">
54069 <title>Using rate limiting</title>
54070 <para>
54071 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
54072 when the rate limit is exceeded. This might be anything from logging a warning
54073 (for example, while measuring existing sending rates in order to define
54074 policy), through time delays to slow down fast senders, up to rejecting the
54075 message. For example:
54076 </para>
54077 <literallayout class="monospaced">
54078 # Log all senders' rates
54079 warn ratelimit = 0 / 1h / strict
54080      log_message = Sender rate $sender_rate / $sender_rate_period
54081
54082 # Slow down fast senders; note the need to truncate $sender_rate
54083 # at the decimal point.
54084 warn ratelimit = 100 / 1h / per_rcpt / strict
54085      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
54086                    $sender_rate_limit }s
54087
54088 # Keep authenticated users under control
54089 deny authenticated = *
54090      ratelimit = 100 / 1d / strict / $authenticated_id
54091
54092 # System-wide rate limit
54093 defer message = Sorry, too busy. Try again later.
54094      ratelimit = 10 / 1s / $primary_hostname
54095
54096 # Restrict incoming rate from each host, with a default
54097 # set using a macro and special cases looked up in a table.
54098 defer message = Sender rate exceeds $sender_rate_limit \
54099                messages per $sender_rate_period
54100      ratelimit = ${lookup {$sender_host_address} \
54101                    cdb {DB/ratelimits.cdb} \
54102                    {$value} {RATELIMIT} }
54103 </literallayout>
54104 <para>
54105 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
54106 especially with the <option>per_rcpt</option> option, you may suffer from a performance
54107 bottleneck caused by locking on the ratelimit hints database. Apart from
54108 making your ACLs less complicated, you can reduce the problem by using a
54109 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
54110 this means that Exim will lose its hints data after a reboot (including retry
54111 hints, the callout cache, and ratelimit data).
54112 </para>
54113 </section>
54114 <section id="SECTaddressverification">
54115 <title>Address verification</title>
54116 <para>
54117 <indexterm role="concept">
54118 <primary>verifying address</primary>
54119 <secondary>options for</secondary>
54120 </indexterm>
54121 <indexterm role="concept">
54122 <primary>policy control</primary>
54123 <secondary>address verification</secondary>
54124 </indexterm>
54125 Several of the <option>verify</option> conditions described in section
54126 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
54127 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
54128 The verification conditions can be followed by options that modify the
54129 verification process. The options are separated from the keyword and from each
54130 other by slashes, and some of them contain parameters. For example:
54131 </para>
54132 <literallayout class="monospaced">
54133 verify = sender/callout
54134 verify = recipient/defer_ok/callout=10s,defer_ok
54135 </literallayout>
54136 <para>
54137 The first stage of address verification, which always happens, is to run the
54138 address through the routers, in <quote>verify mode</quote>. Routers can detect the
54139 difference between verification and routing for delivery, and their actions can
54140 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
54141 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
54142 The available options are as follows:
54143 </para>
54144 <itemizedlist>
54145 <listitem>
54146 <para>
54147 If the <option>callout</option> option is specified, successful routing to one or more
54148 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
54149 check. Callouts and their sub-options are discussed in the next section.
54150 </para>
54151 </listitem>
54152 <listitem>
54153 <para>
54154 If there is a defer error while doing verification routing, the ACL
54155 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
54156 options, the condition is forced to be true instead. Note that this is a main
54157 verification option as well as a suboption for callouts.
54158 </para>
54159 </listitem>
54160 <listitem>
54161 <para>
54162 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
54163 discusses the reporting of sender address verification failures.
54164 </para>
54165 </listitem>
54166 <listitem>
54167 <para>
54168 The <option>success_on_redirect</option> option causes verification always to succeed
54169 immediately after a successful redirection. By default, if a redirection
54170 generates just one address, that address is also verified. See further
54171 discussion in section <xref linkend="SECTredirwhilveri"/>.
54172 </para>
54173 </listitem>
54174 </itemizedlist>
54175 <para>
54176 <indexterm role="concept">
54177 <primary>verifying address</primary>
54178 <secondary>differentiating failures</secondary>
54179 </indexterm>
54180 <indexterm role="variable">
54181 <primary><varname>$recipient_verify_failure</varname></primary>
54182 </indexterm>
54183 <indexterm role="variable">
54184 <primary><varname>$sender_verify_failure</varname></primary>
54185 </indexterm>
54186 <indexterm role="variable">
54187 <primary><varname>$acl_verify_message</varname></primary>
54188 </indexterm>
54189 After an address verification failure, <varname>$acl_verify_message</varname> contains the
54190 error message that is associated with the failure. It can be preserved by
54191 coding like this:
54192 </para>
54193 <literallayout class="monospaced">
54194 warn  !verify = sender
54195        set acl_m0 = $acl_verify_message
54196 </literallayout>
54197 <para>
54198 If you are writing your own custom rejection message or log message when
54199 denying access, you can use this variable to include information about the
54200 verification failure.
54201 </para>
54202 <para>
54203 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
54204 appropriate) contains one of the following words:
54205 </para>
54206 <itemizedlist>
54207 <listitem>
54208 <para>
54209 <option>qualify</option>: The address was unqualified (no domain), and the message
54210 was neither local nor came from an exempted host.
54211 </para>
54212 </listitem>
54213 <listitem>
54214 <para>
54215 <option>route</option>: Routing failed.
54216 </para>
54217 </listitem>
54218 <listitem>
54219 <para>
54220 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
54221 occurred at or before the MAIL command (that is, on initial
54222 connection, HELO, or MAIL).
54223 </para>
54224 </listitem>
54225 <listitem>
54226 <para>
54227 <option>recipient</option>: The RCPT command in a callout was rejected.
54228 </para>
54229 </listitem>
54230 <listitem>
54231 <para>
54232 <option>postmaster</option>: The postmaster check in a callout was rejected.
54233 </para>
54234 </listitem>
54235 </itemizedlist>
54236 <para>
54237 The main use of these variables is expected to be to distinguish between
54238 rejections of MAIL and rejections of RCPT in callouts.
54239 </para>
54240 </section>
54241 <section id="SECTcallver">
54242 <title>Callout verification</title>
54243 <para>
54244 <indexterm role="concept">
54245 <primary>verifying address</primary>
54246 <secondary>by callout</secondary>
54247 </indexterm>
54248 <indexterm role="concept">
54249 <primary>callout</primary>
54250 <secondary>verification</secondary>
54251 </indexterm>
54252 <indexterm role="concept">
54253 <primary>SMTP</primary>
54254 <secondary>callout verification</secondary>
54255 </indexterm>
54256 For non-local addresses, routing verifies the domain, but is unable to do any
54257 checking of the local part. There are situations where some means of verifying
54258 the local part is desirable. One way this can be done is to make an SMTP
54259 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
54260 a subsequent host for a recipient address, to see if the host accepts the
54261 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
54262 sender address, the callback is not to the client host that is trying to
54263 deliver the message, but to one of the hosts that accepts incoming mail for the
54264 sender&#x2019;s domain.
54265 </para>
54266 <para>
54267 Exim does not do callouts by default. If you want them to happen, you must
54268 request them by setting appropriate options on the <option>verify</option> condition, as
54269 described below. This facility should be used with care, because it can add a
54270 lot of resource usage to the cost of verifying an address. However, Exim does
54271 cache the results of callouts, which helps to reduce the cost. Details of
54272 caching are in section <xref linkend="SECTcallvercache"/>.
54273 </para>
54274 <para>
54275 Recipient callouts are usually used only between hosts that are controlled by
54276 the same administration. For example, a corporate gateway host could use
54277 callouts to check for valid recipients on an internal mailserver. A successful
54278 callout does not guarantee that a real delivery to the address would succeed;
54279 on the other hand, a failing callout does guarantee that a delivery would fail.
54280 </para>
54281 <para>
54282 If the <option>callout</option> option is present on a condition that verifies an address, a
54283 second stage of verification occurs if the address is successfully routed to
54284 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
54285 <command>manualroute</command> router, where the router specifies the hosts. However, if a
54286 router that does not set up hosts routes to an <command>smtp</command> transport with a
54287 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
54288 <option>hosts_override</option> set, its hosts are always used, whether or not the router
54289 supplies a host list.
54290 </para>
54291 <para>
54292 The port that is used is taken from the transport, if it is specified and is a
54293 remote transport. (For routers that do verification only, no transport need be
54294 specified.) Otherwise, the default SMTP port is used. If a remote transport
54295 specifies an outgoing interface, this is used; otherwise the interface is not
54296 specified. Likewise, the text that is used for the HELO command is taken from
54297 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
54298 <varname>$smtp_active_hostname</varname> is used.
54299 </para>
54300 <para>
54301 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
54302 test whether a bounce message could be delivered to the sender address. The
54303 following SMTP commands are sent:
54304 </para>
54305 <literallayout>
54306 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
54307 <literal>MAIL FROM:&lt;&gt;</literal>
54308 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
54309 <literal>QUIT</literal>
54310 </literallayout>
54311 <para>
54312 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
54313 set to <quote>lmtp</quote>.
54314 </para>
54315 <para revisionflag="changed">
54316 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
54317 settings.
54318 </para>
54319 <para>
54320 A recipient callout check is similar. By default, it also uses an empty address
54321 for the sender. This default is chosen because most hosts do not make use of
54322 the sender address when verifying a recipient. Using the same address means
54323 that a single cache entry can be used for each recipient. Some sites, however,
54324 do make use of the sender address when verifying. These are catered for by the
54325 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
54326 </para>
54327 <para>
54328 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
54329 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
54330 Exim tries the next host, if any. If there is a problem with all the remote
54331 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
54332 <option>callout</option> option is given, in which case the condition is forced to succeed.
54333 </para>
54334 <para>
54335 <indexterm role="concept">
54336 <primary>SMTP</primary>
54337 <secondary>output flushing, disabling for callout</secondary>
54338 </indexterm>
54339 A callout may take a little time. For this reason, Exim normally flushes SMTP
54340 output before performing a callout in an ACL, to avoid unexpected timeouts in
54341 clients when the SMTP PIPELINING extension is in use. The flushing can be
54342 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
54343 </para>
54344 </section>
54345 <section id="CALLaddparcall">
54346 <title>Additional parameters for callouts</title>
54347 <para>
54348 <indexterm role="concept">
54349 <primary>callout</primary>
54350 <secondary>additional parameters for</secondary>
54351 </indexterm>
54352 The <option>callout</option> option can be followed by an equals sign and a number of
54353 optional parameters, separated by commas. For example:
54354 </para>
54355 <literallayout class="monospaced">
54356 verify = recipient/callout=10s,defer_ok
54357 </literallayout>
54358 <para>
54359 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
54360 separate verify options, is retained for backwards compatibility, but is now
54361 deprecated. The additional parameters for <option>callout</option> are as follows:
54362 </para>
54363 <variablelist>
54364 <varlistentry>
54365 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
54366 <listitem>
54367 <para>
54368 <indexterm role="concept">
54369 <primary>callout</primary>
54370 <secondary>timeout, specifying</secondary>
54371 </indexterm>
54372 This specifies the timeout that applies for the callout attempt to each host.
54373 For example:
54374 </para>
54375 <literallayout class="monospaced">
54376 verify = sender/callout=5s
54377 </literallayout>
54378 <para>
54379 The default is 30 seconds. The timeout is used for each response from the
54380 remote host. It is also used for the initial connection, unless overridden by
54381 the <option>connect</option> parameter.
54382 </para>
54383 </listitem></varlistentry>
54384 <varlistentry>
54385 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
54386 <listitem>
54387 <para>
54388 <indexterm role="concept">
54389 <primary>callout</primary>
54390 <secondary>connection timeout, specifying</secondary>
54391 </indexterm>
54392 This parameter makes it possible to set a different (usually smaller) timeout
54393 for making the SMTP connection. For example:
54394 </para>
54395 <literallayout class="monospaced">
54396 verify = sender/callout=5s,connect=1s
54397 </literallayout>
54398 <para>
54399 If not specified, this timeout defaults to the general timeout value.
54400 </para>
54401 </listitem></varlistentry>
54402 <varlistentry>
54403 <term><emphasis role="bold">defer_ok</emphasis></term>
54404 <listitem>
54405 <para>
54406 <indexterm role="concept">
54407 <primary>callout</primary>
54408 <secondary>defer, action on</secondary>
54409 </indexterm>
54410 When this parameter is present, failure to contact any host, or any other kind
54411 of temporary error, is treated as success by the ACL. However, the cache is not
54412 updated in this circumstance.
54413 </para>
54414 </listitem></varlistentry>
54415 <varlistentry>
54416 <term><emphasis role="bold">fullpostmaster</emphasis></term>
54417 <listitem>
54418 <para>
54419 <indexterm role="concept">
54420 <primary>callout</primary>
54421 <secondary>full postmaster check</secondary>
54422 </indexterm>
54423 This operates like the <option>postmaster</option> option (see below), but if the check for
54424 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
54425 accordance with the specification in RFC 2821. The RFC states that the
54426 unqualified address <emphasis>postmaster</emphasis> should be accepted.
54427 </para>
54428 </listitem></varlistentry>
54429 <varlistentry>
54430 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
54431 <listitem>
54432 <para>
54433 <indexterm role="concept">
54434 <primary>callout</primary>
54435 <secondary>sender when verifying header</secondary>
54436 </indexterm>
54437 When verifying addresses in header lines using the <option>header_sender</option>
54438 verification option, Exim behaves by default as if the addresses are envelope
54439 sender addresses from a message. Callout verification therefore tests to see
54440 whether a bounce message could be delivered, by using an empty address in the
54441 MAIL command. However, it is arguable that these addresses might never be used
54442 as envelope senders, and could therefore justifiably reject bounce messages
54443 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
54444 address to use in the MAIL command. For example:
54445 </para>
54446 <literallayout class="monospaced">
54447 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
54448 </literallayout>
54449 <para>
54450 This parameter is available only for the <option>header_sender</option> verification option.
54451 </para>
54452 </listitem></varlistentry>
54453 <varlistentry>
54454 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
54455 <listitem>
54456 <para>
54457 <indexterm role="concept">
54458 <primary>callout</primary>
54459 <secondary>overall timeout, specifying</secondary>
54460 </indexterm>
54461 This parameter sets an overall timeout for performing a callout verification.
54462 For example:
54463 </para>
54464 <literallayout class="monospaced">
54465 verify = sender/callout=5s,maxwait=30s
54466 </literallayout>
54467 <para>
54468 This timeout defaults to four times the callout timeout for individual SMTP
54469 commands. The overall timeout applies when there is more than one host that can
54470 be tried. The timeout is checked before trying the next host. This prevents
54471 very long delays if there are a large number of hosts and all are timing out
54472 (for example, when network connections are timing out).
54473 </para>
54474 </listitem></varlistentry>
54475 <varlistentry>
54476 <term><emphasis role="bold">no_cache</emphasis></term>
54477 <listitem>
54478 <para>
54479 <indexterm role="concept">
54480 <primary>callout</primary>
54481 <secondary>cache, suppressing</secondary>
54482 </indexterm>
54483 <indexterm role="concept">
54484 <primary>caching callout, suppressing</primary>
54485 </indexterm>
54486 When this parameter is given, the callout cache is neither read nor updated.
54487 </para>
54488 </listitem></varlistentry>
54489 <varlistentry>
54490 <term><emphasis role="bold">postmaster</emphasis></term>
54491 <listitem>
54492 <para>
54493 <indexterm role="concept">
54494 <primary>callout</primary>
54495 <secondary>postmaster; checking</secondary>
54496 </indexterm>
54497 When this parameter is set, a successful callout check is followed by a similar
54498 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
54499 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
54500 the postmaster check is recorded in a cache record; if it is a failure, this is
54501 used to fail subsequent callouts for the domain without a connection being
54502 made, until the cache record expires.
54503 </para>
54504 </listitem></varlistentry>
54505 <varlistentry>
54506 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
54507 <listitem>
54508 <para>
54509 The postmaster check uses an empty sender in the MAIL command by default.
54510 You can use this parameter to do a postmaster check using a different address.
54511 For example:
54512 </para>
54513 <literallayout class="monospaced">
54514 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
54515 </literallayout>
54516 <para>
54517 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
54518 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
54519 </para>
54520 <literallayout class="monospaced">
54521 require  verify = sender/callout=postmaster_mailfrom=
54522 </literallayout>
54523 <para>
54524 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
54525 account of the sender address. It is assumed that either the empty address or
54526 a fixed non-empty address will be used. All that Exim remembers is that the
54527 postmaster check for the domain succeeded or failed.
54528 </para>
54529 </listitem></varlistentry>
54530 <varlistentry>
54531 <term><emphasis role="bold">random</emphasis></term>
54532 <listitem>
54533 <para>
54534 <indexterm role="concept">
54535 <primary>callout</primary>
54536 <secondary><quote>random</quote> check</secondary>
54537 </indexterm>
54538 When this parameter is set, before doing the normal callout check, Exim does a
54539 check for a <quote>random</quote> local part at the same domain. The local part is not
54540 really random &ndash; it is defined by the expansion of the option
54541 <option>callout_random_local_part</option>, which defaults to
54542 </para>
54543 <literallayout class="monospaced">
54544 $primary_hostname-$tod_epoch-testing
54545 </literallayout>
54546 <para>
54547 The idea here is to try to determine whether the remote host accepts all local
54548 parts without checking. If it does, there is no point in doing callouts for
54549 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
54550 a cache record, and used to force the current and subsequent callout checks to
54551 succeed without a connection being made, until the cache record expires.
54552 </para>
54553 </listitem></varlistentry>
54554 <varlistentry>
54555 <term><emphasis role="bold">use_postmaster</emphasis></term>
54556 <listitem>
54557 <para>
54558 <indexterm role="concept">
54559 <primary>callout</primary>
54560 <secondary>sender for recipient check</secondary>
54561 </indexterm>
54562 This parameter applies to recipient callouts only. For example:
54563 </para>
54564 <literallayout class="monospaced">
54565 deny  !verify = recipient/callout=use_postmaster
54566 </literallayout>
54567 <para>
54568 <indexterm role="variable">
54569 <primary><varname>$qualify_domain</varname></primary>
54570 </indexterm>
54571 It causes a non-empty postmaster address to be used in the MAIL command when
54572 performing the callout for the recipient, and also for a <quote>random</quote> check if
54573 that is configured. The local part of the address is <literal>postmaster</literal> and the
54574 domain is the contents of <varname>$qualify_domain</varname>.
54575 </para>
54576 </listitem></varlistentry>
54577 <varlistentry>
54578 <term><emphasis role="bold">use_sender</emphasis></term>
54579 <listitem>
54580 <para>
54581 This option applies to recipient callouts only. For example:
54582 </para>
54583 <literallayout class="monospaced">
54584 require  verify = recipient/callout=use_sender
54585 </literallayout>
54586 <para>
54587 It causes the message&#x2019;s actual sender address to be used in the MAIL
54588 command when performing the callout, instead of an empty address. There is no
54589 need to use this option unless you know that the called hosts make use of the
54590 sender when checking recipients. If used indiscriminately, it reduces the
54591 usefulness of callout caching.
54592 </para>
54593 </listitem></varlistentry>
54594 </variablelist>
54595 <para>
54596 If you use any of the parameters that set a non-empty sender for the MAIL
54597 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
54598 <option>use_sender</option>), you should think about possible loops. Recipient checking is
54599 usually done between two hosts that are under the same management, and the host
54600 that receives the callouts is not normally configured to do callouts itself.
54601 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
54602 these circumstances.
54603 </para>
54604 <para>
54605 However, if you use a non-empty sender address for a callout to an arbitrary
54606 host, there is the likelihood that the remote host will itself initiate a
54607 callout check back to your host. As it is checking what appears to be a message
54608 sender, it is likely to use an empty address in MAIL, thus avoiding a
54609 callout loop. However, to be on the safe side it would be best to set up your
54610 own ACLs so that they do not do sender verification checks when the recipient
54611 is the address you use for header sender or postmaster callout checking.
54612 </para>
54613 <para>
54614 Another issue to think about when using non-empty senders for callouts is
54615 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
54616 by the sender/recipient combination; thus, for any given recipient, many more
54617 actual callouts are performed than when an empty sender or postmaster is used.
54618 </para>
54619 </section>
54620 <section id="SECTcallvercache">
54621 <title>Callout caching</title>
54622 <para>
54623 <indexterm role="concept">
54624 <primary>hints database</primary>
54625 <secondary>callout cache</secondary>
54626 </indexterm>
54627 <indexterm role="concept">
54628 <primary>callout</primary>
54629 <secondary>cache, description of</secondary>
54630 </indexterm>
54631 <indexterm role="concept">
54632 <primary>caching</primary>
54633 <secondary>callout</secondary>
54634 </indexterm>
54635 Exim caches the results of callouts in order to reduce the amount of resources
54636 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
54637 option. A hints database called <quote>callout</quote> is used for the cache. Two
54638 different record types are used: one records the result of a callout check for
54639 a specific address, and the other records information that applies to the
54640 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
54641 </para>
54642 <para>
54643 When an original callout fails, a detailed SMTP error message is given about
54644 the failure. However, for subsequent failures use the cache data, this message
54645 is not available.
54646 </para>
54647 <para>
54648 The expiry times for negative and positive address cache records are
54649 independent, and can be set by the global options <option>callout_negative_expire</option>
54650 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
54651 </para>
54652 <para>
54653 If a host gives a negative response to an SMTP connection, or rejects any
54654 commands up to and including
54655 </para>
54656 <literallayout class="monospaced">
54657 MAIL FROM:&lt;&gt;
54658 </literallayout>
54659 <para>
54660 (but not including the MAIL command with a non-empty address),
54661 any callout attempt is bound to fail. Exim remembers such failures in a
54662 domain cache record, which it uses to fail callouts for the domain without
54663 making new connections, until the domain record times out. There are two
54664 separate expiry times for domain cache records:
54665 <option>callout_domain_negative_expire</option> (default 3h) and
54666 <option>callout_domain_positive_expire</option> (default 7d).
54667 </para>
54668 <para>
54669 Domain records expire when the negative expiry time is reached if callouts
54670 cannot be made for the domain, or if the postmaster check failed.
54671 Otherwise, they expire when the positive expiry time is reached. This
54672 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
54673 will eventually be noticed.
54674 </para>
54675 <para>
54676 The callout caching mechanism is based on the domain of the address that is
54677 being tested. If the domain routes to several hosts, it is assumed that their
54678 behaviour will be the same.
54679 </para>
54680 </section>
54681 <section id="SECTsenaddver">
54682 <title>Sender address verification reporting</title>
54683 <para>
54684 <indexterm role="concept">
54685 <primary>verifying</primary>
54686 <secondary>suppressing error details</secondary>
54687 </indexterm>
54688 See section <xref linkend="SECTaddressverification"/> for a general discussion of
54689 verification. When sender verification fails in an ACL, the details of the
54690 failure are given as additional output lines before the 550 response to the
54691 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
54692 you might see:
54693 </para>
54694 <literallayout class="monospaced">
54695 MAIL FROM:&lt;xyz@abc.example&gt;
54696 250 OK
54697 RCPT TO:&lt;pqr@def.example&gt;
54698 550-Verification failed for &lt;xyz@abc.example&gt;
54699 550-Called:   192.168.34.43
54700 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
54701 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
54702 550 Sender verification failed
54703 </literallayout>
54704 <para>
54705 If more than one RCPT command fails in the same way, the details are given
54706 only for the first of them. However, some administrators do not want to send
54707 out this much information. You can suppress the details by adding
54708 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
54709 example:
54710 </para>
54711 <literallayout class="monospaced">
54712 verify = sender/no_details
54713 </literallayout>
54714 </section>
54715 <section id="SECTredirwhilveri">
54716 <title>Redirection while verifying</title>
54717 <para>
54718 <indexterm role="concept">
54719 <primary>verifying</primary>
54720 <secondary>redirection while</secondary>
54721 </indexterm>
54722 <indexterm role="concept">
54723 <primary>address redirection</primary>
54724 <secondary>while verifying</secondary>
54725 </indexterm>
54726 A dilemma arises when a local address is redirected by aliasing or forwarding
54727 during verification: should the generated addresses themselves be verified,
54728 or should the successful expansion of the original address be enough to verify
54729 it? By default, Exim takes the following pragmatic approach:
54730 </para>
54731 <itemizedlist>
54732 <listitem>
54733 <para>
54734 When an incoming address is redirected to just one child address, verification
54735 continues with the child address, and if that fails to verify, the original
54736 verification also fails.
54737 </para>
54738 </listitem>
54739 <listitem>
54740 <para>
54741 When an incoming address is redirected to more than one child address,
54742 verification does not continue. A success result is returned.
54743 </para>
54744 </listitem>
54745 </itemizedlist>
54746 <para>
54747 This seems the most reasonable behaviour for the common use of aliasing as a
54748 way of redirecting different local parts to the same mailbox. It means, for
54749 example, that a pair of alias entries of the form
54750 </para>
54751 <literallayout class="monospaced">
54752 A.Wol:   aw123
54753 aw123:   :fail: Gone away, no forwarding address
54754 </literallayout>
54755 <para>
54756 work as expected, with both local parts causing verification failure. When a
54757 redirection generates more than one address, the behaviour is more like a
54758 mailing list, where the existence of the alias itself is sufficient for
54759 verification to succeed.
54760 </para>
54761 <para>
54762 It is possible, however, to change the default behaviour so that all successful
54763 redirections count as successful verifications, however many new addresses are
54764 generated. This is specified by the <option>success_on_redirect</option> verification
54765 option. For example:
54766 </para>
54767 <literallayout class="monospaced">
54768 require verify = recipient/success_on_redirect/callout=10s
54769 </literallayout>
54770 <para>
54771 In this example, verification succeeds if a router generates a new address, and
54772 the callout does not occur, because no address was routed to a remote host.
54773 </para>
54774 <para>
54775 When verification is being tested via the <option>-bv</option> option, the treatment of
54776 redirections is as just described, unless the <option>-v</option> or any debugging option is
54777 also specified. In that case, full verification is done for every generated
54778 address and a report is output for each of them.
54779 </para>
54780 </section>
54781 <section id="SECTverifyCSA">
54782 <title>Client SMTP authorization (CSA)</title>
54783 <para>
54784 <indexterm role="concept">
54785 <primary>CSA</primary>
54786 <secondary>verifying</secondary>
54787 </indexterm>
54788 Client SMTP Authorization is a system that allows a site to advertise
54789 which machines are and are not permitted to send email. This is done by placing
54790 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
54791 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
54792 Authorization checks in Exim are performed by the ACL condition:
54793 </para>
54794 <literallayout class="monospaced">
54795 verify = csa
54796 </literallayout>
54797 <para>
54798 This fails if the client is not authorized. If there is a DNS problem, or if no
54799 valid CSA SRV record is found, or if the client is authorized, the condition
54800 succeeds. These three cases can be distinguished using the expansion variable
54801 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
54802 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
54803 be likely to cause problems for legitimate email.
54804 </para>
54805 <para>
54806 The error messages produced by the CSA code include slightly more
54807 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
54808 looking up the CSA SRV record, or problems looking up the CSA target
54809 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
54810 </para>
54811 <itemizedlist>
54812 <listitem>
54813 <para>
54814 The client&#x2019;s host name is explicitly not authorized.
54815 </para>
54816 </listitem>
54817 <listitem>
54818 <para>
54819 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
54820 </para>
54821 </listitem>
54822 <listitem>
54823 <para>
54824 The client&#x2019;s host name is authorized but it has no valid target IP addresses
54825 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
54826 </para>
54827 </listitem>
54828 <listitem>
54829 <para>
54830 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
54831 that all subdomains must be explicitly authorized.
54832 </para>
54833 </listitem>
54834 </itemizedlist>
54835 <para>
54836 The <option>csa</option> verification condition can take an argument which is the domain to
54837 use for the DNS query. The default is:
54838 </para>
54839 <literallayout class="monospaced">
54840 verify = csa/$sender_helo_name
54841 </literallayout>
54842 <para>
54843 This implementation includes an extension to CSA. If the query domain
54844 is an address literal such as [192.0.2.95], or if it is a bare IP
54845 address, Exim searches for CSA SRV records in the reverse DNS as if
54846 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
54847 meaningful to say:
54848 </para>
54849 <literallayout class="monospaced">
54850 verify = csa/$sender_host_address
54851 </literallayout>
54852 <para>
54853 In fact, this is the check that Exim performs if the client does not say HELO.
54854 This extension can be turned off by setting the main configuration option
54855 <option>dns_csa_use_reverse</option> to be false.
54856 </para>
54857 <para>
54858 If a CSA SRV record is not found for the domain itself, a search
54859 is performed through its parent domains for a record which might be
54860 making assertions about subdomains. The maximum depth of this search is limited
54861 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
54862 default. Exim does not look for CSA SRV records in a top level domain, so the
54863 default settings handle HELO domains as long as seven
54864 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
54865 of legitimate HELO domains.
54866 </para>
54867 <para>
54868 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
54869 direct SRV lookups, this is not sufficient because of the extra parent domain
54870 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
54871 addresses into lookups in the reverse DNS space. The result of a successful
54872 lookup such as:
54873 </para>
54874 <literallayout class="monospaced">
54875 ${lookup dnsdb {csa=$sender_helo_name}}
54876 </literallayout>
54877 <para>
54878 has two space-separated fields: an authorization code and a target host name.
54879 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
54880 authorization required but absent, or <quote>?</quote> for unknown.
54881 </para>
54882 </section>
54883 <section id="SECTverifyPRVS">
54884 <title>Bounce address tag validation</title>
54885 <para>
54886 <indexterm role="concept">
54887 <primary>BATV, verifying</primary>
54888 </indexterm>
54889 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
54890 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
54891 Genuine incoming bounce messages should therefore always be addressed to
54892 recipients that have a valid tag. This scheme is a way of detecting unwanted
54893 bounce messages caused by sender address forgeries (often called <quote>collateral
54894 spam</quote>), because the recipients of such messages do not include valid tags.
54895 </para>
54896 <para>
54897 There are two expansion items to help with the implementation of the BATV
54898 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
54899 the original envelope sender address by using a simple key to add a hash of the
54900 address and some time-based randomizing information. The <option>prvs</option> expansion
54901 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
54902 The syntax of these expansion items is described in section
54903 <xref linkend="SECTexpansionitems"/>.
54904 </para>
54905 <para>
54906 As an example, suppose the secret per-address keys are stored in an MySQL
54907 database. A query to look up the key for an address could be defined as a macro
54908 like this:
54909 </para>
54910 <literallayout class="monospaced">
54911 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
54912                 WHERE sender='${quote_mysql:$prvscheck_address}'\
54913                 }{$value}}
54914 </literallayout>
54915 <para>
54916 Suppose also that the senders who make use of BATV are defined by an address
54917 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
54918 use this:
54919 </para>
54920 <literallayout class="monospaced">
54921 # Bounces: drop unsigned addresses for BATV senders
54922 deny message = This address does not send an unsigned reverse path
54923      senders = :
54924      recipients = +batv_senders
54925
54926 # Bounces: In case of prvs-signed address, check signature.
54927 deny message = Invalid reverse path signature.
54928      senders = :
54929      condition  = ${prvscheck {$local_part@$domain}\
54930                   {PRVSCHECK_SQL}{1}}
54931      !condition = $prvscheck_result
54932 </literallayout>
54933 <para>
54934 The first statement rejects recipients for bounce messages that are addressed
54935 to plain BATV sender addresses, because it is known that BATV senders do not
54936 send out messages with plain sender addresses. The second statement rejects
54937 recipients that are prvs-signed, but with invalid signatures (either because
54938 the key is wrong, or the signature has timed out).
54939 </para>
54940 <para>
54941 A non-prvs-signed address is not rejected by the second statement, because the
54942 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
54943 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
54944 the first argument is a syntactically valid prvs-signed address, the yield is
54945 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
54946 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
54947 of the checks (empty for failure, <quote>1</quote> for success).
54948 </para>
54949 <para>
54950 There is one more issue you must consider when implementing prvs-signing:
54951 you have to ensure that the routers accept prvs-signed addresses and
54952 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
54953 router to remove the signature with a configuration along these lines:
54954 </para>
54955 <literallayout class="monospaced">
54956 batv_redirect:
54957   driver = redirect
54958   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
54959 </literallayout>
54960 <para>
54961 This works because, if the third argument of <option>prvscheck</option> is empty, the result
54962 of the expansion of a prvs-signed address is the decoded value of the original
54963 address. This router should probably be the first of your routers that handles
54964 local addresses.
54965 </para>
54966 <para>
54967 To create BATV-signed addresses in the first place, a transport of this form
54968 can be used:
54969 </para>
54970 <literallayout class="monospaced">
54971 external_smtp_batv:
54972   driver = smtp
54973   return_path = ${prvs {$return_path} \
54974                        {${lookup mysql{SELECT \
54975                        secret FROM batv_prvs WHERE \
54976                        sender='${quote_mysql:$sender_address}'} \
54977                        {$value}fail}}}
54978 </literallayout>
54979 <para>
54980 If no key can be found for the existing return path, no signing takes place.
54981 </para>
54982 </section>
54983 <section id="SECTrelaycontrol">
54984 <title>Using an ACL to control relaying</title>
54985 <para>
54986 <indexterm role="concept">
54987 <primary>access control lists (ACLs)</primary>
54988 <secondary>relay control</secondary>
54989 </indexterm>
54990 <indexterm role="concept">
54991 <primary>relaying</primary>
54992 <secondary>control by ACL</secondary>
54993 </indexterm>
54994 <indexterm role="concept">
54995 <primary>policy control</primary>
54996 <secondary>relay control</secondary>
54997 </indexterm>
54998 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
54999 delivers it directly to another host as a result of a remote address contained
55000 within it. Redirecting a local address via an alias or forward file and then
55001 passing the message on to another host is not relaying,
55002 <indexterm role="concept">
55003 <primary><quote>percent hack</quote></primary>
55004 </indexterm>
55005 but a redirection as a result of the <quote>percent hack</quote> is.
55006 </para>
55007 <para>
55008 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
55009 A host which is acting as a gateway or an MX backup is concerned with incoming
55010 relaying from arbitrary hosts to a specific set of domains. On the other hand,
55011 a host which is acting as a smart host for a number of clients is concerned
55012 with outgoing relaying from those clients to the Internet at large. Often the
55013 same host is fulfilling both functions,
55014 but in principle these two kinds of relaying are entirely independent. What is
55015 not wanted is the transmission of mail from arbitrary remote hosts through your
55016 system to arbitrary domains.
55017 </para>
55018 <para>
55019 You can implement relay control by means of suitable statements in the ACL that
55020 runs for each RCPT command. For convenience, it is often easiest to use
55021 Exim&#x2019;s named list facility to define the domains and hosts involved. For
55022 example, suppose you want to do the following:
55023 </para>
55024 <itemizedlist>
55025 <listitem>
55026 <para>
55027 Deliver a number of domains to mailboxes on the local host (or process them
55028 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
55029 <emphasis>my.dom2.example</emphasis>.
55030 </para>
55031 </listitem>
55032 <listitem>
55033 <para>
55034 Relay mail for a number of other domains for which you are the secondary MX.
55035 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
55036 </para>
55037 </listitem>
55038 <listitem>
55039 <para>
55040 Relay mail from the hosts on your local LAN, to whatever domains are involved.
55041 Suppose your LAN is 192.168.45.0/24.
55042 </para>
55043 </listitem>
55044 </itemizedlist>
55045 <para>
55046 In the main part of the configuration, you put the following definitions:
55047 </para>
55048 <literallayout class="monospaced">
55049 domainlist local_domains    = my.dom1.example : my.dom2.example
55050 domainlist relay_to_domains = friend1.example : friend2.example
55051 hostlist   relay_from_hosts = 192.168.45.0/24
55052 </literallayout>
55053 <para>
55054 Now you can use these definitions in the ACL that is run for every RCPT
55055 command:
55056 </para>
55057 <literallayout class="monospaced">
55058 acl_check_rcpt:
55059   accept domains = +local_domains : +relay_to_domains
55060   accept hosts   = +relay_from_hosts
55061 </literallayout>
55062 <para>
55063 The first statement accepts any RCPT command that contains an address in
55064 the local or relay domains. For any other domain, control passes to the second
55065 statement, which accepts the command only if it comes from one of the relay
55066 hosts. In practice, you will probably want to make your ACL more sophisticated
55067 than this, for example, by including sender and recipient verification. The
55068 default configuration includes a more comprehensive example, which is described
55069 in chapter <xref linkend="CHAPdefconfil"/>.
55070 </para>
55071 </section>
55072 <section id="SECTcheralcon">
55073 <title>Checking a relay configuration</title>
55074 <para>
55075 <indexterm role="concept">
55076 <primary>relaying</primary>
55077 <secondary>checking control of</secondary>
55078 </indexterm>
55079 You can check the relay characteristics of your configuration in the same way
55080 that you can test any ACL behaviour for an incoming SMTP connection, by using
55081 the <option>-bh</option> option to run a fake SMTP session with which you interact.
55082 </para>
55083 <para>
55084 For specifically testing for unwanted relaying, the host
55085 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
55086 host from the host on which Exim is running, using the normal telnet port, you
55087 will see a normal telnet connection message and then quite a long delay. Be
55088 patient. The remote host is making an SMTP connection back to your host, and
55089 trying a number of common probes to test for open relay vulnerability. The
55090 results of the tests will eventually appear on your terminal.
55091 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
55092 </para>
55093 </section>
55094 </chapter>
55095
55096 <chapter id="CHAPexiscan">
55097 <title>Content scanning at ACL time</title>
55098 <para>
55099 <indexterm role="concept" id="IIDcosca" class="startofrange">
55100 <primary>content scanning</primary>
55101 <secondary>at ACL time</secondary>
55102 </indexterm>
55103 The extension of Exim to include content scanning at ACL time, formerly known
55104 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
55105 was integrated into the main source for Exim release 4.50, and Tom continues to
55106 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
55107 specification.
55108 </para>
55109 <para>
55110 It is also possible to scan the content of messages at other times. The
55111 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
55112 scanning after all the ACLs have run. A transport filter can be used to scan
55113 messages at delivery time (see the <option>transport_filter</option> option, described in
55114 chapter <xref linkend="CHAPtransportgeneric"/>).
55115 </para>
55116 <para>
55117 If you want to include the ACL-time content-scanning features when you compile
55118 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
55119 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
55120 </para>
55121 <itemizedlist>
55122 <listitem>
55123 <para>
55124 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
55125 for all MIME parts for SMTP and non-SMTP messages, respectively.
55126 </para>
55127 </listitem>
55128 <listitem>
55129 <para>
55130 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
55131 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
55132 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
55133 </para>
55134 </listitem>
55135 <listitem>
55136 <para>
55137 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
55138 of messages, or parts of messages, for debugging purposes.
55139 </para>
55140 </listitem>
55141 <listitem>
55142 <para>
55143 Additional expansion variables that are set in the new ACL and by the new
55144 conditions.
55145 </para>
55146 </listitem>
55147 <listitem>
55148 <para>
55149 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
55150 </para>
55151 </listitem>
55152 </itemizedlist>
55153 <para>
55154 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
55155 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
55156 condition is compiled, in addition to all the other content-scanning features.
55157 </para>
55158 <para>
55159 Content-scanning is continually evolving, and new features are still being
55160 added. While such features are still unstable and liable to incompatible
55161 changes, they are made available in Exim by setting options whose names begin
55162 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
55163 this manual. You can find out about them by reading the file called
55164 <filename>doc/experimental.txt</filename>.
55165 </para>
55166 <para>
55167 All the content-scanning facilities work on a MBOX copy of the message that is
55168 temporarily created in a file called:
55169 </para>
55170 <literallayout>
55171 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
55172 </literallayout>
55173 <para>
55174 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
55175 expect an MBOX-like structure inside that file. The file is created when the
55176 first content scanning facility is called. Subsequent calls to content
55177 scanning conditions open the same file again. The directory is recursively
55178 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
55179 </para>
55180 <literallayout class="monospaced">
55181 control = no_mbox_unspool
55182 </literallayout>
55183 <para>
55184 has been encountered. When the MIME ACL decodes files, they are put into the
55185 same directory by default.
55186 </para>
55187 <section id="SECTscanvirus">
55188 <title>Scanning for viruses</title>
55189 <para>
55190 <indexterm role="concept">
55191 <primary>virus scanning</primary>
55192 </indexterm>
55193 <indexterm role="concept">
55194 <primary>content scanning</primary>
55195 <secondary>for viruses</secondary>
55196 </indexterm>
55197 <indexterm role="concept">
55198 <primary>content scanning</primary>
55199 <secondary>the <option>malware</option> condition</secondary>
55200 </indexterm>
55201 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
55202 It supports a <quote>generic</quote> interface to scanners called via the shell, and
55203 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
55204 in memory and thus are much faster.
55205 </para>
55206 <para>
55207 <indexterm role="option">
55208 <primary><option>av_scanner</option></primary>
55209 </indexterm>
55210 You can set the <option>av_scanner</option> option in first part of the Exim configuration
55211 file to specify which scanner to use, together with any additional options that
55212 are needed. The basic syntax is as follows:
55213 </para>
55214 <literallayout>
55215 <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>
55216 </literallayout>
55217 <para>
55218 If you do not set <option>av_scanner</option>, it defaults to
55219 </para>
55220 <literallayout class="monospaced">
55221 av_scanner = sophie:/var/run/sophie
55222 </literallayout>
55223 <para>
55224 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
55225 before use.
55226 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
55227 The following scanner types are supported in this release:
55228 </para>
55229 <variablelist>
55230 <varlistentry>
55231 <term><option>aveserver</option></term>
55232 <listitem>
55233 <para>
55234 <indexterm role="concept">
55235 <primary>virus scanners</primary>
55236 <secondary>Kaspersky</secondary>
55237 </indexterm>
55238 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
55239 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
55240 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
55241 example:
55242 </para>
55243 <literallayout class="monospaced">
55244 av_scanner = aveserver:/var/run/aveserver
55245 </literallayout>
55246 </listitem></varlistentry>
55247 <varlistentry>
55248 <term><option>clamd</option></term>
55249 <listitem>
55250 <para>
55251 <indexterm role="concept">
55252 <primary>virus scanners</primary>
55253 <secondary>clamd</secondary>
55254 </indexterm>
55255 This daemon-type scanner is GPL and free. You can get it at
55256 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
55257 unpack MIME containers, so it used to be recommended to unpack MIME attachments
55258 in the MIME ACL. This no longer believed to be necessary. One option is
55259 required: either the path and name of a UNIX socket file, or a hostname or IP
55260 number, and a port, separated by space, as in the second of these examples:
55261 </para>
55262 <literallayout class="monospaced">
55263 av_scanner = clamd:/opt/clamd/socket
55264 av_scanner = clamd:192.0.2.3 1234
55265 av_scanner = clamd:192.0.2.3 1234:local
55266 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
55267 </literallayout>
55268 <para>
55269 If the value of av_scanner points to a UNIX socket file or contains the local
55270 keyword, then the ClamAV interface will pass a filename containing the data
55271 to be scanned, which will should normally result in less I/O happening and be
55272 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
55273 Exim does not assume that there is a common filesystem with the remote host.
55274 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
55275 you be running a version of ClamAV prior to 0.95.
55276 </para>
55277 <para revisionflag="changed">
55278 The final example shows that multiple TCP targets can be specified.  Exim will
55279 randomly use one for each incoming email (i.e. it load balances them).  Note
55280 that only TCP targets may be used if specifying a list of scanners; a UNIX
55281 socket cannot be mixed in with TCP targets.  If one of the servers becomes
55282 unavailable, Exim will try the remaining one(s) until it finds one that works.
55283 When a clamd server becomes unreachable, Exim will log a message.  Exim does
55284 not keep track of scanner state between multiple messages, and the scanner
55285 selection is random, so the message will get logged in the mainlog for each
55286 email that the down scanner gets chosen first (message wrapped to be readable):
55287 </para>
55288 <literallayout class="monospaced" revisionflag="changed">
55289 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
55290    clamd: connection to localhost, port 3310 failed
55291    (Connection refused)
55292 </literallayout>
55293 <para>
55294 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
55295 contributing the code for this scanner.
55296 </para>
55297 </listitem></varlistentry>
55298 <varlistentry>
55299 <term><option>cmdline</option></term>
55300 <listitem>
55301 <para>
55302 <indexterm role="concept">
55303 <primary>virus scanners</primary>
55304 <secondary>command line interface</secondary>
55305 </indexterm>
55306 This is the keyword for the generic command line scanner interface. It can be
55307 used to attach virus scanners that are invoked from the shell. This scanner
55308 type takes 3 mandatory options:
55309 </para>
55310 <orderedlist numeration="arabic">
55311 <listitem>
55312 <para>
55313 The full path and name of the scanner binary, with all command line options,
55314 and a placeholder (<literal>%s</literal>) for the directory to scan.
55315 </para>
55316 </listitem>
55317 <listitem>
55318 <para>
55319 A regular expression to match against the STDOUT and STDERR output of the
55320 virus scanner. If the expression matches, a virus was found. You must make
55321 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
55322 the <quote>trigger</quote> expression.
55323 </para>
55324 </listitem>
55325 <listitem>
55326 <para>
55327 Another regular expression, containing exactly one pair of parentheses, to
55328 match the name of the virus found in the scanners output. This is called the
55329 <quote>name</quote> expression.
55330 </para>
55331 </listitem>
55332 </orderedlist>
55333 <para>
55334 For example, Sophos Sweep reports a virus on a line like this:
55335 </para>
55336 <literallayout class="monospaced">
55337 Virus 'W32/Magistr-B' found in file ./those.bat
55338 </literallayout>
55339 <para>
55340 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
55341 name expression, we want to extract the W32/Magistr-B string, so we can match
55342 for the single quotes left and right of it. Altogether, this makes the
55343 configuration setting:
55344 </para>
55345 <literallayout class="monospaced">
55346 av_scanner = cmdline:\
55347              /path/to/sweep -ss -all -rec -archive %s:\
55348              found in file:'(.+)'
55349 </literallayout>
55350 </listitem></varlistentry>
55351 <varlistentry>
55352 <term><option>drweb</option></term>
55353 <listitem>
55354 <para>
55355 <indexterm role="concept">
55356 <primary>virus scanners</primary>
55357 <secondary>DrWeb</secondary>
55358 </indexterm>
55359 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
55360 argument, either a full path to a UNIX socket, or an IP address and port
55361 separated by white space, as in these examples:
55362 </para>
55363 <literallayout class="monospaced">
55364 av_scanner = drweb:/var/run/drwebd.sock
55365 av_scanner = drweb:192.168.2.20 31337
55366 </literallayout>
55367 <para>
55368 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
55369 is used. Thanks to Alex Miller for contributing the code for this scanner.
55370 </para>
55371 </listitem></varlistentry>
55372 <varlistentry>
55373 <term><option>fsecure</option></term>
55374 <listitem>
55375 <para>
55376 <indexterm role="concept">
55377 <primary>virus scanners</primary>
55378 <secondary>F-Secure</secondary>
55379 </indexterm>
55380 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
55381 argument which is the path to a UNIX socket. For example:
55382 </para>
55383 <literallayout class="monospaced">
55384 av_scanner = fsecure:/path/to/.fsav
55385 </literallayout>
55386 <para>
55387 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
55388 Thelmen for contributing the code for this scanner.
55389 </para>
55390 </listitem></varlistentry>
55391 <varlistentry>
55392 <term><option>kavdaemon</option></term>
55393 <listitem>
55394 <para>
55395 <indexterm role="concept">
55396 <primary>virus scanners</primary>
55397 <secondary>Kaspersky</secondary>
55398 </indexterm>
55399 This is the scanner daemon of Kaspersky Version 4. This version of the
55400 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
55401 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
55402 For example:
55403 </para>
55404 <literallayout class="monospaced">
55405 av_scanner = kavdaemon:/opt/AVP/AvpCtl
55406 </literallayout>
55407 <para>
55408 The default path is <filename>/var/run/AvpCtl</filename>.
55409 </para>
55410 </listitem></varlistentry>
55411 <varlistentry>
55412 <term><option>mksd</option></term>
55413 <listitem>
55414 <para>
55415 <indexterm role="concept">
55416 <primary>virus scanners</primary>
55417 <secondary>mksd</secondary>
55418 </indexterm>
55419 This is a daemon type scanner that is aimed mainly at Polish users, though some
55420 parts of documentation are now available in English. You can get it at
55421 <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
55422 the maximum number of processes used simultaneously to scan the attachments,
55423 provided that the demime facility is employed and also provided that mksd has
55424 been run with at least the same number of child processes. For example:
55425 </para>
55426 <literallayout class="monospaced">
55427 av_scanner = mksd:2
55428 </literallayout>
55429 <para>
55430 You can safely omit this option (the default value is 1).
55431 </para>
55432 </listitem></varlistentry>
55433 <varlistentry>
55434 <term><option>sophie</option></term>
55435 <listitem>
55436 <para>
55437 <indexterm role="concept">
55438 <primary>virus scanners</primary>
55439 <secondary>Sophos and Sophie</secondary>
55440 </indexterm>
55441 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
55442 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
55443 for this scanner type is the path to the UNIX socket that Sophie uses for
55444 client communication. For example:
55445 </para>
55446 <literallayout class="monospaced">
55447 av_scanner = sophie:/tmp/sophie
55448 </literallayout>
55449 <para>
55450 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
55451 the option.
55452 </para>
55453 </listitem></varlistentry>
55454 </variablelist>
55455 <para>
55456 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
55457 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
55458 ACL.
55459 </para>
55460 <para>
55461 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
55462 makes it possible to use different scanners. See further below for an example.
55463 The <option>malware</option> condition caches its results, so when you use it multiple times
55464 for the same message, the actual scanning process is only carried out once.
55465 However, using expandable items in <option>av_scanner</option> disables this caching, in
55466 which case each use of the <option>malware</option> condition causes a new scan of the
55467 message.
55468 </para>
55469 <para>
55470 The <option>malware</option> condition takes a right-hand argument that is expanded before
55471 use. It can then be one of
55472 </para>
55473 <itemizedlist>
55474 <listitem>
55475 <para>
55476 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
55477 The condition succeeds if a virus was found, and fail otherwise. This is the
55478 recommended usage.
55479 </para>
55480 </listitem>
55481 <listitem>
55482 <para>
55483 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
55484 the condition fails immediately.
55485 </para>
55486 </listitem>
55487 <listitem>
55488 <para>
55489 A regular expression, in which case the message is scanned for viruses. The
55490 condition succeeds if a virus is found and its name matches the regular
55491 expression. This allows you to take special actions on certain types of virus.
55492 </para>
55493 </listitem>
55494 </itemizedlist>
55495 <para>
55496 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
55497 even if there is a problem with the virus scanner. Otherwise, such a problem
55498 causes the ACL to defer.
55499 </para>
55500 <para>
55501 <indexterm role="variable">
55502 <primary><varname>$malware_name</varname></primary>
55503 </indexterm>
55504 When a virus is found, the condition sets up an expansion variable called
55505 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
55506 <option>message</option> modifier that specifies the error returned to the sender, and/or in
55507 logging data.
55508 </para>
55509 <para>
55510 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
55511 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
55512 <option>malware</option> condition.
55513 </para>
55514 <para>
55515 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
55516 imposed by your anti-virus scanner.
55517 </para>
55518 <para>
55519 Here is a very simple scanning example:
55520 </para>
55521 <literallayout class="monospaced">
55522 deny message = This message contains malware ($malware_name)
55523      demime = *
55524      malware = *
55525 </literallayout>
55526 <para>
55527 The next example accepts messages when there is a problem with the scanner:
55528 </para>
55529 <literallayout class="monospaced">
55530 deny message = This message contains malware ($malware_name)
55531      demime = *
55532      malware = */defer_ok
55533 </literallayout>
55534 <para>
55535 The next example shows how to use an ACL variable to scan with both sophie and
55536 aveserver. It assumes you have set:
55537 </para>
55538 <literallayout class="monospaced">
55539 av_scanner = $acl_m0
55540 </literallayout>
55541 <para>
55542 in the main Exim configuration.
55543 </para>
55544 <literallayout class="monospaced">
55545 deny message = This message contains malware ($malware_name)
55546      set acl_m0 = sophie
55547      malware = *
55548
55549 deny message = This message contains malware ($malware_name)
55550      set acl_m0 = aveserver
55551      malware = *
55552 </literallayout>
55553 </section>
55554 <section id="SECTscanspamass">
55555 <title>Scanning with SpamAssassin</title>
55556 <para>
55557 <indexterm role="concept">
55558 <primary>content scanning</primary>
55559 <secondary>for spam</secondary>
55560 </indexterm>
55561 <indexterm role="concept">
55562 <primary>spam scanning</primary>
55563 </indexterm>
55564 <indexterm role="concept">
55565 <primary>SpamAssassin</primary>
55566 </indexterm>
55567 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
55568 score and a report for the message. You can get SpamAssassin at
55569 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
55570 installation, you can use CPAN by running:
55571 </para>
55572 <literallayout class="monospaced">
55573 perl -MCPAN -e 'install Mail::SpamAssassin'
55574 </literallayout>
55575 <para>
55576 SpamAssassin has its own set of configuration files. Please review its
55577 documentation to see how you can tweak it. The default installation should work
55578 nicely, however.
55579 </para>
55580 <para>
55581 <indexterm role="option">
55582 <primary><option>spamd_address</option></primary>
55583 </indexterm>
55584 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
55585 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
55586 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
55587 part of the Exim configuration as follows (example):
55588 </para>
55589 <literallayout class="monospaced">
55590 spamd_address = 192.168.99.45 387
55591 </literallayout>
55592 <para>
55593 You do not need to set this option if you use the default. As of version 2.60,
55594 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
55595 these, supply <option>spamd_address</option> with an absolute file name instead of a
55596 address/port pair:
55597 </para>
55598 <literallayout class="monospaced">
55599 spamd_address = /var/run/spamd_socket
55600 </literallayout>
55601 <para>
55602 You can have multiple <option>spamd</option> servers to improve scalability. These can
55603 reside on other hardware reachable over the network. To specify multiple
55604 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
55605 option, separated with colons:
55606 </para>
55607 <literallayout class="monospaced">
55608 spamd_address = 192.168.2.10 783 : \
55609                 192.168.2.11 783 : \
55610                 192.168.2.12 783
55611 </literallayout>
55612 <para>
55613 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
55614 fashion. When a server fails to respond to the connection attempt, all other
55615 servers are tried until one succeeds. If no server responds, the <option>spam</option>
55616 condition defers.
55617 </para>
55618 <para>
55619 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
55620 multiple <option>spamd</option> servers.
55621 </para>
55622 <para>
55623 The <option>spamd_address</option> variable is expanded before use if it starts with
55624 a dollar sign. In this case, the expansion may return a string that is
55625 used as the list so that multiple spamd servers can be the result of an
55626 expansion.
55627 </para>
55628 </section>
55629 <section id="SECID206">
55630 <title>Calling SpamAssassin from an Exim ACL</title>
55631 <para>
55632 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
55633 </para>
55634 <literallayout class="monospaced">
55635 deny message = This message was classified as SPAM
55636      spam = joe
55637 </literallayout>
55638 <para>
55639 The right-hand side of the <option>spam</option> condition specifies a name. This is
55640 relevant if you have set up multiple SpamAssassin profiles. If you do not want
55641 to scan using a specific profile, but rather use the SpamAssassin system-wide
55642 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
55643 However, you must put something on the right-hand side.
55644 </para>
55645 <para>
55646 The name allows you to use per-domain or per-user antispam profiles in
55647 principle, but this is not straightforward in practice, because a message may
55648 have multiple recipients, not necessarily all in the same domain. Because the
55649 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
55650 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
55651 are not set.
55652 </para>
55653 <para>
55654 The right-hand side of the <option>spam</option> condition is expanded before being used, so
55655 you can put lookups or conditions there. When the right-hand side evaluates to
55656 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
55657 </para>
55658 <para>
55659 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
55660 large ones may cause significant performance degradation. As most spam messages
55661 are quite small, it is recommended that you do not scan the big ones. For
55662 example:
55663 </para>
55664 <literallayout class="monospaced">
55665 deny message = This message was classified as SPAM
55666      condition = ${if &lt; {$message_size}{10K}}
55667      spam = nobody
55668 </literallayout>
55669 <para>
55670 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
55671 SpamAssassin profile has been matched or exceeded. If you want to use the
55672 <option>spam</option> condition for its side effects (see the variables below), you can make
55673 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
55674 </para>
55675 <para>
55676 <indexterm role="concept">
55677 <primary>spam scanning</primary>
55678 <secondary>returned variables</secondary>
55679 </indexterm>
55680 When the <option>spam</option> condition is run, it sets up a number of expansion
55681 variables. These variables are saved with the received message, thus they are
55682 available for use at delivery time.
55683 </para>
55684 <variablelist>
55685 <varlistentry>
55686 <term><varname>$spam_score</varname></term>
55687 <listitem>
55688 <para>
55689 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
55690 for inclusion in log or reject messages.
55691 </para>
55692 </listitem></varlistentry>
55693 <varlistentry>
55694 <term><varname>$spam_score_int</varname></term>
55695 <listitem>
55696 <para>
55697 The spam score of the message, multiplied by ten, as an integer value. For
55698 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
55699 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
55700 The integer value is useful for numeric comparisons in conditions.
55701 </para>
55702 </listitem></varlistentry>
55703 <varlistentry>
55704 <term><varname>$spam_bar</varname></term>
55705 <listitem>
55706 <para>
55707 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
55708 integer part of the spam score value. A spam score of 4.4 would have a
55709 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
55710 headers, since MUAs can match on such strings.
55711 </para>
55712 </listitem></varlistentry>
55713 <varlistentry>
55714 <term><varname>$spam_report</varname></term>
55715 <listitem>
55716 <para>
55717 A multiline text table, containing the full SpamAssassin report for the
55718 message. Useful for inclusion in headers or reject messages.
55719 </para>
55720 </listitem></varlistentry>
55721 </variablelist>
55722 <para>
55723 The <option>spam</option> condition caches its results unless expansion in
55724 spamd_address was used. If you call it again with the same user name, it
55725 does not scan again, but rather returns the same values as before.
55726 </para>
55727 <para>
55728 The <option>spam</option> condition returns DEFER if there is any error while running
55729 the message through SpamAssassin or if the expansion of spamd_address
55730 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
55731 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
55732 spam condition, like this:
55733 </para>
55734 <literallayout class="monospaced">
55735 deny message = This message was classified as SPAM
55736      spam    = joe/defer_ok
55737 </literallayout>
55738 <para>
55739 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
55740 </para>
55741 <para>
55742 Here is a longer, commented example of the use of the <option>spam</option>
55743 condition:
55744 </para>
55745 <literallayout class="monospaced">
55746 # put headers in all messages (no matter if spam or not)
55747 warn  spam = nobody:true
55748       add_header = X-Spam-Score: $spam_score ($spam_bar)
55749       add_header = X-Spam-Report: $spam_report
55750
55751 # add second subject line with *SPAM* marker when message
55752 # is over threshold
55753 warn  spam = nobody
55754       add_header = Subject: *SPAM* $h_Subject:
55755
55756 # reject spam at high scores (&gt; 12)
55757 deny  message = This message scored $spam_score spam points.
55758       spam = nobody:true
55759       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
55760 </literallayout>
55761 </section>
55762 <section id="SECTscanmimepart">
55763 <title>Scanning MIME parts</title>
55764 <para>
55765 <indexterm role="concept">
55766 <primary>content scanning</primary>
55767 <secondary>MIME parts</secondary>
55768 </indexterm>
55769 <indexterm role="concept">
55770 <primary>MIME content scanning</primary>
55771 </indexterm>
55772 <indexterm role="option">
55773 <primary><option>acl_smtp_mime</option></primary>
55774 </indexterm>
55775 <indexterm role="option">
55776 <primary><option>acl_not_smtp_mime</option></primary>
55777 </indexterm>
55778 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
55779 each MIME part of an SMTP message, including multipart types, in the sequence
55780 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
55781 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
55782 options may both refer to the same ACL if you want the same processing in both
55783 cases.
55784 </para>
55785 <para>
55786 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
55787 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
55788 the case of a non-SMTP message. However, a MIME ACL is called only if the
55789 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
55790 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
55791 result code is sent to the client. In the case of an SMTP message, the
55792 <option>acl_smtp_data</option> ACL is not called when this happens.
55793 </para>
55794 <para>
55795 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
55796 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
55797 condition to match against the raw MIME part. You can also use the
55798 <option>mime_regex</option> condition to match against the decoded MIME part (see section
55799 <xref linkend="SECTscanregex"/>).
55800 </para>
55801 <para>
55802 At the start of a MIME ACL, a number of variables are set from the header
55803 information for the relevant MIME part. These are described below. The contents
55804 of the MIME part are not by default decoded into a disk file except for MIME
55805 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
55806 part into a disk file, you can use the <option>decode</option> condition. The general
55807 syntax is:
55808 </para>
55809 <literallayout>
55810 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
55811 </literallayout>
55812 <para>
55813 The right hand side is expanded before use. After expansion,
55814 the value can be:
55815 </para>
55816 <orderedlist numeration="arabic">
55817 <listitem>
55818 <para>
55819 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
55820 </para>
55821 </listitem>
55822 <listitem>
55823 <para>
55824 The string <quote>default</quote>. In that case, the file is put in the temporary
55825 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
55826 a sequential file name consisting of the message id and a sequence number. The
55827 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
55828 </para>
55829 </listitem>
55830 <listitem>
55831 <para>
55832 A full path name starting with a slash. If the full name is an existing
55833 directory, it is used as a replacement for the default directory. The filename
55834 is then sequentially assigned. If the path does not exist, it is used as
55835 the full path and file name.
55836 </para>
55837 </listitem>
55838 <listitem>
55839 <para>
55840 If the string does not start with a slash, it is used as the
55841 filename, and the default path is then used.
55842 </para>
55843 </listitem>
55844 </orderedlist>
55845 <para>
55846 The <option>decode</option> condition normally succeeds. It is only false for syntax
55847 errors or unusual circumstances such as memory shortages. You can easily decode
55848 a file with its original, proposed filename using
55849 </para>
55850 <literallayout class="monospaced">
55851 decode = $mime_filename
55852 </literallayout>
55853 <para>
55854 However, you should keep in mind that <varname>$mime_filename</varname> might contain
55855 anything. If you place files outside of the default path, they are not
55856 automatically unlinked.
55857 </para>
55858 <para>
55859 For RFC822 attachments (these are messages attached to messages, with a
55860 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
55861 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
55862 variable is set (see below). Attached messages are always decoded to disk
55863 before being checked, and the files are unlinked once the check is done.
55864 </para>
55865 <para>
55866 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
55867 used to match regular expressions against raw and decoded MIME parts,
55868 respectively. They are described in section <xref linkend="SECTscanregex"/>.
55869 </para>
55870 <para>
55871 <indexterm role="concept">
55872 <primary>MIME content scanning</primary>
55873 <secondary>returned variables</secondary>
55874 </indexterm>
55875 The following list describes all expansion variables that are
55876 available in the MIME ACL:
55877 </para>
55878 <variablelist>
55879 <varlistentry>
55880 <term><varname>$mime_boundary</varname></term>
55881 <listitem>
55882 <para>
55883 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
55884 have a boundary string, which is stored in this variable. If the current part
55885 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
55886 contains the empty string.
55887 </para>
55888 </listitem></varlistentry>
55889 <varlistentry>
55890 <term><varname>$mime_charset</varname></term>
55891 <listitem>
55892 <para>
55893 This variable contains the character set identifier, if one was found in the
55894 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
55895 </para>
55896 <literallayout class="monospaced">
55897 us-ascii
55898 gb2312 (Chinese)
55899 iso-8859-1
55900 </literallayout>
55901 <para>
55902 Please note that this value is not normalized, so you should do matches
55903 case-insensitively.
55904 </para>
55905 </listitem></varlistentry>
55906 <varlistentry>
55907 <term><varname>$mime_content_description</varname></term>
55908 <listitem>
55909 <para>
55910 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
55911 header. It can contain a human-readable description of the parts content. Some
55912 implementations repeat the filename for attachments here, but they are usually
55913 only used for display purposes.
55914 </para>
55915 </listitem></varlistentry>
55916 <varlistentry>
55917 <term><varname>$mime_content_disposition</varname></term>
55918 <listitem>
55919 <para>
55920 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
55921 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
55922 </para>
55923 </listitem></varlistentry>
55924 <varlistentry>
55925 <term><varname>$mime_content_id</varname></term>
55926 <listitem>
55927 <para>
55928 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
55929 This is a unique ID that can be used to reference a part from another part.
55930 </para>
55931 </listitem></varlistentry>
55932 <varlistentry>
55933 <term><varname>$mime_content_size</varname></term>
55934 <listitem>
55935 <para>
55936 This variable is set only after the <option>decode</option> modifier (see above) has been
55937 successfully run. It contains the size of the decoded part in kilobytes. The
55938 size is always rounded up to full kilobytes, so only a completely empty part
55939 has a <varname>$mime_content_size</varname> of zero.
55940 </para>
55941 </listitem></varlistentry>
55942 <varlistentry>
55943 <term><varname>$mime_content_transfer_encoding</varname></term>
55944 <listitem>
55945 <para>
55946 This variable contains the normalized content of the
55947 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
55948 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
55949 </para>
55950 </listitem></varlistentry>
55951 <varlistentry>
55952 <term><varname>$mime_content_type</varname></term>
55953 <listitem>
55954 <para>
55955 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
55956 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
55957 are some examples of popular MIME types, as they may appear in this variable:
55958 </para>
55959 <literallayout class="monospaced">
55960 text/plain
55961 text/html
55962 application/octet-stream
55963 image/jpeg
55964 audio/midi
55965 </literallayout>
55966 <para>
55967 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
55968 empty string.
55969 </para>
55970 </listitem></varlistentry>
55971 <varlistentry>
55972 <term><varname>$mime_decoded_filename</varname></term>
55973 <listitem>
55974 <para>
55975 This variable is set only after the <option>decode</option> modifier (see above) has been
55976 successfully run. It contains the full path and file name of the file
55977 containing the decoded data.
55978 </para>
55979 </listitem></varlistentry>
55980 </variablelist>
55981 <para>
55982 <indexterm role="concept">
55983 <primary>RFC 2047</primary>
55984 </indexterm>
55985 </para>
55986 <variablelist>
55987 <varlistentry>
55988 <term><varname>$mime_filename</varname></term>
55989 <listitem>
55990 <para>
55991 This is perhaps the most important of the MIME variables. It contains a
55992 proposed filename for an attachment, if one was found in either the
55993 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
55994 RFC2047 decoded, but no additional sanity checks are done. If no filename was
55995 found, this variable contains the empty string.
55996 </para>
55997 </listitem></varlistentry>
55998 <varlistentry>
55999 <term><varname>$mime_is_coverletter</varname></term>
56000 <listitem>
56001 <para>
56002 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
56003 attached data. It can be used to clamp down on flashy or unnecessarily encoded
56004 content in the cover letter, while not restricting attachments at all.
56005 </para>
56006 <para>
56007 The variable contains 1 (true) for a MIME part believed to be part of the
56008 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
56009 follows:
56010 </para>
56011 <orderedlist numeration="arabic">
56012 <listitem>
56013 <para>
56014 The outermost MIME part of a message is always a cover letter.
56015 </para>
56016 </listitem>
56017 <listitem>
56018 <para>
56019 If a multipart/alternative or multipart/related MIME part is a cover letter,
56020 so are all MIME subparts within that multipart.
56021 </para>
56022 </listitem>
56023 <listitem>
56024 <para>
56025 If any other multipart is a cover letter, the first subpart is a cover letter,
56026 and the rest are attachments.
56027 </para>
56028 </listitem>
56029 <listitem>
56030 <para>
56031 All parts contained within an attachment multipart are attachments.
56032 </para>
56033 </listitem>
56034 </orderedlist>
56035 <para>
56036 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
56037 alternative plain text), while allowing HTML files to be attached. HTML
56038 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
56039 </para>
56040 <literallayout class="monospaced">
56041 deny message = HTML mail is not accepted here
56042 !condition = $mime_is_rfc822
56043 condition = $mime_is_coverletter
56044 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
56045 </literallayout>
56046 </listitem></varlistentry>
56047 <varlistentry>
56048 <term><varname>$mime_is_multipart</varname></term>
56049 <listitem>
56050 <para>
56051 This variable has the value 1 (true) when the current part has the main type
56052 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
56053 Since multipart entities only serve as containers for other parts, you may not
56054 want to carry out specific actions on them.
56055 </para>
56056 </listitem></varlistentry>
56057 <varlistentry>
56058 <term><varname>$mime_is_rfc822</varname></term>
56059 <listitem>
56060 <para>
56061 This variable has the value 1 (true) if the current part is not a part of the
56062 checked message itself, but part of an attached message. Attached message
56063 decoding is fully recursive.
56064 </para>
56065 </listitem></varlistentry>
56066 <varlistentry>
56067 <term><varname>$mime_part_count</varname></term>
56068 <listitem>
56069 <para>
56070 This variable is a counter that is raised for each processed MIME part. It
56071 starts at zero for the very first part (which is usually a multipart). The
56072 counter is per-message, so it is reset when processing RFC822 attachments (see
56073 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
56074 complete, so you can use it in the DATA ACL to determine the number of MIME
56075 parts of a message. For non-MIME messages, this variable contains the value -1.
56076 </para>
56077 </listitem></varlistentry>
56078 </variablelist>
56079 </section>
56080 <section id="SECTscanregex">
56081 <title>Scanning with regular expressions</title>
56082 <para>
56083 <indexterm role="concept">
56084 <primary>content scanning</primary>
56085 <secondary>with regular expressions</secondary>
56086 </indexterm>
56087 <indexterm role="concept">
56088 <primary>regular expressions</primary>
56089 <secondary>content scanning with</secondary>
56090 </indexterm>
56091 You can specify your own custom regular expression matches on the full body of
56092 the message, or on individual MIME parts.
56093 </para>
56094 <para>
56095 The <option>regex</option> condition takes one or more regular expressions as arguments and
56096 matches them against the full message (when called in the DATA ACL) or a raw
56097 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
56098 linewise, with a maximum line length of 32K characters. That means you cannot
56099 have multiline matches with the <option>regex</option> condition.
56100 </para>
56101 <para>
56102 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
56103 to 32K of decoded content (the whole content at once, not linewise). If the
56104 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
56105 is decoded automatically when <option>mime_regex</option> is executed (using default path
56106 and filename values). If the decoded data is larger than  32K, only the first
56107 32K characters are checked.
56108 </para>
56109 <para>
56110 The regular expressions are passed as a colon-separated list. To include a
56111 literal colon, you must double it. Since the whole right-hand side string is
56112 expanded before being used, you must also escape dollar signs and backslashes
56113 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
56114 Here is a simple example that contains two regular expressions:
56115 </para>
56116 <literallayout class="monospaced">
56117 deny message = contains blacklisted regex ($regex_match_string)
56118      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
56119 </literallayout>
56120 <para>
56121 The conditions returns true if any one of the regular expressions matches. The
56122 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
56123 matching regular expression.
56124 </para>
56125 <para>
56126 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
56127 CPU-intensive.
56128 </para>
56129 </section>
56130 <section id="SECTdemimecond">
56131 <title>The demime condition</title>
56132 <para>
56133 <indexterm role="concept">
56134 <primary>content scanning</primary>
56135 <secondary>MIME checking</secondary>
56136 </indexterm>
56137 <indexterm role="concept">
56138 <primary>MIME content scanning</primary>
56139 </indexterm>
56140 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
56141 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
56142 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
56143 ACL functionality, but provides no additional facilities. Please note that this
56144 condition is deprecated and kept only for backward compatibility. You must set
56145 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
56146 use the <option>demime</option> condition.
56147 </para>
56148 <para>
56149 The <option>demime</option> condition unpacks MIME containers in the message. It detects
56150 errors in MIME containers and can match file extensions found in the message
56151 against a list. Using this facility produces files containing the unpacked MIME
56152 parts of the message in the temporary scan directory. If you do antivirus
56153 scanning, it is recommended that you use the <option>demime</option> condition before the
56154 antivirus (<option>malware</option>) condition.
56155 </para>
56156 <para>
56157 On the right-hand side of the <option>demime</option> condition you can pass a
56158 colon-separated list of file extensions that it should match against. For
56159 example:
56160 </para>
56161 <literallayout class="monospaced">
56162 deny message = Found blacklisted file attachment
56163      demime  = vbs:com:bat:pif:prf:lnk
56164 </literallayout>
56165 <para>
56166 If one of the file extensions is found, the condition is true, otherwise it is
56167 false. If there is a temporary error while demimeing (for example, <quote>disk
56168 full</quote>), the condition defers, and the message is temporarily rejected (unless
56169 the condition is on a <option>warn</option> verb).
56170 </para>
56171 <para>
56172 The right-hand side is expanded before being treated as a list, so you can have
56173 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
56174 zero (<quote>0</quote>), no demimeing is done and the condition is false.
56175 </para>
56176 <para>
56177 The <option>demime</option> condition set the following variables:
56178 </para>
56179 <variablelist>
56180 <varlistentry>
56181 <term><varname>$demime_errorlevel</varname></term>
56182 <listitem>
56183 <para>
56184 <indexterm role="variable">
56185 <primary><varname>$demime_errorlevel</varname></primary>
56186 </indexterm>
56187 When an error is detected in a MIME container, this variable contains the
56188 severity of the error, as an integer number. The higher the value, the more
56189 severe the error (the current maximum value is 3). If this variable is unset or
56190 zero, no error occurred.
56191 </para>
56192 </listitem></varlistentry>
56193 <varlistentry>
56194 <term><varname>$demime_reason</varname></term>
56195 <listitem>
56196 <para>
56197 <indexterm role="variable">
56198 <primary><varname>$demime_reason</varname></primary>
56199 </indexterm>
56200 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
56201 human-readable text string describing the MIME error that occurred.
56202 </para>
56203 </listitem></varlistentry>
56204 </variablelist>
56205 <variablelist>
56206 <varlistentry>
56207 <term><varname>$found_extension</varname></term>
56208 <listitem>
56209 <para>
56210 <indexterm role="variable">
56211 <primary><varname>$found_extension</varname></primary>
56212 </indexterm>
56213 When the <option>demime</option> condition is true, this variable contains the file
56214 extension it found.
56215 </para>
56216 </listitem></varlistentry>
56217 </variablelist>
56218 <para>
56219 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
56220 the <option>demime</option> condition, and are not changed on subsequent calls.
56221 </para>
56222 <para>
56223 If you do not want to check for file extensions, but rather use the <option>demime</option>
56224 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
56225 right-hand side value. Here is a more elaborate example of how to use this
56226 facility:
56227 </para>
56228 <literallayout class="monospaced">
56229 # Reject messages with serious MIME container errors
56230 deny  message = Found MIME error ($demime_reason).
56231       demime = *
56232       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
56233
56234 # Reject known virus spreading file extensions.
56235 # Accepting these is pretty much braindead.
56236 deny  message = contains $found_extension file (blacklisted).
56237       demime  = com:vbs:bat:pif:scr
56238
56239 # Freeze .exe and .doc files. Postmaster can
56240 # examine them and eventually thaw them.
56241 deny  log_message = Another $found_extension file.
56242       demime = exe:doc
56243       control = freeze
56244 </literallayout>
56245 <para>
56246 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
56247 </para>
56248 </section>
56249 </chapter>
56250
56251 <chapter id="CHAPlocalscan">
56252 <title>Adding a local scan function to Exim</title>
56253 <titleabbrev>Local scan function</titleabbrev>
56254 <para>
56255 <indexterm role="concept" id="IIDlosca" class="startofrange">
56256 <primary><function>local_scan()</function> function</primary>
56257 <secondary>description of</secondary>
56258 </indexterm>
56259 <indexterm role="concept">
56260 <primary>customizing</primary>
56261 <secondary>input scan using C function</secondary>
56262 </indexterm>
56263 <indexterm role="concept">
56264 <primary>policy control</primary>
56265 <secondary>by local scan function</secondary>
56266 </indexterm>
56267 In these days of email worms, viruses, and ever-increasing spam, some sites
56268 want to apply a lot of checking to messages before accepting them.
56269 </para>
56270 <para>
56271 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
56272 passing messages to external virus and spam scanning software. You can also do
56273 a certain amount in Exim itself through string expansions and the <option>condition</option>
56274 condition in the ACL that runs after the SMTP DATA command or the ACL for
56275 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
56276 </para>
56277 <para>
56278 To allow for further customization to a site&#x2019;s own requirements, there is the
56279 possibility of linking Exim with a private message scanning function, written
56280 in C. If you want to run code that is written in something other than C, you
56281 can of course use a little C stub to call it.
56282 </para>
56283 <para>
56284 The local scan function is run once for every incoming message, at the point
56285 when Exim is just about to accept the message.
56286 It can therefore be used to control non-SMTP messages from local processes as
56287 well as messages arriving via SMTP.
56288 </para>
56289 <para>
56290 Exim applies a timeout to calls of the local scan function, and there is an
56291 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
56292 Zero means <quote>no timeout</quote>.
56293 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
56294 before calling the local scan function, so that the most common types of crash
56295 are caught. If the timeout is exceeded or one of those signals is caught, the
56296 incoming message is rejected with a temporary error if it is an SMTP message.
56297 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
56298 code. The incident is logged on the main and reject logs.
56299 </para>
56300 <section id="SECID207">
56301 <title>Building Exim to use a local scan function</title>
56302 <para>
56303 <indexterm role="concept">
56304 <primary><function>local_scan()</function> function</primary>
56305 <secondary>building Exim to use</secondary>
56306 </indexterm>
56307 To make use of the local scan function feature, you must tell Exim where your
56308 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
56309 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
56310 directory, so you might set
56311 </para>
56312 <literallayout class="monospaced">
56313 LOCAL_SCAN_SOURCE=Local/local_scan.c
56314 </literallayout>
56315 <para>
56316 for example. The function must be called <function>local_scan()</function>. It is called by
56317 Exim after it has received a message, when the success return code is about to
56318 be sent. This is after all the ACLs have been run. The return code from your
56319 function controls whether the message is actually accepted or not. There is a
56320 commented template function (that just accepts the message) in the file
56321 _src/local_scan.c_.
56322 </para>
56323 <para>
56324 If you want to make use of Exim&#x2019;s run time configuration file to set options
56325 for your <function>local_scan()</function> function, you must also set
56326 </para>
56327 <literallayout class="monospaced">
56328 LOCAL_SCAN_HAS_OPTIONS=yes
56329 </literallayout>
56330 <para>
56331 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
56332 </para>
56333 </section>
56334 <section id="SECTapiforloc">
56335 <title>API for local_scan()</title>
56336 <para>
56337 <indexterm role="concept">
56338 <primary><function>local_scan()</function> function</primary>
56339 <secondary>API description</secondary>
56340 </indexterm>
56341 You must include this line near the start of your code:
56342 </para>
56343 <literallayout class="monospaced">
56344 #include "local_scan.h"
56345 </literallayout>
56346 <para>
56347 This header file defines a number of variables and other values, and the
56348 prototype for the function itself. Exim is coded to use unsigned char values
56349 almost exclusively, and one of the things this header defines is a shorthand
56350 for <literal>unsigned char</literal> called <literal>uschar</literal>.
56351 It also contains the following macro definitions, to simplify casting character
56352 strings and pointers to character strings:
56353 </para>
56354 <literallayout class="monospaced">
56355 #define CS   (char *)
56356 #define CCS  (const char *)
56357 #define CSS  (char **)
56358 #define US   (unsigned char *)
56359 #define CUS  (const unsigned char *)
56360 #define USS  (unsigned char **)
56361 </literallayout>
56362 <para>
56363 The function prototype for <function>local_scan()</function> is:
56364 </para>
56365 <literallayout class="monospaced">
56366 extern int local_scan(int fd, uschar **return_text);
56367 </literallayout>
56368 <para>
56369 The arguments are as follows:
56370 </para>
56371 <itemizedlist>
56372 <listitem>
56373 <para>
56374 <option>fd</option> is a file descriptor for the file that contains the body of the message
56375 (the -D file). The file is open for reading and writing, but updating it is not
56376 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
56377 </para>
56378 <para>
56379 The descriptor is positioned at character 19 of the file, which is the first
56380 character of the body itself, because the first 19 characters are the message
56381 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
56382 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
56383 case this changes in some future version.
56384 </para>
56385 </listitem>
56386 <listitem>
56387 <para>
56388 <option>return_text</option> is an address which you can use to return a pointer to a text
56389 string at the end of the function. The value it points to on entry is NULL.
56390 </para>
56391 </listitem>
56392 </itemizedlist>
56393 <para>
56394 The function must return an <option>int</option> value which is one of the following macros:
56395 </para>
56396 <variablelist>
56397 <varlistentry>
56398 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
56399 <listitem>
56400 <para>
56401 <indexterm role="variable">
56402 <primary><varname>$local_scan_data</varname></primary>
56403 </indexterm>
56404 The message is accepted. If you pass back a string of text, it is saved with
56405 the message, and made available in the variable <varname>$local_scan_data</varname>. No
56406 newlines are permitted (if there are any, they are turned into spaces) and the
56407 maximum length of text is 1000 characters.
56408 </para>
56409 </listitem></varlistentry>
56410 <varlistentry>
56411 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
56412 <listitem>
56413 <para>
56414 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
56415 queued without immediate delivery, and is frozen.
56416 </para>
56417 </listitem></varlistentry>
56418 <varlistentry>
56419 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
56420 <listitem>
56421 <para>
56422 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
56423 queued without immediate delivery.
56424 </para>
56425 </listitem></varlistentry>
56426 <varlistentry>
56427 <term><literal>LOCAL_SCAN_REJECT</literal></term>
56428 <listitem>
56429 <para>
56430 The message is rejected; the returned text is used as an error message which is
56431 passed back to the sender and which is also logged. Newlines are permitted &ndash;
56432 they cause a multiline response for SMTP rejections, but are converted to
56433 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
56434 used.
56435 </para>
56436 </listitem></varlistentry>
56437 <varlistentry>
56438 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
56439 <listitem>
56440 <para>
56441 The message is temporarily rejected; the returned text is used as an error
56442 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
56443 problem</quote> is used.
56444 </para>
56445 </listitem></varlistentry>
56446 <varlistentry>
56447 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
56448 <listitem>
56449 <para>
56450 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
56451 message is not written to the reject log. It has the effect of unsetting the
56452 <option>rejected_header</option> log selector for just this rejection. If
56453 <option>rejected_header</option> is already unset (see the discussion of the
56454 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
56455 same as LOCAL_SCAN_REJECT.
56456 </para>
56457 </listitem></varlistentry>
56458 <varlistentry>
56459 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
56460 <listitem>
56461 <para>
56462 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
56463 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
56464 </para>
56465 </listitem></varlistentry>
56466 </variablelist>
56467 <para>
56468 If the message is not being received by interactive SMTP, rejections are
56469 reported by writing to <option>stderr</option> or by sending an email, as configured by the
56470 <option>-oe</option> command line options.
56471 </para>
56472 </section>
56473 <section id="SECTconoptloc">
56474 <title>Configuration options for local_scan()</title>
56475 <para>
56476 <indexterm role="concept">
56477 <primary><function>local_scan()</function> function</primary>
56478 <secondary>configuration options</secondary>
56479 </indexterm>
56480 It is possible to have option settings in the main configuration file
56481 that set values in static variables in the <function>local_scan()</function> module. If you
56482 want to do this, you must have the line
56483 </para>
56484 <literallayout class="monospaced">
56485 LOCAL_SCAN_HAS_OPTIONS=yes
56486 </literallayout>
56487 <para>
56488 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
56489 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
56490 file, you must define static variables to hold the option values, and a table
56491 to define them.
56492 </para>
56493 <para>
56494 The table must be a vector called <option>local_scan_options</option>, of type
56495 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
56496 and a pointer to the variable that holds the value. The entries must appear in
56497 alphabetical order. Following <option>local_scan_options</option> you must also define a
56498 variable called <option>local_scan_options_count</option> that contains the number of
56499 entries in the table. Here is a short example, showing two kinds of option:
56500 </para>
56501 <literallayout class="monospaced">
56502 static int my_integer_option = 42;
56503 static uschar *my_string_option = US"a default string";
56504
56505 optionlist local_scan_options[] = {
56506   { "my_integer", opt_int,       &amp;my_integer_option },
56507   { "my_string",  opt_stringptr, &amp;my_string_option }
56508 };
56509
56510 int local_scan_options_count =
56511   sizeof(local_scan_options)/sizeof(optionlist);
56512 </literallayout>
56513 <para>
56514 The values of the variables can now be changed from Exim&#x2019;s runtime
56515 configuration file by including a local scan section as in this example:
56516 </para>
56517 <literallayout class="monospaced">
56518 begin local_scan
56519 my_integer = 99
56520 my_string = some string of text...
56521 </literallayout>
56522 <para>
56523 The available types of option data are as follows:
56524 </para>
56525 <variablelist>
56526 <varlistentry>
56527 <term><emphasis role="bold">opt_bool</emphasis></term>
56528 <listitem>
56529 <para>
56530 This specifies a boolean (true/false) option. The address should point to a
56531 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
56532 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
56533 whether such a variable has been set at all, you can initialize it to
56534 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
56535 values.)
56536 </para>
56537 </listitem></varlistentry>
56538 <varlistentry>
56539 <term><emphasis role="bold">opt_fixed</emphasis></term>
56540 <listitem>
56541 <para>
56542 This specifies a fixed point number, such as is used for load averages.
56543 The address should point to a variable of type <literal>int</literal>. The value is stored
56544 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
56545 </para>
56546 </listitem></varlistentry>
56547 <varlistentry>
56548 <term><emphasis role="bold">opt_int</emphasis></term>
56549 <listitem>
56550 <para>
56551 This specifies an integer; the address should point to a variable of type
56552 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
56553 Exim.
56554 </para>
56555 </listitem></varlistentry>
56556 <varlistentry>
56557 <term><emphasis role="bold">opt_mkint</emphasis></term>
56558 <listitem>
56559 <para>
56560 This is the same as <option>opt_int</option>, except that when such a value is output in a
56561 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
56562 printed with the suffix K or M.
56563 </para>
56564 </listitem></varlistentry>
56565 <varlistentry>
56566 <term><emphasis role="bold">opt_octint</emphasis></term>
56567 <listitem>
56568 <para>
56569 This also specifies an integer, but the value is always interpreted as an
56570 octal integer, whether or not it starts with the digit zero, and it is
56571 always output in octal.
56572 </para>
56573 </listitem></varlistentry>
56574 <varlistentry>
56575 <term><emphasis role="bold">opt_stringptr</emphasis></term>
56576 <listitem>
56577 <para>
56578 This specifies a string value; the address must be a pointer to a
56579 variable that points to a string (for example, of type <literal>uschar *</literal>).
56580 </para>
56581 </listitem></varlistentry>
56582 <varlistentry>
56583 <term><emphasis role="bold">opt_time</emphasis></term>
56584 <listitem>
56585 <para>
56586 This specifies a time interval value. The address must point to a variable of
56587 type <literal>int</literal>. The value that is placed there is a number of seconds.
56588 </para>
56589 </listitem></varlistentry>
56590 </variablelist>
56591 <para>
56592 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
56593 out the values of all the <function>local_scan()</function> options.
56594 </para>
56595 </section>
56596 <section id="SECID208">
56597 <title>Available Exim variables</title>
56598 <para>
56599 <indexterm role="concept">
56600 <primary><function>local_scan()</function> function</primary>
56601 <secondary>available Exim variables</secondary>
56602 </indexterm>
56603 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
56604 are the only ones that are guaranteed to be maintained from release to release.
56605 Note, however, that you can obtain the value of any Exim expansion variable,
56606 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
56607 C variables are as follows:
56608 </para>
56609 <variablelist>
56610 <varlistentry>
56611 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
56612 <listitem>
56613 <para>
56614 This variable contains the number of lines in the message&#x2019;s body.
56615 </para>
56616 </listitem></varlistentry>
56617 <varlistentry>
56618 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
56619 <listitem>
56620 <para>
56621 This variable contains the number of binary zero bytes in the message&#x2019;s body.
56622 </para>
56623 </listitem></varlistentry>
56624 <varlistentry>
56625 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
56626 <listitem>
56627 <para>
56628 This variable is set to zero when no debugging is taking place. Otherwise, it
56629 is a bitmap of debugging selectors. Two bits are identified for use in
56630 <function>local_scan()</function>; they are defined as macros:
56631 </para>
56632 <itemizedlist>
56633 <listitem>
56634 <para>
56635 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
56636 testing option that is not privileged &ndash; any caller may set it. All the
56637 other selector bits can be set only by admin users.
56638 </para>
56639 </listitem>
56640 <listitem>
56641 <para>
56642 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
56643 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
56644 of debugging bits.
56645 </para>
56646 </listitem>
56647 </itemizedlist>
56648 <para>
56649 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
56650 selected, you should use code like this:
56651 </para>
56652 <literallayout class="monospaced">
56653 if ((debug_selector &amp; D_local_scan) != 0)
56654   debug_printf("xxx", ...);
56655 </literallayout>
56656 </listitem></varlistentry>
56657 <varlistentry>
56658 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
56659 <listitem>
56660 <para>
56661 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
56662 variable <option>expand_string_message</option> contains the error message, zero-terminated.
56663 </para>
56664 </listitem></varlistentry>
56665 <varlistentry>
56666 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
56667 <listitem>
56668 <para>
56669 A pointer to a chain of header lines. The <option>header_line</option> structure is
56670 discussed below.
56671 </para>
56672 </listitem></varlistentry>
56673 <varlistentry>
56674 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
56675 <listitem>
56676 <para>
56677 A pointer to the last of the header lines.
56678 </para>
56679 </listitem></varlistentry>
56680 <varlistentry>
56681 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
56682 <listitem>
56683 <para>
56684 The value of the <option>headers_charset</option> configuration option.
56685 </para>
56686 </listitem></varlistentry>
56687 <varlistentry>
56688 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
56689 <listitem>
56690 <para>
56691 This variable is TRUE during a host checking session that is initiated by the
56692 <option>-bh</option> command line option.
56693 </para>
56694 </listitem></varlistentry>
56695 <varlistentry>
56696 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
56697 <listitem>
56698 <para>
56699 The IP address of the interface that received the message, as a string. This
56700 is NULL for locally submitted messages.
56701 </para>
56702 </listitem></varlistentry>
56703 <varlistentry>
56704 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
56705 <listitem>
56706 <para>
56707 The port on which this message was received. When testing with the <option>-bh</option>
56708 command line option, the value of this variable is -1 unless a port has been
56709 specified via the <option>-oMi</option> option.
56710 </para>
56711 </listitem></varlistentry>
56712 <varlistentry>
56713 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
56714 <listitem>
56715 <para>
56716 This variable contains Exim&#x2019;s message id for the incoming message (the value of
56717 <varname>$message_exim_id</varname>) as a zero-terminated string.
56718 </para>
56719 </listitem></varlistentry>
56720 <varlistentry>
56721 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
56722 <listitem>
56723 <para>
56724 The name of the protocol by which the message was received.
56725 </para>
56726 </listitem></varlistentry>
56727 <varlistentry>
56728 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
56729 <listitem>
56730 <para>
56731 The number of accepted recipients.
56732 </para>
56733 </listitem></varlistentry>
56734 <varlistentry>
56735 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
56736 <listitem>
56737 <para>
56738 <indexterm role="concept">
56739 <primary>recipient</primary>
56740 <secondary>adding in local scan</secondary>
56741 </indexterm>
56742 <indexterm role="concept">
56743 <primary>recipient</primary>
56744 <secondary>removing in local scan</secondary>
56745 </indexterm>
56746 The list of accepted recipients, held in a vector of length
56747 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
56748 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
56749 below). You can delete recipients by removing them from the vector and
56750 adjusting the value in <option>recipients_count</option>. In particular, by setting
56751 <option>recipients_count</option> to zero you remove all recipients. If you then return the
56752 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
56753 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
56754 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
56755 </para>
56756 </listitem></varlistentry>
56757 <varlistentry>
56758 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
56759 <listitem>
56760 <para>
56761 The envelope sender address. For bounce messages this is the empty string.
56762 </para>
56763 </listitem></varlistentry>
56764 <varlistentry>
56765 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
56766 <listitem>
56767 <para>
56768 The IP address of the sending host, as a string. This is NULL for
56769 locally-submitted messages.
56770 </para>
56771 </listitem></varlistentry>
56772 <varlistentry>
56773 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
56774 <listitem>
56775 <para>
56776 The name of the authentication mechanism that was used, or NULL if the message
56777 was not received over an authenticated SMTP connection.
56778 </para>
56779 </listitem></varlistentry>
56780 <varlistentry>
56781 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
56782 <listitem>
56783 <para>
56784 The name of the sending host, if known.
56785 </para>
56786 </listitem></varlistentry>
56787 <varlistentry>
56788 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
56789 <listitem>
56790 <para>
56791 The port on the sending host.
56792 </para>
56793 </listitem></varlistentry>
56794 <varlistentry>
56795 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
56796 <listitem>
56797 <para>
56798 This variable is TRUE for all SMTP input, including BSMTP.
56799 </para>
56800 </listitem></varlistentry>
56801 <varlistentry>
56802 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
56803 <listitem>
56804 <para>
56805 This variable is TRUE for BSMTP input.
56806 </para>
56807 </listitem></varlistentry>
56808 <varlistentry>
56809 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
56810 <listitem>
56811 <para>
56812 The contents of this variable control which pool of memory is used for new
56813 requests. See section <xref linkend="SECTmemhanloc"/> for details.
56814 </para>
56815 </listitem></varlistentry>
56816 </variablelist>
56817 </section>
56818 <section id="SECID209">
56819 <title>Structure of header lines</title>
56820 <para>
56821 The <option>header_line</option> structure contains the members listed below.
56822 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
56823 (see below). You can cause header lines to be ignored (deleted) by setting
56824 their type to *.
56825 </para>
56826 <variablelist>
56827 <varlistentry>
56828 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
56829 <listitem>
56830 <para>
56831 A pointer to the next header line, or NULL for the last line.
56832 </para>
56833 </listitem></varlistentry>
56834 <varlistentry>
56835 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
56836 <listitem>
56837 <para>
56838 A code identifying certain headers that Exim recognizes. The codes are printing
56839 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
56840 Notice in particular that any header line whose type is * is not transmitted
56841 with the message. This flagging is used for header lines that have been
56842 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
56843 lines.) Effectively, * means <quote>deleted</quote>.
56844 </para>
56845 </listitem></varlistentry>
56846 <varlistentry>
56847 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
56848 <listitem>
56849 <para>
56850 The number of characters in the header line, including the terminating and any
56851 internal newlines.
56852 </para>
56853 </listitem></varlistentry>
56854 <varlistentry>
56855 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
56856 <listitem>
56857 <para>
56858 A pointer to the text of the header. It always ends with a newline, followed by
56859 a zero byte. Internal newlines are preserved.
56860 </para>
56861 </listitem></varlistentry>
56862 </variablelist>
56863 </section>
56864 <section id="SECID210">
56865 <title>Structure of recipient items</title>
56866 <para>
56867 The <option>recipient_item</option> structure contains these members:
56868 </para>
56869 <variablelist>
56870 <varlistentry>
56871 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
56872 <listitem>
56873 <para>
56874 This is a pointer to the recipient address as it was received.
56875 </para>
56876 </listitem></varlistentry>
56877 <varlistentry>
56878 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
56879 <listitem>
56880 <para>
56881 This is used in later Exim processing when top level addresses are created by
56882 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
56883 and must always contain -1 at this stage.
56884 </para>
56885 </listitem></varlistentry>
56886 <varlistentry>
56887 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
56888 <listitem>
56889 <para>
56890 If this value is not NULL, bounce messages caused by failing to deliver to the
56891 recipient are sent to the address it contains. In other words, it overrides the
56892 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
56893 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
56894 an unqualified address, Exim qualifies it using the domain from
56895 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
56896 is NULL for all recipients.
56897 </para>
56898 </listitem></varlistentry>
56899 </variablelist>
56900 </section>
56901 <section id="SECID211">
56902 <title>Available Exim functions</title>
56903 <para>
56904 <indexterm role="concept">
56905 <primary><function>local_scan()</function> function</primary>
56906 <secondary>available Exim functions</secondary>
56907 </indexterm>
56908 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
56909 These are the only ones that are guaranteed to be maintained from release to
56910 release:
56911 </para>
56912 <variablelist>
56913 <varlistentry>
56914 <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>
56915 <listitem>
56916 <para>
56917 This function creates a child process that runs the command specified by
56918 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
56919 be NULL if no environment variables are to be passed. A new umask is supplied
56920 for the process in <option>newumask</option>.
56921 </para>
56922 <para>
56923 Pipes to the standard input and output of the new process are set up
56924 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
56925 standard error is cloned to the standard output. If there are any file
56926 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
56927 argument is TRUE, the new process is made into a process group leader.
56928 </para>
56929 <para>
56930 The function returns the pid of the new process, or -1 if things go wrong.
56931 </para>
56932 </listitem></varlistentry>
56933 <varlistentry>
56934 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
56935 <listitem>
56936 <para>
56937 This function waits for a child process to terminate, or for a timeout (in
56938 seconds) to expire. A timeout value of zero means wait as long as it takes. The
56939 return value is as follows:
56940 </para>
56941 <itemizedlist>
56942 <listitem>
56943 <para>
56944 &gt;= 0
56945 </para>
56946 <para>
56947 The process terminated by a normal exit and the value is the process
56948 ending status.
56949 </para>
56950 </listitem>
56951 <listitem>
56952 <para>
56953 &lt; 0 and &gt; &ndash;256
56954 </para>
56955 <para>
56956 The process was terminated by a signal and the value is the negation of the
56957 signal number.
56958 </para>
56959 </listitem>
56960 <listitem>
56961 <para>
56962 &ndash;256
56963 </para>
56964 <para>
56965 The process timed out.
56966 </para>
56967 </listitem>
56968 <listitem>
56969 <para>
56970 &ndash;257
56971 </para>
56972 <para>
56973 The was some other error in wait(); <option>errno</option> is still set.
56974 </para>
56975 </listitem>
56976 </itemizedlist>
56977 </listitem></varlistentry>
56978 <varlistentry>
56979 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
56980 <listitem>
56981 <para>
56982 This function provide you with a means of submitting a new message to
56983 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
56984 want, but this packages it all up for you.) The function creates a pipe,
56985 forks a subprocess that is running
56986 </para>
56987 <literallayout class="monospaced">
56988 exim -t -oem -oi -f &lt;&gt;
56989 </literallayout>
56990 <para>
56991 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
56992 that is connected to the standard input. The yield of the function is the PID
56993 of the subprocess. You can then write a message to the file descriptor, with
56994 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
56995 </para>
56996 <para>
56997 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
56998 finish and to collect its ending status. A timeout value of zero is usually
56999 fine in this circumstance. Unless you have made a mistake with the recipient
57000 addresses, you should get a return code of zero.
57001 </para>
57002 </listitem></varlistentry>
57003 <varlistentry>
57004 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
57005 <listitem>
57006 <para>
57007 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
57008 that it runs is:
57009 </para>
57010 <literallayout>
57011 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
57012 </literallayout>
57013 <para>
57014 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
57015 </para>
57016 </listitem></varlistentry>
57017 <varlistentry>
57018 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
57019 <listitem>
57020 <para>
57021 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
57022 output is written to the standard error stream. If no debugging is selected,
57023 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
57024 conditional on the <literal>local_scan</literal> debug selector by coding like this:
57025 </para>
57026 <literallayout class="monospaced">
57027 if ((debug_selector &amp; D_local_scan) != 0)
57028   debug_printf("xxx", ...);
57029 </literallayout>
57030 </listitem></varlistentry>
57031 <varlistentry>
57032 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
57033 <listitem>
57034 <para>
57035 This is an interface to Exim&#x2019;s string expansion code. The return value is the
57036 expanded string, or NULL if there was an expansion failure.
57037 The C variable <option>expand_string_message</option> contains an error message after an
57038 expansion failure. If expansion does not change the string, the return value is
57039 the pointer to the input string. Otherwise, the return value points to a new
57040 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
57041 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
57042 </para>
57043 </listitem></varlistentry>
57044 <varlistentry>
57045 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
57046 <listitem>
57047 <para>
57048 This function allows you to an add additional header line at the end of the
57049 existing ones. The first argument is the type, and should normally be a space
57050 character. The second argument is a format string and any number of
57051 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
57052 if you want, and you must ensure that the string ends with a newline.
57053 </para>
57054 </listitem></varlistentry>
57055 <varlistentry>
57056 <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>
57057 <listitem>
57058 <para>
57059 This function adds a new header line at a specified point in the header
57060 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
57061 </para>
57062 <para>
57063 If <option>name</option> is NULL, the new header is added at the end of the chain if
57064 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
57065 NULL, the header lines are searched for the first non-deleted header that
57066 matches the name. If one is found, the new header is added before it if
57067 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
57068 found header and any adjacent subsequent ones with the same name (even if
57069 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
57070 option controls where the header is added. If it is true, addition is at the
57071 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
57072 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
57073 </para>
57074 <literallayout class="monospaced">
57075 header_add_at_position(TRUE, US"Received", TRUE,
57076   ' ', "X-xxx: ...");
57077 </literallayout>
57078 <para>
57079 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
57080 there may not be if <option>received_header_text</option> expands to an empty string.
57081 </para>
57082 </listitem></varlistentry>
57083 <varlistentry>
57084 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
57085 <listitem>
57086 <para>
57087 This function removes header lines. If <option>occurrence</option> is zero or negative, all
57088 occurrences of the header are removed. If occurrence is greater than zero, that
57089 particular instance of the header is removed. If no header(s) can be found that
57090 match the specification, the function does nothing.
57091 </para>
57092 </listitem></varlistentry>
57093 <varlistentry>
57094 <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>
57095 <listitem>
57096 <para>
57097 This function tests whether the given header has the given name. It is not just
57098 a string comparison, because white space is permitted between the name and the
57099 colon. If the <option>notdel</option> argument is true, a false return is forced for all
57100 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
57101 </para>
57102 <literallayout class="monospaced">
57103 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
57104 </literallayout>
57105 </listitem></varlistentry>
57106 <varlistentry>
57107 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
57108 <listitem>
57109 <para>
57110 <indexterm role="concept">
57111 <primary>base64 encoding</primary>
57112 <secondary>functions for <function>local_scan()</function> use</secondary>
57113 </indexterm>
57114 This function base64-encodes a string, which is passed by address and length.
57115 The text may contain bytes of any value, including zero. The result is passed
57116 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
57117 zero-terminated.
57118 </para>
57119 </listitem></varlistentry>
57120 <varlistentry>
57121 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
57122 <listitem>
57123 <para>
57124 This function decodes a base64-encoded string. Its arguments are a
57125 zero-terminated base64-encoded string and the address of a variable that is set
57126 to point to the result, which is in dynamic memory. The length of the decoded
57127 string is the yield of the function. If the input is invalid base64 data, the
57128 yield is -1. A zero byte is added to the end of the output string to make it
57129 easy to interpret as a C string (assuming it contains no zeros of its own). The
57130 added zero byte is not included in the returned count.
57131 </para>
57132 </listitem></varlistentry>
57133 <varlistentry>
57134 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
57135 <listitem>
57136 <para>
57137 This function checks for a match in a domain list. Domains are always
57138 matched caselessly. The return value is one of the following:
57139 </para>
57140 <literallayout>
57141 <literal>OK     </literal> match succeeded
57142 <literal>FAIL   </literal> match failed
57143 <literal>DEFER  </literal> match deferred
57144 </literallayout>
57145 <para>
57146 DEFER is usually caused by some kind of lookup defer, such as the
57147 inability to contact a database.
57148 </para>
57149 </listitem></varlistentry>
57150 <varlistentry>
57151 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
57152 <listitem>
57153 <para>
57154 This function checks for a match in a local part list. The third argument
57155 controls case-sensitivity. The return values are as for
57156 <emphasis>lss_match_domain()</emphasis>.
57157 </para>
57158 </listitem></varlistentry>
57159 <varlistentry>
57160 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
57161 <listitem>
57162 <para>
57163 This function checks for a match in an address list. The third argument
57164 controls the case-sensitivity of the local part match. The domain is always
57165 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
57166 </para>
57167 </listitem></varlistentry>
57168 <varlistentry>
57169 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
57170 <listitem>
57171 <para>
57172 This function checks for a match in a host list. The most common usage is
57173 expected to be
57174 </para>
57175 <literallayout class="monospaced">
57176 lss_match_host(sender_host_name, sender_host_address, ...)
57177 </literallayout>
57178 <para>
57179 <indexterm role="variable">
57180 <primary><varname>$sender_host_address</varname></primary>
57181 </indexterm>
57182 An empty address field matches an empty item in the host list. If the host name
57183 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
57184 looked up if a host name is required to match an item in the list. The return
57185 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
57186 returns ERROR in the case when it had to look up a host name, but the lookup
57187 failed.
57188 </para>
57189 </listitem></varlistentry>
57190 <varlistentry>
57191 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
57192 <listitem>
57193 <para>
57194 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
57195 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
57196 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
57197 them. It specifies to which log or logs the message is written. The remaining
57198 arguments are a format and relevant insertion arguments. The string should not
57199 contain any newlines, not even at the end.
57200 </para>
57201 </listitem></varlistentry>
57202 <varlistentry>
57203 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
57204 <listitem>
57205 <para>
57206 This function adds an additional recipient to the message. The first argument
57207 is the recipient address. If it is unqualified (has no domain), it is qualified
57208 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
57209 </para>
57210 <para>
57211 This function does not allow you to specify a private <option>errors_to</option> address (as
57212 described with the structure of <option>recipient_item</option> above), because it pre-dates
57213 the addition of that field to the structure. However, it is easy to add such a
57214 value afterwards. For example:
57215 </para>
57216 <literallayout class="monospaced">
57217  receive_add_recipient(US"monitor@mydom.example", -1);
57218  recipients_list[recipients_count-1].errors_to =
57219    US"postmaster@mydom.example";
57220 </literallayout>
57221 </listitem></varlistentry>
57222 <varlistentry>
57223 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
57224 <listitem>
57225 <para>
57226 This is a convenience function to remove a named recipient from the list of
57227 recipients. It returns true if a recipient was removed, and false if no
57228 matching recipient could be found. The argument must be a complete email
57229 address.
57230 </para>
57231 </listitem></varlistentry>
57232 </variablelist>
57233 <para>
57234 <indexterm role="concept">
57235 <primary>RFC 2047</primary>
57236 </indexterm>
57237 </para>
57238 <variablelist>
57239 <varlistentry>
57240 <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>
57241 <listitem>
57242 <para>
57243 This function decodes strings that are encoded according to RFC 2047. Typically
57244 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
57245 from the Q or B encoding into a byte-string. Then, if provided with the name of
57246 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
57247 made  to translate the result to the named character set. If this fails, the
57248 binary string is returned with an error message.
57249 </para>
57250 <para>
57251 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
57252 maximum MIME word length is enforced. The third argument is the target
57253 encoding, or NULL if no translation is wanted.
57254 </para>
57255 <para>
57256 <indexterm role="concept">
57257 <primary>binary zero</primary>
57258 <secondary>in RFC 2047 decoding</secondary>
57259 </indexterm>
57260 <indexterm role="concept">
57261 <primary>RFC 2047</primary>
57262 <secondary>binary zero in</secondary>
57263 </indexterm>
57264 If a binary zero is encountered in the decoded string, it is replaced by the
57265 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
57266 not be 0 because header lines are handled as zero-terminated strings.
57267 </para>
57268 <para>
57269 The function returns the result of processing the string, zero-terminated; if
57270 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
57271 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
57272 </para>
57273 <para>
57274 If an error is encountered, the function returns NULL and uses the <option>error</option>
57275 argument to return an error message. The variable pointed to by <option>error</option> is
57276 set to NULL if there is no error; it may be set non-NULL even when the function
57277 returns a non-NULL value if decoding was successful, but there was a problem
57278 with translation.
57279 </para>
57280 </listitem></varlistentry>
57281 <varlistentry>
57282 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
57283 <listitem>
57284 <para>
57285 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
57286 below.
57287 </para>
57288 </listitem></varlistentry>
57289 <varlistentry>
57290 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
57291 <listitem>
57292 <para>
57293 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
57294 output stream. You should use this function only when there is an SMTP output
57295 stream, that is, when the incoming message is being received via interactive
57296 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
57297 is FALSE. If you want to test for an incoming message from another host (as
57298 opposed to a local process that used the <option>-bs</option> command line option), you can
57299 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
57300 is involved.
57301 </para>
57302 <para>
57303 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
57304 output function, so it can be used for all forms of SMTP connection.
57305 </para>
57306 <para>
57307 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
57308 must start with an appropriate response code: 550 if you are going to return
57309 LOCAL_SCAN_REJECT, 451 if you are going to return
57310 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
57311 initial lines of a multi-line response, the code must be followed by a hyphen
57312 to indicate that the line is not the final response line. You must also ensure
57313 that the lines you write terminate with CRLF. For example:
57314 </para>
57315 <literallayout class="monospaced">
57316 smtp_printf("550-this is some extra info\r\n");
57317 return LOCAL_SCAN_REJECT;
57318 </literallayout>
57319 <para>
57320 Note that you can also create multi-line responses by including newlines in
57321 the data returned via the <option>return_text</option> argument. The added value of using
57322 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
57323 multiple output lines.
57324 </para>
57325 <para>
57326 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
57327 does not automatically flush pending output, and therefore does not test
57328 the state of the stream. (In the main code of Exim, flushing and error
57329 detection is done when Exim is ready for the next SMTP input command.) If
57330 you want to flush the output and check for an error (for example, the
57331 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
57332 arguments. It flushes the output stream, and returns a non-zero value if there
57333 is an error.
57334 </para>
57335 </listitem></varlistentry>
57336 <varlistentry>
57337 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
57338 <listitem>
57339 <para>
57340 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
57341 chunk of memory whose size is given by the argument. Exim bombs out if it ever
57342 runs out of memory. See the next section for a discussion of memory handling.
57343 </para>
57344 </listitem></varlistentry>
57345 <varlistentry>
57346 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
57347 <listitem>
57348 <para>
57349 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
57350 permanent pool. See the next section for a discussion of memory handling.
57351 </para>
57352 </listitem></varlistentry>
57353 <varlistentry>
57354 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
57355 <listitem>
57356 <para>
57357 See below.
57358 </para>
57359 </listitem></varlistentry>
57360 <varlistentry>
57361 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
57362 <listitem>
57363 <para>
57364 See below.
57365 </para>
57366 </listitem></varlistentry>
57367 <varlistentry>
57368 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
57369 <listitem>
57370 <para>
57371 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
57372 The first makes a copy of an entire string. The second copies up to a maximum
57373 number of characters, indicated by the second argument. The third uses a format
57374 and insertion arguments to create a new string. In each case, the result is a
57375 pointer to a new string in the current memory pool. See the next section for
57376 more discussion.
57377 </para>
57378 </listitem></varlistentry>
57379 </variablelist>
57380 </section>
57381 <section id="SECTmemhanloc">
57382 <title>More about Exim&#x2019;s memory handling</title>
57383 <para>
57384 <indexterm role="concept">
57385 <primary><function>local_scan()</function> function</primary>
57386 <secondary>memory handling</secondary>
57387 </indexterm>
57388 No function is provided for freeing memory, because that is never needed.
57389 The dynamic memory that Exim uses when receiving a message is automatically
57390 recycled if another message is received by the same process (this applies only
57391 to incoming SMTP connections &ndash; other input methods can supply only one
57392 message at a time). After receiving the last message, a reception process
57393 terminates.
57394 </para>
57395 <para>
57396 Because it is recycled, the normal dynamic memory cannot be used for holding
57397 data that must be preserved over a number of incoming messages on the same SMTP
57398 connection. However, Exim in fact uses two pools of dynamic memory; the second
57399 one is not recycled, and can be used for this purpose.
57400 </para>
57401 <para>
57402 If you want to allocate memory that remains available for subsequent messages
57403 in the same SMTP connection, you should set
57404 </para>
57405 <literallayout class="monospaced">
57406 store_pool = POOL_PERM
57407 </literallayout>
57408 <para>
57409 before calling the function that does the allocation. There is no need to
57410 restore the value if you do not need to; however, if you do want to revert to
57411 the normal pool, you can either restore the previous value of <option>store_pool</option> or
57412 set it explicitly to POOL_MAIN.
57413 </para>
57414 <para>
57415 The pool setting applies to all functions that get dynamic memory, including
57416 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
57417 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
57418 block of memory from the permanent pool while preserving the value of
57419 <option>store_pool</option>.
57420 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
57421 </para>
57422 </section>
57423 </chapter>
57424
57425 <chapter id="CHAPsystemfilter">
57426 <title>System-wide message filtering</title>
57427 <para>
57428 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
57429 <primary>filter</primary>
57430 <secondary>system filter</secondary>
57431 </indexterm>
57432 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
57433 <primary>filtering all mail</primary>
57434 </indexterm>
57435 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
57436 <primary>system filter</primary>
57437 </indexterm>
57438 The previous chapters (on ACLs and the local scan function) describe checks
57439 that can be applied to messages before they are accepted by a host. There is
57440 also a mechanism for checking messages once they have been received, but before
57441 they are delivered. This is called the <emphasis>system filter</emphasis>.
57442 </para>
57443 <para>
57444 The system filter operates in a similar manner to users&#x2019; filter files, but it
57445 is run just once per message (however many recipients the message has).
57446 It should not normally be used as a substitute for routing, because <option>deliver</option>
57447 commands in a system router provide new envelope recipient addresses.
57448 The system filter must be an Exim filter. It cannot be a Sieve filter.
57449 </para>
57450 <para>
57451 The system filter is run at the start of a delivery attempt, before any routing
57452 is done. If a message fails to be completely delivered at the first attempt,
57453 the system filter is run again at the start of every retry.
57454 If you want your filter to do something only once per message, you can make use
57455 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
57456 prevent it happening on retries.
57457 </para>
57458 <para>
57459 <indexterm role="variable">
57460 <primary><varname>$domain</varname></primary>
57461 </indexterm>
57462 <indexterm role="variable">
57463 <primary><varname>$local_part</varname></primary>
57464 </indexterm>
57465 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
57466 specific to individual recipient addresses, such as <varname>$local_part</varname> and
57467 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
57468 you want to run a centrally-specified filter for each recipient address
57469 independently, you can do so by setting up a suitable <command>redirect</command> router, as
57470 described in section <xref linkend="SECTperaddfil"/> below.
57471 </para>
57472 <section id="SECID212">
57473 <title>Specifying a system filter</title>
57474 <para>
57475 <indexterm role="concept">
57476 <primary>uid (user id)</primary>
57477 <secondary>system filter</secondary>
57478 </indexterm>
57479 <indexterm role="concept">
57480 <primary>gid (group id)</primary>
57481 <secondary>system filter</secondary>
57482 </indexterm>
57483 The name of the file that contains the system filter must be specified by
57484 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
57485 other than root, you must also set <option>system_filter_user</option> and
57486 <option>system_filter_group</option> as appropriate. For example:
57487 </para>
57488 <literallayout class="monospaced">
57489 system_filter = /etc/mail/exim.filter
57490 system_filter_user = exim
57491 </literallayout>
57492 <para>
57493 If a system filter generates any deliveries directly to files or pipes (via the
57494 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
57495 specified by setting <option>system_filter_file_transport</option> and
57496 <option>system_filter_pipe_transport</option>, respectively. Similarly,
57497 <option>system_filter_reply_transport</option> must be set to handle any messages generated
57498 by the <option>reply</option> command.
57499 </para>
57500 </section>
57501 <section id="SECID213">
57502 <title>Testing a system filter</title>
57503 <para>
57504 You can run simple tests of a system filter in the same way as for a user
57505 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
57506 are permitted only in system filters are recognized.
57507 </para>
57508 <para>
57509 If you want to test the combined effect of a system filter and a user filter,
57510 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
57511 </para>
57512 </section>
57513 <section id="SECID214">
57514 <title>Contents of a system filter</title>
57515 <para>
57516 The language used to specify system filters is the same as for users&#x2019; filter
57517 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
57518 mail filtering</emphasis>. However, there are some additional features that are
57519 available only in system filters; these are described in subsequent sections.
57520 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
57521 they cause errors.
57522 </para>
57523 <para>
57524 <indexterm role="concept">
57525 <primary>frozen messages</primary>
57526 <secondary>manual thaw; testing in filter</secondary>
57527 </indexterm>
57528 There are two special conditions which, though available in users&#x2019; filter
57529 files, are designed for use in system filters. The condition <option>first_delivery</option>
57530 is true only for the first attempt at delivering a message, and
57531 <option>manually_thawed</option> is true only if the message has been frozen, and
57532 subsequently thawed by an admin user. An explicit forced delivery counts as a
57533 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
57534 </para>
57535 <para>
57536 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
57537 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
57538 succeed, it will not be tried again.
57539 If you want Exim to retry an unseen delivery until it succeeds, you should
57540 arrange to set it up every time the filter runs.
57541 </para>
57542 <para>
57543 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
57544 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
57545 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
57546 to which users&#x2019; filter files can refer.
57547 </para>
57548 </section>
57549 <section id="SECID215">
57550 <title>Additional variable for system filters</title>
57551 <para>
57552 <indexterm role="variable">
57553 <primary><varname>$recipients</varname></primary>
57554 </indexterm>
57555 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
57556 of the message (separated by commas and white space), is available in system
57557 filters. It is not available in users&#x2019; filters for privacy reasons.
57558 </para>
57559 </section>
57560 <section id="SECID216">
57561 <title>Defer, freeze, and fail commands for system filters</title>
57562 <para>
57563 <indexterm role="concept">
57564 <primary>freezing messages</primary>
57565 </indexterm>
57566 <indexterm role="concept">
57567 <primary>message</primary>
57568 <secondary>freezing</secondary>
57569 </indexterm>
57570 <indexterm role="concept">
57571 <primary>message</primary>
57572 <secondary>forced failure</secondary>
57573 </indexterm>
57574 <indexterm role="concept">
57575 <primary><option>fail</option></primary>
57576 <secondary>in system filter</secondary>
57577 </indexterm>
57578 <indexterm role="concept">
57579 <primary><option>freeze</option> in system filter</primary>
57580 </indexterm>
57581 <indexterm role="concept">
57582 <primary><option>defer</option> in system filter</primary>
57583 </indexterm>
57584 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
57585 always available in system filters, but are not normally enabled in users&#x2019;
57586 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
57587 for the <command>redirect</command> router.) These commands can optionally be followed by the
57588 word <option>text</option> and a string containing an error message, for example:
57589 </para>
57590 <literallayout class="monospaced">
57591 fail text "this message looks like spam to me"
57592 </literallayout>
57593 <para>
57594 The keyword <option>text</option> is optional if the next character is a double quote.
57595 </para>
57596 <para>
57597 The <option>defer</option> command defers delivery of the original recipients of the
57598 message. The <option>fail</option> command causes all the original recipients to be failed,
57599 and a bounce message to be created. The <option>freeze</option> command suspends all
57600 delivery attempts for the original recipients. In all cases, any new deliveries
57601 that are specified by the filter are attempted as normal after the filter has
57602 run.
57603 </para>
57604 <para>
57605 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
57606 not manually frozen since. This means that automatic freezing by a system
57607 filter can be used as a way of checking out suspicious messages. If a message
57608 is found to be all right, manually unfreezing it allows it to be delivered.
57609 </para>
57610 <para>
57611 <indexterm role="concept">
57612 <primary>log</primary>
57613 <secondary><option>fail</option> command log line</secondary>
57614 </indexterm>
57615 <indexterm role="concept">
57616 <primary><option>fail</option></primary>
57617 <secondary>log line; reducing</secondary>
57618 </indexterm>
57619 The text given with a fail command is used as part of the bounce message as
57620 well as being written to the log. If the message is quite long, this can fill
57621 up a lot of log space when such failures are common. To reduce the size of the
57622 log message, Exim interprets the text in a special way if it starts with the
57623 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
57624 strings is written to the log, and the rest of the text is used in the bounce
57625 message. For example:
57626 </para>
57627 <literallayout class="monospaced">
57628 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
57629      because it contains attachments that we are \
57630      not prepared to receive."
57631 </literallayout>
57632 <para>
57633 <indexterm role="concept">
57634 <primary>loop</primary>
57635 <secondary>caused by <option>fail</option></secondary>
57636 </indexterm>
57637 Take great care with the <option>fail</option> command when basing the decision to fail on
57638 the contents of the message, because the bounce message will of course include
57639 the contents of the original message and will therefore trigger the <option>fail</option>
57640 command again (causing a mail loop) unless steps are taken to prevent this.
57641 Testing the <option>error_message</option> condition is one way to prevent this. You could
57642 use, for example
57643 </para>
57644 <literallayout class="monospaced">
57645 if $message_body contains "this is spam" and not error_message
57646 then fail text "spam is not wanted here" endif
57647 </literallayout>
57648 <para>
57649 though of course that might let through unwanted bounce messages. The
57650 alternative is clever checking of the body and/or headers to detect bounces
57651 generated by the filter.
57652 </para>
57653 <para>
57654 The interpretation of a system filter file ceases after a
57655 <option>defer</option>,
57656 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
57657 set up earlier in the filter file are honoured, so you can use a sequence such
57658 as
57659 </para>
57660 <literallayout class="monospaced">
57661 mail ...
57662 freeze
57663 </literallayout>
57664 <para>
57665 to send a specified message when the system filter is freezing (or deferring or
57666 failing) a message. The normal deliveries for the message do not, of course,
57667 take place.
57668 </para>
57669 </section>
57670 <section id="SECTaddremheasys">
57671 <title>Adding and removing headers in a system filter</title>
57672 <para>
57673 <indexterm role="concept">
57674 <primary>header lines</primary>
57675 <secondary>adding; in system filter</secondary>
57676 </indexterm>
57677 <indexterm role="concept">
57678 <primary>header lines</primary>
57679 <secondary>removing; in system filter</secondary>
57680 </indexterm>
57681 <indexterm role="concept">
57682 <primary>filter</primary>
57683 <secondary>header lines; adding/removing</secondary>
57684 </indexterm>
57685 Two filter commands that are available only in system filters are:
57686 </para>
57687 <literallayout class="monospaced">
57688 headers add &lt;string&gt;
57689 headers remove &lt;string&gt;
57690 </literallayout>
57691 <para>
57692 The argument for the <option>headers add</option> is a string that is expanded and then
57693 added to the end of the message&#x2019;s headers. It is the responsibility of the
57694 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
57695 space is ignored, and if the string is otherwise empty, or if the expansion is
57696 forced to fail, the command has no effect.
57697 </para>
57698 <para>
57699 You can use <quote>\n</quote> within the string, followed by white space, to specify
57700 continued header lines. More than one header may be added in one command by
57701 including <quote>\n</quote> within the string without any following white space. For
57702 example:
57703 </para>
57704 <literallayout class="monospaced">
57705 headers add "X-header-1: ....\n  \
57706              continuation of X-header-1 ...\n\
57707              X-header-2: ...."
57708 </literallayout>
57709 <para>
57710 Note that the header line continuation white space after the first newline must
57711 be placed before the backslash that continues the input string, because white
57712 space after input continuations is ignored.
57713 </para>
57714 <para>
57715 The argument for <option>headers remove</option> is a colon-separated list of header names.
57716 This command applies only to those headers that are stored with the message;
57717 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
57718 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
57719 header with the same name, they are all removed.
57720 </para>
57721 <para>
57722 The <option>headers</option> command in a system filter makes an immediate change to the set
57723 of header lines that was received with the message (with possible additions
57724 from ACL processing). Subsequent commands in the system filter operate on the
57725 modified set, which also forms the basis for subsequent message delivery.
57726 Unless further modified during routing or transporting, this set of headers is
57727 used for all recipients of the message.
57728 </para>
57729 <para>
57730 During routing and transporting, the variables that refer to the contents of
57731 header lines refer only to those lines that are in this set. Thus, header lines
57732 that are added by a system filter are visible to users&#x2019; filter files and to all
57733 routers and transports. This contrasts with the manipulation of header lines by
57734 routers and transports, which is not immediate, but which instead is saved up
57735 until the message is actually being written (see section
57736 <xref linkend="SECTheadersaddrem"/>).
57737 </para>
57738 <para>
57739 If the message is not delivered at the first attempt, header lines that were
57740 added by the system filter are stored with the message, and so are still
57741 present at the next delivery attempt. Header lines that were removed are still
57742 present, but marked <quote>deleted</quote> so that they are not transported with the
57743 message. For this reason, it is usual to make the <option>headers</option> command
57744 conditional on <option>first_delivery</option> so that the set of header lines is not
57745 modified more than once.
57746 </para>
57747 <para>
57748 Because header modification in a system filter acts immediately, you have to
57749 use an indirect approach if you want to modify the contents of a header line.
57750 For example:
57751 </para>
57752 <literallayout class="monospaced">
57753 headers add "Old-Subject: $h_subject:"
57754 headers remove "Subject"
57755 headers add "Subject: new subject (was: $h_old-subject:)"
57756 headers remove "Old-Subject"
57757 </literallayout>
57758 </section>
57759 <section id="SECID217">
57760 <title>Setting an errors address in a system filter</title>
57761 <para>
57762 <indexterm role="concept">
57763 <primary>envelope sender</primary>
57764 </indexterm>
57765 In a system filter, if a <option>deliver</option> command is followed by
57766 </para>
57767 <literallayout class="monospaced">
57768 errors_to &lt;some address&gt;
57769 </literallayout>
57770 <para>
57771 in order to change the envelope sender (and hence the error reporting) for that
57772 delivery, any address may be specified. (In a user filter, only the current
57773 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
57774 might use
57775 </para>
57776 <literallayout class="monospaced">
57777 unseen deliver monitor@spying.example errors_to root@local.example
57778 </literallayout>
57779 <para>
57780 to take a copy which would not be sent back to the normal error reporting
57781 address if its delivery failed.
57782 </para>
57783 </section>
57784 <section id="SECTperaddfil">
57785 <title>Per-address filtering</title>
57786 <para>
57787 <indexterm role="variable">
57788 <primary><varname>$domain</varname></primary>
57789 </indexterm>
57790 <indexterm role="variable">
57791 <primary><varname>$local_part</varname></primary>
57792 </indexterm>
57793 In contrast to the system filter, which is run just once per message for each
57794 delivery attempt, it is also possible to set up a system-wide filtering
57795 operation that runs once for each recipient address. In this case, variables
57796 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
57797 filter file could be made dependent on them. This is an example of a router
57798 which implements such a filter:
57799 </para>
57800 <literallayout class="monospaced">
57801 central_filter:
57802   check_local_user
57803   driver = redirect
57804   domains = +local_domains
57805   file = /central/filters/$local_part
57806   no_verify
57807   allow_filter
57808   allow_freeze
57809 </literallayout>
57810 <para>
57811 The filter is run in a separate process under its own uid. Therefore, either
57812 <option>check_local_user</option> must be set (as above), in which case the filter is run as
57813 the local user, or the <option>user</option> option must be used to specify which user to
57814 use. If both are set, <option>user</option> overrides.
57815 </para>
57816 <para>
57817 Care should be taken to ensure that none of the commands in the filter file
57818 specify a significant delivery if the message is to go on to be delivered to
57819 its intended recipient. The router will not then claim to have dealt with the
57820 address, so it will be passed on to subsequent routers to be delivered in the
57821 normal way.
57822 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
57823 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
57824 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
57825 </para>
57826 </section>
57827 </chapter>
57828
57829 <chapter id="CHAPmsgproc">
57830 <title>Message processing</title>
57831 <para>
57832 <indexterm role="concept" id="IIDmesproc" class="startofrange">
57833 <primary>message</primary>
57834 <secondary>general processing</secondary>
57835 </indexterm>
57836 Exim performs various transformations on the sender and recipient addresses of
57837 all messages that it handles, and also on the messages&#x2019; header lines. Some of
57838 these are optional and configurable, while others always take place. All of
57839 this processing, except rewriting as a result of routing, and the addition or
57840 removal of header lines while delivering, happens when a message is received,
57841 before it is placed on Exim&#x2019;s queue.
57842 </para>
57843 <para>
57844 Some of the automatic processing takes place by default only for
57845 <quote>locally-originated</quote> messages. This adjective is used to describe messages
57846 that are not received over TCP/IP, but instead are passed to an Exim process on
57847 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
57848 set up by the <option>-bs</option> command line option.
57849 </para>
57850 <para>
57851 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
57852 or ::1) are not considered to be locally-originated. Exim does not treat the
57853 loopback interface specially in any way.
57854 </para>
57855 <para>
57856 If you want the loopback interface to be treated specially, you must ensure
57857 that there are appropriate entries in your ACLs.
57858 </para>
57859 <section id="SECTsubmodnon">
57860 <title>Submission mode for non-local messages</title>
57861 <para>
57862 <indexterm role="concept">
57863 <primary>message</primary>
57864 <secondary>submission</secondary>
57865 </indexterm>
57866 <indexterm role="concept">
57867 <primary>submission mode</primary>
57868 </indexterm>
57869 Processing that happens automatically for locally-originated messages (unless
57870 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
57871 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
57872 state. Submission mode is set by the modifier
57873 </para>
57874 <literallayout class="monospaced">
57875 control = submission
57876 </literallayout>
57877 <para>
57878 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
57879 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
57880 a local submission, and is normally used when the source of the message is
57881 known to be an MUA running on a client host (as opposed to an MTA). For
57882 example, to set submission mode for messages originating on the IPv4 loopback
57883 interface, you could include the following in the MAIL ACL:
57884 </para>
57885 <literallayout class="monospaced">
57886 warn  hosts = 127.0.0.1
57887       control = submission
57888 </literallayout>
57889 <para>
57890 <indexterm role="concept">
57891 <primary><option>sender_retain</option> submission option</primary>
57892 </indexterm>
57893 There are some options that can be used when setting submission mode. A slash
57894 is used to separate options. For example:
57895 </para>
57896 <literallayout class="monospaced">
57897 control = submission/sender_retain
57898 </literallayout>
57899 <para>
57900 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
57901 true and <option>local_from_check</option> false for the current incoming message. The first
57902 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
57903 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
57904 authenticated sender. With this setting, Exim still fixes up messages by adding
57905 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
57906 attempt to check sender authenticity in header lines.
57907 </para>
57908 <para>
57909 When <option>sender_retain</option> is not set, a submission mode setting may specify a
57910 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
57911 example:
57912 </para>
57913 <literallayout class="monospaced">
57914 control = submission/domain=some.domain
57915 </literallayout>
57916 <para>
57917 The domain may be empty. How this value is used is described in sections
57918 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
57919 that allows you to specify the user&#x2019;s full name for inclusion in a created
57920 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
57921 </para>
57922 <literallayout class="monospaced">
57923 accept authenticated = *
57924        control = submission/domain=wonderland.example/\
57925                             name=${lookup {$authenticated_id} \
57926                                    lsearch {/etc/exim/namelist}}
57927 </literallayout>
57928 <para>
57929 Because the name may contain any characters, including slashes, the <option>name</option>
57930 option must be given last. The remainder of the string is used as the name. For
57931 the example above, if <filename>/etc/exim/namelist</filename> contains:
57932 </para>
57933 <literallayout class="monospaced">
57934 bigegg:  Humpty Dumpty
57935 </literallayout>
57936 <para>
57937 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
57938 line would be:
57939 </para>
57940 <literallayout class="monospaced">
57941 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
57942 </literallayout>
57943 <para>
57944 <indexterm role="concept">
57945 <primary>return path</primary>
57946 <secondary>in submission mode</secondary>
57947 </indexterm>
57948 By default, submission mode forces the return path to the same address as is
57949 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
57950 specified, the return path is also left unchanged.
57951 </para>
57952 <para>
57953 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
57954 ACL. This means that any sender checks performed before the fix-ups use the
57955 untrusted sender address specified by the user, not the trusted sender address
57956 specified by submission mode. Although this might be slightly unexpected, it
57957 does mean that you can configure ACL checks to spot that a user is trying to
57958 spoof another&#x2019;s address.
57959 </para>
57960 </section>
57961 <section id="SECTlineendings">
57962 <title>Line endings</title>
57963 <para>
57964 <indexterm role="concept">
57965 <primary>line endings</primary>
57966 </indexterm>
57967 <indexterm role="concept">
57968 <primary>carriage return</primary>
57969 </indexterm>
57970 <indexterm role="concept">
57971 <primary>linefeed</primary>
57972 </indexterm>
57973 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
57974 linefeed) is the line ending for messages transmitted over the Internet using
57975 SMTP over TCP/IP. However, within individual operating systems, different
57976 conventions are used. For example, Unix-like systems use just LF, but others
57977 use CRLF or just CR.
57978 </para>
57979 <para>
57980 Exim was designed for Unix-like systems, and internally, it stores messages
57981 using the system&#x2019;s convention of a single LF as a line terminator. When
57982 receiving a message, all line endings are translated to this standard format.
57983 Originally, it was thought that programs that passed messages directly to an
57984 MTA within an operating system would use that system&#x2019;s convention. Experience
57985 has shown that this is not the case; for example, there are Unix applications
57986 that use CRLF in this circumstance. For this reason, and for compatibility with
57987 other MTAs, the way Exim handles line endings for all messages is now as
57988 follows:
57989 </para>
57990 <itemizedlist>
57991 <listitem>
57992 <para>
57993 LF not preceded by CR is treated as a line ending.
57994 </para>
57995 </listitem>
57996 <listitem>
57997 <para>
57998 CR is treated as a line ending; if it is immediately followed by LF, the LF
57999 is ignored.
58000 </para>
58001 </listitem>
58002 <listitem>
58003 <para>
58004 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
58005 nor a local message in the state where a line containing only a dot is a
58006 terminator.
58007 </para>
58008 </listitem>
58009 <listitem>
58010 <para>
58011 If a bare CR is encountered within a header line, an extra space is added after
58012 the line terminator so as not to end the header line. The reasoning behind this
58013 is that bare CRs in header lines are most likely either to be mistakes, or
58014 people trying to play silly games.
58015 </para>
58016 </listitem>
58017 <listitem>
58018 <para>
58019 If the first header line received in a message ends with CRLF, a subsequent
58020 bare LF in a header line is treated in the same way as a bare CR in a header
58021 line.
58022 </para>
58023 </listitem>
58024 </itemizedlist>
58025 </section>
58026 <section id="SECID218">
58027 <title>Unqualified addresses</title>
58028 <para>
58029 <indexterm role="concept">
58030 <primary>unqualified addresses</primary>
58031 </indexterm>
58032 <indexterm role="concept">
58033 <primary>address</primary>
58034 <secondary>qualification</secondary>
58035 </indexterm>
58036 By default, Exim expects every envelope address it receives from an external
58037 host to be fully qualified. Unqualified addresses cause negative responses to
58038 SMTP commands. However, because SMTP is used as a means of transporting
58039 messages from MUAs running on personal workstations, there is sometimes a
58040 requirement to accept unqualified addresses from specific hosts or IP networks.
58041 </para>
58042 <para>
58043 Exim has two options that separately control which hosts may send unqualified
58044 sender or recipient addresses in SMTP commands, namely
58045 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
58046 cases, if an unqualified address is accepted, it is qualified by adding the
58047 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
58048 </para>
58049 <para>
58050 <indexterm role="option">
58051 <primary><option>qualify_domain</option></primary>
58052 </indexterm>
58053 <indexterm role="option">
58054 <primary><option>qualify_recipient</option></primary>
58055 </indexterm>
58056 Unqualified addresses in header lines are automatically qualified for messages
58057 that are locally originated, unless the <option>-bnq</option> option is given on the command
58058 line. For messages received over SMTP, unqualified addresses in header lines
58059 are qualified only if unqualified addresses are permitted in SMTP commands. In
58060 other words, such qualification is also controlled by
58061 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
58062 </para>
58063 </section>
58064 <section id="SECID219">
58065 <title>The UUCP From line</title>
58066 <para>
58067 <indexterm role="concept">
58068 <primary><quote>From</quote> line</primary>
58069 </indexterm>
58070 <indexterm role="concept">
58071 <primary>UUCP</primary>
58072 <secondary><quote>From</quote> line</secondary>
58073 </indexterm>
58074 <indexterm role="concept">
58075 <primary>sender</primary>
58076 <secondary>address</secondary>
58077 </indexterm>
58078 <indexterm role="option">
58079 <primary><option>uucp_from_pattern</option></primary>
58080 </indexterm>
58081 <indexterm role="option">
58082 <primary><option>uucp_from_sender</option></primary>
58083 </indexterm>
58084 <indexterm role="concept">
58085 <primary>envelope sender</primary>
58086 </indexterm>
58087 <indexterm role="concept">
58088 <primary>Sendmail compatibility</primary>
58089 <secondary><quote>From</quote> line</secondary>
58090 </indexterm>
58091 Messages that have come from UUCP (and some other applications) often begin
58092 with a line containing the envelope sender and a timestamp, following the word
58093 <quote>From</quote>. Examples of two common formats are:
58094 </para>
58095 <literallayout class="monospaced">
58096 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
58097 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
58098 </literallayout>
58099 <para>
58100 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
58101 Exim recognizes such lines at the start of messages that are submitted to it
58102 via the command line (that is, on the standard input). It does not recognize
58103 such lines in incoming SMTP messages, unless the sending host matches
58104 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
58105 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
58106 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
58107 default value matches the two common cases shown above and puts the address
58108 that follows <quote>From</quote> into <varname>$1</varname>.
58109 </para>
58110 <para>
58111 <indexterm role="concept">
58112 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
58113 <secondary>in <quote>From </quote> line handling</secondary>
58114 </indexterm>
58115 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
58116 a trusted user, the message&#x2019;s sender address is constructed by expanding the
58117 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
58118 then parsed as an RFC 2822 address. If there is no domain, the local part is
58119 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
58120 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
58121 </para>
58122 <para>
58123 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
58124 sender address is not changed. This is also the case for incoming SMTP messages
58125 that are permitted to contain <quote>From</quote> lines.
58126 </para>
58127 <para>
58128 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
58129 treated as a data line that starts the body of the message, as it is not valid
58130 as a header line. This also happens if a <quote>From</quote> line is present in an
58131 incoming SMTP message from a source that is not permitted to send them.
58132 </para>
58133 </section>
58134 <section id="SECID220">
58135 <title>Resent- header lines</title>
58136 <para>
58137 <indexterm role="concept">
58138 <primary><option>Resent-</option> header lines</primary>
58139 </indexterm>
58140 RFC 2822 makes provision for sets of header lines starting with the string
58141 <literal>Resent-</literal> to be added to a message when it is resent by the original
58142 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
58143 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
58144 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
58145 </para>
58146 <blockquote>
58147 <para>
58148 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
58149 processing of replies or other such automatic actions on messages.</emphasis>
58150 </para>
58151 </blockquote>
58152 <para>
58153 This leaves things a bit vague as far as other processing actions such as
58154 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
58155 follows:
58156 </para>
58157 <itemizedlist>
58158 <listitem>
58159 <para>
58160 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
58161 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
58162 </para>
58163 </listitem>
58164 <listitem>
58165 <para>
58166 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
58167 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
58168 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
58169 </para>
58170 </listitem>
58171 <listitem>
58172 <para>
58173 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
58174 also removed.
58175 </para>
58176 </listitem>
58177 <listitem>
58178 <para>
58179 For a locally-submitted message,
58180 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
58181 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
58182 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
58183 included in log lines in this case.
58184 </para>
58185 </listitem>
58186 <listitem>
58187 <para>
58188 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
58189 <option>Resent-</option> header lines are present.
58190 </para>
58191 </listitem>
58192 </itemizedlist>
58193 </section>
58194 <section id="SECID221">
58195 <title>The Auto-Submitted: header line</title>
58196 <para>
58197 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
58198 includes the header line:
58199 </para>
58200 <literallayout class="monospaced">
58201 Auto-Submitted: auto-replied
58202 </literallayout>
58203 </section>
58204 <section id="SECID222">
58205 <title>The Bcc: header line</title>
58206 <para>
58207 <indexterm role="concept">
58208 <primary><emphasis>Bcc:</emphasis> header line</primary>
58209 </indexterm>
58210 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
58211 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
58212 extracting its addresses). If <option>-t</option> is not present on the command line, any
58213 existing <emphasis>Bcc:</emphasis> is not removed.
58214 </para>
58215 </section>
58216 <section id="SECID223">
58217 <title>The Date: header line</title>
58218 <para>
58219 <indexterm role="concept">
58220 <primary><emphasis>Date:</emphasis> header line</primary>
58221 </indexterm>
58222 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
58223 Exim adds one, using the current date and time, unless the
58224 <option>suppress_local_fixups</option> control has been specified.
58225 </para>
58226 </section>
58227 <section id="SECID224">
58228 <title>The Delivery-date: header line</title>
58229 <para>
58230 <indexterm role="concept">
58231 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
58232 </indexterm>
58233 <indexterm role="option">
58234 <primary><option>delivery_date_remove</option></primary>
58235 </indexterm>
58236 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
58237 set. Exim can be configured to add them to the final delivery of messages. (See
58238 the generic <option>delivery_date_add</option> transport option.) They should not be present
58239 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
58240 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
58241 messages.
58242 </para>
58243 </section>
58244 <section id="SECID225">
58245 <title>The Envelope-to: header line</title>
58246 <para>
58247 <indexterm role="concept">
58248 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
58249 </indexterm>
58250 <indexterm role="option">
58251 <primary><option>envelope_to_remove</option></primary>
58252 </indexterm>
58253 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
58254 Exim can be configured to add them to the final delivery of messages. (See the
58255 generic <option>envelope_to_add</option> transport option.) They should not be present in
58256 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
58257 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
58258 messages.
58259 </para>
58260 </section>
58261 <section id="SECTthefrohea">
58262 <title>The From: header line</title>
58263 <para>
58264 <indexterm role="concept">
58265 <primary><emphasis>From:</emphasis> header line</primary>
58266 </indexterm>
58267 <indexterm role="concept">
58268 <primary>Sendmail compatibility</primary>
58269 <secondary><quote>From</quote> line</secondary>
58270 </indexterm>
58271 <indexterm role="concept">
58272 <primary>message</primary>
58273 <secondary>submission</secondary>
58274 </indexterm>
58275 <indexterm role="concept">
58276 <primary>submission mode</primary>
58277 </indexterm>
58278 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
58279 adds one if either of the following conditions is true:
58280 </para>
58281 <itemizedlist>
58282 <listitem>
58283 <para>
58284 The envelope sender address is not empty (that is, this is not a bounce
58285 message). The added header line copies the envelope sender address.
58286 </para>
58287 </listitem>
58288 <listitem>
58289 <para>
58290 <indexterm role="variable">
58291 <primary><varname>$authenticated_id</varname></primary>
58292 </indexterm>
58293 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
58294 </para>
58295 <orderedlist numeration="arabic">
58296 <listitem>
58297 <para>
58298 <indexterm role="variable">
58299 <primary><varname>$qualify_domain</varname></primary>
58300 </indexterm>
58301 If no domain is specified by the submission control, the local part is
58302 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
58303 </para>
58304 </listitem>
58305 <listitem>
58306 <para>
58307 If a non-empty domain is specified by the submission control, the local
58308 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
58309 </para>
58310 </listitem>
58311 <listitem>
58312 <para>
58313 If an empty domain is specified by the submission control,
58314 <varname>$authenticated_id</varname> is assumed to be the complete address.
58315 </para>
58316 </listitem>
58317 </orderedlist>
58318 </listitem>
58319 </itemizedlist>
58320 <para>
58321 A non-empty envelope sender takes precedence.
58322 </para>
58323 <para>
58324 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
58325 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
58326 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
58327 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
58328 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
58329 <option>unknown_login</option> configuration option). The address is qualified with
58330 <option>qualify_domain</option>.
58331 </para>
58332 <para>
58333 For compatibility with Sendmail, if an incoming, non-SMTP message has a
58334 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
58335 user, this is replaced by an address containing the user&#x2019;s login name and full
58336 name as described in section <xref linkend="SECTconstr"/>.
58337 </para>
58338 </section>
58339 <section id="SECID226">
58340 <title>The Message-ID: header line</title>
58341 <para>
58342 <indexterm role="concept">
58343 <primary><emphasis>Message-ID:</emphasis> header line</primary>
58344 </indexterm>
58345 <indexterm role="concept">
58346 <primary>message</primary>
58347 <secondary>submission</secondary>
58348 </indexterm>
58349 <indexterm role="option">
58350 <primary><option>message_id_header_text</option></primary>
58351 </indexterm>
58352 If a locally-generated or submission-mode incoming message does not contain a
58353 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
58354 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
58355 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
58356 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
58357 message id, preceded by the letter E to ensure it starts with a letter, and
58358 followed by @ and the primary host name. Additional information can be included
58359 in this header line by setting the <option>message_id_header_text</option> and/or
58360 <option>message_id_header_domain</option> options.
58361 </para>
58362 </section>
58363 <section id="SECID227">
58364 <title>The Received: header line</title>
58365 <para>
58366 <indexterm role="concept">
58367 <primary><emphasis>Received:</emphasis> header line</primary>
58368 </indexterm>
58369 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
58370 contents are defined by the <option>received_header_text</option> configuration option, and
58371 Exim automatically adds a semicolon and a timestamp to the configured string.
58372 </para>
58373 <para>
58374 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
58375 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
58376 line is the time that the message started to be received. This is the value
58377 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
58378 </para>
58379 <para>
58380 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
58381 changed to the time of acceptance, which is (apart from a small delay while the
58382 -H spool file is written) the earliest time at which delivery could start.
58383 </para>
58384 </section>
58385 <section id="SECID228">
58386 <title>The References: header line</title>
58387 <para>
58388 <indexterm role="concept">
58389 <primary><emphasis>References:</emphasis> header line</primary>
58390 </indexterm>
58391 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
58392 header line. This is constructed according to the rules that are described in
58393 section 3.64 of RFC 2822 (which states that replies should contain such a
58394 header line), and section 3.14 of RFC 3834 (which states that automatic
58395 responses are not different in this respect). However, because some mail
58396 processing software does not cope well with very long header lines, no more
58397 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
58398 incoming message. If there are more than 12, the first one and then the final
58399 11 are copied, before adding the message ID of the incoming message.
58400 </para>
58401 </section>
58402 <section id="SECID229">
58403 <title>The Return-path: header line</title>
58404 <para>
58405 <indexterm role="concept">
58406 <primary><emphasis>Return-path:</emphasis> header line</primary>
58407 </indexterm>
58408 <indexterm role="option">
58409 <primary><option>return_path_remove</option></primary>
58410 </indexterm>
58411 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
58412 it does the final delivery of messages. (See the generic <option>return_path_add</option>
58413 transport option.) Therefore, they should not be present in messages in
58414 transit. If the <option>return_path_remove</option> configuration option is set (the
58415 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
58416 </para>
58417 </section>
58418 <section id="SECTthesenhea">
58419 <title>The Sender: header line</title>
58420 <para>
58421 <indexterm role="concept">
58422 <primary><emphasis>Sender:</emphasis> header line</primary>
58423 </indexterm>
58424 <indexterm role="concept">
58425 <primary>message</primary>
58426 <secondary>submission</secondary>
58427 </indexterm>
58428 For a locally-originated message from an untrusted user, Exim may remove an
58429 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
58430 these actions by setting the <option>local_sender_retain</option> option true, the
58431 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
58432 control setting.
58433 </para>
58434 <para>
58435 When a local message is received from an untrusted user and
58436 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
58437 control has not been set, a check is made to see if the address given in the
58438 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
58439 that is expected has the login name as the local part and the value of
58440 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
58441 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
58442 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
58443 line is added to the message.
58444 </para>
58445 <para>
58446 If you set <option>local_from_check</option> false, this checking does not occur. However,
58447 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
58448 <option>local_sender_retain</option> to be true. It is not possible to set both of these
58449 options true at the same time.
58450 </para>
58451 <para>
58452 <indexterm role="concept">
58453 <primary>submission mode</primary>
58454 </indexterm>
58455 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
58456 received over TCP/IP or for messages submitted by trusted users. However, when
58457 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
58458 not specified on the submission control, the following processing takes place:
58459 </para>
58460 <para>
58461 <indexterm role="variable">
58462 <primary><varname>$authenticated_id</varname></primary>
58463 </indexterm>
58464 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
58465 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
58466 created as follows:
58467 </para>
58468 <itemizedlist>
58469 <listitem>
58470 <para>
58471 <indexterm role="variable">
58472 <primary><varname>$qualify_domain</varname></primary>
58473 </indexterm>
58474 If no domain is specified by the submission control, the local part is
58475 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
58476 </para>
58477 </listitem>
58478 <listitem>
58479 <para>
58480 If a non-empty domain is specified by the submission control, the local part
58481 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
58482 </para>
58483 </listitem>
58484 <listitem>
58485 <para>
58486 If an empty domain is specified by the submission control,
58487 <varname>$authenticated_id</varname> is assumed to be the complete address.
58488 </para>
58489 </listitem>
58490 </itemizedlist>
58491 <para>
58492 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
58493 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
58494 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
58495 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
58496 </para>
58497 <para>
58498 <indexterm role="concept">
58499 <primary>return path</primary>
58500 <secondary>created from <emphasis>Sender:</emphasis></secondary>
58501 </indexterm>
58502 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
58503 the message (the envelope sender address) is changed to be the same address,
58504 except in the case of submission mode when <option>sender_retain</option> is specified.
58505 </para>
58506 </section>
58507 <section id="SECTheadersaddrem">
58508 <title>Adding and removing header lines in routers and transports</title>
58509 <para>
58510 <indexterm role="concept">
58511 <primary>header lines</primary>
58512 <secondary>adding; in router or transport</secondary>
58513 </indexterm>
58514 <indexterm role="concept">
58515 <primary>header lines</primary>
58516 <secondary>removing; in router or transport</secondary>
58517 </indexterm>
58518 When a message is delivered, the addition and removal of header lines can be
58519 specified in a system filter, or on any of the routers and transports that
58520 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
58521 modifying headers in a system filter. Header lines can also be added in an ACL
58522 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
58523 </para>
58524 <para>
58525 In contrast to what happens in a system filter, header modifications that are
58526 specified on routers and transports apply only to the particular recipient
58527 addresses that are being processed by those routers and transports. These
58528 changes do not actually take place until a copy of the message is being
58529 transported. Therefore, they do not affect the basic set of header lines, and
58530 they do not affect the values of the variables that refer to header lines.
58531 </para>
58532 <para>
58533 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
58534 the transport cannot refer to the modified header lines, because such
58535 expansions all occur before the message is actually transported.
58536 </para>
58537 <para>
58538 For both routers and transports, the result of expanding a <option>headers_add</option>
58539 option must be in the form of one or more RFC 2822 header lines, separated by
58540 newlines (coded as <quote>\n</quote>). For example:
58541 </para>
58542 <literallayout class="monospaced">
58543 headers_add = X-added-header: added by $primary_hostname\n\
58544               X-added-second: another added header line
58545 </literallayout>
58546 <para>
58547 Exim does not check the syntax of these added header lines.
58548 </para>
58549 <para revisionflag="changed">
58550 Multiple <option>headers_add</option> options for a single router or transport can be
58551 specified; the values will be concatenated (with a separating newline
58552 added) before expansion.
58553 </para>
58554 <para>
58555 The result of expanding <option>headers_remove</option> must consist of a colon-separated
58556 list of header names. This is confusing, because header names themselves are
58557 often terminated by colons. In this case, the colons are the list separators,
58558 not part of the names. For example:
58559 </para>
58560 <literallayout class="monospaced">
58561 headers_remove = return-receipt-to:acknowledge-to
58562 </literallayout>
58563 <para>
58564 Multiple <option>headers_remove</option> options for a single router or transport can be
58565 specified; the values will be concatenated (with a separating colon
58566 added) before expansion.
58567 </para>
58568 <para>
58569 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
58570 is expanded at routing time, and then associated with all addresses that are
58571 accepted by that router, and also with any new addresses that it generates. If
58572 an address passes through several routers as a result of aliasing or
58573 forwarding, the changes are cumulative.
58574 </para>
58575 <para>
58576 <indexterm role="option">
58577 <primary><option>unseen</option></primary>
58578 </indexterm>
58579 However, this does not apply to multiple routers that result from the use of
58580 the <option>unseen</option> option. Any header modifications that were specified by the
58581 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
58582 </para>
58583 <para>
58584 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
58585 settings cannot be delivered together in a batch, so a transport is always
58586 dealing with a set of addresses that have the same header-processing
58587 requirements.
58588 </para>
58589 <para>
58590 The transport starts by writing the original set of header lines that arrived
58591 with the message, possibly modified by the system filter. As it writes out
58592 these lines, it consults the list of header names that were attached to the
58593 recipient address(es) by <option>headers_remove</option> options in routers, and it also
58594 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
58595 names are on either of these lists are not written out. If there are multiple
58596 instances of any listed header, they are all skipped.
58597 </para>
58598 <para>
58599 After the remaining original header lines have been written, new header
58600 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
58601 the order in which they were attached to the address. These are followed by any
58602 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
58603 </para>
58604 <para>
58605 This way of handling header line modifications in routers and transports has
58606 the following consequences:
58607 </para>
58608 <itemizedlist>
58609 <listitem>
58610 <para>
58611 The original set of header lines, possibly modified by the system filter,
58612 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
58613 to it, at all times.
58614 </para>
58615 </listitem>
58616 <listitem>
58617 <para>
58618 Header lines that are added by a router&#x2019;s
58619 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
58620 expansion syntax in subsequent routers or the transport.
58621 </para>
58622 </listitem>
58623 <listitem>
58624 <para>
58625 Conversely, header lines that are specified for removal by <option>headers_remove</option>
58626 in a router remain visible to subsequent routers and the transport.
58627 </para>
58628 </listitem>
58629 <listitem>
58630 <para>
58631 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
58632 a later router or by a transport.
58633 </para>
58634 </listitem>
58635 <listitem>
58636 <para>
58637 An added header can refer to the contents of an original header that is to be
58638 removed, even it has the same name as the added header. For example:
58639 </para>
58640 <literallayout class="monospaced">
58641 headers_remove = subject
58642 headers_add = Subject: new subject (was: $h_subject:)
58643 </literallayout>
58644 </listitem>
58645 </itemizedlist>
58646 <para>
58647 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
58648 for a <command>redirect</command> router that has the <option>one_time</option> option set.
58649 </para>
58650 </section>
58651 <section id="SECTconstr">
58652 <title>Constructed addresses</title>
58653 <para>
58654 <indexterm role="concept">
58655 <primary>address</primary>
58656 <secondary>constructed</secondary>
58657 </indexterm>
58658 <indexterm role="concept">
58659 <primary>constructed address</primary>
58660 </indexterm>
58661 When Exim constructs a sender address for a locally-generated message, it uses
58662 the form
58663 </para>
58664 <literallayout>
58665 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
58666 </literallayout>
58667 <para>
58668 For example:
58669 </para>
58670 <literallayout class="monospaced">
58671 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
58672 </literallayout>
58673 <para>
58674 The user name is obtained from the <option>-F</option> command line option if set, or
58675 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
58676 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
58677 ampersand character, this is replaced by the login name with the first letter
58678 upper cased, as is conventional in a number of operating systems. See the
58679 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
58680 The <option>unknown_username</option> option can be used to specify user names in cases when
58681 there is no password file entry.
58682 </para>
58683 <para>
58684 <indexterm role="concept">
58685 <primary>RFC 2047</primary>
58686 </indexterm>
58687 In all cases, the user name is made to conform to RFC 2822 by quoting all or
58688 parts of it if necessary. In addition, if it contains any non-printing
58689 characters, it is encoded as described in RFC 2047, which defines a way of
58690 including non-ASCII characters in header lines. The value of the
58691 <option>headers_charset</option> option specifies the name of the encoding that is used (the
58692 characters are assumed to be in this encoding). The setting of
58693 <option>print_topbitchars</option> controls whether characters with the top bit set (that
58694 is, with codes greater than 127) count as printing characters or not.
58695 </para>
58696 </section>
58697 <section id="SECID230">
58698 <title>Case of local parts</title>
58699 <para>
58700 <indexterm role="concept">
58701 <primary>case of local parts</primary>
58702 </indexterm>
58703 <indexterm role="concept">
58704 <primary>local part</primary>
58705 <secondary>case of</secondary>
58706 </indexterm>
58707 RFC 2822 states that the case of letters in the local parts of addresses cannot
58708 be assumed to be non-significant. Exim preserves the case of local parts of
58709 addresses, but by default it uses a lower-cased form when it is routing,
58710 because on most Unix systems, usernames are in lower case and case-insensitive
58711 routing is required. However, any particular router can be made to use the
58712 original case for local parts by setting the <option>caseful_local_part</option> generic
58713 router option.
58714 </para>
58715 <para>
58716 <indexterm role="concept">
58717 <primary>mixed-case login names</primary>
58718 </indexterm>
58719 If you must have mixed-case user names on your system, the best way to proceed,
58720 assuming you want case-independent handling of incoming email, is to set up
58721 your first router to convert incoming local parts in your domains to the
58722 correct case by means of a file lookup. For example:
58723 </para>
58724 <literallayout class="monospaced">
58725 correct_case:
58726   driver = redirect
58727   domains = +local_domains
58728   data = ${lookup{$local_part}cdb\
58729               {/etc/usercased.cdb}{$value}fail}\
58730               @$domain
58731 </literallayout>
58732 <para>
58733 For this router, the local part is forced to lower case by the default action
58734 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
58735 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
58736 on any subsequent routers which process your domains, they will operate on
58737 local parts with the correct case in a case-sensitive manner.
58738 </para>
58739 </section>
58740 <section id="SECID231">
58741 <title>Dots in local parts</title>
58742 <para>
58743 <indexterm role="concept">
58744 <primary>dot</primary>
58745 <secondary>in local part</secondary>
58746 </indexterm>
58747 <indexterm role="concept">
58748 <primary>local part</primary>
58749 <secondary>dots in</secondary>
58750 </indexterm>
58751 RFC 2822 forbids empty components in local parts. That is, an unquoted local
58752 part may not begin or end with a dot, nor have two consecutive dots in the
58753 middle. However, it seems that many MTAs do not enforce this, so Exim permits
58754 empty components for compatibility.
58755 </para>
58756 </section>
58757 <section id="SECID232">
58758 <title>Rewriting addresses</title>
58759 <para>
58760 <indexterm role="concept">
58761 <primary>rewriting</primary>
58762 <secondary>addresses</secondary>
58763 </indexterm>
58764 Rewriting of sender and recipient addresses, and addresses in headers, can
58765 happen automatically, or as the result of configuration options, as described
58766 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
58767 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
58768 </para>
58769 <para>
58770 Automatic rewriting includes qualification, as mentioned above. The other case
58771 in which it can happen is when an incomplete non-local domain is given. The
58772 routing process may cause this to be expanded into the full domain name. For
58773 example, a header such as
58774 </para>
58775 <literallayout class="monospaced">
58776 To: hare@teaparty
58777 </literallayout>
58778 <para>
58779 might get rewritten as
58780 </para>
58781 <literallayout class="monospaced">
58782 To: hare@teaparty.wonderland.fict.example
58783 </literallayout>
58784 <para>
58785 Rewriting as a result of routing is the one kind of message processing that
58786 does not happen at input time, as it cannot be done until the address has
58787 been routed.
58788 </para>
58789 <para>
58790 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
58791 addresses have been routed, in case any of the headers get changed as a
58792 result of routing. However, doing this in practice would hold up many
58793 deliveries for unreasonable amounts of time, just because one address could not
58794 immediately be routed. Exim therefore does not delay other deliveries when
58795 routing of one or more addresses is deferred.
58796 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
58797 </para>
58798 </section>
58799 </chapter>
58800
58801 <chapter id="CHAPSMTP">
58802 <title>SMTP processing</title>
58803 <para>
58804 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
58805 <primary>SMTP</primary>
58806 <secondary>processing details</secondary>
58807 </indexterm>
58808 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
58809 <primary>LMTP</primary>
58810 <secondary>processing details</secondary>
58811 </indexterm>
58812 Exim supports a number of different ways of using the SMTP protocol, and its
58813 LMTP variant, which is an interactive protocol for transferring messages into a
58814 closed mail store application. This chapter contains details of how SMTP is
58815 processed. For incoming mail, the following are available:
58816 </para>
58817 <itemizedlist>
58818 <listitem>
58819 <para>
58820 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
58821 </para>
58822 </listitem>
58823 <listitem>
58824 <para>
58825 SMTP over the standard input and output (the <option>-bs</option> option);
58826 </para>
58827 </listitem>
58828 <listitem>
58829 <para>
58830 Batched SMTP on the standard input (the <option>-bS</option> option).
58831 </para>
58832 </listitem>
58833 </itemizedlist>
58834 <para>
58835 For mail delivery, the following are available:
58836 </para>
58837 <itemizedlist>
58838 <listitem>
58839 <para>
58840 SMTP over TCP/IP (the <command>smtp</command> transport);
58841 </para>
58842 </listitem>
58843 <listitem>
58844 <para>
58845 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
58846 <quote>lmtp</quote>);
58847 </para>
58848 </listitem>
58849 <listitem>
58850 <para>
58851 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
58852 transport);
58853 </para>
58854 </listitem>
58855 <listitem>
58856 <para>
58857 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
58858 the <option>use_bsmtp</option> option set).
58859 </para>
58860 </listitem>
58861 </itemizedlist>
58862 <para>
58863 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
58864 stored in or read from files (or pipes), in a format in which SMTP commands are
58865 used to contain the envelope information.
58866 </para>
58867 <section id="SECToutSMTPTCP">
58868 <title>Outgoing SMTP and LMTP over TCP/IP</title>
58869 <para>
58870 <indexterm role="concept">
58871 <primary>SMTP</primary>
58872 <secondary>outgoing over TCP/IP</secondary>
58873 </indexterm>
58874 <indexterm role="concept">
58875 <primary>outgoing SMTP over TCP/IP</primary>
58876 </indexterm>
58877 <indexterm role="concept">
58878 <primary>LMTP</primary>
58879 <secondary>over TCP/IP</secondary>
58880 </indexterm>
58881 <indexterm role="concept">
58882 <primary>outgoing LMTP over TCP/IP</primary>
58883 </indexterm>
58884 <indexterm role="concept">
58885 <primary>EHLO</primary>
58886 </indexterm>
58887 <indexterm role="concept">
58888 <primary>HELO</primary>
58889 </indexterm>
58890 <indexterm role="concept">
58891 <primary>SIZE option on MAIL command</primary>
58892 </indexterm>
58893 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
58894 The <option>protocol</option> option selects which protocol is to be used, but the actual
58895 processing is the same in both cases.
58896 </para>
58897 <para>
58898 If, in response to its EHLO command, Exim is told that the SIZE
58899 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
58900 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
58901 <option>size_addition</option> option (default 1024) to allow for additions to the message
58902 such as per-transport header lines, or changes made in a
58903 <indexterm role="concept">
58904 <primary>transport</primary>
58905 <secondary>filter</secondary>
58906 </indexterm>
58907 <indexterm role="concept">
58908 <primary>filter</primary>
58909 <secondary>transport filter</secondary>
58910 </indexterm>
58911 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
58912 suppressed.
58913 </para>
58914 <para>
58915 If the remote server advertises support for PIPELINING, Exim uses the
58916 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
58917 required for the transaction.
58918 </para>
58919 <para>
58920 If the remote server advertises support for the STARTTLS command, and Exim
58921 was built to support TLS encryption, it tries to start a TLS session unless the
58922 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
58923 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
58924 is called for verification.
58925 </para>
58926 <para>
58927 If the remote server advertises support for the AUTH command, Exim scans
58928 the authenticators configuration for any suitable client settings, as described
58929 in chapter <xref linkend="CHAPSMTPAUTH"/>.
58930 </para>
58931 <para>
58932 <indexterm role="concept">
58933 <primary>carriage return</primary>
58934 </indexterm>
58935 <indexterm role="concept">
58936 <primary>linefeed</primary>
58937 </indexterm>
58938 Responses from the remote host are supposed to be terminated by CR followed by
58939 LF. However, there are known to be hosts that do not send CR characters, so in
58940 order to be able to interwork with such hosts, Exim treats LF on its own as a
58941 line terminator.
58942 </para>
58943 <para>
58944 If a message contains a number of different addresses, all those with the same
58945 characteristics (for example, the same envelope sender) that resolve to the
58946 same set of hosts, in the same order, are sent in a single SMTP transaction,
58947 even if they are for different domains, unless there are more than the setting
58948 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
58949 they are split into groups containing no more than <option>max_rcpt</option>s addresses
58950 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
58951 in parallel sessions. The order of hosts with identical MX values is not
58952 significant when checking whether addresses can be batched in this way.
58953 </para>
58954 <para>
58955 When the <command>smtp</command> transport suffers a temporary failure that is not
58956 message-related, Exim updates its transport-specific database, which contains
58957 records indexed by host name that remember which messages are waiting for each
58958 particular host. It also updates the retry database with new retry times.
58959 </para>
58960 <para>
58961 <indexterm role="concept">
58962 <primary>hints database</primary>
58963 <secondary>retry keys</secondary>
58964 </indexterm>
58965 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
58966 a multi-homed host is broken, it will soon be skipped most of the time.
58967 See the next section for more detail about error handling.
58968 </para>
58969 <para>
58970 <indexterm role="concept">
58971 <primary>SMTP</primary>
58972 <secondary>passed connection</secondary>
58973 </indexterm>
58974 <indexterm role="concept">
58975 <primary>SMTP</primary>
58976 <secondary>batching over TCP/IP</secondary>
58977 </indexterm>
58978 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
58979 looks in the hints database for the transport to see if there are any queued
58980 messages waiting for the host to which it is connected. If it finds one, it
58981 creates a new Exim process using the <option>-MC</option> option (which can only be used by
58982 a process running as root or the Exim user) and passes the TCP/IP socket to it
58983 so that it can deliver another message using the same socket. The new process
58984 does only those deliveries that are routed to the connected host, and may in
58985 turn pass the socket on to a third process, and so on.
58986 </para>
58987 <para>
58988 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
58989 limit the number of messages sent down a single TCP/IP connection.
58990 </para>
58991 <para>
58992 <indexterm role="concept">
58993 <primary>asterisk</primary>
58994 <secondary>after IP address</secondary>
58995 </indexterm>
58996 The second and subsequent messages delivered down an existing connection are
58997 identified in the main log by the addition of an asterisk after the closing
58998 square bracket of the IP address.
58999 </para>
59000 </section>
59001 <section id="SECToutSMTPerr">
59002 <title>Errors in outgoing SMTP</title>
59003 <para>
59004 <indexterm role="concept">
59005 <primary>error</primary>
59006 <secondary>in outgoing SMTP</secondary>
59007 </indexterm>
59008 <indexterm role="concept">
59009 <primary>SMTP</primary>
59010 <secondary>errors in outgoing</secondary>
59011 </indexterm>
59012 <indexterm role="concept">
59013 <primary>host</primary>
59014 <secondary>error</secondary>
59015 </indexterm>
59016 Three different kinds of error are recognized for outgoing SMTP: host errors,
59017 message errors, and recipient errors.
59018 </para>
59019 <variablelist>
59020 <varlistentry>
59021 <term><emphasis role="bold">Host errors</emphasis></term>
59022 <listitem>
59023 <para>
59024 A host error is not associated with a particular message or with a
59025 particular recipient of a message. The host errors are:
59026 </para>
59027 <itemizedlist>
59028 <listitem>
59029 <para>
59030 Connection refused or timed out,
59031 </para>
59032 </listitem>
59033 <listitem>
59034 <para>
59035 Any error response code on connection,
59036 </para>
59037 </listitem>
59038 <listitem>
59039 <para>
59040 Any error response code to EHLO or HELO,
59041 </para>
59042 </listitem>
59043 <listitem>
59044 <para>
59045 Loss of connection at any time, except after <quote>.</quote>,
59046 </para>
59047 </listitem>
59048 <listitem>
59049 <para>
59050 I/O errors at any time,
59051 </para>
59052 </listitem>
59053 <listitem>
59054 <para>
59055 Timeouts during the session, other than in response to MAIL, RCPT or
59056 the <quote>.</quote> at the end of the data.
59057 </para>
59058 </listitem>
59059 </itemizedlist>
59060 <para>
59061 For a host error, a permanent error response on connection, or in response to
59062 EHLO, causes all addresses routed to the host to be failed. Any other host
59063 error causes all addresses to be deferred, and retry data to be created for the
59064 host. It is not tried again, for any message, until its retry time arrives. If
59065 the current set of addresses are not all delivered in this run (to some
59066 alternative host), the message is added to the list of those waiting for this
59067 host, so if it is still undelivered when a subsequent successful delivery is
59068 made to the host, it will be sent down the same SMTP connection.
59069 </para>
59070 </listitem></varlistentry>
59071 <varlistentry>
59072 <term><emphasis role="bold">Message errors</emphasis></term>
59073 <listitem>
59074 <para>
59075 <indexterm role="concept">
59076 <primary>message</primary>
59077 <secondary>error</secondary>
59078 </indexterm>
59079 A message error is associated with a particular message when sent to a
59080 particular host, but not with a particular recipient of the message. The
59081 message errors are:
59082 </para>
59083 <itemizedlist>
59084 <listitem>
59085 <para>
59086 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
59087 the data,
59088 </para>
59089 </listitem>
59090 <listitem>
59091 <para>
59092 Timeout after MAIL,
59093 </para>
59094 </listitem>
59095 <listitem>
59096 <para>
59097 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
59098 timeout after the DATA command itself is treated as a host error, as is loss of
59099 connection at any other time.
59100 </para>
59101 </listitem>
59102 </itemizedlist>
59103 <para>
59104 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
59105 to be failed, and a delivery error report to be returned to the sender. A
59106 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
59107 addresses to be deferred. Retry data is not created for the host, but instead,
59108 a retry record for the combination of host plus message id is created. The
59109 message is not added to the list of those waiting for this host. This ensures
59110 that the failing message will not be sent to this host again until the retry
59111 time arrives. However, other messages that are routed to the host are not
59112 affected, so if it is some property of the message that is causing the error,
59113 it will not stop the delivery of other mail.
59114 </para>
59115 <para>
59116 If the remote host specified support for the SIZE parameter in its response
59117 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
59118 over-large message will cause a message error because the error arrives as a
59119 response to MAIL.
59120 </para>
59121 </listitem></varlistentry>
59122 <varlistentry>
59123 <term><emphasis role="bold">Recipient errors</emphasis></term>
59124 <listitem>
59125 <para>
59126 <indexterm role="concept">
59127 <primary>recipient</primary>
59128 <secondary>error</secondary>
59129 </indexterm>
59130 A recipient error is associated with a particular recipient of a message. The
59131 recipient errors are:
59132 </para>
59133 <itemizedlist>
59134 <listitem>
59135 <para>
59136 Any error response to RCPT,
59137 </para>
59138 </listitem>
59139 <listitem>
59140 <para>
59141 Timeout after RCPT.
59142 </para>
59143 </listitem>
59144 </itemizedlist>
59145 <para>
59146 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
59147 recipient address to be failed, and a bounce message to be returned to the
59148 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
59149 address to be deferred, and routing retry data to be created for it. This is
59150 used to delay processing of the address in subsequent queue runs, until its
59151 routing retry time arrives. This applies to all messages, but because it
59152 operates only in queue runs, one attempt will be made to deliver a new message
59153 to the failing address before the delay starts to operate. This ensures that,
59154 if the failure is really related to the message rather than the recipient
59155 (<quote>message too big for this recipient</quote> is a possible example), other messages
59156 have a chance of getting delivered. If a delivery to the address does succeed,
59157 the retry information gets cleared, so all stuck messages get tried again, and
59158 the retry clock is reset.
59159 </para>
59160 <para>
59161 The message is not added to the list of those waiting for this host. Use of the
59162 host for other messages is unaffected, and except in the case of a timeout,
59163 other recipients are processed independently, and may be successfully delivered
59164 in the current SMTP session. After a timeout it is of course impossible to
59165 proceed with the session, so all addresses get deferred. However, those other
59166 than the one that failed do not suffer any subsequent retry delays. Therefore,
59167 if one recipient is causing trouble, the others have a chance of getting
59168 through when a subsequent delivery attempt occurs before the failing
59169 recipient&#x2019;s retry time.
59170 </para>
59171 </listitem></varlistentry>
59172 </variablelist>
59173 <para>
59174 In all cases, if there are other hosts (or IP addresses) available for the
59175 current set of addresses (for example, from multiple MX records), they are
59176 tried in this run for any undelivered addresses, subject of course to their
59177 own retry data. In other words, recipient error retry data does not take effect
59178 until the next delivery attempt.
59179 </para>
59180 <para>
59181 Some hosts have been observed to give temporary error responses to every
59182 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
59183 would be nice if such circumstances could be recognized, and defer data for the
59184 host itself created, but this is not possible within the current Exim design.
59185 What actually happens is that retry data for every (host, message) combination
59186 is created.
59187 </para>
59188 <para>
59189 The reason that timeouts after MAIL and RCPT are treated specially is that
59190 these can sometimes arise as a result of the remote host&#x2019;s verification
59191 procedures. Exim makes this assumption, and treats them as if a temporary error
59192 response had been received. A timeout after <quote>.</quote> is treated specially because
59193 it is known that some broken implementations fail to recognize the end of the
59194 message if the last character of the last line is a binary zero. Thus, it is
59195 helpful to treat this case as a message error.
59196 </para>
59197 <para>
59198 Timeouts at other times are treated as host errors, assuming a problem with the
59199 host, or the connection to it. If a timeout after MAIL, RCPT,
59200 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
59201 the timeout is likely to occur at some other point in the dialogue, causing it
59202 then to be treated as a host error.
59203 </para>
59204 <para>
59205 There is experimental evidence that some MTAs drop the connection after the
59206 terminating <quote>.</quote> if they do not like the contents of the message for some
59207 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
59208 should be given. That is why Exim treats this case as a message rather than a
59209 host error, in order not to delay other messages to the same host.
59210 </para>
59211 </section>
59212 <section id="SECID233">
59213 <title>Incoming SMTP messages over TCP/IP</title>
59214 <para>
59215 <indexterm role="concept">
59216 <primary>SMTP</primary>
59217 <secondary>incoming over TCP/IP</secondary>
59218 </indexterm>
59219 <indexterm role="concept">
59220 <primary>incoming SMTP over TCP/IP</primary>
59221 </indexterm>
59222 <indexterm role="concept">
59223 <primary>inetd</primary>
59224 </indexterm>
59225 <indexterm role="concept">
59226 <primary>daemon</primary>
59227 </indexterm>
59228 Incoming SMTP messages can be accepted in one of two ways: by running a
59229 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
59230 <filename>/etc/inetd.conf</filename> should be like this:
59231 </para>
59232 <literallayout class="monospaced">
59233 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
59234 </literallayout>
59235 <para>
59236 Exim distinguishes between this case and the case of a locally running user
59237 agent using the <option>-bs</option> option by checking whether or not the standard input is
59238 a socket. When it is, either the port must be privileged (less than 1024), or
59239 the caller must be root or the Exim user. If any other user passes a socket
59240 with an unprivileged port number, Exim prints a message on the standard error
59241 stream and exits with an error code.
59242 </para>
59243 <para>
59244 By default, Exim does not make a log entry when a remote host connects or
59245 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
59246 unexpected. It can be made to write such log entries by setting the
59247 <option>smtp_connection</option> log selector.
59248 </para>
59249 <para>
59250 <indexterm role="concept">
59251 <primary>carriage return</primary>
59252 </indexterm>
59253 <indexterm role="concept">
59254 <primary>linefeed</primary>
59255 </indexterm>
59256 Commands from the remote host are supposed to be terminated by CR followed by
59257 LF. However, there are known to be hosts that do not send CR characters. In
59258 order to be able to interwork with such hosts, Exim treats LF on its own as a
59259 line terminator.
59260 Furthermore, because common code is used for receiving messages from all
59261 sources, a CR on its own is also interpreted as a line terminator. However, the
59262 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
59263 </para>
59264 <para>
59265 <indexterm role="concept">
59266 <primary>EHLO</primary>
59267 <secondary>invalid data</secondary>
59268 </indexterm>
59269 <indexterm role="concept">
59270 <primary>HELO</primary>
59271 <secondary>invalid data</secondary>
59272 </indexterm>
59273 One area that sometimes gives rise to problems concerns the EHLO or
59274 HELO commands. Some clients send syntactically invalid versions of these
59275 commands, which Exim rejects by default. (This is nothing to do with verifying
59276 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
59277 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
59278 match the broken hosts that send invalid commands.
59279 </para>
59280 <para>
59281 <indexterm role="concept">
59282 <primary>SIZE option on MAIL command</primary>
59283 </indexterm>
59284 <indexterm role="concept">
59285 <primary>MAIL</primary>
59286 <secondary>SIZE option</secondary>
59287 </indexterm>
59288 The amount of disk space available is checked whenever SIZE is received on
59289 a MAIL command, independently of whether <option>message_size_limit</option> or
59290 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
59291 false. A temporary error is given if there is not enough space. If
59292 <option>check_spool_space</option> is set, the check is for that amount of space plus the
59293 value given with SIZE, that is, it checks that the addition of the incoming
59294 message will not reduce the space below the threshold.
59295 </para>
59296 <para>
59297 When a message is successfully received, Exim includes the local message id in
59298 its response to the final <quote>.</quote> that terminates the data. If the remote host
59299 logs this text it can help with tracing what has happened to a message.
59300 </para>
59301 <para>
59302 The Exim daemon can limit the number of simultaneous incoming connections it is
59303 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
59304 number of simultaneous incoming connections from a single remote host (see the
59305 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
59306 rejected using the SMTP temporary error code 421.
59307 </para>
59308 <para>
59309 The Exim daemon does not rely on the SIGCHLD signal to detect when a
59310 subprocess has finished, as this can get lost at busy times. Instead, it looks
59311 for completed subprocesses every time it wakes up. Provided there are other
59312 things happening (new incoming calls, starts of queue runs), completed
59313 processes will be noticed and tidied away. On very quiet systems you may
59314 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
59315 it will be noticed when the daemon next wakes up.
59316 </para>
59317 <para>
59318 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
59319 and can also be set up to reject SMTP calls from non-reserved hosts at times of
59320 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
59321 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
59322 applies in both the daemon and <emphasis>inetd</emphasis> cases.
59323 </para>
59324 <para>
59325 Exim normally starts a delivery process for each message received, though this
59326 can be varied by means of the <option>-odq</option> command line option and the
59327 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
59328 number of simultaneously running delivery processes started in this way from
59329 SMTP input can be limited by the <option>smtp_accept_queue</option> and
59330 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
59331 subsequently received messages are just put on the input queue without starting
59332 a delivery process.
59333 </para>
59334 <para>
59335 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
59336 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
59337 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
59338 handled by an entirely independent Exim process. Control by load average is,
59339 however, available with <emphasis>inetd</emphasis>.
59340 </para>
59341 <para>
59342 Exim can be configured to verify addresses in incoming SMTP commands as they
59343 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
59344 to rewrite addresses at this time &ndash; before any syntax checking is done. See
59345 section <xref linkend="SECTrewriteS"/>.
59346 </para>
59347 <para>
59348 Exim can also be configured to limit the rate at which a client host submits
59349 MAIL and RCPT commands in a single SMTP session. See the
59350 <option>smtp_ratelimit_hosts</option> option.
59351 </para>
59352 </section>
59353 <section id="SECID234">
59354 <title>Unrecognized SMTP commands</title>
59355 <para>
59356 <indexterm role="concept">
59357 <primary>SMTP</primary>
59358 <secondary>unrecognized commands</secondary>
59359 </indexterm>
59360 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
59361 commands during a single SMTP connection, it drops the connection after sending
59362 the error response to the last command. The default value for
59363 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
59364 abuse that subvert web servers into making connections to SMTP ports; in these
59365 circumstances, a number of non-SMTP lines are sent first.
59366 </para>
59367 </section>
59368 <section id="SECID235">
59369 <title>Syntax and protocol errors in SMTP commands</title>
59370 <para>
59371 <indexterm role="concept">
59372 <primary>SMTP</primary>
59373 <secondary>syntax errors</secondary>
59374 </indexterm>
59375 <indexterm role="concept">
59376 <primary>SMTP</primary>
59377 <secondary>protocol errors</secondary>
59378 </indexterm>
59379 A syntax error is detected if an SMTP command is recognized, but there is
59380 something syntactically wrong with its data, for example, a malformed email
59381 address in a RCPT command. Protocol errors include invalid command
59382 sequencing such as RCPT before MAIL. If Exim receives more than
59383 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
59384 drops the connection after sending the error response to the last command. The
59385 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
59386 broken clients that loop sending bad commands (yes, it has been seen).
59387 </para>
59388 </section>
59389 <section id="SECID236">
59390 <title>Use of non-mail SMTP commands</title>
59391 <para>
59392 <indexterm role="concept">
59393 <primary>SMTP</primary>
59394 <secondary>non-mail commands</secondary>
59395 </indexterm>
59396 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
59397 DATA. Exim counts such commands, and drops the connection if there are too
59398 many of them in a single SMTP session. This action catches some
59399 denial-of-service attempts and things like repeated failing AUTHs, or a mad
59400 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
59401 defines what <quote>too many</quote> means. Its default value is 10.
59402 </para>
59403 <para>
59404 When a new message is expected, one occurrence of RSET is not counted. This
59405 allows a client to send one RSET between messages (this is not necessary,
59406 but some clients do it). Exim also allows one uncounted occurrence of HELO
59407 or EHLO, and one occurrence of STARTTLS between messages. After
59408 starting up a TLS session, another EHLO is expected, and so it too is not
59409 counted.
59410 </para>
59411 <para>
59412 The first occurrence of AUTH in a connection, or immediately following
59413 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
59414 RCPT, DATA, and QUIT are counted.
59415 </para>
59416 <para>
59417 You can control which hosts are subject to the limit set by
59418 <option>smtp_accept_max_nonmail</option> by setting
59419 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
59420 the limit apply to all hosts. This option means that you can exclude any
59421 specific badly-behaved hosts that you have to live with.
59422 </para>
59423 </section>
59424 <section id="SECID237">
59425 <title>The VRFY and EXPN commands</title>
59426 <para>
59427 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
59428 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
59429 appropriate) in order to decide whether the command should be accepted or not.
59430 If no ACL is defined, the command is rejected.
59431 </para>
59432 <para>
59433 <indexterm role="concept">
59434 <primary>VRFY</primary>
59435 <secondary>processing</secondary>
59436 </indexterm>
59437 When VRFY is accepted, it runs exactly the same code as when Exim is
59438 called with the <option>-bv</option> option.
59439 </para>
59440 <para>
59441 <indexterm role="concept">
59442 <primary>EXPN</primary>
59443 <secondary>processing</secondary>
59444 </indexterm>
59445 When EXPN is accepted, a single-level expansion of the address is done.
59446 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
59447 than a verification (the <option>-bv</option> option). If an unqualified local part is given
59448 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
59449 of VRFY and EXPN commands are logged on the main and reject logs, and
59450 VRFY verification failures are logged on the main log for consistency with
59451 RCPT failures.
59452 </para>
59453 </section>
59454 <section id="SECTETRN">
59455 <title>The ETRN command</title>
59456 <para>
59457 <indexterm role="concept">
59458 <primary>ETRN</primary>
59459 <secondary>processing</secondary>
59460 </indexterm>
59461 RFC 1985 describes an SMTP command called ETRN that is designed to
59462 overcome the security problems of the TURN command (which has fallen into
59463 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
59464 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
59465 should be accepted or not. If no ACL is defined, the command is rejected.
59466 </para>
59467 <para>
59468 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
59469 delivery to certain hosts. As Exim does not organize its message queue by host,
59470 the only form of ETRN that is supported by default is the one where the
59471 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
59472 specific to the SMTP server. A valid ETRN command causes a run of Exim with
59473 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
59474 argument. For example,
59475 </para>
59476 <literallayout class="monospaced">
59477 ETRN #brigadoon
59478 </literallayout>
59479 <para>
59480 runs the command
59481 </para>
59482 <literallayout class="monospaced">
59483 exim -R brigadoon
59484 </literallayout>
59485 <para>
59486 which causes a delivery attempt on all messages with undelivered addresses
59487 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
59488 default), Exim prevents the simultaneous execution of more than one queue run
59489 for the same argument string as a result of an ETRN command. This stops
59490 a misbehaving client from starting more than one queue runner at once.
59491 </para>
59492 <para>
59493 <indexterm role="concept">
59494 <primary>hints database</primary>
59495 <secondary>ETRN serialization</secondary>
59496 </indexterm>
59497 Exim implements the serialization by means of a hints database in which a
59498 record is written whenever a process is started by ETRN, and deleted when
59499 the process completes. However, Exim does not keep the SMTP session waiting for
59500 the ETRN process to complete. Once ETRN is accepted, the client is sent
59501 a <quote>success</quote> return code. Obviously there is scope for hints records to get
59502 left lying around if there is a system or program crash. To guard against this,
59503 Exim ignores any records that are more than six hours old.
59504 </para>
59505 <para>
59506 <indexterm role="option">
59507 <primary><option>smtp_etrn_command</option></primary>
59508 </indexterm>
59509 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
59510 used. This specifies a command that is run whenever ETRN is received,
59511 whatever the form of its argument. For
59512 example:
59513 </para>
59514 <literallayout class="monospaced">
59515 smtp_etrn_command = /etc/etrn_command $domain \
59516                     $sender_host_address
59517 </literallayout>
59518 <para>
59519 <indexterm role="variable">
59520 <primary><varname>$domain</varname></primary>
59521 </indexterm>
59522 The string is split up into arguments which are independently expanded. The
59523 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
59524 and no syntax checking is done on the contents of this argument. Exim does not
59525 wait for the command to complete, so its status code is not checked. Exim runs
59526 under its own uid and gid when receiving incoming SMTP, so it is not possible
59527 for it to change them before running the command.
59528 </para>
59529 </section>
59530 <section id="SECID238">
59531 <title>Incoming local SMTP</title>
59532 <para>
59533 <indexterm role="concept">
59534 <primary>SMTP</primary>
59535 <secondary>local incoming</secondary>
59536 </indexterm>
59537 Some user agents use SMTP to pass messages to their local MTA using the
59538 standard input and output, as opposed to passing the envelope on the command
59539 line and writing the message to the standard input. This is supported by the
59540 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
59541 messages over TCP/IP (including the use of ACLs), except that the envelope
59542 sender given in a MAIL command is ignored unless the caller is trusted. In
59543 an ACL you can detect this form of SMTP input by testing for an empty host
59544 identification. It is common to have this as the first line in the ACL that
59545 runs for RCPT commands:
59546 </para>
59547 <literallayout class="monospaced">
59548 accept hosts = :
59549 </literallayout>
59550 <para>
59551 This accepts SMTP messages from local processes without doing any other tests.
59552 </para>
59553 </section>
59554 <section id="SECTbatchSMTP">
59555 <title>Outgoing batched SMTP</title>
59556 <para>
59557 <indexterm role="concept">
59558 <primary>SMTP</primary>
59559 <secondary>batched outgoing</secondary>
59560 </indexterm>
59561 <indexterm role="concept">
59562 <primary>batched SMTP output</primary>
59563 </indexterm>
59564 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
59565 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
59566 be output in BSMTP format. No SMTP responses are possible for this form of
59567 delivery. All it is doing is using SMTP commands as a way of transmitting the
59568 envelope along with the message.
59569 </para>
59570 <para>
59571 The message is written to the file or pipe preceded by the SMTP commands
59572 MAIL and RCPT, and followed by a line containing a single dot. Lines in
59573 the message that start with a dot have an extra dot added. The SMTP command
59574 HELO is not normally used. If it is required, the <option>message_prefix</option> option
59575 can be used to specify it.
59576 </para>
59577 <para>
59578 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
59579 one recipient address at a time by default. However, you can arrange for them
59580 to handle several addresses at once by setting the <option>batch_max</option> option. When
59581 this is done for BSMTP, messages may contain multiple RCPT commands. See
59582 chapter <xref linkend="CHAPbatching"/> for more details.
59583 </para>
59584 <para>
59585 <indexterm role="variable">
59586 <primary><varname>$host</varname></primary>
59587 </indexterm>
59588 When one or more addresses are routed to a BSMTP transport by a router that
59589 sets up a host list, the name of the first host on the list is available to the
59590 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
59591 router:
59592 </para>
59593 <literallayout class="monospaced">
59594 begin routers
59595 route_append:
59596   driver = manualroute
59597   transport = smtp_appendfile
59598   route_list = domain.example  batch.host.example
59599
59600 begin transports
59601 smtp_appendfile:
59602   driver = appendfile
59603   directory = /var/bsmtp/$host
59604   batch_max = 1000
59605   use_bsmtp
59606   user = exim
59607 </literallayout>
59608 <para>
59609 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
59610 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
59611 message (unless there are more than 1000 recipients).
59612 </para>
59613 </section>
59614 <section id="SECTincomingbatchedSMTP">
59615 <title>Incoming batched SMTP</title>
59616 <para>
59617 <indexterm role="concept">
59618 <primary>SMTP</primary>
59619 <secondary>batched incoming</secondary>
59620 </indexterm>
59621 <indexterm role="concept">
59622 <primary>batched SMTP input</primary>
59623 </indexterm>
59624 The <option>-bS</option> command line option causes Exim to accept one or more messages by
59625 reading SMTP on the standard input, but to generate no responses. If the caller
59626 is trusted, the senders in the MAIL commands are believed; otherwise the
59627 sender is always the caller of Exim. Unqualified senders and receivers are not
59628 rejected (there seems little point) but instead just get qualified. HELO
59629 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
59630 as NOOP; QUIT quits.
59631 </para>
59632 <para>
59633 Minimal policy checking is done for BSMTP input. Only the non-SMTP
59634 ACL is run in the same way as for non-SMTP local input.
59635 </para>
59636 <para>
59637 If an error is detected while reading a message, including a missing <quote>.</quote> at
59638 the end, Exim gives up immediately. It writes details of the error to the
59639 standard output in a stylized way that the calling program should be able to
59640 make some use of automatically, for example:
59641 </para>
59642 <literallayout class="monospaced">
59643 554 Unexpected end of file
59644 Transaction started in line 10
59645 Error detected in line 14
59646 </literallayout>
59647 <para>
59648 It writes a more verbose version, for human consumption, to the standard error
59649 file, for example:
59650 </para>
59651 <literallayout class="monospaced">
59652 An error was detected while processing a file of BSMTP input.
59653 The error message was:
59654
59655 501 '&gt;' missing at end of address
59656
59657 The SMTP transaction started in line 10.
59658 The error was detected in line 12.
59659 The SMTP command at fault was:
59660
59661 rcpt to:&lt;malformed@in.com.plete
59662
59663 1 previous message was successfully processed.
59664 The rest of the batch was abandoned.
59665 </literallayout>
59666 <para>
59667 The return code from Exim is zero only if there were no errors. It is 1 if some
59668 messages were accepted before an error was detected, and 2 if no messages were
59669 accepted.
59670 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
59671 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
59672 </para>
59673 </section>
59674 </chapter>
59675
59676 <chapter id="CHAPemsgcust">
59677 <title>Customizing bounce and warning messages</title>
59678 <titleabbrev>Customizing messages</titleabbrev>
59679 <para>
59680 When a message fails to be delivered, or remains on the queue for more than a
59681 configured amount of time, Exim sends a message to the original sender, or
59682 to an alternative configured address. The text of these messages is built into
59683 the code of Exim, but it is possible to change it, either by adding a single
59684 string, or by replacing each of the paragraphs by text supplied in a file.
59685 </para>
59686 <para>
59687 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
59688 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
59689 option. Exim also adds the line
59690 </para>
59691 <literallayout class="monospaced">
59692 Auto-Submitted: auto-generated
59693 </literallayout>
59694 <para>
59695 to all warning and bounce messages,
59696 </para>
59697 <section id="SECID239">
59698 <title>Customizing bounce messages</title>
59699 <para>
59700 <indexterm role="concept">
59701 <primary>customizing</primary>
59702 <secondary>bounce message</secondary>
59703 </indexterm>
59704 <indexterm role="concept">
59705 <primary>bounce message</primary>
59706 <secondary>customizing</secondary>
59707 </indexterm>
59708 If <option>bounce_message_text</option> is set, its contents are included in the default
59709 message immediately after <quote>This message was created automatically by mail
59710 delivery software.</quote> The string is not expanded. It is not used if
59711 <option>bounce_message_file</option> is set.
59712 </para>
59713 <para>
59714 When <option>bounce_message_file</option> is set, it must point to a template file for
59715 constructing error messages. The file consists of a series of text items,
59716 separated by lines consisting of exactly four asterisks. If the file cannot be
59717 opened, default text is used and a message is written to the main and panic
59718 logs. If any text item in the file is empty, default text is used for that
59719 item.
59720 </para>
59721 <para>
59722 <indexterm role="variable">
59723 <primary><varname>$bounce_recipient</varname></primary>
59724 </indexterm>
59725 <indexterm role="variable">
59726 <primary><varname>$bounce_return_size_limit</varname></primary>
59727 </indexterm>
59728 Each item of text that is read from the file is expanded, and there are two
59729 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
59730 the recipient of an error message while it is being created, and
59731 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
59732 option, rounded to a whole number.
59733 </para>
59734 <para>
59735 The items must appear in the file in the following order:
59736 </para>
59737 <itemizedlist>
59738 <listitem>
59739 <para>
59740 The first item is included in the headers, and should include at least a
59741 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
59742 </para>
59743 </listitem>
59744 <listitem>
59745 <para>
59746 The second item forms the start of the error message. After it, Exim lists the
59747 failing addresses with their error messages.
59748 </para>
59749 </listitem>
59750 <listitem>
59751 <para>
59752 The third item is used to introduce any text from pipe transports that is to be
59753 returned to the sender. It is omitted if there is no such text.
59754 </para>
59755 </listitem>
59756 <listitem>
59757 <para>
59758 The fourth item is used to introduce the copy of the message that is returned
59759 as part of the error report.
59760 </para>
59761 </listitem>
59762 <listitem>
59763 <para>
59764 The fifth item is added after the fourth one if the returned message is
59765 truncated because it is bigger than <option>return_size_limit</option>.
59766 </para>
59767 </listitem>
59768 <listitem>
59769 <para>
59770 The sixth item is added after the copy of the original message.
59771 </para>
59772 </listitem>
59773 </itemizedlist>
59774 <para>
59775 The default state (<option>bounce_message_file</option> unset) is equivalent to the
59776 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
59777 other lines have been split in order to fit them on the page:
59778 </para>
59779 <literallayout class="monospaced">
59780 Subject: Mail delivery failed
59781   ${if eq{$sender_address}{$bounce_recipient}
59782   {: returning message to sender}}
59783 ****
59784 This message was created automatically by mail delivery software.
59785
59786 A message ${if eq{$sender_address}{$bounce_recipient}
59787   {that you sent }{sent by
59788
59789 &lt;$sender_address&gt;
59790
59791 }}could not be delivered to all of its recipients.
59792 This is a permanent error. The following address(es) failed:
59793 ****
59794 The following text was generated during the delivery attempt(s):
59795 ****
59796 ------ This is a copy of the message, including all the headers.
59797   ------
59798 ****
59799 ------ The body of the message is $message_size characters long;
59800   only the first
59801 ------ $bounce_return_size_limit or so are included here.
59802 ****
59803 </literallayout>
59804 </section>
59805 <section id="SECTcustwarn">
59806 <title>Customizing warning messages</title>
59807 <para>
59808 <indexterm role="concept">
59809 <primary>customizing</primary>
59810 <secondary>warning message</secondary>
59811 </indexterm>
59812 <indexterm role="concept">
59813 <primary>warning of delay</primary>
59814 <secondary>customizing the message</secondary>
59815 </indexterm>
59816 The option <option>warn_message_file</option> can be pointed at a template file for use when
59817 warnings about message delays are created. In this case there are only three
59818 text sections:
59819 </para>
59820 <itemizedlist>
59821 <listitem>
59822 <para>
59823 The first item is included in the headers, and should include at least a
59824 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
59825 </para>
59826 </listitem>
59827 <listitem>
59828 <para>
59829 The second item forms the start of the warning message. After it, Exim lists
59830 the delayed addresses.
59831 </para>
59832 </listitem>
59833 <listitem>
59834 <para>
59835 The third item then ends the message.
59836 </para>
59837 </listitem>
59838 </itemizedlist>
59839 <para>
59840 The default state is equivalent to the following file, except that some lines
59841 have been split here, in order to fit them on the page:
59842 </para>
59843 <literallayout class="monospaced">
59844 Subject: Warning: message $message_exim_id delayed
59845   $warn_message_delay
59846 ****
59847 This message was created automatically by mail delivery software.
59848
59849 A message ${if eq{$sender_address}{$warn_message_recipients}
59850 {that you sent }{sent by
59851
59852 &lt;$sender_address&gt;
59853
59854 }}has not been delivered to all of its recipients after
59855 more than $warn_message_delay on the queue on $primary_hostname.
59856
59857 The message identifier is:     $message_exim_id
59858 The subject of the message is: $h_subject
59859 The date of the message is:    $h_date
59860
59861 The following address(es) have not yet been delivered:
59862 ****
59863 No action is required on your part. Delivery attempts will
59864 continue for some time, and this warning may be repeated at
59865 intervals if the message remains undelivered. Eventually the
59866 mail delivery software will give up, and when that happens,
59867 the message will be returned to you.
59868 </literallayout>
59869 <para>
59870 <indexterm role="variable">
59871 <primary><varname>$warn_message_delay</varname></primary>
59872 </indexterm>
59873 <indexterm role="variable">
59874 <primary><varname>$warn_message_recipients</varname></primary>
59875 </indexterm>
59876 However, in the default state the subject and date lines are omitted if no
59877 appropriate headers exist. During the expansion of this file,
59878 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
59879 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
59880 of recipients for the warning message. There may be more than one if there are
59881 multiple addresses with different <option>errors_to</option> settings on the routers that
59882 handled them.
59883 </para>
59884 </section>
59885 </chapter>
59886
59887 <chapter id="CHAPcomconreq">
59888 <title>Some common configuration settings</title>
59889 <para>
59890 This chapter discusses some configuration settings that seem to be fairly
59891 common. More examples and discussion can be found in the Exim book.
59892 </para>
59893 <section id="SECID240">
59894 <title>Sending mail to a smart host</title>
59895 <para>
59896 <indexterm role="concept">
59897 <primary>smart host</primary>
59898 <secondary>example router</secondary>
59899 </indexterm>
59900 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
59901 should replace the default <command>dnslookup</command> router with a router which does the
59902 routing explicitly:
59903 </para>
59904 <literallayout class="monospaced">
59905 send_to_smart_host:
59906   driver = manualroute
59907   route_list = !+local_domains smart.host.name
59908   transport = remote_smtp
59909 </literallayout>
59910 <para>
59911 You can use the smart host&#x2019;s IP address instead of the name if you wish.
59912 If you are using Exim only to submit messages to a smart host, and not for
59913 receiving incoming messages, you can arrange for it to do the submission
59914 synchronously by setting the <option>mua_wrapper</option> option (see chapter
59915 <xref linkend="CHAPnonqueueing"/>).
59916 </para>
59917 </section>
59918 <section id="SECTmailinglists">
59919 <title>Using Exim to handle mailing lists</title>
59920 <para>
59921 <indexterm role="concept">
59922 <primary>mailing lists</primary>
59923 </indexterm>
59924 Exim can be used to run simple mailing lists, but for large and/or complicated
59925 requirements, the use of additional specialized mailing list software such as
59926 Majordomo or Mailman is recommended.
59927 </para>
59928 <para>
59929 The <command>redirect</command> router can be used to handle mailing lists where each list
59930 is maintained in a separate file, which can therefore be managed by an
59931 independent manager. The <option>domains</option> router option can be used to run these
59932 lists in a separate domain from normal mail. For example:
59933 </para>
59934 <literallayout class="monospaced">
59935 lists:
59936   driver = redirect
59937   domains = lists.example
59938   file = /usr/lists/$local_part
59939   forbid_pipe
59940   forbid_file
59941   errors_to = $local_part-request@lists.example
59942   no_more
59943 </literallayout>
59944 <para>
59945 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
59946 in that domain, it looks for a file that matches the local part. If there is no
59947 such file, the router declines, but because <option>no_more</option> is set, no subsequent
59948 routers are tried, and so the whole delivery fails.
59949 </para>
59950 <para>
59951 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
59952 expanded into a file name or a pipe delivery, which is usually inappropriate in
59953 a mailing list.
59954 </para>
59955 <para>
59956 <indexterm role="option">
59957 <primary><option>errors_to</option></primary>
59958 </indexterm>
59959 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
59960 taken from a mailing list are to be sent to the given address rather than the
59961 original sender of the message. However, before acting on this, Exim verifies
59962 the error address, and ignores it if verification fails.
59963 </para>
59964 <para>
59965 For example, using the configuration above, mail sent to
59966 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
59967 <filename>/usr/lists/dicts</filename>, with error reports directed to
59968 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
59969 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
59970 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
59971 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
59972 or <option>local_part_suffix</option> options) to handle addresses of the form
59973 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
59974 </para>
59975 </section>
59976 <section id="SECID241">
59977 <title>Syntax errors in mailing lists</title>
59978 <para>
59979 <indexterm role="concept">
59980 <primary>mailing lists</primary>
59981 <secondary>syntax errors in</secondary>
59982 </indexterm>
59983 If an entry in redirection data contains a syntax error, Exim normally defers
59984 delivery of the original address. That means that a syntax error in a mailing
59985 list holds up all deliveries to the list. This may not be appropriate when a
59986 list is being maintained automatically from data supplied by users, and the
59987 addresses are not rigorously checked.
59988 </para>
59989 <para>
59990 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
59991 entries that fail to parse, noting the incident in the log. If in addition
59992 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
59993 whenever a broken address is skipped. It is usually appropriate to set
59994 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
59995 </para>
59996 </section>
59997 <section id="SECID242">
59998 <title>Re-expansion of mailing lists</title>
59999 <para>
60000 <indexterm role="concept">
60001 <primary>mailing lists</primary>
60002 <secondary>re-expansion of</secondary>
60003 </indexterm>
60004 Exim remembers every individual address to which a message has been delivered,
60005 in order to avoid duplication, but it normally stores only the original
60006 recipient addresses with a message. If all the deliveries to a mailing list
60007 cannot be done at the first attempt, the mailing list is re-expanded when the
60008 delivery is next tried. This means that alterations to the list are taken into
60009 account at each delivery attempt, so addresses that have been added to
60010 the list since the message arrived will therefore receive a copy of the
60011 message, even though it pre-dates their subscription.
60012 </para>
60013 <para>
60014 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
60015 on the <command>redirect</command> router. If this is done, any addresses generated by the
60016 router that fail to deliver at the first attempt are added to the message as
60017 <quote>top level</quote> addresses, and the parent address that generated them is marked
60018 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
60019 subsequent delivery attempts. The disadvantage of this is that if any of the
60020 failing addresses are incorrect, correcting them in the file has no effect on
60021 pre-existing messages.
60022 </para>
60023 <para>
60024 The original top-level address is remembered with each of the generated
60025 addresses, and is output in any log messages. However, any intermediate parent
60026 addresses are not recorded. This makes a difference to the log only if the
60027 <option>all_parents</option> selector is set, but for mailing lists there is normally only
60028 one level of expansion anyway.
60029 </para>
60030 </section>
60031 <section id="SECID243">
60032 <title>Closed mailing lists</title>
60033 <para>
60034 <indexterm role="concept">
60035 <primary>mailing lists</primary>
60036 <secondary>closed</secondary>
60037 </indexterm>
60038 The examples so far have assumed open mailing lists, to which anybody may
60039 send mail. It is also possible to set up closed lists, where mail is accepted
60040 from specified senders only. This is done by making use of the generic
60041 <option>senders</option> option to restrict the router that handles the list.
60042 </para>
60043 <para>
60044 The following example uses the same file as a list of recipients and as a list
60045 of permitted senders. It requires three routers:
60046 </para>
60047 <literallayout class="monospaced">
60048 lists_request:
60049   driver = redirect
60050   domains = lists.example
60051   local_part_suffix = -request
60052   file = /usr/lists/$local_part$local_part_suffix
60053   no_more
60054
60055 lists_post:
60056   driver = redirect
60057   domains = lists.example
60058   senders = ${if exists {/usr/lists/$local_part}\
60059              {lsearch;/usr/lists/$local_part}{*}}
60060   file = /usr/lists/$local_part
60061   forbid_pipe
60062   forbid_file
60063   errors_to = $local_part-request@lists.example
60064   no_more
60065
60066 lists_closed:
60067   driver = redirect
60068   domains = lists.example
60069   allow_fail
60070   data = :fail: $local_part@lists.example is a closed mailing list
60071 </literallayout>
60072 <para>
60073 All three routers have the same <option>domains</option> setting, so for any other domains,
60074 they are all skipped. The first router runs only if the local part ends in
60075 <option>-request</option>. It handles messages to the list manager(s) by means of an open
60076 mailing list.
60077 </para>
60078 <para>
60079 The second router runs only if the <option>senders</option> precondition is satisfied. It
60080 checks for the existence of a list that corresponds to the local part, and then
60081 checks that the sender is on the list by means of a linear search. It is
60082 necessary to check for the existence of the file before trying to search it,
60083 because otherwise Exim thinks there is a configuration error. If the file does
60084 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
60085 means that the router runs, but because there is no list, declines, and
60086 <option>no_more</option> ensures that no further routers are run. The address fails with an
60087 <quote>unrouteable address</quote> error.
60088 </para>
60089 <para>
60090 The third router runs only if the second router is skipped, which happens when
60091 a mailing list exists, but the sender is not on it. This router forcibly fails
60092 the address, giving a suitable error message.
60093 </para>
60094 </section>
60095 <section id="SECTverp">
60096 <title>Variable Envelope Return Paths (VERP)</title>
60097 <para>
60098 <indexterm role="concept">
60099 <primary>VERP</primary>
60100 </indexterm>
60101 <indexterm role="concept">
60102 <primary>Variable Envelope Return Paths</primary>
60103 </indexterm>
60104 <indexterm role="concept">
60105 <primary>envelope sender</primary>
60106 </indexterm>
60107 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;
60108 are a way of helping mailing list administrators discover which subscription
60109 address is the cause of a particular delivery failure. The idea is to encode
60110 the original recipient address in the outgoing envelope sender address, so that
60111 if the message is forwarded by another host and then subsequently bounces, the
60112 original recipient can be extracted from the recipient address of the bounce.
60113 </para>
60114 <para>
60115 <indexterm role="option">
60116 <primary><option>errors_to</option></primary>
60117 </indexterm>
60118 <indexterm role="option">
60119 <primary><option>return_path</option></primary>
60120 </indexterm>
60121 Envelope sender addresses can be modified by Exim using two different
60122 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
60123 list examples), or the <option>return_path</option> option on a transport. The second of
60124 these is effective only if the message is successfully delivered to another
60125 host; it is not used for errors detected on the local host (see the description
60126 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
60127 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
60128 </para>
60129 <literallayout class="monospaced">
60130 verp_smtp:
60131   driver = smtp
60132   max_rcpt = 1
60133   return_path = \
60134     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
60135       {$1-request+$local_part=$domain@your.dom.example}fail}
60136 </literallayout>
60137 <para>
60138 This has the effect of rewriting the return path (envelope sender) on outgoing
60139 SMTP messages, if the local part of the original return path ends in
60140 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
60141 local part and domain of the recipient into the return path. Suppose, for
60142 example, that a message whose return path has been set to
60143 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
60144 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
60145 rewritten as
60146 </para>
60147 <literallayout class="monospaced">
60148 somelist-request+subscriber=other.dom.example@your.dom.example
60149 </literallayout>
60150 <para>
60151 <indexterm role="variable">
60152 <primary><varname>$local_part</varname></primary>
60153 </indexterm>
60154 For this to work, you must tell Exim to send multiple copies of messages that
60155 have more than one recipient, so that each copy has just one recipient. This is
60156 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
60157 might be sent to several different recipients in the same domain, in which case
60158 <varname>$local_part</varname> is not available in the transport, because it is not unique.
60159 </para>
60160 <para>
60161 Unless your host is doing nothing but mailing list deliveries, you should
60162 probably use a separate transport for the VERP deliveries, so as not to use
60163 extra resources in making one-per-recipient copies for other deliveries. This
60164 can easily be done by expanding the <option>transport</option> option in the router:
60165 </para>
60166 <literallayout class="monospaced">
60167 dnslookup:
60168   driver = dnslookup
60169   domains = ! +local_domains
60170   transport = \
60171     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
60172       {verp_smtp}{remote_smtp}}
60173   no_more
60174 </literallayout>
60175 <para>
60176 If you want to change the return path using <option>errors_to</option> in a router instead
60177 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
60178 routers that handle mailing list addresses. This will ensure that all delivery
60179 errors, including those detected on the local host, are sent to the VERP
60180 address.
60181 </para>
60182 <para>
60183 On a host that does no local deliveries and has no manual routing, only the
60184 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
60185 SMTP deliveries. Every mailing list recipient has its own return path value,
60186 and so Exim must hand them to the transport one at a time. Here is an example
60187 of a <command>dnslookup</command> router that implements VERP:
60188 </para>
60189 <literallayout class="monospaced">
60190 verp_dnslookup:
60191   driver = dnslookup
60192   domains = ! +local_domains
60193   transport = remote_smtp
60194   errors_to = \
60195     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
60196      {$1-request+$local_part=$domain@your.dom.example}fail}
60197   no_more
60198 </literallayout>
60199 <para>
60200 Before you start sending out messages with VERPed return paths, you must also
60201 configure Exim to accept the bounce messages that come back to those paths.
60202 Typically this is done by setting a <option>local_part_suffix</option> option for a
60203 router, and using this to route the messages to wherever you want to handle
60204 them.
60205 </para>
60206 <para>
60207 The overhead incurred in using VERP depends very much on the size of the
60208 message, the number of recipient addresses that resolve to the same remote
60209 host, and the speed of the connection over which the message is being sent. If
60210 a lot of addresses resolve to the same host and the connection is slow, sending
60211 a separate copy of the message for each address may take substantially longer
60212 than sending a single copy with many recipients (for which VERP cannot be
60213 used).
60214 </para>
60215 </section>
60216 <section id="SECTvirtualdomains">
60217 <title>Virtual domains</title>
60218 <para>
60219 <indexterm role="concept">
60220 <primary>virtual domains</primary>
60221 </indexterm>
60222 <indexterm role="concept">
60223 <primary>domain</primary>
60224 <secondary>virtual</secondary>
60225 </indexterm>
60226 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
60227 meanings:
60228 </para>
60229 <itemizedlist>
60230 <listitem>
60231 <para>
60232 A domain for which there are no real mailboxes; all valid local parts are
60233 aliases for other email addresses. Common examples are organizational
60234 top-level domains and <quote>vanity</quote> domains.
60235 </para>
60236 </listitem>
60237 <listitem>
60238 <para>
60239 One of a number of independent domains that are all handled by the same host,
60240 with mailboxes on that host, but where the mailbox owners do not necessarily
60241 have login accounts on that host.
60242 </para>
60243 </listitem>
60244 </itemizedlist>
60245 <para>
60246 The first usage is probably more common, and does seem more <quote>virtual</quote> than
60247 the second. This kind of domain can be handled in Exim with a straightforward
60248 aliasing router. One approach is to create a separate alias file for each
60249 virtual domain. Exim can test for the existence of the alias file to determine
60250 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
60251 to a router of this form:
60252 </para>
60253 <literallayout class="monospaced">
60254 virtual:
60255   driver = redirect
60256   domains = dsearch;/etc/mail/virtual
60257   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
60258   no_more
60259 </literallayout>
60260 <para>
60261 The <option>domains</option> option specifies that the router is to be skipped, unless there
60262 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
60263 domain that is being processed. When the router runs, it looks up the local
60264 part in the file to find a new address (or list of addresses). The <option>no_more</option>
60265 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
60266 string), Exim gives up on the address without trying any subsequent routers.
60267 </para>
60268 <para>
60269 This one router can handle all the virtual domains because the alias file names
60270 follow a fixed pattern. Permissions can be arranged so that appropriate people
60271 can edit the different alias files. A successful aliasing operation results in
60272 a new envelope recipient address, which is then routed from scratch.
60273 </para>
60274 <para>
60275 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
60276 way. One approach is to create a file for each domain containing a list of
60277 valid local parts, and use it in a router like this:
60278 </para>
60279 <literallayout class="monospaced">
60280 my_domains:
60281   driver = accept
60282   domains = dsearch;/etc/mail/domains
60283   local_parts = lsearch;/etc/mail/domains/$domain
60284   transport = my_mailboxes
60285 </literallayout>
60286 <para>
60287 The address is accepted if there is a file for the domain, and the local part
60288 can be found in the file. The <option>domains</option> option is used to check for the
60289 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
60290 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
60291 because that option is tested after <option>local_parts</option>. The transport is as
60292 follows:
60293 </para>
60294 <literallayout class="monospaced">
60295 my_mailboxes:
60296   driver = appendfile
60297   file = /var/mail/$domain/$local_part
60298   user = mail
60299 </literallayout>
60300 <para>
60301 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
60302 required, to specify which uid is to be used for writing to the mailboxes.
60303 </para>
60304 <para>
60305 The configuration shown here is just one example of how you might support this
60306 requirement. There are many other ways this kind of configuration can be set
60307 up, for example, by using a database instead of separate files to hold all the
60308 information about the domains.
60309 </para>
60310 </section>
60311 <section id="SECTmulbox">
60312 <title>Multiple user mailboxes</title>
60313 <para>
60314 <indexterm role="concept">
60315 <primary>multiple mailboxes</primary>
60316 </indexterm>
60317 <indexterm role="concept">
60318 <primary>mailbox</primary>
60319 <secondary>multiple</secondary>
60320 </indexterm>
60321 <indexterm role="concept">
60322 <primary>local part</primary>
60323 <secondary>prefix</secondary>
60324 </indexterm>
60325 <indexterm role="concept">
60326 <primary>local part</primary>
60327 <secondary>suffix</secondary>
60328 </indexterm>
60329 Heavy email users often want to operate with multiple mailboxes, into which
60330 incoming mail is automatically sorted. A popular way of handling this is to
60331 allow users to use multiple sender addresses, so that replies can easily be
60332 identified. Users are permitted to add prefixes or suffixes to their local
60333 parts for this purpose. The wildcard facility of the generic router options
60334 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
60335 example, consider this router:
60336 </para>
60337 <literallayout class="monospaced">
60338 userforward:
60339   driver = redirect
60340   check_local_user
60341   file = $home/.forward
60342   local_part_suffix = -*
60343   local_part_suffix_optional
60344   allow_filter
60345 </literallayout>
60346 <para>
60347 <indexterm role="variable">
60348 <primary><varname>$local_part_suffix</varname></primary>
60349 </indexterm>
60350 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
60351 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
60352 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
60353 </para>
60354 <literallayout class="monospaced">
60355 if $local_part_suffix contains -special then
60356 save /home/$local_part/Mail/special
60357 endif
60358 </literallayout>
60359 <para>
60360 If the filter file does not exist, or does not deal with such addresses, they
60361 fall through to subsequent routers, and, assuming no subsequent use of the
60362 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
60363 control over which suffixes are valid.
60364 </para>
60365 <para>
60366 Alternatively, a suffix can be used to trigger the use of a different
60367 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
60368 another MTA:
60369 </para>
60370 <literallayout class="monospaced">
60371 userforward:
60372   driver = redirect
60373   check_local_user
60374   file = $home/.forward$local_part_suffix
60375   local_part_suffix = -*
60376   local_part_suffix_optional
60377   allow_filter
60378 </literallayout>
60379 <para>
60380 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
60381 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
60382 does not exist, or does not deal with the address, it is passed on to
60383 subsequent routers, which could, if required, look for an unqualified
60384 <filename>.forward</filename> file to use as a default.
60385 </para>
60386 </section>
60387 <section id="SECID244">
60388 <title>Simplified vacation processing</title>
60389 <para>
60390 <indexterm role="concept">
60391 <primary>vacation processing</primary>
60392 </indexterm>
60393 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
60394 a pipe command in a <filename>.forward</filename> file
60395 (see section <xref linkend="SECTspecitredli"/> for syntax details).
60396 This is prone to error by inexperienced users. There are two features of Exim
60397 that can be used to make this process simpler for users:
60398 </para>
60399 <itemizedlist>
60400 <listitem>
60401 <para>
60402 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
60403 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
60404 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
60405 <filename>.forward</filename> file are then much simpler. For example:
60406 </para>
60407 <literallayout class="monospaced">
60408 spqr, vacation-spqr
60409 </literallayout>
60410 </listitem>
60411 <listitem>
60412 <para>
60413 The <option>require_files</option> generic router option can be used to trigger a
60414 vacation delivery by checking for the existence of a certain file in the
60415 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
60416 ensure that the original delivery also proceeds. In this case, all the user has
60417 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
60418 message.
60419 </para>
60420 </listitem>
60421 </itemizedlist>
60422 <para>
60423 Another advantage of both these methods is that they both work even when the
60424 use of arbitrary pipes by users is locked out.
60425 </para>
60426 </section>
60427 <section id="SECID245">
60428 <title>Taking copies of mail</title>
60429 <para>
60430 <indexterm role="concept">
60431 <primary>message</primary>
60432 <secondary>copying every</secondary>
60433 </indexterm>
60434 Some installations have policies that require archive copies of all messages to
60435 be made. A single copy of each message can easily be taken by an appropriate
60436 command in a system filter, which could, for example, use a different file for
60437 each day&#x2019;s messages.
60438 </para>
60439 <para>
60440 There is also a shadow transport mechanism that can be used to take copies of
60441 messages that are successfully delivered by local transports, one copy per
60442 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
60443 notification of delivery by sites that insist on doing such things.
60444 </para>
60445 </section>
60446 <section id="SECID246">
60447 <title>Intermittently connected hosts</title>
60448 <para>
60449 <indexterm role="concept">
60450 <primary>intermittently connected hosts</primary>
60451 </indexterm>
60452 It has become quite common (because it is cheaper) for hosts to connect to the
60453 Internet periodically rather than remain connected all the time. The normal
60454 arrangement is that mail for such hosts accumulates on a system that is
60455 permanently connected.
60456 </para>
60457 <para>
60458 Exim was designed for use on permanently connected hosts, and so it is not
60459 particularly well-suited to use in an intermittently connected environment.
60460 Nevertheless there are some features that can be used.
60461 </para>
60462 </section>
60463 <section id="SECID247">
60464 <title>Exim on the upstream server host</title>
60465 <para>
60466 It is tempting to arrange for incoming mail for the intermittently connected
60467 host to remain on Exim&#x2019;s queue until the client connects. However, this
60468 approach does not scale very well. Two different kinds of waiting message are
60469 being mixed up in the same queue &ndash; those that cannot be delivered because of
60470 some temporary problem, and those that are waiting for their destination host
60471 to connect. This makes it hard to manage the queue, as well as wasting
60472 resources, because each queue runner scans the entire queue.
60473 </para>
60474 <para>
60475 A better approach is to separate off those messages that are waiting for an
60476 intermittently connected host. This can be done by delivering these messages
60477 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
60478 format, from where they are transmitted by other software when their
60479 destination connects. This makes it easy to collect all the mail for one host
60480 in a single directory, and to apply local timeout rules on a per-message basis
60481 if required.
60482 </para>
60483 <para>
60484 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
60485 you are doing this, you should configure Exim with a long retry period for the
60486 intermittent host. For example:
60487 </para>
60488 <literallayout class="monospaced">
60489 cheshire.wonderland.fict.example    *   F,5d,24h
60490 </literallayout>
60491 <para>
60492 This stops a lot of failed delivery attempts from occurring, but Exim remembers
60493 which messages it has queued up for that host. Once the intermittent host comes
60494 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
60495 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
60496 causes all the queued up messages to be delivered, often down a single SMTP
60497 connection. While the host remains connected, any new messages get delivered
60498 immediately.
60499 </para>
60500 <para>
60501 If the connecting hosts do not have fixed IP addresses, that is, if a host is
60502 issued with a different IP address each time it connects, Exim&#x2019;s retry
60503 mechanisms on the holding host get confused, because the IP address is normally
60504 used as part of the key string for holding retry information. This can be
60505 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
60506 Since this has disadvantages for permanently connected hosts, it is best to
60507 arrange a separate transport for the intermittently connected ones.
60508 </para>
60509 </section>
60510 <section id="SECID248">
60511 <title>Exim on the intermittently connected client host</title>
60512 <para>
60513 The value of <option>smtp_accept_queue_per_connection</option> should probably be
60514 increased, or even set to zero (that is, disabled) on the intermittently
60515 connected host, so that all incoming messages down a single connection get
60516 delivered immediately.
60517 </para>
60518 <para>
60519 <indexterm role="concept">
60520 <primary>SMTP</primary>
60521 <secondary>passed connection</secondary>
60522 </indexterm>
60523 <indexterm role="concept">
60524 <primary>SMTP</primary>
60525 <secondary>multiple deliveries</secondary>
60526 </indexterm>
60527 <indexterm role="concept">
60528 <primary>multiple SMTP deliveries</primary>
60529 </indexterm>
60530 Mail waiting to be sent from an intermittently connected host will probably
60531 not have been routed, because without a connection DNS lookups are not
60532 possible. This means that if a normal queue run is done at connection time,
60533 each message is likely to be sent in a separate SMTP session. This can be
60534 avoided by starting the queue run with a command line option beginning with
60535 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
60536 first pass, routing is done but no deliveries take place. The second pass is a
60537 normal queue run; since all the messages have been previously routed, those
60538 destined for the same host are likely to get sent as multiple deliveries in a
60539 single SMTP connection.
60540 </para>
60541 </section>
60542 </chapter>
60543
60544 <chapter id="CHAPnonqueueing">
60545 <title>Using Exim as a non-queueing client</title>
60546 <titleabbrev>Exim as a non-queueing client</titleabbrev>
60547 <para>
60548 <indexterm role="concept">
60549 <primary>client, non-queueing</primary>
60550 </indexterm>
60551 <indexterm role="concept">
60552 <primary>smart host</primary>
60553 <secondary>suppressing queueing</secondary>
60554 </indexterm>
60555 On a personal computer, it is a common requirement for all
60556 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
60557 configured to operate that way, for all the popular operating systems.
60558 However, there are some MUAs for Unix-like systems that cannot be so
60559 configured: they submit messages using the command line interface of
60560 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
60561 messages this way.
60562 </para>
60563 <para>
60564 If the personal computer runs continuously, there is no problem, because it can
60565 run a conventional MTA that handles delivery to the smart host, and deal with
60566 any delays via its queueing mechanism. However, if the computer does not run
60567 continuously or runs different operating systems at different times, queueing
60568 email is not desirable.
60569 </para>
60570 <para>
60571 There is therefore a requirement for something that can provide the
60572 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
60573 any queueing or retrying facilities. Furthermore, the delivery to the smart
60574 host should be synchronous, so that if it fails, the sending MUA is immediately
60575 informed. In other words, we want something that extends an MUA that submits
60576 to a local MTA via the command line so that it behaves like one that submits
60577 to a remote smart host using TCP/SMTP.
60578 </para>
60579 <para>
60580 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
60581 that do this job. However, people have found them to be lacking in various
60582 ways. For instance, you might want to allow aliasing and forwarding to be done
60583 before sending a message to the smart host.
60584 </para>
60585 <para>
60586 Exim already had the necessary infrastructure for doing this job. Just a few
60587 tweaks were needed to make it behave as required, though it is somewhat of an
60588 overkill to use a fully-featured MTA for this purpose.
60589 </para>
60590 <para>
60591 <indexterm role="option">
60592 <primary><option>mua_wrapper</option></primary>
60593 </indexterm>
60594 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
60595 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
60596 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
60597 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
60598 compatible router and transport configuration. Typically there will be just one
60599 router and one transport, sending everything to a smart host.
60600 </para>
60601 <para>
60602 When run in MUA wrapping mode, the behaviour of Exim changes in the
60603 following ways:
60604 </para>
60605 <itemizedlist>
60606 <listitem>
60607 <para>
60608 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
60609 In other words, the only way to submit messages is via the command line.
60610 </para>
60611 </listitem>
60612 <listitem>
60613 <para>
60614 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
60615 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
60616 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
60617 does not finish until the delivery attempt is complete. If the delivery is
60618 successful, a zero return code is given.
60619 </para>
60620 </listitem>
60621 <listitem>
60622 <para>
60623 Address redirection is permitted, but the final routing for all addresses must
60624 be to the same remote transport, and to the same list of hosts. Furthermore,
60625 the return address (envelope sender) must be the same for all recipients, as
60626 must any added or deleted header lines. In other words, it must be possible to
60627 deliver the message in a single SMTP transaction, however many recipients there
60628 are.
60629 </para>
60630 </listitem>
60631 <listitem>
60632 <para>
60633 If these conditions are not met, or if routing any address results in a
60634 failure or defer status, or if Exim is unable to deliver all the recipients
60635 successfully to one of the smart hosts, delivery of the entire message fails.
60636 </para>
60637 </listitem>
60638 <listitem>
60639 <para>
60640 Because no queueing is allowed, all failures are treated as permanent; there
60641 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
60642 smart host. Furthermore, because only a single yes/no response can be given to
60643 the caller, it is not possible to deliver to some recipients and not others. If
60644 there is an error (temporary or permanent) for any recipient, all are failed.
60645 </para>
60646 </listitem>
60647 <listitem>
60648 <para>
60649 If more than one smart host is listed, Exim will try another host after a
60650 connection failure or a timeout, in the normal way. However, if this kind of
60651 failure happens for all the hosts, the delivery fails.
60652 </para>
60653 </listitem>
60654 <listitem>
60655 <para>
60656 When delivery fails, an error message is written to the standard error stream
60657 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
60658 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
60659 are ever generated.
60660 </para>
60661 </listitem>
60662 <listitem>
60663 <para>
60664 No retry data is maintained, and any retry rules are ignored.
60665 </para>
60666 </listitem>
60667 <listitem>
60668 <para>
60669 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
60670 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
60671 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
60672 </para>
60673 </listitem>
60674 </itemizedlist>
60675 <para>
60676 The overall effect is that Exim makes a single synchronous attempt to deliver
60677 the message, failing if there is any kind of problem. Because no local
60678 deliveries are done and no daemon can be run, Exim does not need root
60679 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
60680 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
60681 the advantages and disadvantages of running without root privilege.
60682 </para>
60683 </chapter>
60684
60685 <chapter id="CHAPlog">
60686 <title>Log files</title>
60687 <para>
60688 <indexterm role="concept" id="IIDloggen" class="startofrange">
60689 <primary>log</primary>
60690 <secondary>general description</secondary>
60691 </indexterm>
60692 <indexterm role="concept">
60693 <primary>log</primary>
60694 <secondary>types of</secondary>
60695 </indexterm>
60696 Exim writes three different logs, referred to as the main log, the reject log,
60697 and the panic log:
60698 </para>
60699 <itemizedlist>
60700 <listitem>
60701 <para>
60702 <indexterm role="concept">
60703 <primary>main log</primary>
60704 </indexterm>
60705 The main log records the arrival of each message and each delivery in a single
60706 line in each case. The format is as compact as possible, in an attempt to keep
60707 down the size of log files. Two-character flag sequences make it easy to pick
60708 out these lines. A number of other events are recorded in the main log. Some of
60709 them are optional, in which case the <option>log_selector</option> option controls whether
60710 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
60711 analysis of main log files, is provided in the Exim distribution (see section
60712 <xref linkend="SECTmailstat"/>).
60713 </para>
60714 </listitem>
60715 <listitem>
60716 <para>
60717 <indexterm role="concept">
60718 <primary>reject log</primary>
60719 </indexterm>
60720 The reject log records information from messages that are rejected as a result
60721 of a configuration option (that is, for policy reasons).
60722 The first line of each rejection is a copy of the line that is also written to
60723 the main log. Then, if the message&#x2019;s header has been read at the time the log
60724 is written, its contents are written to this log. Only the original header
60725 lines are available; header lines added by ACLs are not logged. You can use the
60726 reject log to check that your policy controls are working correctly; on a busy
60727 host this may be easier than scanning the main log for rejection messages. You
60728 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
60729 false.
60730 </para>
60731 </listitem>
60732 <listitem>
60733 <para>
60734 <indexterm role="concept">
60735 <primary>panic log</primary>
60736 </indexterm>
60737 <indexterm role="concept">
60738 <primary>system log</primary>
60739 </indexterm>
60740 When certain serious errors occur, Exim writes entries to its panic log. If the
60741 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
60742 are usually written to the main log as well, but can get lost amid the mass of
60743 other entries. The panic log should be empty under normal circumstances. It is
60744 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
60745 regularly, in order to become aware of any problems. When Exim cannot open its
60746 panic log, it tries as a last resort to write to the system log (syslog). This
60747 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
60748 message itself is written at priority LOG_CRIT.
60749 </para>
60750 </listitem>
60751 </itemizedlist>
60752 <para>
60753 Every log line starts with a timestamp, in the format shown in the following
60754 example. Note that many of the examples shown in this chapter are line-wrapped.
60755 In the log file, this would be all on one line:
60756 </para>
60757 <literallayout class="monospaced">
60758 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
60759   by QUIT
60760 </literallayout>
60761 <para>
60762 By default, the timestamps are in the local timezone. There are two
60763 ways of changing this:
60764 </para>
60765 <itemizedlist>
60766 <listitem>
60767 <para>
60768 You can set the <option>timezone</option> option to a different time zone; in particular, if
60769 you set
60770 </para>
60771 <literallayout class="monospaced">
60772 timezone = UTC
60773 </literallayout>
60774 <para>
60775 the timestamps will be in UTC (aka GMT).
60776 </para>
60777 </listitem>
60778 <listitem>
60779 <para>
60780 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
60781 example:
60782 </para>
60783 <literallayout class="monospaced">
60784 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
60785 </literallayout>
60786 </listitem>
60787 </itemizedlist>
60788 <para>
60789 <indexterm role="concept">
60790 <primary>log</primary>
60791 <secondary>process ids in</secondary>
60792 </indexterm>
60793 <indexterm role="concept">
60794 <primary>pid (process id)</primary>
60795 <secondary>in log lines</secondary>
60796 </indexterm>
60797 Exim does not include its process id in log lines by default, but you can
60798 request that it does so by specifying the <literal>pid</literal> log selector (see section
60799 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
60800 brackets, immediately after the time and date.
60801 </para>
60802 <section id="SECTwhelogwri">
60803 <title>Where the logs are written</title>
60804 <para>
60805 <indexterm role="concept">
60806 <primary>log</primary>
60807 <secondary>destination</secondary>
60808 </indexterm>
60809 <indexterm role="concept">
60810 <primary>log</primary>
60811 <secondary>to file</secondary>
60812 </indexterm>
60813 <indexterm role="concept">
60814 <primary>log</primary>
60815 <secondary>to syslog</secondary>
60816 </indexterm>
60817 <indexterm role="concept">
60818 <primary>syslog</primary>
60819 </indexterm>
60820 The logs may be written to local files, or to syslog, or both. However, it
60821 should be noted that many syslog implementations use UDP as a transport, and
60822 are therefore unreliable in the sense that messages are not guaranteed to
60823 arrive at the loghost, nor is the ordering of messages necessarily maintained.
60824 It has also been reported that on large log files (tens of megabytes) you may
60825 need to tweak syslog to prevent it syncing the file with each write &ndash; on
60826 Linux this has been seen to make syslog take 90% plus of CPU time.
60827 </para>
60828 <para>
60829 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
60830 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
60831 configuration. This latter string is expanded, so it can contain, for example,
60832 references to the host name:
60833 </para>
60834 <literallayout class="monospaced">
60835 log_file_path = /var/log/$primary_hostname/exim_%slog
60836 </literallayout>
60837 <para>
60838 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
60839 rather than at run time, because then the setting is available right from the
60840 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
60841 before it has read the configuration file (for example, an error in the
60842 configuration file) it will not use the path you want, and may not be able to
60843 log at all.
60844 </para>
60845 <para>
60846 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
60847 list, currently limited to at most two items. This is one option where the
60848 facility for changing a list separator may not be used. The list must always be
60849 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
60850 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
60851 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
60852 implying the use of a default path.
60853 </para>
60854 <para>
60855 When Exim encounters an empty item in the list, it searches the list defined by
60856 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
60857 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
60858 mean <quote>use the path specified at build time</quote>. It no such item exists, log
60859 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
60860 equivalent to the setting:
60861 </para>
60862 <literallayout class="monospaced">
60863 log_file_path = $spool_directory/log/%slog
60864 </literallayout>
60865 <para>
60866 If you do not specify anything at build time or run time, that is where the
60867 logs are written.
60868 </para>
60869 <para>
60870 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
60871 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
60872 </para>
60873 <para>
60874 Here are some examples of possible settings:
60875 </para>
60876 <literallayout>
60877 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
60878 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
60879 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
60880 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
60881 </literallayout>
60882 <para>
60883 If there are more than two paths in the list, the first is used and a panic
60884 error is logged.
60885 </para>
60886 </section>
60887 <section id="SECID285">
60888 <title>Logging to local files that are periodically <quote>cycled</quote></title>
60889 <para>
60890 <indexterm role="concept">
60891 <primary>log</primary>
60892 <secondary>cycling local files</secondary>
60893 </indexterm>
60894 <indexterm role="concept">
60895 <primary>cycling logs</primary>
60896 </indexterm>
60897 <indexterm role="concept">
60898 <primary><emphasis>exicyclog</emphasis></primary>
60899 </indexterm>
60900 <indexterm role="concept">
60901 <primary>log</primary>
60902 <secondary>local files; writing to</secondary>
60903 </indexterm>
60904 Some operating systems provide centralized and standardized methods for cycling
60905 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
60906 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
60907 main and reject logs each time it is called. The maximum number of old logs to
60908 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
60909 </para>
60910 <para>
60911 An Exim delivery process opens the main log when it first needs to write to it,
60912 and it keeps the file open in case subsequent entries are required &ndash; for
60913 example, if a number of different deliveries are being done for the same
60914 message. However, remote SMTP deliveries can take a long time, and this means
60915 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
60916 something similar is being used to rename log files on a regular basis. To
60917 ensure that a switch of log files is noticed as soon as possible, Exim calls
60918 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
60919 does not exist, or its inode has changed, the old file is closed and Exim
60920 tries to open the main log from scratch. Thus, an old log file may remain open
60921 for quite some time, but no Exim processes should write to it once it has been
60922 renamed.
60923 </para>
60924 </section>
60925 <section id="SECTdatlogfil">
60926 <title>Datestamped log files</title>
60927 <para>
60928 <indexterm role="concept">
60929 <primary>log</primary>
60930 <secondary>datestamped files</secondary>
60931 </indexterm>
60932 Instead of cycling the main and reject log files by renaming them
60933 periodically, some sites like to use files whose names contain a datestamp,
60934 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
60935 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
60936 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
60937 point where the datestamp is required. For example:
60938 </para>
60939 <literallayout class="monospaced">
60940 log_file_path = /var/spool/exim/log/%slog-%D
60941 log_file_path = /var/log/exim-%s-%D.log
60942 log_file_path = /var/spool/exim/log/%D-%slog
60943 log_file_path = /var/log/exim/%s.%M
60944 </literallayout>
60945 <para>
60946 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
60947 examples of names generated by the above examples:
60948 </para>
60949 <literallayout class="monospaced">
60950 /var/spool/exim/log/mainlog-20021225
60951 /var/log/exim-reject-20021225.log
60952 /var/spool/exim/log/20021225-mainlog
60953 /var/log/exim/main.200212
60954 </literallayout>
60955 <para>
60956 When this form of log file is specified, Exim automatically switches to new
60957 files at midnight. It does not make any attempt to compress old logs; you
60958 will need to write your own script if you require this. You should not
60959 run <emphasis>exicyclog</emphasis> with this form of logging.
60960 </para>
60961 <para>
60962 The location of the panic log is also determined by <option>log_file_path</option>, but it
60963 is not datestamped, because rotation of the panic log does not make sense.
60964 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
60965 the string. In addition, if it immediately follows a slash, a following
60966 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
60967 character is removed. Thus, the four examples above would give these panic
60968 log names:
60969 </para>
60970 <literallayout class="monospaced">
60971 /var/spool/exim/log/paniclog
60972 /var/log/exim-panic.log
60973 /var/spool/exim/log/paniclog
60974 /var/log/exim/panic
60975 </literallayout>
60976 </section>
60977 <section id="SECID249">
60978 <title>Logging to syslog</title>
60979 <para>
60980 <indexterm role="concept">
60981 <primary>log</primary>
60982 <secondary>syslog; writing to</secondary>
60983 </indexterm>
60984 The use of syslog does not change what Exim logs or the format of its messages,
60985 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
60986 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
60987 that, the same strings are written to syslog as to log files. The syslog
60988 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
60989 by default, but you can change these by setting the <option>syslog_facility</option> and
60990 <option>syslog_processname</option> options, respectively. If Exim was compiled with
60991 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
60992 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
60993 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
60994 the time and host name to each line.
60995 The three log streams are mapped onto syslog priorities as follows:
60996 </para>
60997 <itemizedlist>
60998 <listitem>
60999 <para>
61000 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
61001 </para>
61002 </listitem>
61003 <listitem>
61004 <para>
61005 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
61006 </para>
61007 </listitem>
61008 <listitem>
61009 <para>
61010 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
61011 </para>
61012 </listitem>
61013 </itemizedlist>
61014 <para>
61015 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
61016 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
61017 these are routed by syslog to the same place. You can suppress this duplication
61018 by setting <option>syslog_duplication</option> false.
61019 </para>
61020 <para>
61021 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
61022 entries contain multiple lines when headers are included. To cope with both
61023 these cases, entries written to syslog are split into separate <function>syslog()</function>
61024 calls at each internal newline, and also after a maximum of
61025 870 data characters. (This allows for a total syslog line length of 1024, when
61026 additions such as timestamps are added.) If you are running a syslog
61027 replacement that can handle lines longer than the 1024 characters allowed by
61028 RFC 3164, you should set
61029 </para>
61030 <literallayout class="monospaced">
61031 SYSLOG_LONG_LINES=yes
61032 </literallayout>
61033 <para>
61034 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
61035 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
61036 </para>
61037 <para>
61038 To make it easy to re-assemble split lines later, each component of a split
61039 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;]
61040 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
61041 components in the entry. The / delimiter is used when the line was split
61042 because it was too long; if it was split because of an internal newline, the \
61043 delimiter is used. For example, supposing the length limit to be 50 instead of
61044 870, the following would be the result of a typical rejection message to
61045 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
61046 name, and pid as added by syslog:
61047 </para>
61048 <literallayout class="monospaced">
61049 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
61050 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
61051 [3/5]  when scanning for sender: missing or malformed lo
61052 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
61053 [5/5] mple&gt;)
61054 </literallayout>
61055 <para>
61056 The same error might cause the following lines to be written to <quote>rejectlog</quote>
61057 (LOG_NOTICE):
61058 </para>
61059 <literallayout class="monospaced">
61060 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
61061 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
61062 [3/18] er when scanning for sender: missing or malformed
61063 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
61064 [5\18] .example&gt;)
61065 [6\18] Recipients: ph10@some.domain.cam.example
61066 [7\18] P Received: from [127.0.0.1] (ident=ph10)
61067 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
61068 [9\18]        id 16RdAL-0006pc-00
61069 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
61070 [11\18] 09:43 +0100
61071 [12\18] F From: &lt;&gt;
61072 [13\18]   Subject: this is a test header
61073 [18\18]   X-something: this is another header
61074 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
61075 [16\18] le&gt;
61076 [17\18] B Bcc:
61077 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
61078 </literallayout>
61079 <para>
61080 Log lines that are neither too long nor contain newlines are written to syslog
61081 without modification.
61082 </para>
61083 <para>
61084 If only syslog is being used, the Exim monitor is unable to provide a log tail
61085 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
61086 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
61087 where it is.
61088 </para>
61089 </section>
61090 <section id="SECID250">
61091 <title>Log line flags</title>
61092 <para>
61093 One line is written to the main log for each message received, and for each
61094 successful, unsuccessful, and delayed delivery. These lines can readily be
61095 picked out by the distinctive two-character flags that immediately follow the
61096 timestamp. The flags are:
61097 </para>
61098 <literallayout>
61099 <literal>&lt;=</literal>     message arrival
61100 <literal>=&gt;</literal>     normal message delivery
61101 <literal>-&gt;</literal>     additional address in same delivery
61102 <phrase revisionflag="changed"><literal>&gt;&gt;</literal>     cutthrough message delivery
61103 </phrase><literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
61104 <literal>**</literal>     delivery failed; address bounced
61105 <literal>==</literal>     delivery deferred; temporary problem
61106 </literallayout>
61107 </section>
61108 <section id="SECID251">
61109 <title>Logging message reception</title>
61110 <para>
61111 <indexterm role="concept">
61112 <primary>log</primary>
61113 <secondary>reception line</secondary>
61114 </indexterm>
61115 The format of the single-line entry in the main log that is written for every
61116 message received is shown in the basic example below, which is split over
61117 several lines in order to fit it on the page:
61118 </para>
61119 <literallayout class="monospaced">
61120 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
61121   H=mailer.fict.example [192.168.123.123] U=exim
61122   P=smtp S=5678 id=&lt;incoming message id&gt;
61123 </literallayout>
61124 <para>
61125 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
61126 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
61127 generated, this is followed by an item of the form
61128 </para>
61129 <literallayout class="monospaced">
61130 R=&lt;message id&gt;
61131 </literallayout>
61132 <para>
61133 which is a reference to the message that caused the bounce to be sent.
61134 </para>
61135 <para>
61136 <indexterm role="concept">
61137 <primary>HELO</primary>
61138 </indexterm>
61139 <indexterm role="concept">
61140 <primary>EHLO</primary>
61141 </indexterm>
61142 For messages from other hosts, the H and U fields identify the remote host and
61143 record the RFC 1413 identity of the user that sent the message, if one was
61144 received. The number given in square brackets is the IP address of the sending
61145 host. If there is a single, unparenthesized  host name in the H field, as
61146 above, it has been verified to correspond to the IP address (see the
61147 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
61148 by the remote host in the SMTP HELO or EHLO command, and has not been
61149 verified. If verification yields a different name to that given for HELO or
61150 EHLO, the verified name appears first, followed by the HELO or EHLO
61151 name in parentheses.
61152 </para>
61153 <para>
61154 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
61155 without brackets, in the HELO or EHLO command, leading to entries in
61156 the log containing text like these examples:
61157 </para>
61158 <literallayout class="monospaced">
61159 H=(10.21.32.43) [192.168.8.34]
61160 H=([10.21.32.43]) [192.168.8.34]
61161 </literallayout>
61162 <para>
61163 This can be confusing. Only the final address in square brackets can be relied
61164 on.
61165 </para>
61166 <para>
61167 For locally generated messages (that is, messages not received over TCP/IP),
61168 the H field is omitted, and the U field contains the login name of the caller
61169 of Exim.
61170 </para>
61171 <para>
61172 <indexterm role="concept">
61173 <primary>authentication</primary>
61174 <secondary>logging</secondary>
61175 </indexterm>
61176 <indexterm role="concept">
61177 <primary>AUTH</primary>
61178 <secondary>logging</secondary>
61179 </indexterm>
61180 For all messages, the P field specifies the protocol used to receive the
61181 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
61182 of incoming SMTP messages, the value indicates whether or not any SMTP
61183 extensions (ESMTP), encryption, or authentication were used. If the SMTP
61184 session was encrypted, there is an additional X field that records the cipher
61185 suite that was used.
61186 </para>
61187 <para>
61188 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
61189 hosts that have authenticated themselves using the SMTP AUTH command. The first
61190 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
61191 there is an additional item A= followed by the name of the authenticator that
61192 was used. If an authenticated identification was set up by the authenticator&#x2019;s
61193 <option>server_set_id</option> option, this is logged too, separated by a colon from the
61194 authenticator name.
61195 </para>
61196 <para>
61197 <indexterm role="concept">
61198 <primary>size</primary>
61199 <secondary>of message</secondary>
61200 </indexterm>
61201 The id field records the existing message id, if present. The size of the
61202 received message is given by the S field. When the message is delivered,
61203 headers may be removed or added, so that the size of delivered copies of the
61204 message may not correspond with this value (and indeed may be different to each
61205 other).
61206 </para>
61207 <para>
61208 The <option>log_selector</option> option can be used to request the logging of additional
61209 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
61210 </para>
61211 </section>
61212 <section id="SECID252">
61213 <title>Logging deliveries</title>
61214 <para>
61215 <indexterm role="concept">
61216 <primary>log</primary>
61217 <secondary>delivery line</secondary>
61218 </indexterm>
61219 The format of the single-line entry in the main log that is written for every
61220 delivery is shown in one of the examples below, for local and remote
61221 deliveries, respectively. Each example has been split into two lines in order
61222 to fit it on the page:
61223 </para>
61224 <literallayout class="monospaced">
61225 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
61226   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
61227 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
61228   monk@holistic.fict.example R=dnslookup T=remote_smtp
61229   H=holistic.fict.example [192.168.234.234]
61230 </literallayout>
61231 <para>
61232 For ordinary local deliveries, the original address is given in angle brackets
61233 after the final delivery address, which might be a pipe or a file. If
61234 intermediate address(es) exist between the original and the final address, the
61235 last of these is given in parentheses after the final address. The R and T
61236 fields record the router and transport that were used to process the address.
61237 </para>
61238 <para revisionflag="changed">
61239 If SMTP AUTH was used for the delivery there is an additional item A=
61240 followed by the name of the authenticator that was used.
61241 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
61242 option, this is logged too, separated by a colon from the authenticator name.
61243 </para>
61244 <para>
61245 If a shadow transport was run after a successful local delivery, the log line
61246 for the successful delivery has an item added on the end, of the form
61247 </para>
61248 <literallayout>
61249 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
61250 </literallayout>
61251 <para>
61252 If the shadow transport did not succeed, the error message is put in
61253 parentheses afterwards.
61254 </para>
61255 <para>
61256 <indexterm role="concept">
61257 <primary>asterisk</primary>
61258 <secondary>after IP address</secondary>
61259 </indexterm>
61260 When more than one address is included in a single delivery (for example, two
61261 SMTP RCPT commands in one transaction) the second and subsequent addresses are
61262 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
61263 down a single SMTP connection, an asterisk follows the IP address in the log
61264 lines for the second and subsequent messages.
61265 </para>
61266 <para revisionflag="changed">
61267 <indexterm role="concept">
61268 <primary>delivery</primary>
61269 <secondary>cutthrough; logging</secondary>
61270 </indexterm>
61271 <indexterm role="concept">
61272 <primary>cutthrough</primary>
61273 <secondary>logging</secondary>
61274 </indexterm>
61275 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
61276 line precedes the reception line, since cutthrough waits for a possible
61277 rejection from the destination in case it can reject the sourced item.
61278 </para>
61279 <para>
61280 The generation of a reply message by a filter file gets logged as a
61281 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
61282 </para>
61283 <para>
61284 The <option>log_selector</option> option can be used to request the logging of additional
61285 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
61286 </para>
61287 </section>
61288 <section id="SECID253">
61289 <title>Discarded deliveries</title>
61290 <para>
61291 <indexterm role="concept">
61292 <primary>discarded messages</primary>
61293 </indexterm>
61294 <indexterm role="concept">
61295 <primary>message</primary>
61296 <secondary>discarded</secondary>
61297 </indexterm>
61298 <indexterm role="concept">
61299 <primary>delivery</primary>
61300 <secondary>discarded; logging</secondary>
61301 </indexterm>
61302 When a message is discarded as a result of the command <quote>seen finish</quote> being
61303 obeyed in a filter file which generates no deliveries, a log entry of the form
61304 </para>
61305 <literallayout class="monospaced">
61306 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
61307   &lt;low.club@bridge.example&gt; R=userforward
61308 </literallayout>
61309 <para>
61310 is written, to record why no deliveries are logged. When a message is discarded
61311 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
61312 </para>
61313 <literallayout class="monospaced">
61314 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
61315   &lt;hole@nowhere.example&gt; R=blackhole_router
61316 </literallayout>
61317 </section>
61318 <section id="SECID254">
61319 <title>Deferred deliveries</title>
61320 <para>
61321 When a delivery is deferred, a line of the following form is logged:
61322 </para>
61323 <literallayout class="monospaced">
61324 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
61325   R=dnslookup T=smtp defer (146): Connection refused
61326 </literallayout>
61327 <para>
61328 In the case of remote deliveries, the error is the one that was given for the
61329 last IP address that was tried. Details of individual SMTP failures are also
61330 written to the log, so the above line would be preceded by something like
61331 </para>
61332 <literallayout class="monospaced">
61333 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
61334   mail1.endrest.example [192.168.239.239]: Connection refused
61335 </literallayout>
61336 <para>
61337 When a deferred address is skipped because its retry time has not been reached,
61338 a message is written to the log, but this can be suppressed by setting an
61339 appropriate value in <option>log_selector</option>.
61340 </para>
61341 </section>
61342 <section id="SECID255">
61343 <title>Delivery failures</title>
61344 <para>
61345 <indexterm role="concept">
61346 <primary>delivery</primary>
61347 <secondary>failure; logging</secondary>
61348 </indexterm>
61349 If a delivery fails because an address cannot be routed, a line of the
61350 following form is logged:
61351 </para>
61352 <literallayout class="monospaced">
61353 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
61354   &lt;jim@trek99.example&gt;: unknown mail domain
61355 </literallayout>
61356 <para>
61357 If a delivery fails at transport time, the router and transport are shown, and
61358 the response from the remote host is included, as in this example:
61359 </para>
61360 <literallayout class="monospaced">
61361 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
61362   R=dnslookup T=remote_smtp: SMTP error from remote mailer
61363   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
61364   pbmail3.py.example [192.168.63.111]: 553 5.3.0
61365   &lt;ace400@pb.example&gt;...Addressee unknown
61366 </literallayout>
61367 <para>
61368 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
61369 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
61370 disabling PIPELINING. The log lines for all forms of delivery failure are
61371 flagged with <literal>**</literal>.
61372 </para>
61373 </section>
61374 <section id="SECID256">
61375 <title>Fake deliveries</title>
61376 <para>
61377 <indexterm role="concept">
61378 <primary>delivery</primary>
61379 <secondary>fake; logging</secondary>
61380 </indexterm>
61381 If a delivery does not actually take place because the <option>-N</option> option has been
61382 used to suppress it, a normal delivery line is written to the log, except that
61383 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
61384 </para>
61385 </section>
61386 <section id="SECID257">
61387 <title>Completion</title>
61388 <para>
61389 A line of the form
61390 </para>
61391 <literallayout class="monospaced">
61392 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
61393 </literallayout>
61394 <para>
61395 is written to the main log when a message is about to be removed from the spool
61396 at the end of its processing.
61397 </para>
61398 </section>
61399 <section id="SECID258">
61400 <title>Summary of Fields in Log Lines</title>
61401 <para>
61402 <indexterm role="concept">
61403 <primary>log</primary>
61404 <secondary>summary of fields</secondary>
61405 </indexterm>
61406 A summary of the field identifiers that are used in log lines is shown in
61407 the following table:
61408 </para>
61409 <literallayout>
61410 <literal>A   </literal>        authenticator name (and optional id and sender)
61411 <literal>C   </literal>        SMTP confirmation on delivery
61412 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
61413 <literal>CV  </literal>        certificate verification status
61414 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
61415 <literal>DN  </literal>        distinguished name from peer certificate
61416 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
61417 <literal>F   </literal>        sender address (on delivery lines)
61418 <literal>H   </literal>        host name and IP address
61419 <literal>I   </literal>        local interface used
61420 <literal>id  </literal>        message id for incoming message
61421 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
61422 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
61423 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
61424 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
61425 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
61426 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
61427 <literal>S   </literal>        size of message
61428 <literal>ST  </literal>        shadow transport name
61429 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
61430 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
61431 <literal>U   </literal>        local user or RFC 1413 identity
61432 <literal>X   </literal>        TLS cipher suite
61433 </literallayout>
61434 </section>
61435 <section id="SECID259">
61436 <title>Other log entries</title>
61437 <para>
61438 Various other types of log entry are written from time to time. Most should be
61439 self-explanatory. Among the more common are:
61440 </para>
61441 <itemizedlist>
61442 <listitem>
61443 <para>
61444 <indexterm role="concept">
61445 <primary>retry</primary>
61446 <secondary>time not reached</secondary>
61447 </indexterm>
61448 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
61449 during routing or local delivery, and the time to retry has not yet arrived.
61450 This message is not written to an individual message log file unless it happens
61451 during the first delivery attempt.
61452 </para>
61453 </listitem>
61454 <listitem>
61455 <para>
61456 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
61457 temporary errors during remote delivery, and the retry time has not yet arrived
61458 for any of the hosts to which it is routed.
61459 </para>
61460 </listitem>
61461 <listitem>
61462 <para>
61463 <indexterm role="concept">
61464 <primary>spool directory</primary>
61465 <secondary>file locked</secondary>
61466 </indexterm>
61467 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
61468 some other Exim process is already working on the message. This can be quite
61469 common if queue running processes are started at frequent intervals. The
61470 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
61471 doing.
61472 </para>
61473 </listitem>
61474 <listitem>
61475 <para>
61476 <indexterm role="concept">
61477 <primary>error</primary>
61478 <secondary>ignored</secondary>
61479 </indexterm>
61480 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
61481 message:
61482 </para>
61483 <orderedlist numeration="arabic">
61484 <listitem>
61485 <para>
61486 Exim failed to deliver a bounce message whose age was greater than
61487 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
61488 </para>
61489 </listitem>
61490 <listitem>
61491 <para>
61492 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
61493 failed. The delivery was discarded.
61494 </para>
61495 </listitem>
61496 <listitem>
61497 <para>
61498 A delivery set up by a router configured with
61499 </para>
61500 <literallayout class="monospaced">
61501     errors_to = &lt;&gt;
61502 </literallayout>
61503 <para>
61504 failed. The delivery was discarded.
61505 </para>
61506 </listitem>
61507 </orderedlist>
61508 </listitem>
61509 </itemizedlist>
61510 </section>
61511 <section id="SECTlogselector">
61512 <title>Reducing or increasing what is logged</title>
61513 <para>
61514 <indexterm role="concept">
61515 <primary>log</primary>
61516 <secondary>selectors</secondary>
61517 </indexterm>
61518 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
61519 default logging, or you can request additional logging. The value of
61520 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
61521 example:
61522 </para>
61523 <literallayout class="monospaced">
61524 log_selector = +arguments -retry_defer
61525 </literallayout>
61526 <para>
61527 The list of optional log items is in the following table, with the default
61528 selection marked by asterisks:
61529 </para>
61530 <literallayout>
61531 <phrase revisionflag="changed"><literal> 8bitmime                   </literal>  received 8BITMIME status
61532 </phrase><literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
61533 <literal> address_rewrite            </literal>  address rewriting
61534 <literal> all_parents                </literal>  all parents in =&gt; lines
61535 <literal> arguments                  </literal>  command line arguments
61536 <literal>*connection_reject          </literal>  connection rejections
61537 <literal>*delay_delivery             </literal>  immediate delivery delayed
61538 <literal> deliver_time               </literal>  time taken to perform delivery
61539 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
61540 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
61541 <literal>*etrn                       </literal>  ETRN commands
61542 <literal>*host_lookup_failed         </literal>  as it says
61543 <literal> ident_timeout              </literal>  timeout for ident connection
61544 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
61545 <literal> incoming_port              </literal>  incoming port on &lt;= lines
61546 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
61547 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
61548 <literal>*queue_run                  </literal>  start and end queue runs
61549 <literal> queue_time                 </literal>  time on queue for one recipient
61550 <literal> queue_time_overall         </literal>  time on queue for whole message
61551 <literal> pid                        </literal>  Exim process id
61552 <literal> received_recipients        </literal>  recipients on &lt;= lines
61553 <literal> received_sender            </literal>  sender on &lt;= lines
61554 <literal>*rejected_header            </literal>  header contents on reject log
61555 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
61556 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
61557 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
61558 <literal>*sender_verify_fail         </literal>  sender verification failures
61559 <literal>*size_reject                </literal>  rejection because too big
61560 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
61561 <phrase revisionflag="changed"><literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
61562 </phrase><literal> smtp_connection            </literal>  SMTP connections
61563 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
61564 <phrase revisionflag="changed"><literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
61565 </phrase><literal> smtp_no_mail               </literal>  session with no MAIL commands
61566 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
61567 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
61568 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
61569 <literal> tls_certificate_verified   </literal>  certificate verification status
61570 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
61571 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
61572 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
61573 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
61574
61575 <literal> all                        </literal>  all of the above
61576 </literallayout>
61577 <para>
61578 More details on each of these items follows:
61579 </para>
61580 <itemizedlist>
61581 <listitem>
61582 <para revisionflag="changed">
61583 <indexterm role="concept">
61584 <primary>8BITMIME</primary>
61585 </indexterm>
61586 <indexterm role="concept">
61587 <primary>log</primary>
61588 <secondary>8BITMIME</secondary>
61589 </indexterm>
61590 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
61591 which may help in tracking down interoperability issues with ancient MTAs
61592 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
61593 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
61594 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
61595 </para>
61596 </listitem>
61597 <listitem>
61598 <para>
61599 <indexterm role="concept">
61600 <primary><option>warn</option> ACL verb</primary>
61601 <secondary>log when skipping</secondary>
61602 </indexterm>
61603 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
61604 its conditions cannot be evaluated, a log line to this effect is written if
61605 this log selector is set.
61606 </para>
61607 </listitem>
61608 <listitem>
61609 <para>
61610 <indexterm role="concept">
61611 <primary>log</primary>
61612 <secondary>rewriting</secondary>
61613 </indexterm>
61614 <indexterm role="concept">
61615 <primary>rewriting</primary>
61616 <secondary>logging</secondary>
61617 </indexterm>
61618 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
61619 rewrites, but not to rewrites in filters run as an unprivileged user (because
61620 such users cannot access the log).
61621 </para>
61622 </listitem>
61623 <listitem>
61624 <para>
61625 <indexterm role="concept">
61626 <primary>log</primary>
61627 <secondary>full parentage</secondary>
61628 </indexterm>
61629 <option>all_parents</option>: Normally only the original and final addresses are logged on
61630 delivery lines; with this selector, intermediate parents are given in
61631 parentheses between them.
61632 </para>
61633 </listitem>
61634 <listitem>
61635 <para>
61636 <indexterm role="concept">
61637 <primary>log</primary>
61638 <secondary>Exim arguments</secondary>
61639 </indexterm>
61640 <indexterm role="concept">
61641 <primary>Exim arguments, logging</primary>
61642 </indexterm>
61643 <option>arguments</option>: This causes Exim to write the arguments with which it was called
61644 to the main log, preceded by the current working directory. This is a debugging
61645 feature, added to make it easier to find out how certain MUAs call
61646 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
61647 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
61648 that are empty or that contain white space are quoted. Non-printing characters
61649 are shown as escape sequences. This facility cannot log unrecognized arguments,
61650 because the arguments are checked before the configuration file is read. The
61651 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
61652 between the caller and Exim.
61653 </para>
61654 </listitem>
61655 <listitem>
61656 <para>
61657 <indexterm role="concept">
61658 <primary>log</primary>
61659 <secondary>connection rejections</secondary>
61660 </indexterm>
61661 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
61662 connection is rejected, for whatever reason.
61663 </para>
61664 </listitem>
61665 <listitem>
61666 <para>
61667 <indexterm role="concept">
61668 <primary>log</primary>
61669 <secondary>delayed delivery</secondary>
61670 </indexterm>
61671 <indexterm role="concept">
61672 <primary>delayed delivery, logging</primary>
61673 </indexterm>
61674 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
61675 started for an incoming message because the load is too high or too many
61676 messages were received on one connection. Logging does not occur if no delivery
61677 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
61678 </para>
61679 </listitem>
61680 <listitem>
61681 <para>
61682 <indexterm role="concept">
61683 <primary>log</primary>
61684 <secondary>delivery duration</secondary>
61685 </indexterm>
61686 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
61687 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
61688 </para>
61689 </listitem>
61690 <listitem>
61691 <para>
61692 <indexterm role="concept">
61693 <primary>log</primary>
61694 <secondary>message size on delivery</secondary>
61695 </indexterm>
61696 <indexterm role="concept">
61697 <primary>size</primary>
61698 <secondary>of message</secondary>
61699 </indexterm>
61700 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
61701 the <quote>=&gt;</quote> line, tagged with S=.
61702 </para>
61703 </listitem>
61704 <listitem>
61705 <para>
61706 <indexterm role="concept">
61707 <primary>log</primary>
61708 <secondary>dnslist defer</secondary>
61709 </indexterm>
61710 <indexterm role="concept">
61711 <primary>DNS list</primary>
61712 <secondary>logging defer</secondary>
61713 </indexterm>
61714 <indexterm role="concept">
61715 <primary>black list (DNS)</primary>
61716 </indexterm>
61717 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
61718 DNS black list suffers a temporary error.
61719 </para>
61720 </listitem>
61721 <listitem>
61722 <para>
61723 <indexterm role="concept">
61724 <primary>log</primary>
61725 <secondary>ETRN commands</secondary>
61726 </indexterm>
61727 <indexterm role="concept">
61728 <primary>ETRN</primary>
61729 <secondary>logging</secondary>
61730 </indexterm>
61731 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
61732 is run to determine whether or not it is actually accepted. An invalid ETRN
61733 command, or one received within a message transaction is not logged by this
61734 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
61735 </para>
61736 </listitem>
61737 <listitem>
61738 <para>
61739 <indexterm role="concept">
61740 <primary>log</primary>
61741 <secondary>host lookup failure</secondary>
61742 </indexterm>
61743 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
61744 any addresses, or when a lookup of an IP address fails to find a host name, a
61745 log line is written. This logging does not apply to direct DNS lookups when
61746 routing email addresses, but it does apply to <quote>byname</quote> lookups.
61747 </para>
61748 </listitem>
61749 <listitem>
61750 <para>
61751 <indexterm role="concept">
61752 <primary>log</primary>
61753 <secondary>ident timeout</secondary>
61754 </indexterm>
61755 <indexterm role="concept">
61756 <primary>RFC 1413</primary>
61757 <secondary>logging timeout</secondary>
61758 </indexterm>
61759 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
61760 client&#x2019;s ident port times out.
61761 </para>
61762 </listitem>
61763 <listitem>
61764 <para>
61765 <indexterm role="concept">
61766 <primary>log</primary>
61767 <secondary>incoming interface</secondary>
61768 </indexterm>
61769 <indexterm role="concept">
61770 <primary>interface</primary>
61771 <secondary>logging</secondary>
61772 </indexterm>
61773 <option>incoming_interface</option>: The interface on which a message was received is added
61774 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
61775 followed by a colon and the port number. The local interface and port are also
61776 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
61777 rejection lines.
61778 </para>
61779 </listitem>
61780 <listitem>
61781 <para>
61782 <indexterm role="concept">
61783 <primary>log</primary>
61784 <secondary>incoming remote port</secondary>
61785 </indexterm>
61786 <indexterm role="concept">
61787 <primary>port</primary>
61788 <secondary>logging remote</secondary>
61789 </indexterm>
61790 <indexterm role="concept">
61791 <primary>TCP/IP</primary>
61792 <secondary>logging incoming remote port</secondary>
61793 </indexterm>
61794 <indexterm role="variable">
61795 <primary><varname>$sender_fullhost</varname></primary>
61796 </indexterm>
61797 <indexterm role="variable">
61798 <primary><varname>$sender_rcvhost</varname></primary>
61799 </indexterm>
61800 <option>incoming_port</option>: The remote port number from which a message was received is
61801 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
61802 in square brackets, and separated from it by a colon. This is implemented by
61803 changing the value that is put in the <varname>$sender_fullhost</varname> and
61804 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
61805 important with the widening use of NAT (see RFC 2505).
61806 </para>
61807 </listitem>
61808 <listitem>
61809 <para>
61810 <indexterm role="concept">
61811 <primary>log</primary>
61812 <secondary>dropped connection</secondary>
61813 </indexterm>
61814 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
61815 connection is unexpectedly dropped.
61816 </para>
61817 </listitem>
61818 <listitem>
61819 <para>
61820 <indexterm role="concept">
61821 <primary>log</primary>
61822 <secondary>outgoing remote port</secondary>
61823 </indexterm>
61824 <indexterm role="concept">
61825 <primary>port</primary>
61826 <secondary>logging outgoint remote</secondary>
61827 </indexterm>
61828 <indexterm role="concept">
61829 <primary>TCP/IP</primary>
61830 <secondary>logging ougtoing remote port</secondary>
61831 </indexterm>
61832 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
61833 containing =&gt; tags) following the IP address. This option is not included in
61834 the default setting, because for most ordinary configurations, the remote port
61835 number is always 25 (the SMTP port).
61836 </para>
61837 </listitem>
61838 <listitem>
61839 <para>
61840 <indexterm role="concept">
61841 <primary>log</primary>
61842 <secondary>process ids in</secondary>
61843 </indexterm>
61844 <indexterm role="concept">
61845 <primary>pid (process id)</primary>
61846 <secondary>in log lines</secondary>
61847 </indexterm>
61848 <option>pid</option>: The current process id is added to every log line, in square brackets,
61849 immediately after the time and date.
61850 </para>
61851 </listitem>
61852 <listitem>
61853 <para>
61854 <indexterm role="concept">
61855 <primary>log</primary>
61856 <secondary>queue run</secondary>
61857 </indexterm>
61858 <indexterm role="concept">
61859 <primary>queue runner</primary>
61860 <secondary>logging</secondary>
61861 </indexterm>
61862 <option>queue_run</option>: The start and end of every queue run are logged.
61863 </para>
61864 </listitem>
61865 <listitem>
61866 <para>
61867 <indexterm role="concept">
61868 <primary>log</primary>
61869 <secondary>queue time</secondary>
61870 </indexterm>
61871 <option>queue_time</option>: The amount of time the message has been in the queue on the
61872 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
61873 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
61874 includes reception time as well as the delivery time for the current address.
61875 This means that it may be longer than the difference between the arrival and
61876 delivery log line times, because the arrival log line is not written until the
61877 message has been successfully received.
61878 </para>
61879 </listitem>
61880 <listitem>
61881 <para>
61882 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
61883 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
61884 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
61885 message, so it includes reception time as well as the total delivery time.
61886 </para>
61887 </listitem>
61888 <listitem>
61889 <para>
61890 <indexterm role="concept">
61891 <primary>log</primary>
61892 <secondary>recipients</secondary>
61893 </indexterm>
61894 <option>received_recipients</option>: The recipients of a message are listed in the main log
61895 as soon as the message is received. The list appears at the end of the log line
61896 that is written when a message is received, preceded by the word <quote>for</quote>. The
61897 addresses are listed after they have been qualified, but before any rewriting
61898 has taken place.
61899 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
61900 in the list.
61901 </para>
61902 </listitem>
61903 <listitem>
61904 <para>
61905 <indexterm role="concept">
61906 <primary>log</primary>
61907 <secondary>sender reception</secondary>
61908 </indexterm>
61909 <option>received_sender</option>: The unrewritten original sender of a message is added to
61910 the end of the log line that records the message&#x2019;s arrival, after the word
61911 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
61912 </para>
61913 </listitem>
61914 <listitem>
61915 <para>
61916 <indexterm role="concept">
61917 <primary>log</primary>
61918 <secondary>header lines for rejection</secondary>
61919 </indexterm>
61920 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
61921 rejection is written to the reject log, the complete header is added to the
61922 log. Header logging can be turned off individually for messages that are
61923 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
61924 </para>
61925 </listitem>
61926 <listitem>
61927 <para>
61928 <indexterm role="concept">
61929 <primary>log</primary>
61930 <secondary>retry defer</secondary>
61931 </indexterm>
61932 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
61933 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
61934 message is always omitted from individual message logs after the first delivery
61935 attempt.
61936 </para>
61937 </listitem>
61938 <listitem>
61939 <para>
61940 <indexterm role="concept">
61941 <primary>log</primary>
61942 <secondary>return path</secondary>
61943 </indexterm>
61944 <option>return_path_on_delivery</option>: The return path that is being transmitted with
61945 the message is included in delivery and bounce lines, using the tag P=.
61946 This is omitted if no delivery actually happens, for example, if routing fails,
61947 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
61948 </para>
61949 </listitem>
61950 <listitem>
61951 <para>
61952 <indexterm role="concept">
61953 <primary>log</primary>
61954 <secondary>sender on delivery</secondary>
61955 </indexterm>
61956 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
61957 and bounce line, tagged by F= (for <quote>from</quote>).
61958 This is the original sender that was received with the message; it is not
61959 necessarily the same as the outgoing return path.
61960 </para>
61961 </listitem>
61962 <listitem>
61963 <para>
61964 <indexterm role="concept">
61965 <primary>log</primary>
61966 <secondary>sender verify failure</secondary>
61967 </indexterm>
61968 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
61969 gives details of a sender verification failure is not written. Log lines for
61970 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
61971 detail is lost.
61972 </para>
61973 </listitem>
61974 <listitem>
61975 <para>
61976 <indexterm role="concept">
61977 <primary>log</primary>
61978 <secondary>size rejection</secondary>
61979 </indexterm>
61980 <option>size_reject</option>: A log line is written whenever a message is rejected because
61981 it is too big.
61982 </para>
61983 </listitem>
61984 <listitem>
61985 <para>
61986 <indexterm role="concept">
61987 <primary>log</primary>
61988 <secondary>frozen messages; skipped</secondary>
61989 </indexterm>
61990 <indexterm role="concept">
61991 <primary>frozen messages</primary>
61992 <secondary>logging skipping</secondary>
61993 </indexterm>
61994 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
61995 queue run because it is frozen or because another process is already delivering
61996 it.
61997 <indexterm role="concept">
61998 <primary><quote>spool file is locked</quote></primary>
61999 </indexterm>
62000 The message that is written is <quote>spool file is locked</quote>.
62001 </para>
62002 </listitem>
62003 <listitem>
62004 <para>
62005 <indexterm role="concept">
62006 <primary>log</primary>
62007 <secondary>smtp confirmation</secondary>
62008 </indexterm>
62009 <indexterm role="concept">
62010 <primary>SMTP</primary>
62011 <secondary>logging confirmation</secondary>
62012 </indexterm>
62013 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
62014 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
62015 A number of MTAs (including Exim) return an identifying string in this
62016 response.
62017 </para>
62018 </listitem>
62019 <listitem>
62020 <para>
62021 <indexterm role="concept">
62022 <primary>log</primary>
62023 <secondary>SMTP connections</secondary>
62024 </indexterm>
62025 <indexterm role="concept">
62026 <primary>SMTP</primary>
62027 <secondary>logging connections</secondary>
62028 </indexterm>
62029 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
62030 established or closed, unless the connection is from a host that matches
62031 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
62032 only when the closure is unexpected.) This applies to connections from local
62033 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
62034 dropped in the middle of a message, a log line is always written, whether or
62035 not this selector is set, but otherwise nothing is written at the start and end
62036 of connections unless this selector is enabled.
62037 </para>
62038 <para>
62039 For TCP/IP connections to an Exim daemon, the current number of connections is
62040 included in the log message for each new connection, but note that the count is
62041 reset if the daemon is restarted.
62042 Also, because connections are closed (and the closure is logged) in
62043 subprocesses, the count may not include connections that have been closed but
62044 whose termination the daemon has not yet noticed. Thus, while it is possible to
62045 match up the opening and closing of connections in the log, the value of the
62046 logged counts may not be entirely accurate.
62047 </para>
62048 </listitem>
62049 <listitem>
62050 <para>
62051 <indexterm role="concept">
62052 <primary>log</primary>
62053 <secondary>SMTP transaction; incomplete</secondary>
62054 </indexterm>
62055 <indexterm role="concept">
62056 <primary>SMTP</primary>
62057 <secondary>logging incomplete transactions</secondary>
62058 </indexterm>
62059 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
62060 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
62061 and the message sender plus any accepted recipients are included in the log
62062 line. This can provide evidence of dictionary attacks.
62063 </para>
62064 </listitem>
62065 <listitem>
62066 <para>
62067 <indexterm role="concept">
62068 <primary>log</primary>
62069 <secondary>non-MAIL SMTP sessions</secondary>
62070 </indexterm>
62071 <indexterm role="concept">
62072 <primary>MAIL</primary>
62073 <secondary>logging session without</secondary>
62074 </indexterm>
62075 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
62076 connection terminates without having issued a MAIL command. This includes both
62077 the case when the connection is dropped, and the case when QUIT is used. It
62078 does not include cases where the connection is rejected right at the start (by
62079 an ACL, or because there are too many connections, or whatever). These cases
62080 already have their own log lines.
62081 </para>
62082 <para>
62083 The log line that is written contains the identity of the client in the usual
62084 way, followed by D= and a time, which records the duration of the connection.
62085 If the connection was authenticated, this fact is logged exactly as it is for
62086 an incoming message, with an A= item. If the connection was encrypted, CV=,
62087 DN=, and X= items may appear as they do for an incoming message, controlled by
62088 the same logging options.
62089 </para>
62090 <para>
62091 Finally, if any SMTP commands were issued during the connection, a C= item
62092 is added to the line, listing the commands that were used. For example,
62093 </para>
62094 <literallayout class="monospaced">
62095 C=EHLO,QUIT
62096 </literallayout>
62097 <para>
62098 shows that the client issued QUIT straight after EHLO. If there were fewer
62099 than 20 commands, they are all listed. If there were more than 20 commands,
62100 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
62101 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
62102 have been aborted before 20 non-mail commands are processed.
62103 </para>
62104 </listitem>
62105 <listitem>
62106 <para revisionflag="changed">
62107 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
62108 colon-separated, is appended to the A= item for a message arrival or delivery
62109 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
62110 was accepted or used.
62111 </para>
62112 </listitem>
62113 <listitem>
62114 <para>
62115 <indexterm role="concept">
62116 <primary>log</primary>
62117 <secondary>SMTP protocol error</secondary>
62118 </indexterm>
62119 <indexterm role="concept">
62120 <primary>SMTP</primary>
62121 <secondary>logging protocol error</secondary>
62122 </indexterm>
62123 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
62124 encountered. Exim does not have perfect detection of all protocol errors
62125 because of transmission delays and the use of pipelining. If PIPELINING has
62126 been advertised to a client, an Exim server assumes that the client will use
62127 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
62128 received after rejecting MAIL) as protocol errors.
62129 </para>
62130 </listitem>
62131 <listitem>
62132 <para>
62133 <indexterm role="concept">
62134 <primary>SMTP</primary>
62135 <secondary>logging syntax errors</secondary>
62136 </indexterm>
62137 <indexterm role="concept">
62138 <primary>SMTP</primary>
62139 <secondary>syntax errors; logging</secondary>
62140 </indexterm>
62141 <indexterm role="concept">
62142 <primary>SMTP</primary>
62143 <secondary>unknown command; logging</secondary>
62144 </indexterm>
62145 <indexterm role="concept">
62146 <primary>log</primary>
62147 <secondary>unknown SMTP command</secondary>
62148 </indexterm>
62149 <indexterm role="concept">
62150 <primary>log</primary>
62151 <secondary>SMTP syntax error</secondary>
62152 </indexterm>
62153 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
62154 encountered. An unrecognized command is treated as a syntax error. For an
62155 external connection, the host identity is given; for an internal connection
62156 using <option>-bs</option> the sender identification (normally the calling user) is given.
62157 </para>
62158 </listitem>
62159 <listitem>
62160 <para>
62161 <indexterm role="concept">
62162 <primary>log</primary>
62163 <secondary>subject</secondary>
62164 </indexterm>
62165 <indexterm role="concept">
62166 <primary>subject, logging</primary>
62167 </indexterm>
62168 <option>subject</option>: The subject of the message is added to the arrival log line,
62169 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
62170 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
62171 specifies whether characters with values greater than 127 should be logged
62172 unchanged, or whether they should be rendered as escape sequences.
62173 </para>
62174 </listitem>
62175 <listitem>
62176 <para>
62177 <indexterm role="concept">
62178 <primary>log</primary>
62179 <secondary>certificate verification</secondary>
62180 </indexterm>
62181 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
62182 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
62183 verified, and <literal>CV=no</literal> if not.
62184 </para>
62185 </listitem>
62186 <listitem>
62187 <para>
62188 <indexterm role="concept">
62189 <primary>log</primary>
62190 <secondary>TLS cipher</secondary>
62191 </indexterm>
62192 <indexterm role="concept">
62193 <primary>TLS</primary>
62194 <secondary>logging cipher</secondary>
62195 </indexterm>
62196 <option>tls_cipher</option>: When a message is sent or received over an encrypted
62197 connection, the cipher suite used is added to the log line, preceded by X=.
62198 </para>
62199 </listitem>
62200 <listitem>
62201 <para>
62202 <indexterm role="concept">
62203 <primary>log</primary>
62204 <secondary>TLS peer DN</secondary>
62205 </indexterm>
62206 <indexterm role="concept">
62207 <primary>TLS</primary>
62208 <secondary>logging peer DN</secondary>
62209 </indexterm>
62210 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
62211 connection, and a certificate is supplied by the remote host, the peer DN is
62212 added to the log line, preceded by DN=.
62213 </para>
62214 </listitem>
62215 <listitem>
62216 <para>
62217 <indexterm role="concept">
62218 <primary>log</primary>
62219 <secondary>TLS SNI</secondary>
62220 </indexterm>
62221 <indexterm role="concept">
62222 <primary>TLS</primary>
62223 <secondary>logging SNI</secondary>
62224 </indexterm>
62225 <option>tls_sni</option>: When a message is received over an encrypted connection, and
62226 the remote host provided the Server Name Indication extension, the SNI is
62227 added to the log line, preceded by SNI=.
62228 </para>
62229 </listitem>
62230 <listitem>
62231 <para>
62232 <indexterm role="concept">
62233 <primary>log</primary>
62234 <secondary>DNS failure in list</secondary>
62235 </indexterm>
62236 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
62237 result of a list match is failure because a DNS lookup failed.
62238 </para>
62239 </listitem>
62240 </itemizedlist>
62241 </section>
62242 <section id="SECID260">
62243 <title>Message log</title>
62244 <para>
62245 <indexterm role="concept">
62246 <primary>message</primary>
62247 <secondary>log file for</secondary>
62248 </indexterm>
62249 <indexterm role="concept">
62250 <primary>log</primary>
62251 <secondary>message log; description of</secondary>
62252 </indexterm>
62253 <indexterm role="concept">
62254 <primary><filename>msglog</filename> directory</primary>
62255 </indexterm>
62256 <indexterm role="option">
62257 <primary><option>preserve_message_logs</option></primary>
62258 </indexterm>
62259 In addition to the general log files, Exim writes a log file for each message
62260 that it handles. The names of these per-message logs are the message ids, and
62261 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
62262 message log contains copies of the log lines that apply to the message. This
62263 makes it easier to inspect the status of an individual message without having
62264 to search the main log. A message log is deleted when processing of the message
62265 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
62266 only with great care because they can fill up your disk very quickly.
62267 </para>
62268 <para>
62269 On a heavily loaded system, it may be desirable to disable the use of
62270 per-message logs, in order to reduce disk I/O. This can be done by setting the
62271 <option>message_logs</option> option false.
62272 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
62273 </para>
62274 </section>
62275 </chapter>
62276
62277 <chapter id="CHAPutils">
62278 <title>Exim utilities</title>
62279 <para>
62280 <indexterm role="concept" id="IIDutils" class="startofrange">
62281 <primary>utilities</primary>
62282 </indexterm>
62283 A number of utility scripts and programs are supplied with Exim and are
62284 described in this chapter. There is also the Exim Monitor, which is covered in
62285 the next chapter. The utilities described here are:
62286 </para>
62287 <informaltable frame="none">
62288 <tgroup cols="3" colsep="0" rowsep="0">
62289 <colspec colwidth="7*" align="left"/>
62290 <colspec colwidth="15*" align="left"/>
62291 <colspec colwidth="40*" align="left"/>
62292 <tbody>
62293 <row>
62294 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
62295 <entry><emphasis>exiwhat</emphasis></entry>
62296 <entry>list what Exim processes are doing</entry>
62297 </row>
62298 <row>
62299 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
62300 <entry><emphasis>exiqgrep</emphasis></entry>
62301 <entry>grep the queue</entry>
62302 </row>
62303 <row>
62304 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
62305 <entry><emphasis>exiqsumm</emphasis></entry>
62306 <entry>summarize the queue</entry>
62307 </row>
62308 <row>
62309 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
62310 <entry><emphasis>exigrep</emphasis></entry>
62311 <entry>search the main log</entry>
62312 </row>
62313 <row>
62314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
62315 <entry><emphasis>exipick</emphasis></entry>
62316 <entry>select messages on various criteria</entry>
62317 </row>
62318 <row>
62319 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
62320 <entry><emphasis>exicyclog</emphasis></entry>
62321 <entry>cycle (rotate) log files</entry>
62322 </row>
62323 <row>
62324 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
62325 <entry><emphasis>eximstats</emphasis></entry>
62326 <entry>extract statistics from the log</entry>
62327 </row>
62328 <row>
62329 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
62330 <entry><emphasis>exim_checkaccess</emphasis></entry>
62331 <entry>check address acceptance from given IP</entry>
62332 </row>
62333 <row>
62334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
62335 <entry><emphasis>exim_dbmbuild</emphasis></entry>
62336 <entry>build a DBM file</entry>
62337 </row>
62338 <row>
62339 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
62340 <entry><emphasis>exinext</emphasis></entry>
62341 <entry>extract retry information</entry>
62342 </row>
62343 <row>
62344 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
62345 <entry><emphasis>exim_dumpdb</emphasis></entry>
62346 <entry>dump a hints database</entry>
62347 </row>
62348 <row>
62349 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
62350 <entry><emphasis>exim_tidydb</emphasis></entry>
62351 <entry>clean up a hints database</entry>
62352 </row>
62353 <row>
62354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
62355 <entry><emphasis>exim_fixdb</emphasis></entry>
62356 <entry>patch a hints database</entry>
62357 </row>
62358 <row>
62359 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
62360 <entry><emphasis>exim_lock</emphasis></entry>
62361 <entry>lock a mailbox file</entry>
62362 </row>
62363 </tbody>
62364 </tgroup>
62365 </informaltable>
62366 <para>
62367 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
62368 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
62369 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
62370 </para>
62371 <section id="SECTfinoutwha">
62372 <title>Finding out what Exim processes are doing (exiwhat)</title>
62373 <para>
62374 <indexterm role="concept">
62375 <primary><emphasis>exiwhat</emphasis></primary>
62376 </indexterm>
62377 <indexterm role="concept">
62378 <primary>process, querying</primary>
62379 </indexterm>
62380 <indexterm role="concept">
62381 <primary>SIGUSR1</primary>
62382 </indexterm>
62383 On operating systems that can restart a system call after receiving a signal
62384 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
62385 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
62386 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
62387 processes it can find, having first emptied the file. It then waits for one
62388 second to allow the Exim processes to react before displaying the results. In
62389 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
62390 send the signal to the Exim processes, so it is normally run as root.
62391 </para>
62392 <para>
62393 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
62394 use by system administrators. It is not sensible, for example, to set up a
62395 script that sends SIGUSR1 signals to Exim processes at short intervals.
62396 </para>
62397 <para>
62398 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
62399 varies in different operating systems. Not only are different options used,
62400 but the format of the output is different. For this reason, there are some
62401 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
62402 it doesn&#x2019;t seem to be working for you, check the following compile-time
62403 options:
62404 </para>
62405 <literallayout>
62406 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
62407 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
62408 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
62409 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
62410 </literallayout>
62411 <para>
62412 An example of typical output from <emphasis>exiwhat</emphasis> is
62413 </para>
62414 <literallayout class="monospaced">
62415 164 daemon: -q1h, listening on port 25
62416 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
62417 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
62418   [10.19.42.42] (editor@ref.example)
62419 10592 handling incoming call from [192.168.243.242]
62420 10628 accepting a local non-SMTP message
62421 </literallayout>
62422 <para>
62423 The first number in the output line is the process number. The third line has
62424 been split here, in order to fit it on the page.
62425 </para>
62426 </section>
62427 <section id="SECTgreptheque">
62428 <title>Selective queue listing (exiqgrep)</title>
62429 <para>
62430 <indexterm role="concept">
62431 <primary><emphasis>exiqgrep</emphasis></primary>
62432 </indexterm>
62433 <indexterm role="concept">
62434 <primary>queue</primary>
62435 <secondary>grepping</secondary>
62436 </indexterm>
62437 This utility is a Perl script contributed by Matt Hubbard. It runs
62438 </para>
62439 <literallayout class="monospaced">
62440 exim -bpu
62441 </literallayout>
62442 <para>
62443 to obtain a queue listing with undelivered recipients only, and then greps the
62444 output to select messages that match given criteria. The following selection
62445 options are available:
62446 </para>
62447 <variablelist>
62448 <varlistentry>
62449 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
62450 <listitem>
62451 <para>
62452 Match the sender address using a case-insensitive search. The field that is
62453 tested is enclosed in angle brackets, so you can test for bounce messages with
62454 </para>
62455 <literallayout class="monospaced">
62456 exiqgrep -f '^&lt;&gt;$'
62457 </literallayout>
62458 </listitem></varlistentry>
62459 <varlistentry>
62460 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
62461 <listitem>
62462 <para>
62463 Match a recipient address using a case-insensitve search. The field that is
62464 tested is not enclosed in angle brackets.
62465 </para>
62466 </listitem></varlistentry>
62467 <varlistentry>
62468 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
62469 <listitem>
62470 <para>
62471 Match against the size field.
62472 </para>
62473 </listitem></varlistentry>
62474 <varlistentry>
62475 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
62476 <listitem>
62477 <para>
62478 Match messages that are younger than the given time.
62479 </para>
62480 </listitem></varlistentry>
62481 <varlistentry>
62482 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
62483 <listitem>
62484 <para>
62485 Match messages that are older than the given time.
62486 </para>
62487 </listitem></varlistentry>
62488 <varlistentry>
62489 <term><emphasis role="bold">-z</emphasis></term>
62490 <listitem>
62491 <para>
62492 Match only frozen messages.
62493 </para>
62494 </listitem></varlistentry>
62495 <varlistentry>
62496 <term><emphasis role="bold">-x</emphasis></term>
62497 <listitem>
62498 <para>
62499 Match only non-frozen messages.
62500 </para>
62501 </listitem></varlistentry>
62502 </variablelist>
62503 <para>
62504 The following options control the format of the output:
62505 </para>
62506 <variablelist>
62507 <varlistentry>
62508 <term><emphasis role="bold">-c</emphasis></term>
62509 <listitem>
62510 <para>
62511 Display only the count of matching messages.
62512 </para>
62513 </listitem></varlistentry>
62514 <varlistentry>
62515 <term><emphasis role="bold">-l</emphasis></term>
62516 <listitem>
62517 <para>
62518 Long format &ndash; display the full message information as output by Exim. This is
62519 the default.
62520 </para>
62521 </listitem></varlistentry>
62522 <varlistentry>
62523 <term><emphasis role="bold">-i</emphasis></term>
62524 <listitem>
62525 <para>
62526 Display message ids only.
62527 </para>
62528 </listitem></varlistentry>
62529 <varlistentry>
62530 <term><emphasis role="bold">-b</emphasis></term>
62531 <listitem>
62532 <para>
62533 Brief format &ndash; one line per message.
62534 </para>
62535 </listitem></varlistentry>
62536 <varlistentry>
62537 <term><emphasis role="bold">-R</emphasis></term>
62538 <listitem>
62539 <para>
62540 Display messages in reverse order.
62541 </para>
62542 </listitem></varlistentry>
62543 </variablelist>
62544 <para>
62545 There is one more option, <option>-h</option>, which outputs a list of options.
62546 </para>
62547 </section>
62548 <section id="SECTsumtheque">
62549 <title>Summarizing the queue (exiqsumm)</title>
62550 <para>
62551 <indexterm role="concept">
62552 <primary><emphasis>exiqsumm</emphasis></primary>
62553 </indexterm>
62554 <indexterm role="concept">
62555 <primary>queue</primary>
62556 <secondary>summary</secondary>
62557 </indexterm>
62558 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
62559 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
62560 running a command such as
62561 </para>
62562 <literallayout class="monospaced">
62563 exim -bp | exiqsumm
62564 </literallayout>
62565 <para>
62566 The output consists of one line for each domain that has messages waiting for
62567 it, as in the following example:
62568 </para>
62569 <literallayout class="monospaced">
62570 3   2322   74m   66m  msn.com.example
62571 </literallayout>
62572 <para>
62573 Each line lists the number of pending deliveries for a domain, their total
62574 volume, and the length of time that the oldest and the newest messages have
62575 been waiting. Note that the number of pending deliveries is greater than the
62576 number of messages when messages have more than one recipient.
62577 </para>
62578 <para>
62579 A summary line is output at the end. By default the output is sorted on the
62580 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
62581 the output to be sorted by oldest message and by count of messages,
62582 respectively. There are also three options that split the messages for each
62583 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
62584 separates frozen messages, and <option>-s</option> separates messages according to their
62585 sender.
62586 </para>
62587 <para>
62588 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
62589 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
62590 generated by aliasing or forwarding are included (unless the <option>one_time</option>
62591 option of the <command>redirect</command> router has been used to convert them into <quote>top
62592 level</quote> addresses).
62593 </para>
62594 </section>
62595 <section id="SECTextspeinf">
62596 <title>Extracting specific information from the log (exigrep)</title>
62597 <para>
62598 <indexterm role="concept">
62599 <primary><emphasis>exigrep</emphasis></primary>
62600 </indexterm>
62601 <indexterm role="concept">
62602 <primary>log</primary>
62603 <secondary>extracts; grepping for</secondary>
62604 </indexterm>
62605 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
62606 files for entries that match a given pattern. When it finds a match, it
62607 extracts all the log entries for the relevant message, not just those that
62608 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
62609 given message, or all mail for a given user, or for a given host, for example.
62610 The input files can be in Exim log format or syslog format.
62611 If a matching log line is not associated with a specific message, it is
62612 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
62613 </para>
62614 <literallayout>
62615 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
62616 </literallayout>
62617 <para>
62618 If no log file names are given on the command line, the standard input is read.
62619 </para>
62620 <para>
62621 The <option>-t</option> argument specifies a number of seconds. It adds an additional
62622 condition for message selection. Messages that are complete are shown only if
62623 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
62624 </para>
62625 <para>
62626 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
62627 makes it case-sensitive. This may give a performance improvement when searching
62628 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
62629 option; with <option>-I</option> they do not. In both cases it is possible to change the
62630 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
62631 </para>
62632 <para>
62633 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
62634 pattern as standing for themselves. Otherwise the pattern must be a Perl
62635 regular expression.
62636 </para>
62637 <para>
62638 The <option>-v</option> option inverts the matching condition. That is, a line is selected
62639 if it does <emphasis>not</emphasis> match the pattern.
62640 </para>
62641 <para>
62642 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
62643 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
62644 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
62645 </para>
62646 </section>
62647 <section id="SECTexipick">
62648 <title>Selecting messages by various criteria (exipick)</title>
62649 <para>
62650 <indexterm role="concept">
62651 <primary><emphasis>exipick</emphasis></primary>
62652 </indexterm>
62653 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
62654 lists messages from the queue according to a variety of criteria. For details
62655 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
62656 <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
62657 the <option>--help</option> option.
62658 </para>
62659 </section>
62660 <section id="SECTcyclogfil">
62661 <title>Cycling log files (exicyclog)</title>
62662 <para>
62663 <indexterm role="concept">
62664 <primary>log</primary>
62665 <secondary>cycling local files</secondary>
62666 </indexterm>
62667 <indexterm role="concept">
62668 <primary>cycling logs</primary>
62669 </indexterm>
62670 <indexterm role="concept">
62671 <primary><emphasis>exicyclog</emphasis></primary>
62672 </indexterm>
62673 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
62674 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
62675 you are using log files with datestamps in their names (see section
62676 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
62677 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
62678 There are two command line options for <emphasis>exicyclog</emphasis>:
62679 </para>
62680 <itemizedlist>
62681 <listitem>
62682 <para>
62683 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
62684 default that is set when Exim is built. The default default is 10.
62685 </para>
62686 </listitem>
62687 <listitem>
62688 <para>
62689 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
62690 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
62691 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
62692 configuration.
62693 </para>
62694 </listitem>
62695 </itemizedlist>
62696 <para>
62697 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
62698 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
62699 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
62700 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
62701 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
62702 logs are handled similarly.
62703 </para>
62704 <para>
62705 If the limit is greater than 99, the script uses 3-digit numbers such as
62706 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
62707 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
62708 any existing log files.
62709 </para>
62710 <para>
62711 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
62712 the end are deleted. All files with numbers greater than 01 are compressed,
62713 using a compression command which is configured by the COMPRESS_COMMAND
62714 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
62715 root <option>crontab</option> entry of the form
62716 </para>
62717 <literallayout class="monospaced">
62718 1 0 * * * su exim -c /usr/exim/bin/exicyclog
62719 </literallayout>
62720 <para>
62721 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
62722 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
62723 </para>
62724 </section>
62725 <section id="SECTmailstat">
62726 <title>Mail statistics (eximstats)</title>
62727 <para>
62728 <indexterm role="concept">
62729 <primary>statistics</primary>
62730 </indexterm>
62731 <indexterm role="concept">
62732 <primary><emphasis>eximstats</emphasis></primary>
62733 </indexterm>
62734 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
62735 information from log files. The output is either plain text, or HTML.
62736 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
62737 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
62738 </para>
62739 <para>
62740 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
62741 latest version is the result of some extensive revision by Steve Campbell. A
62742 lot of information is given by default, but there are options for suppressing
62743 various parts of it. Following any options, the arguments to the script are a
62744 list of files, which should be main log files. For example:
62745 </para>
62746 <literallayout class="monospaced">
62747 eximstats -nr /var/spool/exim/log/mainlog.01
62748 </literallayout>
62749 <para>
62750 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
62751 messages received from or delivered to various hosts. The information is sorted
62752 both by message count and by volume, and the top fifty hosts in each category
62753 are listed on the standard output. Similar information, based on email
62754 addresses or domains instead of hosts can be requested by means of various
62755 options. For messages delivered and received locally, similar statistics are
62756 also produced per user.
62757 </para>
62758 <para>
62759 The output also includes total counts and statistics about delivery errors, and
62760 histograms showing the number of messages received and deliveries made in each
62761 hour of the day. A delivery with more than one address in its envelope (for
62762 example, an SMTP transaction with more than one RCPT command) is counted
62763 as a single delivery by <emphasis>eximstats</emphasis>.
62764 </para>
62765 <para>
62766 Though normally more deliveries than receipts are reported (as messages may
62767 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
62768 messages received than delivered, even though the queue is empty at the start
62769 and end of the period in question. If an incoming message contains no valid
62770 recipients, no deliveries are recorded for it. A bounce message is handled as
62771 an entirely separate message.
62772 </para>
62773 <para>
62774 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
62775 of messages received and deliveries made, and the number of hosts involved in
62776 each case. It also outputs the number of messages that were delayed (that is,
62777 not completely delivered at the first attempt), and the number that had at
62778 least one address that failed.
62779 </para>
62780 <para>
62781 The remainder of the output is in sections that can be independently disabled
62782 or modified by various options. It consists of a summary of deliveries by
62783 transport, histograms of messages received and delivered per time interval
62784 (default per hour), information about the time messages spent on the queue,
62785 a list of relayed messages, lists of the top fifty sending hosts, local
62786 senders, destination hosts, and destination local users by count and by volume,
62787 and a list of delivery errors that occurred.
62788 </para>
62789 <para>
62790 The relay information lists messages that were actually relayed, that is, they
62791 came from a remote host and were directly delivered to some other remote host,
62792 without being processed (for example, for aliasing or forwarding) locally.
62793 </para>
62794 <para>
62795 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
62796 outputs. These are documented in the Perl script itself, and can be extracted
62797 by running the command <command>perldoc</command> on the script. For example:
62798 </para>
62799 <literallayout class="monospaced">
62800 perldoc /usr/exim/bin/eximstats
62801 </literallayout>
62802 </section>
62803 <section id="SECTcheckaccess">
62804 <title>Checking access policy (exim_checkaccess)</title>
62805 <para>
62806 <indexterm role="concept">
62807 <primary><emphasis>exim_checkaccess</emphasis></primary>
62808 </indexterm>
62809 <indexterm role="concept">
62810 <primary>policy control</primary>
62811 <secondary>checking access</secondary>
62812 </indexterm>
62813 <indexterm role="concept">
62814 <primary>checking access</primary>
62815 </indexterm>
62816 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
62817 debugging output, in order to check what Exim is doing when it is applying
62818 policy controls to incoming SMTP mail. However, not everybody is sufficiently
62819 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
62820 sometimes you just want to answer the question <quote>Does this address have
62821 access?</quote> without bothering with any further details.
62822 </para>
62823 <para>
62824 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
62825 two arguments, an IP address and an email address:
62826 </para>
62827 <literallayout class="monospaced">
62828 exim_checkaccess 10.9.8.7 A.User@a.domain.example
62829 </literallayout>
62830 <para>
62831 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
62832 given email address would be accepted in a RCPT command in a TCP/IP
62833 connection from the host with the given IP address. The output of the utility
62834 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
62835 </para>
62836 <literallayout class="monospaced">
62837 Rejected:
62838 550 Relay not permitted
62839 </literallayout>
62840 <para>
62841 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
62842 for the MAIL command, but you can change this by providing additional
62843 options. These are passed directly to the Exim command. For example, to specify
62844 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
62845 you can use:
62846 </para>
62847 <literallayout class="monospaced">
62848 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
62849                  -f himself@there.example
62850 </literallayout>
62851 <para>
62852 Note that these additional Exim command line items must be given after the two
62853 mandatory arguments.
62854 </para>
62855 <para>
62856 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
62857 while running its checks. You can run checks that include callouts by using
62858 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
62859 </para>
62860 </section>
62861 <section id="SECTdbmbuild">
62862 <title>Making DBM files (exim_dbmbuild)</title>
62863 <para>
62864 <indexterm role="concept">
62865 <primary>DBM</primary>
62866 <secondary>building dbm files</secondary>
62867 </indexterm>
62868 <indexterm role="concept">
62869 <primary>building DBM files</primary>
62870 </indexterm>
62871 <indexterm role="concept">
62872 <primary><emphasis>exim_dbmbuild</emphasis></primary>
62873 </indexterm>
62874 <indexterm role="concept">
62875 <primary>lower casing</primary>
62876 </indexterm>
62877 <indexterm role="concept">
62878 <primary>binary zero</primary>
62879 <secondary>in lookup key</secondary>
62880 </indexterm>
62881 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
62882 the format used by the <command>lsearch</command> lookup (see section
62883 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
62884 names as keys and the remainder of the information as data. The lower-casing
62885 can be prevented by calling the program with the <option>-nolc</option> option.
62886 </para>
62887 <para>
62888 A terminating zero is included as part of the key string. This is expected by
62889 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
62890 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
62891 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
62892 files.
62893 </para>
62894 <para>
62895 The program requires two arguments: the name of the input file (which can be a
62896 single hyphen to indicate the standard input), and the name of the output file.
62897 It creates the output under a temporary name, and then renames it if all went
62898 well.
62899 </para>
62900 <para>
62901 <indexterm role="concept">
62902 <primary>USE_DB</primary>
62903 </indexterm>
62904 If the native DB interface is in use (USE_DB is set in a compile-time
62905 configuration file &ndash; this is common in free versions of Unix) the two file
62906 names must be different, because in this mode the Berkeley DB functions create
62907 a single output file using exactly the name given. For example,
62908 </para>
62909 <literallayout class="monospaced">
62910 exim_dbmbuild /etc/aliases /etc/aliases.db
62911 </literallayout>
62912 <para>
62913 reads the system alias file and creates a DBM version of it in
62914 <filename>/etc/aliases.db</filename>.
62915 </para>
62916 <para>
62917 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
62918 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
62919 environment, the suffixes are added to the second argument of
62920 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
62921 when the Berkeley functions are used in compatibility mode (though this is not
62922 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
62923 </para>
62924 <para>
62925 If a duplicate key is encountered, the program outputs a warning, and when it
62926 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
62927 option is used. By default, only the first of a set of duplicates is used &ndash;
62928 this makes it compatible with <command>lsearch</command> lookups. There is an option
62929 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
62930 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
62931 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
62932 return code is 2.
62933 </para>
62934 </section>
62935 <section id="SECTfinindret">
62936 <title>Finding individual retry times (exinext)</title>
62937 <para>
62938 <indexterm role="concept">
62939 <primary>retry</primary>
62940 <secondary>times</secondary>
62941 </indexterm>
62942 <indexterm role="concept">
62943 <primary><emphasis>exinext</emphasis></primary>
62944 </indexterm>
62945 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
62946 fish specific information out of the retry database. Given a mail domain (or a
62947 complete address), it looks up the hosts for that domain, and outputs any retry
62948 information for the hosts or for the domain. At present, the retry information
62949 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
62950 output. For example:
62951 </para>
62952 <literallayout class="monospaced">
62953 $ exinext piglet@milne.fict.example
62954 kanga.milne.example:192.168.8.1 error 146: Connection refused
62955   first failed: 21-Feb-1996 14:57:34
62956   last tried:   21-Feb-1996 14:57:34
62957   next try at:  21-Feb-1996 15:02:34
62958 roo.milne.example:192.168.8.3 error 146: Connection refused
62959   first failed: 20-Jan-1996 13:12:08
62960   last tried:   21-Feb-1996 11:42:03
62961   next try at:  21-Feb-1996 19:42:03
62962   past final cutoff time
62963 </literallayout>
62964 <para>
62965 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
62966 will give any retry information for that local part in your default domain.
62967 A message id can be used to obtain retry information pertaining to a specific
62968 message. This exists only when an attempt to deliver a message to a remote host
62969 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
62970 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
62971 run very often.
62972 </para>
62973 <para>
62974 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
62975 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
62976 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
62977 configuration file, and the second sets macros for use within the configuration
62978 file. These features are mainly to help in testing, but might also be useful in
62979 environments where more than one configuration file is in use.
62980 </para>
62981 </section>
62982 <section id="SECThindatmai">
62983 <title>Hints database maintenance</title>
62984 <para>
62985 <indexterm role="concept">
62986 <primary>hints database</primary>
62987 <secondary>maintenance</secondary>
62988 </indexterm>
62989 <indexterm role="concept">
62990 <primary>maintaining Exim&#x2019;s hints database</primary>
62991 </indexterm>
62992 Three utility programs are provided for maintaining the DBM files that Exim
62993 uses to contain its delivery hint information. Each program requires two
62994 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
62995 second is the name of the database it is to operate on. These are as follows:
62996 </para>
62997 <itemizedlist>
62998 <listitem>
62999 <para>
63000 <emphasis>retry</emphasis>: the database of retry information
63001 </para>
63002 </listitem>
63003 <listitem>
63004 <para>
63005 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
63006 for remote hosts
63007 </para>
63008 </listitem>
63009 <listitem>
63010 <para>
63011 <emphasis>callout</emphasis>: the callout cache
63012 </para>
63013 </listitem>
63014 <listitem>
63015 <para>
63016 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
63017 </para>
63018 </listitem>
63019 <listitem>
63020 <para>
63021 <emphasis>misc</emphasis>: other hints data
63022 </para>
63023 </listitem>
63024 </itemizedlist>
63025 <para>
63026 The <emphasis>misc</emphasis> database is used for
63027 </para>
63028 <itemizedlist>
63029 <listitem>
63030 <para>
63031 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
63032 </para>
63033 </listitem>
63034 <listitem>
63035 <para>
63036 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
63037 <command>smtp</command> transport)
63038 </para>
63039 </listitem>
63040 </itemizedlist>
63041 </section>
63042 <section id="SECID261">
63043 <title>exim_dumpdb</title>
63044 <para>
63045 <indexterm role="concept">
63046 <primary><emphasis>exim_dumpdb</emphasis></primary>
63047 </indexterm>
63048 The entire contents of a database are written to the standard output by the
63049 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
63050 spool and database names. For example, to dump the retry database:
63051 </para>
63052 <literallayout class="monospaced">
63053 exim_dumpdb /var/spool/exim retry
63054 </literallayout>
63055 <para>
63056 Two lines of output are produced for each entry:
63057 </para>
63058 <literallayout class="monospaced">
63059 T:mail.ref.example:192.168.242.242 146 77 Connection refused
63060 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
63061 </literallayout>
63062 <para>
63063 The first item on the first line is the key of the record. It starts with one
63064 of the letters R, or T, depending on whether it refers to a routing or
63065 transport retry. For a local delivery, the next part is the local address; for
63066 a remote delivery it is the name of the remote host, followed by its failing IP
63067 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
63068 transport). If the remote port is not the standard one (port 25), it is added
63069 to the IP address. Then there follows an error code, an additional error code,
63070 and a textual description of the error.
63071 </para>
63072 <para>
63073 The three times on the second line are the time of first failure, the time of
63074 the last delivery attempt, and the computed time for the next attempt. The line
63075 ends with an asterisk if the cutoff time for the last retry rule has been
63076 exceeded.
63077 </para>
63078 <para>
63079 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
63080 consists of a host name followed by a list of ids for messages that are or were
63081 waiting to be delivered to that host. If there are a very large number for any
63082 one host, continuation records, with a sequence number added to the host name,
63083 may be seen. The data in these records is often out of date, because a message
63084 may be routed to several alternative hosts, and Exim makes no effort to keep
63085 cross-references.
63086 </para>
63087 </section>
63088 <section id="SECID262">
63089 <title>exim_tidydb</title>
63090 <para>
63091 <indexterm role="concept">
63092 <primary><emphasis>exim_tidydb</emphasis></primary>
63093 </indexterm>
63094 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
63095 database. If run with no options, it removes all records that are more than 30
63096 days old. The age is calculated from the date and time that the record was last
63097 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
63098 since the first delivery failure. Information about a host that has been down
63099 for more than 30 days will remain in the database, provided that the record is
63100 updated sufficiently often.
63101 </para>
63102 <para>
63103 The cutoff date can be altered by means of the <option>-t</option> option, which must be
63104 followed by a time. For example, to remove all records older than a week from
63105 the retry database:
63106 </para>
63107 <literallayout class="monospaced">
63108 exim_tidydb -t 7d /var/spool/exim retry
63109 </literallayout>
63110 <para>
63111 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
63112 message ids. In the former these appear as data in records keyed by host &ndash;
63113 they were messages that were waiting for that host &ndash; and in the latter they
63114 are the keys for retry information for messages that have suffered certain
63115 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
63116 message ids in database records are those of messages that are still on the
63117 queue. Message ids for messages that no longer exist are removed from
63118 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
63119 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
63120 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
63121 whenever it removes information from the database.
63122 </para>
63123 <para>
63124 Certain records are automatically removed by Exim when they are no longer
63125 needed, but others are not. For example, if all the MX hosts for a domain are
63126 down, a retry record is created for each one. If the primary MX host comes back
63127 first, its record is removed when Exim successfully delivers to it, but the
63128 records for the others remain because Exim has not tried to use those hosts.
63129 </para>
63130 <para>
63131 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
63132 hints databases. You should do this at a quiet time of day, because it requires
63133 a database to be locked (and therefore inaccessible to Exim) while it does its
63134 work. Removing records from a DBM file does not normally make the file smaller,
63135 but all the common DBM libraries are able to re-use the space that is released.
63136 After an initial phase of increasing in size, the databases normally reach a
63137 point at which they no longer get any bigger, as long as they are regularly
63138 tidied.
63139 </para>
63140 <para>
63141 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
63142 databases is likely to keep on increasing.
63143 </para>
63144 </section>
63145 <section id="SECID263">
63146 <title>exim_fixdb</title>
63147 <para>
63148 <indexterm role="concept">
63149 <primary><emphasis>exim_fixdb</emphasis></primary>
63150 </indexterm>
63151 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
63152 Its main use is for testing Exim, but it might also be occasionally useful for
63153 getting round problems in a live system. It has no options, and its interface
63154 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
63155 key of a database record can then be entered, and the data for that record is
63156 displayed.
63157 </para>
63158 <para>
63159 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
63160 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
63161 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
63162 data for individual fields can be changed by typing the field number followed
63163 by new data, for example:
63164 </para>
63165 <literallayout class="monospaced">
63166 &gt; 4 951102:1000
63167 </literallayout>
63168 <para>
63169 resets the time of the next delivery attempt. Time values are given as a
63170 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
63171 used as optional separators.
63172 </para>
63173 </section>
63174 <section id="SECTmailboxmaint">
63175 <title>Mailbox maintenance (exim_lock)</title>
63176 <para>
63177 <indexterm role="concept">
63178 <primary>mailbox</primary>
63179 <secondary>maintenance</secondary>
63180 </indexterm>
63181 <indexterm role="concept">
63182 <primary><emphasis>exim_lock</emphasis></primary>
63183 </indexterm>
63184 <indexterm role="concept">
63185 <primary>locking mailboxes</primary>
63186 </indexterm>
63187 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
63188 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
63189 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
63190 a user agent while investigating a problem. The utility requires the name of
63191 the file as its first argument. If the locking is successful, the second
63192 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
63193 second argument, the value of the SHELL environment variable is used; if this
63194 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
63195 is unlocked and the utility ends. The following options are available:
63196 </para>
63197 <variablelist>
63198 <varlistentry>
63199 <term><option>-fcntl</option></term>
63200 <listitem>
63201 <para>
63202 Use <function>fcntl()</function> locking on the open mailbox.
63203 </para>
63204 </listitem></varlistentry>
63205 <varlistentry>
63206 <term><option>-flock</option></term>
63207 <listitem>
63208 <para>
63209 Use <function>flock()</function> locking on the open mailbox, provided the operating system
63210 supports it.
63211 </para>
63212 </listitem></varlistentry>
63213 <varlistentry>
63214 <term><option>-interval</option></term>
63215 <listitem>
63216 <para>
63217 This must be followed by a number, which is a number of seconds; it sets the
63218 interval to sleep between retries (default 3).
63219 </para>
63220 </listitem></varlistentry>
63221 <varlistentry>
63222 <term><option>-lockfile</option></term>
63223 <listitem>
63224 <para>
63225 Create a lock file before opening the mailbox.
63226 </para>
63227 </listitem></varlistentry>
63228 <varlistentry>
63229 <term><option>-mbx</option></term>
63230 <listitem>
63231 <para>
63232 Lock the mailbox using MBX rules.
63233 </para>
63234 </listitem></varlistentry>
63235 <varlistentry>
63236 <term><option>-q</option></term>
63237 <listitem>
63238 <para>
63239 Suppress verification output.
63240 </para>
63241 </listitem></varlistentry>
63242 <varlistentry>
63243 <term><option>-retries</option></term>
63244 <listitem>
63245 <para>
63246 This must be followed by a number; it sets the number of times to try to get
63247 the lock (default 10).
63248 </para>
63249 </listitem></varlistentry>
63250 <varlistentry>
63251 <term><option>-restore_time</option></term>
63252 <listitem>
63253 <para>
63254 This option causes <option>exim_lock</option> to restore the modified and read times to the
63255 locked file before exiting. This allows you to access a locked mailbox (for
63256 example, to take a backup copy) without disturbing the times that the user
63257 subsequently sees.
63258 </para>
63259 </listitem></varlistentry>
63260 <varlistentry>
63261 <term><option>-timeout</option></term>
63262 <listitem>
63263 <para>
63264 This must be followed by a number, which is a number of seconds; it sets a
63265 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
63266 default), a non-blocking call is used.
63267 </para>
63268 </listitem></varlistentry>
63269 <varlistentry>
63270 <term><option>-v</option></term>
63271 <listitem>
63272 <para>
63273 Generate verbose output.
63274 </para>
63275 </listitem></varlistentry>
63276 </variablelist>
63277 <para>
63278 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
63279 default is to create a lock file and also to use <function>fcntl()</function> locking on the
63280 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
63281 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
63282 requires that the directory containing the file be writeable. Locking by lock
63283 file does not last for ever; Exim assumes that a lock file is expired if it is
63284 more than 30 minutes old.
63285 </para>
63286 <para>
63287 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
63288 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
63289 to be taken out on the open mailbox, and an exclusive lock on the file
63290 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
63291 number of the mailbox file. When the locking is released, if an exclusive lock
63292 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
63293 </para>
63294 <para>
63295 The default output contains verification of the locking that takes place. The
63296 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
63297 suppresses all output except error messages.
63298 </para>
63299 <para>
63300 A command such as
63301 </para>
63302 <literallayout class="monospaced">
63303 exim_lock /var/spool/mail/spqr
63304 </literallayout>
63305 <para>
63306 runs an interactive shell while the file is locked, whereas
63307 </para>
63308 <literallayout>
63309 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
63310 &lt;<emphasis>some commands</emphasis>&gt;
63311 <literal>End</literal>
63312 </literallayout>
63313 <para>
63314 runs a specific non-interactive sequence of commands while the file is locked,
63315 suppressing all verification output. A single command can be run by a command
63316 such as
63317 </para>
63318 <literallayout class="monospaced">
63319 exim_lock -q /var/spool/mail/spqr \
63320   "cp /var/spool/mail/spqr /some/where"
63321 </literallayout>
63322 <para>
63323 Note that if a command is supplied, it must be entirely contained within the
63324 second argument &ndash; hence the quotes.
63325 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
63326 </para>
63327 </section>
63328 </chapter>
63329
63330 <chapter id="CHAPeximon">
63331 <title>The Exim monitor</title>
63332 <para>
63333 <indexterm role="concept" id="IIDeximon" class="startofrange">
63334 <primary>Exim monitor</primary>
63335 <secondary>description</secondary>
63336 </indexterm>
63337 <indexterm role="concept">
63338 <primary>X-windows</primary>
63339 </indexterm>
63340 <indexterm role="concept">
63341 <primary><emphasis>eximon</emphasis></primary>
63342 </indexterm>
63343 <indexterm role="concept">
63344 <primary>Local/eximon.conf</primary>
63345 </indexterm>
63346 <indexterm role="concept">
63347 <primary><filename>exim_monitor/EDITME</filename></primary>
63348 </indexterm>
63349 The Exim monitor is an application which displays in an X window information
63350 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
63351 perform certain operations on messages from this GUI interface; however all
63352 such facilities are also available from the command line, and indeed, the
63353 monitor itself makes use of the command line to perform any actions requested.
63354 </para>
63355 <section id="SECID264">
63356 <title>Running the monitor</title>
63357 <para>
63358 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
63359 script that sets up a number of environment variables, and then runs the
63360 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
63361 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
63362 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
63363 parameters are for.
63364 </para>
63365 <para>
63366 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
63367 a particular invocation by setting up environment variables of the same names,
63368 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
63369 </para>
63370 <literallayout class="monospaced">
63371 EXIMON_LOG_DEPTH=400 eximon
63372 </literallayout>
63373 <para>
63374 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
63375 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
63376 overrides the Exim log file configuration. This makes it possible to have
63377 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
63378 syslog messages are routed to a file on the local host.
63379 </para>
63380 <para>
63381 X resources can be used to change the appearance of the window in the normal
63382 way. For example, a resource setting of the form
63383 </para>
63384 <literallayout class="monospaced">
63385 Eximon*background: gray94
63386 </literallayout>
63387 <para>
63388 changes the colour of the background to light grey rather than white. The
63389 stripcharts are drawn with both the data lines and the reference lines in
63390 black. This means that the reference lines are not visible when on top of the
63391 data. However, their colour can be changed by setting a resource called
63392 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
63393 For example, if your X server is running Unix, you could set up lighter
63394 reference lines in the stripcharts by obeying
63395 </para>
63396 <literallayout class="monospaced">
63397 xrdb -merge &lt;&lt;End
63398 Eximon*highlight: gray
63399 End
63400 </literallayout>
63401 <para>
63402 <indexterm role="concept">
63403 <primary>admin user</primary>
63404 </indexterm>
63405 In order to see the contents of messages on the queue, and to operate on them,
63406 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
63407 </para>
63408 <para>
63409 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
63410 contain X11 resource parameters interpreted by the X11 library.  In addition,
63411 if the first parameter starts with the string "gdb" then it is removed and the
63412 binary is invoked under gdb (the parameter is used as the gdb command-name, so
63413 versioned variants of gdb can be invoked).
63414 </para>
63415 <para>
63416 The monitor&#x2019;s window is divided into three parts. The first contains one or
63417 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
63418 main log file, and the third is a display of the queue of messages awaiting
63419 delivery, with two more action buttons. The following sections describe these
63420 different parts of the display.
63421 </para>
63422 </section>
63423 <section id="SECID265">
63424 <title>The stripcharts</title>
63425 <para>
63426 <indexterm role="concept">
63427 <primary>stripchart</primary>
63428 </indexterm>
63429 The first stripchart is always a count of messages on the queue. Its name can
63430 be configured by setting QUEUE_STRIPCHART_NAME in the
63431 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
63432 configuration script by regular expression matches on log file entries, making
63433 it possible to display, for example, counts of messages delivered to certain
63434 hosts or using certain transports. The supplied defaults display counts of
63435 received and delivered messages, and of local and SMTP deliveries. The default
63436 period between stripchart updates is one minute; this can be adjusted by a
63437 parameter in the <filename>Local/eximon.conf</filename> file.
63438 </para>
63439 <para>
63440 The stripchart displays rescale themselves automatically as the value they are
63441 displaying changes. There are always 10 horizontal lines in each chart; the
63442 title string indicates the value of each division when it is greater than one.
63443 For example, <quote>x2</quote> means that each division represents a value of 2.
63444 </para>
63445 <para>
63446 It is also possible to have a stripchart which shows the percentage fullness of
63447 a particular disk partition, which is useful when local deliveries are confined
63448 to a single partition.
63449 </para>
63450 <para>
63451 <indexterm role="concept">
63452 <primary><option>statvfs</option> function</primary>
63453 </indexterm>
63454 This relies on the availability of the <function>statvfs()</function> function or equivalent in
63455 the operating system. Most, but not all versions of Unix that support Exim have
63456 this. For this particular stripchart, the top of the chart always represents
63457 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
63458 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
63459 <filename>Local/eximon.conf</filename> file.
63460 </para>
63461 </section>
63462 <section id="SECID266">
63463 <title>Main action buttons</title>
63464 <para>
63465 <indexterm role="concept">
63466 <primary>size</primary>
63467 <secondary>of monitor window</secondary>
63468 </indexterm>
63469 <indexterm role="concept">
63470 <primary>Exim monitor</primary>
63471 <secondary>window size</secondary>
63472 </indexterm>
63473 <indexterm role="concept">
63474 <primary>window size</primary>
63475 </indexterm>
63476 Below the stripcharts there is an action button for quitting the monitor. Next
63477 to this is another button marked <quote>Size</quote>. They are placed here so that
63478 shrinking the window to its default minimum size leaves just the queue count
63479 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
63480 the window to expand to its maximum size, unless it is already at the maximum,
63481 in which case it is reduced to its minimum.
63482 </para>
63483 <para>
63484 When expanding to the maximum, if the window cannot be fully seen where it
63485 currently is, it is moved back to where it was the last time it was at full
63486 size. When it is expanding from its minimum size, the old position is
63487 remembered, and next time it is reduced to the minimum it is moved back there.
63488 </para>
63489 <para>
63490 The idea is that you can keep a reduced window just showing one or two
63491 stripcharts at a convenient place on your screen, easily expand it to show
63492 the full window when required, and just as easily put it back to what it was.
63493 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
63494 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
63495 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
63496 </para>
63497 <para>
63498 Normally, the monitor starts up with the window at its full size, but it can be
63499 built so that it starts up with the window at its smallest size, by setting
63500 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
63501 </para>
63502 </section>
63503 <section id="SECID267">
63504 <title>The log display</title>
63505 <para>
63506 <indexterm role="concept">
63507 <primary>log</primary>
63508 <secondary>tail of; in monitor</secondary>
63509 </indexterm>
63510 The second section of the window is an area in which a display of the tail of
63511 the main log is maintained.
63512 To save space on the screen, the timestamp on each log line is shortened by
63513 removing the date and, if <option>log_timezone</option> is set, the timezone.
63514 The log tail is not available when the only destination for logging data is
63515 syslog, unless the syslog lines are routed to a local file whose name is passed
63516 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
63517 </para>
63518 <para>
63519 The log sub-window has a scroll bar at its lefthand side which can be used to
63520 move back to look at earlier text, and the up and down arrow keys also have a
63521 scrolling effect. The amount of log that is kept depends on the setting of
63522 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
63523 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
63524 much more efficient than throwing it away line by line. The sub-window also has
63525 a horizontal scroll bar for accessing the ends of long log lines. This is the
63526 only means of horizontal scrolling; the right and left arrow keys are not
63527 available. Text can be cut from this part of the window using the mouse in the
63528 normal way. The size of this subwindow is controlled by parameters in the
63529 configuration file <filename>Local/eximon.conf</filename>.
63530 </para>
63531 <para>
63532 Searches of the text in the log window can be carried out by means of the ^R
63533 and ^S keystrokes, which default to a reverse and a forward search,
63534 respectively. The search covers only the text that is displayed in the window.
63535 It cannot go further back up the log.
63536 </para>
63537 <para>
63538 The point from which the search starts is indicated by a caret marker. This is
63539 normally at the end of the text in the window, but can be positioned explicitly
63540 by pointing and clicking with the left mouse button, and is moved automatically
63541 by a successful search. If new text arrives in the window when it is scrolled
63542 back, the caret remains where it is, but if the window is not scrolled back,
63543 the caret is moved to the end of the new text.
63544 </para>
63545 <para>
63546 Pressing ^R or ^S pops up a window into which the search text can be typed.
63547 There are buttons for selecting forward or reverse searching, for carrying out
63548 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
63549 happens and the window remains so that further searches can be done. If the
63550 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
63551 ^C is typed the search is cancelled.
63552 </para>
63553 <para>
63554 The searching facility is implemented using the facilities of the Athena text
63555 widget. By default this pops up a window containing both <quote>search</quote> and
63556 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
63557 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
63558 However, the linkers in BSDI and HP-UX seem unable to handle an externally
63559 provided version of <option>TextPop</option> when the remaining parts of the text widget
63560 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
63561 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
63562 on these systems, at the expense of having unwanted items in the search popup
63563 window.
63564 </para>
63565 </section>
63566 <section id="SECID268">
63567 <title>The queue display</title>
63568 <para>
63569 <indexterm role="concept">
63570 <primary>queue</primary>
63571 <secondary>display in monitor</secondary>
63572 </indexterm>
63573 The bottom section of the monitor window contains a list of all messages that
63574 are on the queue, which includes those currently being received or delivered,
63575 as well as those awaiting delivery. The size of this subwindow is controlled by
63576 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
63577 at which it is updated is controlled by another parameter in the same file &ndash;
63578 the default is 5 minutes, since queue scans can be quite expensive. However,
63579 there is an <quote>Update</quote> action button just above the display which can be used
63580 to force an update of the queue display at any time.
63581 </para>
63582 <para>
63583 When a host is down for some time, a lot of pending mail can build up for it,
63584 and this can make it hard to deal with other messages on the queue. To help
63585 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
63586 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
63587 type anything in here and press <quote>Return</quote>, the text is added to a chain of
63588 such texts, and if every undelivered address in a message matches at least one
63589 of the texts, the message is not displayed.
63590 </para>
63591 <para>
63592 If there is an address that does not match any of the texts, all the addresses
63593 are displayed as normal. The matching happens on the ends of addresses so, for
63594 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
63595 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
63596 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
63597 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
63598 a hide request is automatically cancelled after one hour.
63599 </para>
63600 <para>
63601 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
63602 else to the monitor window. For this reason, if you want to cut text from the
63603 queue display to use in the dialogue box, you have to do the cutting before
63604 pressing the <quote>Hide</quote> button.
63605 </para>
63606 <para>
63607 The queue display contains, for each unhidden queued message, the length of
63608 time it has been on the queue, the size of the message, the message id, the
63609 message sender, and the first undelivered recipient, all on one line. If it is
63610 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
63611 recipient to which the message has not yet been delivered, subsequent ones are
63612 listed on additional lines, up to a maximum configured number, following which
63613 an ellipsis is displayed. Recipients that have already received the message are
63614 not shown.
63615 </para>
63616 <para>
63617 <indexterm role="concept">
63618 <primary>frozen messages</primary>
63619 <secondary>display</secondary>
63620 </indexterm>
63621 If a message is frozen, an asterisk is displayed at the left-hand side.
63622 </para>
63623 <para>
63624 The queue display has a vertical scroll bar, and can also be scrolled by means
63625 of the arrow keys. Text can be cut from it using the mouse in the normal way.
63626 The text searching facilities, as described above for the log window, are also
63627 available, but the caret is always moved to the end of the text when the queue
63628 display is updated.
63629 </para>
63630 </section>
63631 <section id="SECID269">
63632 <title>The queue menu</title>
63633 <para>
63634 <indexterm role="concept">
63635 <primary>queue</primary>
63636 <secondary>menu in monitor</secondary>
63637 </indexterm>
63638 If the <option>shift</option> key is held down and the left button is clicked when the mouse
63639 pointer is over the text for any message, an action menu pops up, and the first
63640 line of the queue display for the message is highlighted. This does not affect
63641 any selected text.
63642 </para>
63643 <para>
63644 If you want to use some other event for popping up the menu, you can set the
63645 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
63646 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
63647 value set in this parameter is a standard X event description. For example, to
63648 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
63649 </para>
63650 <literallayout class="monospaced">
63651 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
63652 </literallayout>
63653 <para>
63654 The title of the menu is the message id, and it contains entries which act as
63655 follows:
63656 </para>
63657 <itemizedlist>
63658 <listitem>
63659 <para>
63660 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
63661 in a new text window.
63662 </para>
63663 </listitem>
63664 <listitem>
63665 <para>
63666 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
63667 information and headers is displayed in a new text window. See chapter
63668 <xref linkend="CHAPspool"/> for a description of the format of spool files.
63669 </para>
63670 </listitem>
63671 <listitem>
63672 <para>
63673 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
63674 displayed in a new text window. There is a default limit of 20,000 bytes to the
63675 amount of data displayed. This can be changed by setting the BODY_MAX
63676 option at compile time, or the EXIMON_BODY_MAX option at run time.
63677 </para>
63678 </listitem>
63679 <listitem>
63680 <para>
63681 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
63682 delivery of the message. This causes an automatic thaw if the message is
63683 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
63684 a new text window. The delivery is run in a separate process, to avoid holding
63685 up the monitor while the delivery proceeds.
63686 </para>
63687 </listitem>
63688 <listitem>
63689 <para>
63690 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
63691 that the message be frozen.
63692 </para>
63693 </listitem>
63694 <listitem>
63695 <para>
63696 <indexterm role="concept">
63697 <primary>thawing messages</primary>
63698 </indexterm>
63699 <indexterm role="concept">
63700 <primary>unfreezing messages</primary>
63701 </indexterm>
63702 <indexterm role="concept">
63703 <primary>frozen messages</primary>
63704 <secondary>thawing</secondary>
63705 </indexterm>
63706 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
63707 that the message be thawed.
63708 </para>
63709 </listitem>
63710 <listitem>
63711 <para>
63712 <indexterm role="concept">
63713 <primary>delivery</primary>
63714 <secondary>forcing failure</secondary>
63715 </indexterm>
63716 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
63717 that Exim gives up trying to deliver the message. A bounce message is generated
63718 for any remaining undelivered addresses.
63719 </para>
63720 </listitem>
63721 <listitem>
63722 <para>
63723 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
63724 that the message be deleted from the system without generating a bounce
63725 message.
63726 </para>
63727 </listitem>
63728 <listitem>
63729 <para>
63730 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
63731 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
63732 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
63733 Otherwise it must be entered as a fully qualified address. Pressing RETURN
63734 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
63735 additional recipient be added to the message, unless the entry box is empty, in
63736 which case no action is taken.
63737 </para>
63738 </listitem>
63739 <listitem>
63740 <para>
63741 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
63742 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
63743 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
63744 Otherwise it must be entered as a fully qualified address. Pressing RETURN
63745 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
63746 recipient address as already delivered, unless the entry box is empty, in which
63747 case no action is taken.
63748 </para>
63749 </listitem>
63750 <listitem>
63751 <para>
63752 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
63753 mark all recipient addresses as already delivered.
63754 </para>
63755 </listitem>
63756 <listitem>
63757 <para>
63758 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
63759 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
63760 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
63761 in which case no action is taken. If you want to set an empty sender (as in
63762 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
63763 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
63764 the address is qualified with that domain.
63765 </para>
63766 </listitem>
63767 </itemizedlist>
63768 <para>
63769 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
63770 other cases when a call to Exim is made, if there is any output from Exim (in
63771 particular, if the command fails) a window containing the command and the
63772 output is displayed. Otherwise, the results of the action are normally apparent
63773 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
63774 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
63775 if no output is generated.
63776 </para>
63777 <para>
63778 The queue display is automatically updated for actions such as freezing and
63779 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
63780 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
63781 force an update of the display after one of these actions.
63782 </para>
63783 <para>
63784 In any text window that is displayed as result of a menu action, the normal
63785 cut-and-paste facility is available, and searching can be carried out using ^R
63786 and ^S, as described above for the log tail window.
63787 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
63788 </para>
63789 </section>
63790 </chapter>
63791
63792 <chapter id="CHAPsecurity">
63793 <title>Security considerations</title>
63794 <para>
63795 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
63796 <primary>security</primary>
63797 <secondary>discussion of</secondary>
63798 </indexterm>
63799 This chapter discusses a number of issues concerned with security, some of
63800 which are also covered in other parts of this manual.
63801 </para>
63802 <para>
63803 For reasons that this author does not understand, some people have promoted
63804 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
63805 existence of this chapter in the documentation. However, the intent of the
63806 chapter is simply to describe the way Exim works in relation to certain
63807 security concerns, not to make any specific claims about the effectiveness of
63808 its security as compared with other MTAs.
63809 </para>
63810 <para>
63811 What follows is a description of the way Exim is supposed to be. Best efforts
63812 have been made to try to ensure that the code agrees with the theory, but an
63813 absence of bugs can never be guaranteed. Any that are reported will get fixed
63814 as soon as possible.
63815 </para>
63816 <section id="SECID286">
63817 <title>Building a more <quote>hardened</quote> Exim</title>
63818 <para>
63819 <indexterm role="concept">
63820 <primary>security</primary>
63821 <secondary>build-time features</secondary>
63822 </indexterm>
63823 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
63824 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
63825 Exim administrator who does not have the root password, or by someone who has
63826 penetrated the Exim (but not the root) account. These options are as follows:
63827 </para>
63828 <itemizedlist>
63829 <listitem>
63830 <para>
63831 ALT_CONFIG_PREFIX can be set to a string that is required to match the
63832 start of any file names used with the <option>-C</option> option. When it is set, these file
63833 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
63834 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
63835 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
63836 default setting for <option>ALT_CONFIG_PREFIX</option>.
63837 </para>
63838 <para>
63839 If the permitted configuration files are confined to a directory to
63840 which only root has access, this guards against someone who has broken
63841 into the Exim account from running a privileged Exim with an arbitrary
63842 configuration file, and using it to break into other accounts.
63843 </para>
63844 </listitem>
63845 <listitem>
63846 <para>
63847 If a non-trusted configuration file (i.e. not the default configuration file
63848 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
63849 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
63850 the next item), then root privilege is retained only if the caller of Exim is
63851 root. This locks out the possibility of testing a configuration using <option>-C</option>
63852 right through message reception and delivery, even if the caller is root. The
63853 reception works, but by that time, Exim is running as the Exim user, so when
63854 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
63855 privilege to be lost. However, root can test reception and delivery using two
63856 separate commands.
63857 </para>
63858 </listitem>
63859 <listitem>
63860 <para>
63861 The WHITELIST_D_MACROS build option declares some macros to be safe to override
63862 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
63863 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
63864 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
63865 the restrictive side.  Requiring build-time selection of safe macros is onerous
63866 but this option is intended solely as a transition mechanism to permit
63867 previously-working configurations to continue to work after release 4.73.
63868 </para>
63869 </listitem>
63870 <listitem>
63871 <para>
63872 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
63873 is disabled.
63874 </para>
63875 </listitem>
63876 <listitem>
63877 <para>
63878 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
63879 never to be used for any deliveries. This is like the <option>never_users</option> runtime
63880 option, but it cannot be overridden; the runtime option adds additional users
63881 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
63882 is permitted to modify the runtime file from using Exim as a way to get root.
63883 </para>
63884 </listitem>
63885 </itemizedlist>
63886 </section>
63887 <section id="SECID270">
63888 <title>Root privilege</title>
63889 <para>
63890 <indexterm role="concept">
63891 <primary>setuid</primary>
63892 </indexterm>
63893 <indexterm role="concept">
63894 <primary>root privilege</primary>
63895 </indexterm>
63896 The Exim binary is normally setuid to root, which means that it gains root
63897 privilege (runs as root) when it starts execution. In some special cases (for
63898 example, when the daemon is not in use and there are no local deliveries), it
63899 may be possible to run Exim setuid to some user other than root. This is
63900 discussed in the next section. However, in most installations, root privilege
63901 is required for two things:
63902 </para>
63903 <itemizedlist>
63904 <listitem>
63905 <para>
63906 To set up a socket connected to the standard SMTP port (25) when initialising
63907 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
63908 not required.
63909 </para>
63910 </listitem>
63911 <listitem>
63912 <para>
63913 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
63914 perform local deliveries as the receiving user or as specified in the
63915 configuration.
63916 </para>
63917 </listitem>
63918 </itemizedlist>
63919 <para>
63920 It is not necessary to be root to do any of the other things Exim does, such as
63921 receiving messages and delivering them externally over SMTP, and it is
63922 obviously more secure if Exim does not run as root except when necessary.
63923 For this reason, a user and group for Exim to use must be defined in
63924 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
63925 group</quote>. Their values can be changed by the run time configuration, though this
63926 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
63927 <emphasis>mail</emphasis> or another user name altogether.
63928 </para>
63929 <para>
63930 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
63931 abdication; the process cannot regain root afterwards. Prior to release 4.00,
63932 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
63933 </para>
63934 <para>
63935 After a new Exim process has interpreted its command line options, it changes
63936 uid and gid in the following cases:
63937 </para>
63938 <itemizedlist>
63939 <listitem>
63940 <para>
63941 <indexterm role="option">
63942 <primary><option>-C</option></primary>
63943 </indexterm>
63944 <indexterm role="option">
63945 <primary><option>-D</option></primary>
63946 </indexterm>
63947 If the <option>-C</option> option is used to specify an alternate configuration file, or if
63948 the <option>-D</option> option is used to define macro values for the configuration, and the
63949 calling process is not running as root, the uid and gid are changed to those of
63950 the calling process.
63951 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
63952 option may not be used at all.
63953 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
63954 can be supplied if the calling process is running as root, the Exim run-time
63955 user or CONFIGURE_OWNER, if defined.
63956 </para>
63957 </listitem>
63958 <listitem>
63959 <para>
63960 <indexterm role="option">
63961 <primary><option>-be</option></primary>
63962 </indexterm>
63963 <indexterm role="option">
63964 <primary><option>-bf</option></primary>
63965 </indexterm>
63966 <indexterm role="option">
63967 <primary><option>-bF</option></primary>
63968 </indexterm>
63969 If the expansion test option (<option>-be</option>) or one of the filter testing options
63970 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
63971 calling process.
63972 </para>
63973 </listitem>
63974 <listitem>
63975 <para>
63976 If the process is not a daemon process or a queue runner process or a delivery
63977 process or a process for testing address routing (started with <option>-bt</option>), the
63978 uid and gid are changed to the Exim user and group. This means that Exim always
63979 runs under its own uid and gid when receiving messages. This also applies when
63980 testing address verification
63981 <indexterm role="option">
63982 <primary><option>-bv</option></primary>
63983 </indexterm>
63984 <indexterm role="option">
63985 <primary><option>-bh</option></primary>
63986 </indexterm>
63987 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
63988 option).
63989 </para>
63990 </listitem>
63991 <listitem>
63992 <para>
63993 For a daemon, queue runner, delivery, or address testing process, the uid
63994 remains as root at this stage, but the gid is changed to the Exim group.
63995 </para>
63996 </listitem>
63997 </itemizedlist>
63998 <para>
63999 The processes that initially retain root privilege behave as follows:
64000 </para>
64001 <itemizedlist>
64002 <listitem>
64003 <para>
64004 A daemon process changes the gid to the Exim group and the uid to the Exim
64005 user after setting up one or more listening sockets. The <function>initgroups()</function>
64006 function is called, so that if the Exim user is in any additional groups, they
64007 will be used during message reception.
64008 </para>
64009 </listitem>
64010 <listitem>
64011 <para>
64012 A queue runner process retains root privilege throughout its execution. Its
64013 job is to fork a controlled sequence of delivery processes.
64014 </para>
64015 </listitem>
64016 <listitem>
64017 <para>
64018 A delivery process retains root privilege throughout most of its execution,
64019 but any actual deliveries (that is, the transports themselves) are run in
64020 subprocesses which always change to a non-root uid and gid. For local
64021 deliveries this is typically the uid and gid of the owner of the mailbox; for
64022 remote deliveries, the Exim uid and gid are used. Once all the delivery
64023 subprocesses have been run, a delivery process changes to the Exim uid and gid
64024 while doing post-delivery tidying up such as updating the retry database and
64025 generating bounce and warning messages.
64026 </para>
64027 <para>
64028 While the recipient addresses in a message are being routed, the delivery
64029 process runs as root. However, if a user&#x2019;s filter file has to be processed,
64030 this is done in a subprocess that runs under the individual user&#x2019;s uid and
64031 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
64032 </para>
64033 </listitem>
64034 <listitem>
64035 <para>
64036 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
64037 the routing is done in the same environment as a message delivery.
64038 </para>
64039 </listitem>
64040 </itemizedlist>
64041 </section>
64042 <section id="SECTrunexiwitpri">
64043 <title>Running Exim without privilege</title>
64044 <para>
64045 <indexterm role="concept">
64046 <primary>privilege, running without</primary>
64047 </indexterm>
64048 <indexterm role="concept">
64049 <primary>unprivileged running</primary>
64050 </indexterm>
64051 <indexterm role="concept">
64052 <primary>root privilege</primary>
64053 <secondary>running without</secondary>
64054 </indexterm>
64055 Some installations like to run Exim in an unprivileged state for more of its
64056 operation, for added security. Support for this mode of operation is provided
64057 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
64058 gid are changed to the Exim user and group at the start of a delivery process
64059 (and also queue runner and address testing processes). This means that address
64060 routing is no longer run as root, and the deliveries themselves cannot change
64061 to any other uid.
64062 </para>
64063 <para>
64064 <indexterm role="concept">
64065 <primary>SIGHUP</primary>
64066 </indexterm>
64067 <indexterm role="concept">
64068 <primary>daemon</primary>
64069 <secondary>restarting</secondary>
64070 </indexterm>
64071 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
64072 that the daemon can still be started in the usual way, and it can respond
64073 correctly to SIGHUP because the re-invocation regains root privilege.
64074 </para>
64075 <para>
64076 An alternative approach is to make Exim setuid to the Exim user and also setgid
64077 to the Exim group. If you do this, the daemon must be started from a root
64078 process. (Calling Exim from a root process makes it behave in the way it does
64079 when it is setuid root.) However, the daemon cannot restart itself after a
64080 SIGHUP signal because it cannot regain privilege.
64081 </para>
64082 <para>
64083 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
64084 stops Exim from trying to re-invoke itself to do a delivery after a message has
64085 been received. Such a re-invocation is a waste of resources because it has no
64086 effect.
64087 </para>
64088 <para>
64089 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
64090 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
64091 to the Exim user seems a clean approach, but there is one complication:
64092 </para>
64093 <para>
64094 In this style of operation, Exim is running with the real uid and gid set to
64095 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
64096 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
64097 that is, the real uid/gid should be reset to the effective values so as to
64098 discard any privileges that the caller may have. While some operating systems
64099 have a function that permits this action for a non-root effective uid, quite a
64100 number of them do not. Because of this lack of standardization, Exim does not
64101 address this problem at this time.
64102 </para>
64103 <para>
64104 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
64105 is to keep the Exim binary setuid to root, and to set
64106 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
64107 be used in the most straightforward way.
64108 </para>
64109 <para>
64110 If you configure Exim not to run delivery processes as root, there are a
64111 number of restrictions on what you can do:
64112 </para>
64113 <itemizedlist>
64114 <listitem>
64115 <para>
64116 You can deliver only as the Exim user/group. You should  explicitly use the
64117 <option>user</option> and <option>group</option> options to override routers or local transports that
64118 normally deliver as the recipient. This makes sure that configurations that
64119 work in this mode function the same way in normal mode. Any implicit or
64120 explicit specification of another user causes an error.
64121 </para>
64122 </listitem>
64123 <listitem>
64124 <para>
64125 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
64126 not worthwhile to include them in the configuration.
64127 </para>
64128 </listitem>
64129 <listitem>
64130 <para>
64131 Users who wish to use <filename>.forward</filename> would have to make their home directory and
64132 the file itself accessible to the Exim user. Pipe and append-to-file entries,
64133 and their equivalents in Exim filters, cannot be used. While they could be
64134 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
64135 </para>
64136 </listitem>
64137 <listitem>
64138 <para>
64139 Unless the local user mailboxes are all owned by the Exim user (possible in
64140 some POP3 or IMAP-only environments):
64141 </para>
64142 <orderedlist numeration="arabic">
64143 <listitem>
64144 <para>
64145 They must be owned by the Exim group and be writeable by that group. This
64146 implies you must set <option>mode</option> in the appendfile configuration, as well as the
64147 mode of the mailbox files themselves.
64148 </para>
64149 </listitem>
64150 <listitem>
64151 <para>
64152 You must set <option>no_check_owner</option>, since most or all of the files will not be
64153 owned by the Exim user.
64154 </para>
64155 </listitem>
64156 <listitem>
64157 <para>
64158 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
64159 on a newly created mailbox when unprivileged. This also implies that new
64160 mailboxes need to be created manually.
64161 </para>
64162 </listitem>
64163 </orderedlist>
64164 </listitem>
64165 </itemizedlist>
64166 <para>
64167 These restrictions severely restrict what can be done in local deliveries.
64168 However, there are no restrictions on remote deliveries. If you are running a
64169 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
64170 gives more security at essentially no cost.
64171 </para>
64172 <para>
64173 If you are using the <option>mua_wrapper</option> facility (see chapter
64174 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
64175 </para>
64176 </section>
64177 <section id="SECID271">
64178 <title>Delivering to local files</title>
64179 <para>
64180 Full details of the checks applied by <command>appendfile</command> before it writes to a file
64181 are given in chapter <xref linkend="CHAPappendfile"/>.
64182 </para>
64183 </section>
64184 <section id="SECTsecconslocalcmds" revisionflag="changed">
64185 <title>Running local commands</title>
64186 <para revisionflag="changed">
64187 <indexterm role="concept">
64188 <primary>security</primary>
64189 <secondary>local commands</secondary>
64190 </indexterm>
64191 <indexterm role="concept">
64192 <primary>security</primary>
64193 <secondary>command injection attacks</secondary>
64194 </indexterm>
64195 There are a number of ways in which an administrator can configure Exim to run
64196 commands based upon received, untrustworthy, data. Further, in some
64197 configurations a user who can control a <filename>.forward</filename> file can also arrange to
64198 run commands. Configuration to check includes, but is not limited to:
64199 </para>
64200 <itemizedlist revisionflag="changed">
64201 <listitem>
64202 <para revisionflag="changed">
64203 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
64204 injection may be possible with this option present. It is dangerous and should
64205 be used only with considerable caution. Consider constraints which whitelist
64206 allowed characters in a variable which is to be used in a pipe transport that
64207 has <option>use_shell</option> enabled.
64208 </para>
64209 </listitem>
64210 <listitem>
64211 <para revisionflag="changed">
64212 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
64213 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
64214 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
64215 hub to which ordinary users do not have shell access, but home directories are
64216 NFS mounted (for instance) then administrators should review the list of these
64217 forbid options available, and should bear in mind that the options that may
64218 need forbidding can change as new features are added between releases.
64219 </para>
64220 </listitem>
64221 <listitem>
64222 <para revisionflag="changed">
64223 The <option>${run...}</option> expansion item does not use a shell by default, but
64224 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
64225 Such invocations should be viewed with prejudicial suspicion.
64226 </para>
64227 </listitem>
64228 <listitem>
64229 <para revisionflag="changed">
64230 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
64231 taint checking might apply to their usage.
64232 </para>
64233 </listitem>
64234 <listitem>
64235 <para revisionflag="changed">
64236 Use of <option>${expand...}</option> is somewhat analagous to shell&#x2019;s eval builtin and
64237 administrators are well advised to view its use with suspicion, in case (for
64238 instance) it allows a local-part to contain embedded Exim directives.
64239 </para>
64240 </listitem>
64241 <listitem>
64242 <para revisionflag="changed">
64243 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
64244 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
64245 each can reference arbitrary lists and files, rather than just being a list
64246 of opaque strings.
64247 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
64248 real-world security vulnerabilities caused by its use with untrustworthy data
64249 injected in, for SQL injection attacks.
64250 Consider the use of the <option>inlisti</option> expansion condition instead.
64251 </para>
64252 </listitem>
64253 </itemizedlist>
64254 </section>
64255 <section id="SECTsecconfdata" revisionflag="changed">
64256 <title>Trust in configuration data</title>
64257 <para revisionflag="changed">
64258 <indexterm role="concept">
64259 <primary>security</primary>
64260 <secondary>data sources</secondary>
64261 </indexterm>
64262 <indexterm role="concept">
64263 <primary>security</primary>
64264 <secondary>regular expressions</secondary>
64265 </indexterm>
64266 <indexterm role="concept">
64267 <primary>regular expressions</primary>
64268 <secondary>security</secondary>
64269 </indexterm>
64270 <indexterm role="concept">
64271 <primary>PCRE</primary>
64272 <secondary>security</secondary>
64273 </indexterm>
64274 If configuration data for Exim can come from untrustworthy sources, there
64275 are some issues to be aware of:
64276 </para>
64277 <itemizedlist revisionflag="changed">
64278 <listitem>
64279 <para revisionflag="changed">
64280 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
64281 </para>
64282 </listitem>
64283 <listitem>
64284 <para revisionflag="changed">
64285 Letting untrusted data provide a regular expression is unwise.
64286 </para>
64287 </listitem>
64288 <listitem>
64289 <para revisionflag="changed">
64290 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
64291 data may result in pathological behaviour within PCRE.  Be aware of what
64292 "backtracking" means and consider options for being more strict with a regular
64293 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
64294 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
64295 possessive quantifiers or just not using regular expressions against untrusted
64296 data.
64297 </para>
64298 </listitem>
64299 <listitem>
64300 <para revisionflag="changed">
64301 It can be important to correctly use <option>${quote:...}</option>,
64302 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
64303 items to ensure that data is correctly constructed.
64304 </para>
64305 </listitem>
64306 <listitem>
64307 <para revisionflag="changed">
64308 Some lookups might return multiple results, even though normal usage is only
64309 expected to yield one result.
64310 </para>
64311 </listitem>
64312 </itemizedlist>
64313 </section>
64314 <section id="SECID272">
64315 <title>IPv4 source routing</title>
64316 <para>
64317 <indexterm role="concept">
64318 <primary>source routing</primary>
64319 <secondary>in IP packets</secondary>
64320 </indexterm>
64321 <indexterm role="concept">
64322 <primary>IP source routing</primary>
64323 </indexterm>
64324 Many operating systems suppress IP source-routed packets in the kernel, but
64325 some cannot be made to do this, so Exim does its own check. It logs incoming
64326 IPv4 source-routed TCP calls, and then drops them. Things are all different in
64327 IPv6. No special checking is currently done.
64328 </para>
64329 </section>
64330 <section id="SECID273">
64331 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
64332 <para>
64333 Support for these SMTP commands is disabled by default. If required, they can
64334 be enabled by defining suitable ACLs.
64335 </para>
64336 </section>
64337 <section id="SECID274">
64338 <title>Privileged users</title>
64339 <para>
64340 <indexterm role="concept">
64341 <primary>trusted users</primary>
64342 </indexterm>
64343 <indexterm role="concept">
64344 <primary>admin user</primary>
64345 </indexterm>
64346 <indexterm role="concept">
64347 <primary>privileged user</primary>
64348 </indexterm>
64349 <indexterm role="concept">
64350 <primary>user</primary>
64351 <secondary>trusted</secondary>
64352 </indexterm>
64353 <indexterm role="concept">
64354 <primary>user</primary>
64355 <secondary>admin</secondary>
64356 </indexterm>
64357 Exim recognizes two sets of users with special privileges. Trusted users are
64358 able to submit new messages to Exim locally, but supply their own sender
64359 addresses and information about a sending host. For other users submitting
64360 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
64361 permit a remote host to be specified.
64362 </para>
64363 <para>
64364 <indexterm role="option">
64365 <primary><option>-f</option></primary>
64366 </indexterm>
64367 However, an untrusted user is permitted to use the <option>-f</option> command line option
64368 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
64369 message should not cause an error report. This affects the message&#x2019;s envelope,
64370 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
64371 permitted to use specific forms of address with the <option>-f</option> option by setting
64372 the <option>untrusted_set_sender</option> option.
64373 </para>
64374 <para>
64375 Trusted users are used to run processes that receive mail messages from some
64376 other mail domain and pass them on to Exim for delivery either locally, or over
64377 the Internet. Exim trusts a caller that is running as root, as the Exim user,
64378 as any user listed in the <option>trusted_users</option> configuration option, or under any
64379 group listed in the <option>trusted_groups</option> option.
64380 </para>
64381 <para>
64382 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
64383 can freeze or thaw messages, cause them to be returned to their senders, remove
64384 them entirely, or modify them in various ways. In addition, admin users can run
64385 the Exim monitor and see all the information it is capable of providing, which
64386 includes the contents of files on the spool.
64387 </para>
64388 <para>
64389 <indexterm role="option">
64390 <primary><option>-M</option></primary>
64391 </indexterm>
64392 <indexterm role="option">
64393 <primary><option>-q</option></primary>
64394 </indexterm>
64395 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
64396 delivery of messages on its queue is restricted to admin users. This
64397 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
64398 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
64399 queue is also restricted to admin users. This restriction can be relaxed by
64400 setting <option>no_queue_list_requires_admin</option>.
64401 </para>
64402 <para>
64403 Exim recognizes an admin user if the calling process is running as root or as
64404 the Exim user or if any of the groups associated with the calling process is
64405 the Exim group. It is not necessary actually to be running under the Exim
64406 group. However, if admin users who are not root or the Exim user are to access
64407 the contents of files on the spool via the Exim monitor (which runs
64408 unprivileged), Exim must be built to allow group read access to its spool
64409 files.
64410 </para>
64411 </section>
64412 <section id="SECID275">
64413 <title>Spool files</title>
64414 <para>
64415 <indexterm role="concept">
64416 <primary>spool directory</primary>
64417 <secondary>files</secondary>
64418 </indexterm>
64419 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
64420 set to the Exim group. The mode for spool files is defined in the
64421 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
64422 any user who is a member of the Exim group can access these files.
64423 </para>
64424 </section>
64425 <section id="SECID276">
64426 <title>Use of argv[0]</title>
64427 <para>
64428 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
64429 of specific strings, Exim assumes certain options. For example, calling Exim
64430 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
64431 to calling it with the option <option>-bS</option>. There are no security implications in
64432 this.
64433 </para>
64434 </section>
64435 <section id="SECID277">
64436 <title>Use of %f formatting</title>
64437 <para>
64438 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
64439 are actually stored in integer variables as 1000 times the load average.
64440 Consequently, their range is limited and so therefore is the length of the
64441 converted output.
64442 </para>
64443 </section>
64444 <section id="SECID278">
64445 <title>Embedded Exim path</title>
64446 <para>
64447 Exim uses its own path name, which is embedded in the code, only when it needs
64448 to re-exec in order to regain root privilege. Therefore, it is not root when it
64449 does so. If some bug allowed the path to get overwritten, it would lead to an
64450 arbitrary program&#x2019;s being run as exim, not as root.
64451 </para>
64452 </section>
64453 <section id="SECTdynmoddir">
64454 <title>Dynamic module directory</title>
64455 <para>
64456 Any dynamically loadable modules must be installed into the directory
64457 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
64458 loading it.
64459 </para>
64460 </section>
64461 <section id="SECID279">
64462 <title>Use of sprintf()</title>
64463 <para>
64464 <indexterm role="concept">
64465 <primary><function>sprintf()</function></primary>
64466 </indexterm>
64467 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
64468 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
64469 The intermediate formatting is done into a large fixed buffer by a function
64470 that runs through the format string itself, and checks the length of each
64471 conversion before performing it, thus preventing buffer overruns.
64472 </para>
64473 <para>
64474 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
64475 the output buffer is known to be sufficiently long to contain the converted
64476 string.
64477 </para>
64478 </section>
64479 <section id="SECID280">
64480 <title>Use of debug_printf() and log_write()</title>
64481 <para>
64482 Arbitrary strings are passed to both these functions, but they do their
64483 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
64484 the format string itself, and checks the length of each conversion.
64485 </para>
64486 </section>
64487 <section id="SECID281">
64488 <title>Use of strcat() and strcpy()</title>
64489 <para>
64490 These are used only in cases where the output buffer is known to be large
64491 enough to hold the result.
64492 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
64493 </para>
64494 </section>
64495 </chapter>
64496
64497 <chapter id="CHAPspool">
64498 <title>Format of spool files</title>
64499 <para>
64500 <indexterm role="concept" id="IIDforspo1" class="startofrange">
64501 <primary>format</primary>
64502 <secondary>spool files</secondary>
64503 </indexterm>
64504 <indexterm role="concept" id="IIDforspo2" class="startofrange">
64505 <primary>spool directory</primary>
64506 <secondary>format of files</secondary>
64507 </indexterm>
64508 <indexterm role="concept" id="IIDforspo3" class="startofrange">
64509 <primary>spool files</primary>
64510 <secondary>format of</secondary>
64511 </indexterm>
64512 <indexterm role="concept">
64513 <primary>spool files</primary>
64514 <secondary>editing</secondary>
64515 </indexterm>
64516 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
64517 followed by -D and -H, respectively. The data portion of the message is kept in
64518 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
64519 kept in the -H file, whose format is described in this chapter. Each of these
64520 two files contains the final component of its own name as its first line. This
64521 is insurance against disk crashes where the directory is lost but the files
64522 themselves are recoverable.
64523 </para>
64524 <para>
64525 Some people are tempted into editing -D files in order to modify messages. You
64526 need to be extremely careful if you do this; it is not recommended and you are
64527 on your own if you do it. Here are some of the pitfalls:
64528 </para>
64529 <itemizedlist>
64530 <listitem>
64531 <para>
64532 You must ensure that Exim does not try to deliver the message while you are
64533 fiddling with it. The safest way is to take out a write lock on the -D file,
64534 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
64535 place, the lock will be retained. If you write a new file and rename it, the
64536 lock will be lost at the instant of rename.
64537 </para>
64538 </listitem>
64539 <listitem>
64540 <para>
64541 <indexterm role="variable">
64542 <primary><varname>$body_linecount</varname></primary>
64543 </indexterm>
64544 If you change the number of lines in the file, the value of
64545 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
64546 present, this value is not used by Exim, but there is no guarantee that this
64547 will always be the case.
64548 </para>
64549 </listitem>
64550 <listitem>
64551 <para>
64552 If the message is in MIME format, you must take care not to break it.
64553 </para>
64554 </listitem>
64555 <listitem>
64556 <para>
64557 If the message is cryptographically signed, any change will invalidate the
64558 signature.
64559 </para>
64560 </listitem>
64561 </itemizedlist>
64562 <para>
64563 All in all, modifying -D files is fraught with danger.
64564 </para>
64565 <para>
64566 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
64567 its subdirectories when <option>split_spool_directory</option> is set). These are journal
64568 files, used to record addresses to which the message has been delivered during
64569 the course of a delivery attempt. If there are still undelivered recipients at
64570 the end, the -H file is updated, and the -J file is deleted. If, however, there
64571 is some kind of crash (for example, a power outage) before this happens, the -J
64572 file remains in existence. When Exim next processes the message, it notices the
64573 -J file and uses it to update the -H file before starting the next delivery
64574 attempt.
64575 </para>
64576 <section id="SECID282">
64577 <title>Format of the -H file</title>
64578 <para>
64579 <indexterm role="concept">
64580 <primary>uid (user id)</primary>
64581 <secondary>in spool file</secondary>
64582 </indexterm>
64583 <indexterm role="concept">
64584 <primary>gid (group id)</primary>
64585 <secondary>in spool file</secondary>
64586 </indexterm>
64587 The second line of the -H file contains the login name for the uid of the
64588 process that called Exim to read the message, followed by the numerical uid and
64589 gid. For a locally generated message, this is normally the user who sent the
64590 message. For a message received over TCP/IP via the daemon, it is
64591 normally the Exim user.
64592 </para>
64593 <para>
64594 The third line of the file contains the address of the message&#x2019;s sender as
64595 transmitted in the envelope, contained in angle brackets. The sender address is
64596 empty for bounce messages. For incoming SMTP mail, the sender address is given
64597 in the MAIL command. For locally generated mail, the sender address is
64598 created by Exim from the login name of the current user and the configured
64599 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
64600 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
64601 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
64602 </para>
64603 <para>
64604 The fourth line contains two numbers. The first is the time that the message
64605 was received, in the conventional Unix form &ndash; the number of seconds since the
64606 start of the epoch. The second number is a count of the number of messages
64607 warning of delayed delivery that have been sent to the sender.
64608 </para>
64609 <para>
64610 There follow a number of lines starting with a hyphen. These can appear in any
64611 order, and are omitted when not relevant:
64612 </para>
64613 <variablelist>
64614 <varlistentry>
64615 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
64616 <listitem>
64617 <para>
64618 This item is obsolete, and is not generated from Exim release 4.61 onwards;
64619 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
64620 recognized, to provide backward compatibility. In the old format, a line of
64621 this form is present for every ACL variable that is not empty. The number
64622 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
64623 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
64624 the data string for the variable. The string itself starts at the beginning of
64625 the next line, and is followed by a newline character. It may contain internal
64626 newlines.
64627 </para>
64628 </listitem></varlistentry>
64629 <varlistentry>
64630 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
64631 <listitem>
64632 <para>
64633 A line of this form is present for every ACL connection variable that is
64634 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
64635 The length is the length of the data string for the variable. The string itself
64636 starts at the beginning of the next line, and is followed by a newline
64637 character. It may contain internal newlines.
64638 </para>
64639 </listitem></varlistentry>
64640 <varlistentry>
64641 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
64642 <listitem>
64643 <para>
64644 A line of this form is present for every ACL message variable that is defined.
64645 Note that there is a space between <option>-aclm</option> and the rest of the name. The
64646 length is the length of the data string for the variable. The string itself
64647 starts at the beginning of the next line, and is followed by a newline
64648 character. It may contain internal newlines.
64649 </para>
64650 </listitem></varlistentry>
64651 <varlistentry>
64652 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
64653 <listitem>
64654 <para>
64655 This is present if, when the message was received over SMTP, the value of
64656 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
64657 </para>
64658 </listitem></varlistentry>
64659 <varlistentry>
64660 <term><option>-allow_unqualified_recipient</option></term>
64661 <listitem>
64662 <para>
64663 This is present if unqualified recipient addresses are permitted in header
64664 lines (to stop such addresses from being qualified if rewriting occurs at
64665 transport time). Local messages that were input using <option>-bnq</option> and remote
64666 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
64667 </para>
64668 </listitem></varlistentry>
64669 <varlistentry>
64670 <term><option>-allow_unqualified_sender</option></term>
64671 <listitem>
64672 <para>
64673 This is present if unqualified sender addresses are permitted in header lines
64674 (to stop such addresses from being qualified if rewriting occurs at transport
64675 time). Local messages that were input using <option>-bnq</option> and remote messages from
64676 hosts that match <option>sender_unqualified_hosts</option> set this flag.
64677 </para>
64678 </listitem></varlistentry>
64679 <varlistentry>
64680 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
64681 <listitem>
64682 <para>
64683 The id information for a message received on an authenticated SMTP connection
64684 &ndash; the value of the <varname>$authenticated_id</varname> variable.
64685 </para>
64686 </listitem></varlistentry>
64687 <varlistentry>
64688 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
64689 <listitem>
64690 <para>
64691 The address of an authenticated sender &ndash; the value of the
64692 <varname>$authenticated_sender</varname> variable.
64693 </para>
64694 </listitem></varlistentry>
64695 <varlistentry>
64696 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
64697 <listitem>
64698 <para>
64699 This records the number of lines in the body of the message, and is always
64700 present.
64701 </para>
64702 </listitem></varlistentry>
64703 <varlistentry>
64704 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
64705 <listitem>
64706 <para>
64707 This records the number of binary zero bytes in the body of the message, and is
64708 present if the number is greater than zero.
64709 </para>
64710 </listitem></varlistentry>
64711 <varlistentry>
64712 <term><option>-deliver_firsttime</option></term>
64713 <listitem>
64714 <para>
64715 This is written when a new message is first added to the spool. When the spool
64716 file is updated after a deferral, it is omitted.
64717 </para>
64718 </listitem></varlistentry>
64719 <varlistentry>
64720 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
64721 <listitem>
64722 <para>
64723 <indexterm role="concept">
64724 <primary>frozen messages</primary>
64725 <secondary>spool data</secondary>
64726 </indexterm>
64727 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
64728 </para>
64729 </listitem></varlistentry>
64730 <varlistentry>
64731 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
64732 <listitem>
64733 <para>
64734 This records the host name as specified by a remote host in a HELO or EHLO
64735 command.
64736 </para>
64737 </listitem></varlistentry>
64738 <varlistentry>
64739 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
64740 <listitem>
64741 <para>
64742 This records the IP address of the host from which the message was received and
64743 the remote port number that was used. It is omitted for locally generated
64744 messages.
64745 </para>
64746 </listitem></varlistentry>
64747 <varlistentry>
64748 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
64749 <listitem>
64750 <para>
64751 If the message was received on an authenticated SMTP connection, this records
64752 the name of the authenticator &ndash; the value of the
64753 <varname>$sender_host_authenticated</varname> variable.
64754 </para>
64755 </listitem></varlistentry>
64756 <varlistentry>
64757 <term><option>-host_lookup_failed</option></term>
64758 <listitem>
64759 <para>
64760 This is present if an attempt to look up the sending host&#x2019;s name from its IP
64761 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
64762 </para>
64763 </listitem></varlistentry>
64764 <varlistentry>
64765 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
64766 <listitem>
64767 <para>
64768 <indexterm role="concept">
64769 <primary>reverse DNS lookup</primary>
64770 </indexterm>
64771 <indexterm role="concept">
64772 <primary>DNS</primary>
64773 <secondary>reverse lookup</secondary>
64774 </indexterm>
64775 This records the name of the remote host from which the message was received,
64776 if the host name was looked up from the IP address when the message was being
64777 received. It is not present if no reverse lookup was done.
64778 </para>
64779 </listitem></varlistentry>
64780 <varlistentry>
64781 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
64782 <listitem>
64783 <para>
64784 For locally submitted messages, this records the login of the originating user,
64785 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
64786 ident value. For messages received over TCP/IP, this records the ident string
64787 supplied by the remote host, if any.
64788 </para>
64789 </listitem></varlistentry>
64790 <varlistentry>
64791 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
64792 <listitem>
64793 <para>
64794 This records the IP address of the local interface and the port number through
64795 which a message was received from a remote host. It is omitted for locally
64796 generated messages.
64797 </para>
64798 </listitem></varlistentry>
64799 <varlistentry>
64800 <term><option>-local</option></term>
64801 <listitem>
64802 <para>
64803 The message is from a local sender.
64804 </para>
64805 </listitem></varlistentry>
64806 <varlistentry>
64807 <term><option>-localerror</option></term>
64808 <listitem>
64809 <para>
64810 The message is a locally-generated bounce message.
64811 </para>
64812 </listitem></varlistentry>
64813 <varlistentry>
64814 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
64815 <listitem>
64816 <para>
64817 This records the data string that was returned by the <function>local_scan()</function> function
64818 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
64819 variable. It is omitted if no data was returned.
64820 </para>
64821 </listitem></varlistentry>
64822 <varlistentry>
64823 <term><option>-manual_thaw</option></term>
64824 <listitem>
64825 <para>
64826 The message was frozen but has been thawed manually, that is, by an explicit
64827 Exim command rather than via the auto-thaw process.
64828 </para>
64829 </listitem></varlistentry>
64830 <varlistentry>
64831 <term><option>-N</option></term>
64832 <listitem>
64833 <para>
64834 A testing delivery process was started using the <option>-N</option> option to suppress any
64835 actual deliveries, but delivery was deferred. At any further delivery attempts,
64836 <option>-N</option> is assumed.
64837 </para>
64838 </listitem></varlistentry>
64839 <varlistentry>
64840 <term><option>-received_protocol</option></term>
64841 <listitem>
64842 <para>
64843 This records the value of the <varname>$received_protocol</varname> variable, which contains
64844 the name of the protocol by which the message was received.
64845 </para>
64846 </listitem></varlistentry>
64847 <varlistentry>
64848 <term><option>-sender_set_untrusted</option></term>
64849 <listitem>
64850 <para>
64851 The envelope sender of this message was set by an untrusted local caller (used
64852 to ensure that the caller is displayed in queue listings).
64853 </para>
64854 </listitem></varlistentry>
64855 <varlistentry>
64856 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
64857 <listitem>
64858 <para>
64859 If a message was scanned by SpamAssassin, this is present. It records the value
64860 of <varname>$spam_score_int</varname>.
64861 </para>
64862 </listitem></varlistentry>
64863 <varlistentry>
64864 <term><option>-tls_certificate_verified</option></term>
64865 <listitem>
64866 <para>
64867 A TLS certificate was received from the client that sent this message, and the
64868 certificate was verified by the server.
64869 </para>
64870 </listitem></varlistentry>
64871 <varlistentry>
64872 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
64873 <listitem>
64874 <para>
64875 When the message was received over an encrypted connection, this records the
64876 name of the cipher suite that was used.
64877 </para>
64878 </listitem></varlistentry>
64879 <varlistentry>
64880 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
64881 <listitem>
64882 <para>
64883 When the message was received over an encrypted connection, and a certificate
64884 was received from the client, this records the Distinguished Name from that
64885 certificate.
64886 </para>
64887 </listitem></varlistentry>
64888 </variablelist>
64889 <para>
64890 Following the options there is a list of those addresses to which the message
64891 is not to be delivered. This set of addresses is initialized from the command
64892 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
64893 is set; otherwise it starts out empty. Whenever a successful delivery is made,
64894 the address is added to this set. The addresses are kept internally as a
64895 balanced binary tree, and it is a representation of that tree which is written
64896 to the spool file. If an address is expanded via an alias or forward file, the
64897 original address is added to the tree when deliveries to all its child
64898 addresses are complete.
64899 </para>
64900 <para>
64901 If the tree is empty, there is a single line in the spool file containing just
64902 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
64903 Y or N, followed by an address. The address is the value for the node of the
64904 tree, and the letters indicate whether the node has a left branch and/or a
64905 right branch attached to it, respectively. If branches exist, they immediately
64906 follow. Here is an example of a three-node tree:
64907 </para>
64908 <literallayout class="monospaced">
64909 YY darcy@austen.fict.example
64910 NN alice@wonderland.fict.example
64911 NN editor@thesaurus.ref.example
64912 </literallayout>
64913 <para>
64914 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
64915 This is a simple list, preceded by a count. It includes all the original
64916 recipients of the message, including those to whom the message has already been
64917 delivered. In the simplest case, the list contains one address per line. For
64918 example:
64919 </para>
64920 <literallayout class="monospaced">
64921 4
64922 editor@thesaurus.ref.example
64923 darcy@austen.fict.example
64924 rdo@foundation
64925 alice@wonderland.fict.example
64926 </literallayout>
64927 <para>
64928 However, when a child address has been added to the top-level addresses as a
64929 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
64930 line is of the following form:
64931 </para>
64932 <literallayout>
64933 &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;
64934 </literallayout>
64935 <para>
64936 The 01 flag bit indicates the presence of the three other fields that follow
64937 the top-level address. Other bits may be used in future to support additional
64938 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
64939 original parent of the <quote>one time</quote> address. The first two fields are the
64940 envelope sender that is associated with this address and its length. If the
64941 length is zero, there is no special envelope sender (there are then two space
64942 characters in the line). A non-empty field can arise from a <command>redirect</command> router
64943 that has an <option>errors_to</option> setting.
64944 </para>
64945 <para>
64946 A blank line separates the envelope and status information from the headers
64947 which follow. A header may occupy several lines of the file, and to save effort
64948 when reading it in, each header is preceded by a number and an identifying
64949 character. The number is the number of characters in the header, including any
64950 embedded newlines and the terminating newline. The character is one of the
64951 following:
64952 </para>
64953 <informaltable frame="none">
64954 <tgroup cols="2" colsep="0" rowsep="0">
64955 <colspec colwidth="50pt" align="left"/>
64956 <colspec colwidth="254pt" align="left"/>
64957 <tbody>
64958 <row>
64959 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
64960 <entry>header in which Exim has no special interest</entry>
64961 </row>
64962 <row>
64963 <entry><literal>B</literal></entry>
64964 <entry><emphasis>Bcc:</emphasis> header</entry>
64965 </row>
64966 <row>
64967 <entry><literal>C</literal></entry>
64968 <entry><emphasis>Cc:</emphasis> header</entry>
64969 </row>
64970 <row>
64971 <entry><literal>F</literal></entry>
64972 <entry><emphasis>From:</emphasis> header</entry>
64973 </row>
64974 <row>
64975 <entry><literal>I</literal></entry>
64976 <entry><emphasis>Message-id:</emphasis> header</entry>
64977 </row>
64978 <row>
64979 <entry><literal>P</literal></entry>
64980 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
64981 </row>
64982 <row>
64983 <entry><literal>R</literal></entry>
64984 <entry><emphasis>Reply-To:</emphasis> header</entry>
64985 </row>
64986 <row>
64987 <entry><literal>S</literal></entry>
64988 <entry><emphasis>Sender:</emphasis> header</entry>
64989 </row>
64990 <row>
64991 <entry><literal>T</literal></entry>
64992 <entry><emphasis>To:</emphasis> header</entry>
64993 </row>
64994 <row>
64995 <entry><literal>*</literal></entry>
64996 <entry>replaced or deleted header</entry>
64997 </row>
64998 </tbody>
64999 </tgroup>
65000 </informaltable>
65001 <para>
65002 Deleted or replaced (rewritten) headers remain in the spool file for debugging
65003 purposes. They are not transmitted when the message is delivered. Here is a
65004 typical set of headers:
65005 </para>
65006 <literallayout class="monospaced">
65007 111P Received: by hobbit.fict.example with local (Exim 4.00)
65008 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
65009 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
65010 038* X-rewrote-sender: bb@hobbit.fict.example
65011 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
65012 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
65013 099* To: alice@wonderland.fict.example, rdo@foundation,
65014 darcy@austen.fict.example, editor@thesaurus.ref.example
65015 104T To: alice@wonderland.fict.example, rdo@foundation.example,
65016 darcy@austen.fict.example, editor@thesaurus.ref.example
65017 038  Date: Fri, 11 May 2001 10:28:59 +0100
65018 </literallayout>
65019 <para>
65020 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
65021 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
65022 unqualified domain <emphasis>foundation</emphasis>.
65023 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
65024 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
65025 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
65026 </para>
65027 </section>
65028 </chapter>
65029
65030 <chapter id="CHAPdkim">
65031 <title>Support for DKIM (DomainKeys Identified Mail)</title>
65032 <titleabbrev>DKIM Support</titleabbrev>
65033 <para>
65034 <indexterm role="concept">
65035 <primary>DKIM</primary>
65036 </indexterm>
65037 </para>
65038 <para>
65039 DKIM is a mechanism by which messages sent by some entity can be provably
65040 linked to a domain which that entity controls.  It permits reputation to
65041 be tracked on a per-domain basis, rather than merely upon source IP address.
65042 DKIM is documented in RFC 4871.
65043 </para>
65044 <para>
65045 Since version 4.70, DKIM support is compiled into Exim by default. It can be
65046 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
65047 </para>
65048 <para>
65049 Exim&#x2019;s DKIM implementation allows to
65050 </para>
65051 <orderedlist numeration="arabic">
65052 <listitem>
65053 <para>
65054 Sign outgoing messages: This function is implemented in the SMTP transport.
65055 It can co-exist with all other Exim features, including transport filters.
65056 </para>
65057 </listitem>
65058 <listitem>
65059 <para>
65060 Verify signatures in incoming messages: This is implemented by an additional
65061 ACL (acl_smtp_dkim), which can be called several times per message, with
65062 different signature contexts.
65063 </para>
65064 </listitem>
65065 </orderedlist>
65066 <para>
65067 In typical Exim style, the verification implementation does not include any
65068 default "policy". Instead it enables you to build your own policy using
65069 Exim&#x2019;s standard controls.
65070 </para>
65071 <para>
65072 Please note that verification of DKIM signatures in incoming mail is turned
65073 on by default for logging purposes. For each signature in incoming email,
65074 exim will log a line displaying the most important signature details, and the
65075 signature status. Here is an example (with line-breaks added for clarity):
65076 </para>
65077 <literallayout class="monospaced">
65078 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
65079     d=facebookmail.com s=q1-2009b
65080     c=relaxed/relaxed a=rsa-sha1
65081     i=@facebookmail.com t=1252484542 [verification succeeded]
65082 </literallayout>
65083 <para>
65084 You might want to turn off DKIM verification processing entirely for internal
65085 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
65086 control modifier. This should typically be done in the RCPT ACL, at points
65087 where you accept mail from relay sources (internal hosts or authenticated
65088 senders).
65089 </para>
65090 <section id="SECID513">
65091 <title>Signing outgoing messages</title>
65092 <para>
65093 <indexterm role="concept">
65094 <primary>DKIM</primary>
65095 <secondary>signing</secondary>
65096 </indexterm>
65097 </para>
65098 <para>
65099 Signing is implemented by setting private options on the SMTP transport.
65100 These options take (expandable) strings as arguments.
65101 </para>
65102 <para>
65103 <indexterm role="option">
65104 <primary><option>dkim_domain</option></primary>
65105 </indexterm>
65106 </para>
65107 <informaltable frame="all">
65108 <tgroup cols="4" colsep="0" rowsep="0">
65109 <colspec colwidth="8*" align="left"/>
65110 <colspec colwidth="6*" align="center"/>
65111 <colspec colwidth="6*" align="center"/>
65112 <colspec colwidth="6*" align="right"/>
65113 <tbody>
65114 <row>
65115 <entry><option>dkim_domain</option></entry>
65116 <entry>Use: <emphasis>smtp</emphasis></entry>
65117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65118 <entry>Default: <emphasis>unset</emphasis></entry>
65119 </row>
65120 </tbody>
65121 </tgroup>
65122 </informaltable>
65123 <para>
65124 MANDATORY:
65125 The domain you want to sign with. The result of this expanded
65126 option is put into the <option>$dkim_domain</option> expansion variable.
65127 </para>
65128 <para>
65129 <indexterm role="option">
65130 <primary><option>dkim_selector</option></primary>
65131 </indexterm>
65132 </para>
65133 <informaltable frame="all">
65134 <tgroup cols="4" colsep="0" rowsep="0">
65135 <colspec colwidth="8*" align="left"/>
65136 <colspec colwidth="6*" align="center"/>
65137 <colspec colwidth="6*" align="center"/>
65138 <colspec colwidth="6*" align="right"/>
65139 <tbody>
65140 <row>
65141 <entry><option>dkim_selector</option></entry>
65142 <entry>Use: <emphasis>smtp</emphasis></entry>
65143 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65144 <entry>Default: <emphasis>unset</emphasis></entry>
65145 </row>
65146 </tbody>
65147 </tgroup>
65148 </informaltable>
65149 <para>
65150 MANDATORY:
65151 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
65152 variable to look up a matching selector. The result is put in the expansion
65153 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
65154 option along with <option>$dkim_domain</option>.
65155 </para>
65156 <para>
65157 <indexterm role="option">
65158 <primary><option>dkim_private_key</option></primary>
65159 </indexterm>
65160 </para>
65161 <informaltable frame="all">
65162 <tgroup cols="4" colsep="0" rowsep="0">
65163 <colspec colwidth="8*" align="left"/>
65164 <colspec colwidth="6*" align="center"/>
65165 <colspec colwidth="6*" align="center"/>
65166 <colspec colwidth="6*" align="right"/>
65167 <tbody>
65168 <row>
65169 <entry><option>dkim_private_key</option></entry>
65170 <entry>Use: <emphasis>smtp</emphasis></entry>
65171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65172 <entry>Default: <emphasis>unset</emphasis></entry>
65173 </row>
65174 </tbody>
65175 </tgroup>
65176 </informaltable>
65177 <para>
65178 MANDATORY:
65179 This sets the private key to use. You can use the <option>$dkim_domain</option> and
65180 <option>$dkim_selector</option> expansion variables to determine the private key to use.
65181 The result can either
65182 </para>
65183 <itemizedlist>
65184 <listitem>
65185 <para>
65186 be a valid RSA private key in ASCII armor, including line breaks.
65187 </para>
65188 </listitem>
65189 <listitem>
65190 <para>
65191 start with a slash, in which case it is treated as a file that contains
65192 the private key.
65193 </para>
65194 </listitem>
65195 <listitem>
65196 <para>
65197 be "0", "false" or the empty string, in which case the message will not
65198 be signed. This case will not result in an error, even if <option>dkim_strict</option>
65199 is set.
65200 </para>
65201 </listitem>
65202 </itemizedlist>
65203 <para>
65204 <indexterm role="option">
65205 <primary><option>dkim_canon</option></primary>
65206 </indexterm>
65207 </para>
65208 <informaltable frame="all">
65209 <tgroup cols="4" colsep="0" rowsep="0">
65210 <colspec colwidth="8*" align="left"/>
65211 <colspec colwidth="6*" align="center"/>
65212 <colspec colwidth="6*" align="center"/>
65213 <colspec colwidth="6*" align="right"/>
65214 <tbody>
65215 <row>
65216 <entry><option>dkim_canon</option></entry>
65217 <entry>Use: <emphasis>smtp</emphasis></entry>
65218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65219 <entry>Default: <emphasis>unset</emphasis></entry>
65220 </row>
65221 </tbody>
65222 </tgroup>
65223 </informaltable>
65224 <para>
65225 OPTIONAL:
65226 This option sets the canonicalization method used when signing a message.
65227 The DKIM RFC currently supports two methods: "simple" and "relaxed".
65228 The option defaults to "relaxed" when unset. Note: the current implementation
65229 only supports using the same canonicalization method for both headers and body.
65230 </para>
65231 <para>
65232 <indexterm role="option">
65233 <primary><option>dkim_strict</option></primary>
65234 </indexterm>
65235 </para>
65236 <informaltable frame="all">
65237 <tgroup cols="4" colsep="0" rowsep="0">
65238 <colspec colwidth="8*" align="left"/>
65239 <colspec colwidth="6*" align="center"/>
65240 <colspec colwidth="6*" align="center"/>
65241 <colspec colwidth="6*" align="right"/>
65242 <tbody>
65243 <row>
65244 <entry><option>dkim_strict</option></entry>
65245 <entry>Use: <emphasis>smtp</emphasis></entry>
65246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65247 <entry>Default: <emphasis>unset</emphasis></entry>
65248 </row>
65249 </tbody>
65250 </tgroup>
65251 </informaltable>
65252 <para>
65253 OPTIONAL:
65254 This  option  defines  how  Exim  behaves  when  signing a message that
65255 should be signed fails for some reason.  When the expansion evaluates to
65256 either "1" or "true", Exim will defer. Otherwise Exim will send the message
65257 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
65258 variables here.
65259 </para>
65260 <para>
65261 <indexterm role="option">
65262 <primary><option>dkim_sign_headers</option></primary>
65263 </indexterm>
65264 </para>
65265 <informaltable frame="all">
65266 <tgroup cols="4" colsep="0" rowsep="0">
65267 <colspec colwidth="8*" align="left"/>
65268 <colspec colwidth="6*" align="center"/>
65269 <colspec colwidth="6*" align="center"/>
65270 <colspec colwidth="6*" align="right"/>
65271 <tbody>
65272 <row>
65273 <entry><option>dkim_sign_headers</option></entry>
65274 <entry>Use: <emphasis>smtp</emphasis></entry>
65275 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
65276 <entry>Default: <emphasis>unset</emphasis></entry>
65277 </row>
65278 </tbody>
65279 </tgroup>
65280 </informaltable>
65281 <para>
65282 OPTIONAL:
65283 When set, this option must expand to (or be specified as) a colon-separated
65284 list of header names. Headers with these names will be included in the message
65285 signature. When unspecified, the header names recommended in RFC4871 will be
65286 used.
65287 </para>
65288 </section>
65289 <section id="SECID514">
65290 <title>Verifying DKIM signatures in incoming mail</title>
65291 <para>
65292 <indexterm role="concept">
65293 <primary>DKIM</primary>
65294 <secondary>verification</secondary>
65295 </indexterm>
65296 </para>
65297 <para>
65298 Verification of DKIM signatures in incoming email is implemented via the
65299 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
65300 syntactically(!) correct signature in the incoming message.
65301 </para>
65302 <para>
65303 To evaluate the signature in the ACL a large number of expansion variables
65304 containing the signature status and its details are set up during the
65305 runtime of the ACL.
65306 </para>
65307 <para>
65308 Calling the ACL only for existing signatures is not sufficient to build
65309 more advanced policies. For that reason, the global option
65310 <option>dkim_verify_signers</option>, and a global expansion variable
65311 <option>$dkim_signers</option> exist.
65312 </para>
65313 <para>
65314 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
65315 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
65316 called. It is expanded when the message has been received. At this point,
65317 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
65318 list of signer domains and identities for the message. When
65319 <option>dkim_verify_signers</option> is not specified in the main configuration,
65320 it defaults as:
65321 </para>
65322 <literallayout class="monospaced">
65323 dkim_verify_signers = $dkim_signers
65324 </literallayout>
65325 <para>
65326 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
65327 DKIM signature in the message. Current DKIM verifiers may want to explicitly
65328 call the ACL for known domains or identities. This would be achieved as follows:
65329 </para>
65330 <literallayout class="monospaced">
65331 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
65332 </literallayout>
65333 <para>
65334 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
65335 and "ebay.com", plus all domains and identities that have signatures in the message.
65336 You can also be more creative in constructing your policy. For example:
65337 </para>
65338 <literallayout class="monospaced">
65339 dkim_verify_signers = $sender_address_domain:$dkim_signers
65340 </literallayout>
65341 <para>
65342 If a domain or identity is listed several times in the (expanded) value of
65343 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
65344 </para>
65345 <para>
65346 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
65347 available (from most to least important):
65348 </para>
65349 <variablelist>
65350 <varlistentry>
65351 <term><option>$dkim_cur_signer</option></term>
65352 <listitem>
65353 <para>
65354 The signer that is being evaluated in this ACL run. This can be a domain or
65355 an identity. This is one of the list items from the expanded main option
65356 <option>dkim_verify_signers</option> (see above).
65357 </para>
65358 </listitem></varlistentry>
65359 <varlistentry>
65360 <term><option>$dkim_verify_status</option></term>
65361 <listitem>
65362 <para>
65363 A string describing the general status of the signature. One of
65364 </para>
65365 <itemizedlist>
65366 <listitem>
65367 <para>
65368 <option>none</option>: There is no signature in the message for the current domain or
65369 identity (as reflected by <option>$dkim_cur_signer</option>).
65370 </para>
65371 </listitem>
65372 <listitem>
65373 <para>
65374 <option>invalid</option>: The signature could not be verified due to a processing error.
65375 More detail is available in <option>$dkim_verify_reason</option>.
65376 </para>
65377 </listitem>
65378 <listitem>
65379 <para>
65380 <option>fail</option>: Verification of the signature failed.  More detail is
65381 available in <option>$dkim_verify_reason</option>.
65382 </para>
65383 </listitem>
65384 <listitem>
65385 <para>
65386 <option>pass</option>: The signature passed verification. It is valid.
65387 </para>
65388 </listitem>
65389 </itemizedlist>
65390 </listitem></varlistentry>
65391 <varlistentry>
65392 <term><option>$dkim_verify_reason</option></term>
65393 <listitem>
65394 <para>
65395 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
65396 "fail" or "invalid". One of
65397 </para>
65398 <itemizedlist>
65399 <listitem>
65400 <para>
65401 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
65402 key for the domain could not be retrieved. This may be a temporary problem.
65403 </para>
65404 </listitem>
65405 <listitem>
65406 <para>
65407 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
65408 record for the domain is syntactically invalid.
65409 </para>
65410 </listitem>
65411 <listitem>
65412 <para>
65413 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
65414 body hash does not match the one specified in the signature header. This
65415 means that the message body was modified in transit.
65416 </para>
65417 </listitem>
65418 <listitem>
65419 <para>
65420 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
65421 could not be verified. This may mean that headers were modified,
65422 re-written or otherwise changed in a way which is incompatible with
65423 DKIM verification. It may of course also mean that the signature is forged.
65424 </para>
65425 </listitem>
65426 </itemizedlist>
65427 </listitem></varlistentry>
65428 <varlistentry>
65429 <term><option>$dkim_domain</option></term>
65430 <listitem>
65431 <para>
65432 The signing domain. IMPORTANT: This variable is only populated if there is
65433 an actual signature in the message for the current domain or identity (as
65434 reflected by <option>$dkim_cur_signer</option>).
65435 </para>
65436 </listitem></varlistentry>
65437 <varlistentry>
65438 <term><option>$dkim_identity</option></term>
65439 <listitem>
65440 <para>
65441 The signing identity, if present. IMPORTANT: This variable is only populated
65442 if there is an actual signature in the message for the current domain or
65443 identity (as reflected by <option>$dkim_cur_signer</option>).
65444 </para>
65445 </listitem></varlistentry>
65446 <varlistentry>
65447 <term><option>$dkim_selector</option></term>
65448 <listitem>
65449 <para>
65450 The key record selector string.
65451 </para>
65452 </listitem></varlistentry>
65453 <varlistentry>
65454 <term><option>$dkim_algo</option></term>
65455 <listitem>
65456 <para>
65457 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
65458 </para>
65459 </listitem></varlistentry>
65460 <varlistentry>
65461 <term><option>$dkim_canon_body</option></term>
65462 <listitem>
65463 <para>
65464 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
65465 </para>
65466 </listitem></varlistentry>
65467 <varlistentry>
65468 <term><option>dkim_canon_headers</option></term>
65469 <listitem>
65470 <para>
65471 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
65472 </para>
65473 </listitem></varlistentry>
65474 <varlistentry>
65475 <term><option>$dkim_copiedheaders</option></term>
65476 <listitem>
65477 <para>
65478 A transcript of headers and their values which are included in the signature
65479 (copied from the &#x2019;z=&#x2019; tag of the signature).
65480 </para>
65481 </listitem></varlistentry>
65482 <varlistentry>
65483 <term><option>$dkim_bodylength</option></term>
65484 <listitem>
65485 <para>
65486 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
65487 limit was set by the signer, "9999999999999" is returned. This makes sure
65488 that this variable always expands to an integer value.
65489 </para>
65490 </listitem></varlistentry>
65491 <varlistentry>
65492 <term><option>$dkim_created</option></term>
65493 <listitem>
65494 <para>
65495 UNIX timestamp reflecting the date and time when the signature was created.
65496 When this was not specified by the signer, "0" is returned.
65497 </para>
65498 </listitem></varlistentry>
65499 <varlistentry>
65500 <term><option>$dkim_expires</option></term>
65501 <listitem>
65502 <para>
65503 UNIX timestamp reflecting the date and time when the signer wants the
65504 signature to be treated as "expired". When this was not specified by the
65505 signer, "9999999999999" is returned. This makes it possible to do useful
65506 integer size comparisons against this value.
65507 </para>
65508 </listitem></varlistentry>
65509 <varlistentry>
65510 <term><option>$dkim_headernames</option></term>
65511 <listitem>
65512 <para>
65513 A colon-separated list of names of headers included in the signature.
65514 </para>
65515 </listitem></varlistentry>
65516 <varlistentry>
65517 <term><option>$dkim_key_testing</option></term>
65518 <listitem>
65519 <para>
65520 "1" if the key record has the "testing" flag set, "0" if not.
65521 </para>
65522 </listitem></varlistentry>
65523 <varlistentry>
65524 <term><option>$dkim_key_nosubdomains</option></term>
65525 <listitem>
65526 <para>
65527 "1" if the key record forbids subdomaining, "0" otherwise.
65528 </para>
65529 </listitem></varlistentry>
65530 <varlistentry>
65531 <term><option>$dkim_key_srvtype</option></term>
65532 <listitem>
65533 <para>
65534 Service type (tag s=) from the key record. Defaults to "*" if not specified
65535 in the key record.
65536 </para>
65537 </listitem></varlistentry>
65538 <varlistentry>
65539 <term><option>$dkim_key_granularity</option></term>
65540 <listitem>
65541 <para>
65542 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
65543 in the key record.
65544 </para>
65545 </listitem></varlistentry>
65546 <varlistentry>
65547 <term><option>$dkim_key_notes</option></term>
65548 <listitem>
65549 <para>
65550 Notes from the key record (tag n=).
65551 </para>
65552 </listitem></varlistentry>
65553 </variablelist>
65554 <para>
65555 In addition, two ACL conditions are provided:
65556 </para>
65557 <variablelist>
65558 <varlistentry>
65559 <term><option>dkim_signers</option></term>
65560 <listitem>
65561 <para>
65562 ACL condition that checks a colon-separated list of domains or identities
65563 for a match against the domain or identity that the ACL is currently verifying
65564 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
65565 verb to a group of domains or identities. For example:
65566 </para>
65567 <literallayout class="monospaced">
65568 # Warn when Mail purportedly from GMail has no signature at all
65569 warn log_message = GMail sender without DKIM signature
65570      sender_domains = gmail.com
65571      dkim_signers = gmail.com
65572      dkim_status = none
65573 </literallayout>
65574 </listitem></varlistentry>
65575 <varlistentry>
65576 <term><option>dkim_status</option></term>
65577 <listitem>
65578 <para>
65579 ACL condition that checks a colon-separated list of possible DKIM verification
65580 results against the actual result of verification. This is typically used
65581 to restrict an ACL verb to a list of verification outcomes, for example:
65582 </para>
65583 <literallayout class="monospaced">
65584 deny message = Mail from Paypal with invalid/missing signature
65585      sender_domains = paypal.com:paypal.de
65586      dkim_signers = paypal.com:paypal.de
65587      dkim_status = none:invalid:fail
65588 </literallayout>
65589 <para>
65590 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
65591 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
65592 for more information of what they mean.
65593 </para>
65594 </listitem></varlistentry>
65595 </variablelist>
65596 </section>
65597 </chapter>
65598
65599 <chapter id="CHID13">
65600 <title>Adding new drivers or lookup types</title>
65601 <titleabbrev>Adding drivers or lookups</titleabbrev>
65602 <para>
65603 <indexterm role="concept">
65604 <primary>adding drivers</primary>
65605 </indexterm>
65606 <indexterm role="concept">
65607 <primary>new drivers, adding</primary>
65608 </indexterm>
65609 <indexterm role="concept">
65610 <primary>drivers</primary>
65611 <secondary>adding new</secondary>
65612 </indexterm>
65613 The following actions have to be taken in order to add a new router, transport,
65614 authenticator, or lookup type to Exim:
65615 </para>
65616 <orderedlist numeration="arabic">
65617 <listitem>
65618 <para>
65619 Choose a name for the driver or lookup type that does not conflict with any
65620 existing name; I will use <quote>newdriver</quote> in what follows.
65621 </para>
65622 </listitem>
65623 <listitem>
65624 <para>
65625 Add to <filename>src/EDITME</filename> the line:
65626 </para>
65627 <literallayout>
65628 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
65629 </literallayout>
65630 <para>
65631 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
65632 code is not to be included in the binary by default, comment this line out. You
65633 should also add any relevant comments about the driver or lookup type.
65634 </para>
65635 </listitem>
65636 <listitem>
65637 <para>
65638 Add to <filename>src/config.h.defaults</filename> the line:
65639 </para>
65640 <literallayout class="monospaced">
65641 #define &lt;type&gt;_NEWDRIVER
65642 </literallayout>
65643 </listitem>
65644 <listitem>
65645 <para>
65646 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
65647 and create a table entry as is done for all the other drivers and lookup types.
65648 </para>
65649 </listitem>
65650 <listitem>
65651 <para revisionflag="changed">
65652 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
65653 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
65654 Add your <literal>NEWDRIVER</literal> to that list.
65655 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
65656 simple form that most lookups have.
65657 </para>
65658 </listitem>
65659 <listitem>
65660 <para>
65661 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
65662 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
65663 driver or lookup type and add it to the definition of OBJ.
65664 </para>
65665 </listitem>
65666 <listitem>
65667 <para>
65668 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
65669 <filename>src</filename>.
65670 </para>
65671 </listitem>
65672 <listitem>
65673 <para>
65674 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
65675 as for other drivers and lookups.
65676 </para>
65677 </listitem>
65678 </orderedlist>
65679 <para>
65680 Then all you need to do is write the code! A good way to start is to make a
65681 proforma by copying an existing module of the same type, globally changing all
65682 occurrences of the name, and cutting out most of the code. Note that any
65683 options you create must be listed in alphabetical order, because the tables are
65684 searched using a binary chop procedure.
65685 </para>
65686 <para>
65687 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
65688 the interface that is expected.
65689 </para>
65690 <?sdop
65691   format="newpage"
65692   foot_right_recto="&chaptertitle;"
65693   foot_right_verso="&chaptertitle;"
65694 ?>
65695 </chapter>
65696
65697 <index role="option">
65698 <title>Options index</title>
65699 </index>
65700
65701 <index role="variable">
65702 <title>Variables index</title>
65703 </index>
65704
65705 <index role="concept">
65706 <title>Concept index</title>
65707 </index>
65708
65709 </book>